lang
stringclasses
10 values
seed
stringlengths
5
2.12k
cpp
pthread_mutex_lock(&mAccess); if (count == max) { pthread_cond_wait(&cvFull, &mAccess); } buffer[writeIndex].len = len;
cpp
#endif #include <tinyhal.h> #ifdef TEST_TOUCHPANEL volatile int count;
cpp
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* This is a haggle main function. It's purpose is to let the testsuite run a haggle kernel without the need to start a separate program that is haggle. */ #include "hagglemain.h" #include <libcpphaggle/Thread.h> #include "DataManager.h"
cpp
unsigned int addrlen = backtrace(addrlist, maxNumOfFrames); if (addrlen == 0) { return 0; } int count = 0; if (nativeContext == nullptr) { ++suppressCount; // Skip current call
cpp
contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
cpp
if(devID < 0){ p = new char[size]; return p; } else{ #ifdef USE_CUDA cudaError_t e = cudaMalloc((void **)&p, size); if(e != cudaSuccess){ ShowNTErrors("Cannot allocate the memory in XMemAlloc.");
cpp
namespace{ class TouchAreaNew :public TouchArea{ public: TouchAreaNew(WndStory* w, Visual* t) :wnd(w), TouchArea(t){} protected: WndStory* wnd; virtual void onClick(TouchScreen::Touch* touch) { wnd->hide(); delete wnd; }
cpp
// Finish the loop switch(j) { case 7: res ^= (-(x & one)) & *p--; x >>= 1; case 6: res ^= (-(x & one)) & *p--; x >>= 1; case 5: res ^= (-(x & one)) & *p--; x >>= 1; case 4: res ^= (-(x & one)) & *p--; x >>= 1; case 3: res ^= (-(x & one)) & *p--; x >>= 1; case 2: res ^= (-(x & one)) & *p--; x >>= 1; case 1: res ^= (-(x & one)) & *p; }
cpp
} void ThreadManager::RemoveThread() { RECORD_STACK;
cpp
static Params PRMS; //TODO private outside Fast5Reader (friend?) ReadBuffer(); ReadBuffer(const std::string &filename); ReadBuffer(const hdf5_tools::File &file, const std::string &raw_path, const std::string &ch_path);
cpp
class StrVec { private: /* data */ static std::allocator<std::string> alloc; std::string *elements; std::string *frist_free; std::string *cap; void reallocate(); void free(); std::pair<std::string *, std::string *> alloc_n_copy(const std::string *, const std::string *); void chk_n_alloc() {
cpp
// REQUIRES: modules-support // Test that <cstdint> re-exports <stdint.h> // RUN: %build_module #include <cstdint.hxx> int main(int, char**) { int8_t x; ((void)x); std::int8_t y; ((void)y); return 0; }
cpp
commandGroup.RemoveAllCommands(); CommandRagdollHelpers::RemoveJointsFromRagdoll(GetActor()->GetID(), {"l_shldr"}, &commandGroup); EXPECT_TRUE(commandManager.ExecuteCommandGroup(commandGroup, result)) << result.c_str(); EXPECT_THAT(
cpp
#include <dmusici.h> #include "reginfo.h" #include "sysinfo.h" #include "dispinfo.h" #include "musinfo.h" #include "testmus.h" #include "resource.h" #ifndef ReleasePpo #define ReleasePpo(ppo) \ if (*(ppo) != NULL) \ { \
cpp
iterator(T** in_level0_data) : level0_ptr(in_level0_data) { status_next = level0_ptr[0]; } bool has_more_blocks() { return *status_next != STATUS_NEXT::NO_MORE_BLOCKS;
cpp
{ dgList<dgContactMaterial>::RemoveAll(); if (m_contactNode) { dgActiveContacts* const activeContacts = m_world; activeContacts->Remove (m_contactNode);
cpp
#include <bits/stdc++.h> #define LOCAL using namespace std; struct LCS{ int step , max_len ; }Dp[5000][5000];
cpp
Configuration conf(Directory::join(CONFIGURATION_TEST_DIR, "parse.conf"), Configuration::Flag::ReadOnly|Configuration::Flag::Truncate); /* File is truncated on saving */ CORRADE_VERIFY(conf.isValid()); CORRADE_VERIFY(conf.isEmpty()); CORRADE_VERIFY(conf.save(Directory::join(CONFIGURATION_WRITE_TEST_DIR, "truncate.conf"))); CORRADE_COMPARE_AS(Directory::join(CONFIGURATION_WRITE_TEST_DIR, "truncate.conf"), "", TestSuite::Compare::FileToString);
cpp
{ byErrCode = 1; break; } float fNewPos[3]{ pObj->m_fCurPos[0], pfPos[1], pObj->m_fCurPos[2] }; next(pObj, wSkillIndex, wTowerItemSerial, byMaterialNum, pMaterial, fNewPos, pConsumeSerial); } while (false); if (byErrCode != 0) pObj->SendMsg_CreateTowerResult(byErrCode, -1); } void WINAPIV CPlayer::pc_GestureRequest( ATF::CPlayer * pObj,
cpp
#if BYTE_ORDER == BIG_ENDIAN constexpr Endianness kBigEndian = Endianness::HOST; constexpr Endianness kLittleEndian = Endianness::INVERT; #else constexpr Endianness kBigEndian = Endianness::INVERT; constexpr Endianness kLittleEndian = Endianness::HOST; #endif template <Endianness E> struct CodeUnit; template <> struct CodeUnit<Endianness::HOST> {
cpp
sLocalMacroName = pEvents->ScriptCode; sLibrary = ::rtl::OUString(); if ( 0 == pEvents->ScriptType.compareToAscii( EVENT_STARBASIC ) ) { // for StarBasic, the library name is part of the ScriptCode sal_Int32 nPrefixLen = sLocalMacroName.indexOf( ':' ); DBG_ASSERT( 0 <= nPrefixLen, "OEventDescriptorMapper::OEventDescriptorMapper: invalid script code prefix!" ); if ( 0 <= nPrefixLen ) { // the export handler for StarBasic expects "StarOffice", not "application" for application modules ... sLibrary = sLocalMacroName.copy( 0, nPrefixLen ); if ( sLibrary.equalsAscii( EVENT_APPLICATION ) )
cpp
takeExp(); for(int i=0; i<exp.length(); i++) { c = exp.at(i); if((c >= "a" && c <= "z") || (c >= "A" && c <= "Z") || (c >= "0" && c <= "9")) { str = str + c; } else if(isEmpty() || peek() == "(") push(c); else if(c == "(") push(c); else if(c == ")") { while(!isEmpty() && peek() != "(")
cpp
.inplace_b(true) .Test(xnn_f32_vmul_minmax_ukernel__avx_x16, VBinaryMicrokernelTester::OpType::Mul, xnn_init_f32_minmax_avx_params); } } TEST(F32_VMUL_MINMAX__AVX_X16, qmin) { TEST_REQUIRES_X86_AVX;
cpp
// cout << endl << operacionBase; while (operacionBase.size() > 0) { subCadena = operacionBase[0]; operacionBase = operacionBase.substr(1,operacionBase.size()); if (subCadena == "+" or subCadena == "*" or subCadena == "/") { cout << "Numero: " <<acumuladorCadena << endl << "Operacion: " << subCadena << endl; if (acumuladorCadena.size() == 1) { acumuladorCadena = "0" + acumuladorCadena; }
cpp
static Qml::Register::AbstractClass<ApproximatingSubdivisionFilter> Register; vtkSmartPointer<vtkApproximatingSubdivisionFilter> m_vtkObject = nullptr; public: ApproximatingSubdivisionFilter(vtkSmartPointer<vtkApproximatingSubdivisionFilter>); auto setNumberOfSubdivisions(int) -> void; auto getNumberOfSubdivisions() -> int; signals: void numberOfSubdivisionsChanged(); }; } }
cpp
this->Bindings.emplace_back(); this->Bindings[bindingIndex].binding = bindingIndex; this->Bindings[bindingIndex].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER; this->Bindings[bindingIndex].descriptorCount = arrayCount; this->Bindings[bindingIndex].stageFlags = shaderStages; return bindingIndex; } uint Vlk::DescriptorSetLayoutTemplate::AddSamplerBinding( VkShaderStageFlags shaderStages, uint arrayCount ) { uint bindingIndex = (uint)this->Bindings.size(); this->Bindings.emplace_back(); this->Bindings[bindingIndex].binding = bindingIndex;
cpp
} #if defined(Q_OS_UNIX) PathResolver::DirectoryCacheInfo PathResolver::getCachedInfo(const QString &path, bool &ok) const { if(cache.contains(path)) { ok = true; return cache.value(path);
cpp
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com #include "flpch.h" #include "FarLight/EventSystem/WindowEvents/WindowResizedEvent.h" namespace FarLight { std::string WindowResizedEvent::ToString() const noexcept {
cpp
modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the
cpp
#include "light/rendering/vertexarray.hpp" #include "light/rendering/framebuffer.hpp" namespace Light { /* * SceneRenderer is responsible for rendering the scene. * Usage: * ~~~~~~~~~~~~~~~{.cpp}
cpp
ASSERT(layoutObject()); ASSERT(layoutObject()->parent()); // We can have any number of anonymous layout objects inserted between // us and our parent so make sure we skip over them. LayoutObject* ancestor = layoutObject()->parent(); while (ancestor->isAnonymous() || (ancestor->node() && ancestor->node()->isPseudoElement())) { ASSERT(ancestor->parent()); ancestor = ancestor->parent(); }
cpp
CComPtr<ILatLongReport> lat_long_report; result_type = locator_->GetReport(IID_ILatLongReport, &location_report); // Checks to see if location access is allowed. if (result_type == E_ACCESSDENIED) position->error_code = Geoposition::ERROR_CODE_PERMISSION_DENIED; // Checks for any other errors while requesting a location report. if (!SUCCEEDED(result_type)) return false; result_type = location_report->QueryInterface(&lat_long_report); if (!SUCCEEDED(result_type)) return false; result_type = lat_long_report->GetLatitude(&position->latitude); if (!SUCCEEDED(result_type)) return false; result_type = lat_long_report->GetLongitude(&position->longitude);
cpp
return rmse; } // * the estimation vector size should equal ground truth vector size if(estimations.size()!=ground_truth.size()){ cout<<"size mismatch"; return rmse; } // ... your code here //accumulate squared residuals
cpp
#ifndef IROHA_POSTGRES_WSV_QUERY_HPP #define IROHA_POSTGRES_WSV_QUERY_HPP #include <soci/soci.h> #include "ametsuchi/wsv_query.hpp" #include "logger/logger_fwd.hpp" namespace iroha { namespace ametsuchi { class PostgresWsvQuery : public WsvQuery { public: PostgresWsvQuery(soci::session &sql, logger::LoggerPtr log);
cpp
binding = binding1; } LavaVk::Core::ImageStorageShaderResource::ImageStorageShaderResource(std::string_view name1, uint32_t arraySize1, uint32_t set1, uint32_t binding1) { name = name1; type = ShaderResourceType::ImageStorage; arraySize = arraySize1;
cpp
} return Status::OK(); } Status is_directory(const std::string& path, bool* is_dir) override { struct stat path_stat; if (stat(path.c_str(), &path_stat) != 0) { return io_error(path, errno); } else { *is_dir = S_ISDIR(path_stat.st_mode); }
cpp
*/ #ifndef __cplusplus #error "this test should be compiled with a C++ compiler" #endif #include <config.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <nbdkit-filter.h> #define THREAD_MODEL NBDKIT_THREAD_MODEL_PARALLEL
cpp
/* * Copyright (c) 2018 <NAME> (<EMAIL>) * Distributed under the MIT License. * See accompanying file LICENSE.md or copy at http://opensource.org/licenses/MIT */ #ifndef INTEGRATE_HPP #define INTEGRATE_HPP
cpp
Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
cpp
result.Append(names[i]); } result.Append(';'); return result.ReleaseString(); } void CSSLayerStatementRule::Reattach(StyleRuleBase* rule) { DCHECK(rule); layer_statement_rule_ = To<StyleRuleLayerStatement>(rule); } void CSSLayerStatementRule::Trace(Visitor* visitor) const { visitor->Trace(layer_statement_rule_);
cpp
return status; } status = rocsparse_importer_switch_base(nnzb, col_ind, import_base, base); if(status != rocsparse_status_success) { return status; } return rocsparse_status_success; } template <typename I, typename J, typename T,
cpp
DisplayDevice Parent; Parent.mName = "PARENT"; Parent.mMain = false; Point2DI parentSize(GetHTMLParentSizeX(), GetHTMLParentSizeY()); printf("Parent Size : %d %d\n", parentSize.x, parentSize.y);
cpp
} TreeNode; void redirect(Tree t, DTYPE cx, DTYPE cy) { int i, root, prev, curr, next; /* assume that one of the nodes must match (cx, cy) */
cpp
// For each needle: for (int i = 0; i < aNeedleCount; ++i) // For each character in this needle: for (LPTSTR needle_pos = aNeedle[i], str_pos = aStr; ; ++needle_pos, ++str_pos) { if (!*needle_pos) { // All characters in needle matched aStr at this position, so we've // found our string. If this needle is empty, it implicitly matches // at the first position in the string. aFoundLen = needle_pos - aNeedle[i]; return aStr; }
cpp
sge::scenic::scene::prefer_cg_context const &_prefer_cg_context) : renderer_(_renderer), mesh_vertex_declaration_( renderer_.get().create_vertex_declaration(sge::renderer::vertex::declaration_parameters( sge::renderer::vf::dynamic::make_format<sge::scenic::vf::format>()))), texture_manager_(renderer_, _image_loader), shader_context_(renderer_), render_context_manager_( _prefer_cg_context.get() ? fcppt::unique_ptr_to_base<sge::scenic::render_context::manager_base>( fcppt::make_unique_ptr<sge::scenic::render_context::cg::manager>( fcppt::make_ref(shader_context_), fcppt::make_cref(*mesh_vertex_declaration_)))
cpp
Out( "out" ); cmdLineParameter< float > Scale( "scale" , 1.f ); cmdLineReadable* params[] = { &In , &Out , &Scale , NULL };
cpp
} void CPageSetupDlg::DoDataExchange(CDataExchange* pDX) { CCSDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CPageSetupDlg) DDX_Twips(pDX, IDC_EDIT_TM, m_nTopMargin); DDV_MinMaxTwips(pDX, m_nTopMargin, -31680, 31680); DDX_Twips(pDX, IDC_EDIT_RM, m_nRightMargin); DDV_MinMaxTwips(pDX, m_nRightMargin, -31680, 31680); DDX_Twips(pDX, IDC_EDIT_LM, m_nLeftMargin); DDV_MinMaxTwips(pDX, m_nLeftMargin, -31680, 31680); DDX_Twips(pDX, IDC_EDIT_BM, m_nBottomMargin); DDV_MinMaxTwips(pDX, m_nBottomMargin, -31680, 31680);
cpp
})", {wrong_length_key}, /*offsets=*/nullptr); absl::optional<base::Value> json_object = base::JSONReader::Read(json_string); ASSERT_TRUE(json_object) << "Incorrectly formatted JSON string."; std::vector<PublicKey> keys = aggregation_service::GetPublicKeys(json_object.value()); EXPECT_TRUE(keys.empty()); } TEST(PublicKeyParsingUtilsTest, WellFormedAndMalformedKeys_EmptyResult) {
cpp
we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. */ #include <iostream> int main() { int s = 0;
cpp
} CommandBuffer* cmd = GraphicCmdPool::instance()->alloc(); cmd->beginOneTime(); VkCommandBuffer commandBuffer = cmd->get(); VkImageMemoryBarrier barrier = {}; barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; barrier.image = m_image; barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; barrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; barrier.subresourceRange.baseArrayLayer = 0;
cpp
// test get cout << "Element with index 0 is " << y.get(0) << endl; cout << "Element with index 3 is " << y.get(3) << endl; // test erase y.erase(1); cout << "Element 1 erased" << endl; cout << "The list is " << y << endl; y.erase(2);
cpp
#include "ChatHandler.h" ChatHandler::ChatHandler( Context* context ) : HandlerImpl( context ) { }
cpp
* * Purpose: Support code for fmjpeg2k * */ #include "dcmtk/config/osconfig.h" #include "djlsutil.h" #include "dcmtk/dcmdata/dcerror.h"
cpp
m_test_mode = false; m_src_test_mode = false; m_token_test_mode = false; } Controller::~Controller() {}
cpp
} return true; } bool ReadFileToString(const std::string& path, std::string* result) { Descriptor fd(open(path.c_str(), O_RDONLY));
cpp
indexBuffer = Buffer::IndexBuffer(AE_UINT, sizeof(uint32_t), 1, nullptr, AE_BUFFER_DYNAMIC_STORAGE); vertexArray.AddIndexComponent(&indexBuffer); vertexBuffer = Buffer::VertexBuffer(AE_FLOAT, 3, sizeof(vec3), 8, nullptr, AE_BUFFER_DYNAMIC_STORAGE); vertexArray.AddComponent(0, &vertexBuffer); shader.AddStage(AE_VERTEX_STAGE, vertexPath); shader.AddStage(AE_FRAGMENT_STAGE, fragmentPath); shader.Compile(); GetUniforms(); }
cpp
#include "chrome/common/chrome_switches.h" #include "cloud_print/common/win/cloud_print_utils.h" #include "cloud_print/service/service_constants.h" #include "cloud_print/service/service_state.h" #include "cloud_print/service/service_switches.h" #include "cloud_print/service/win/chrome_launcher.h" #include "cloud_print/service/win/service_controller.h" #include "cloud_print/service/win/service_listener.h" #include "cloud_print/service/win/service_utils.h" #include "cloud_print/service/win/setup_listener.h" namespace { void InvalidUsage() {
cpp
* * Created on: 13.11.2013 * Author: <NAME> (<EMAIL>) */ #ifndef NETWORKIT_AUXILIARY_PARALLELISM_HPP_ #define NETWORKIT_AUXILIARY_PARALLELISM_HPP_ namespace Aux { /** * Set the number of threads available to the program.
cpp
break; } } if (u <= 0) {
cpp
* ------- */ space = wcschr(wcmd + 2, L' '); if (!space) { fprintf(stderr, "invalid query request '%ls'", wcmd); return -1; } *space = L'\0'; wstring origin(wcmd + 2); /* * Q firefox https://google.com
cpp
script.Execute("userValueType.data = 100"); script.Execute("globalVar1 = valueHolder.value.data"); AZ_TEST_ASSERT(s_globalVar1 == 10.0f); // now store a reference and make sure it works script.Execute("userValueTypeRef = valueHolder.value"); script.Execute("userValueTypeRef.data = 100"); script.Execute("globalVar1 = valueHolder.value.data"); AZ_TEST_ASSERT(s_globalVar1 == 100.0f); script.Execute("valueHolder = nil userValueType = nil"); // test class pointer casting for unregistered classes ScriptUnregisteredBaseClass ubc; ScriptUnregisteredDerivedClass udc;
cpp
#include <mbgl/programs/debug_program.hpp> namespace mbgl { } // namespace mbgl
cpp
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and
cpp
{ ErlNifResourceFlags flags = static_cast<ErlNifResourceFlags>(ERL_NIF_RT_CREATE | ERL_NIF_RT_TAKEOVER); data->res_timezone = enif_open_resource_type(env, NULL, "res_timezone", enif_timezone_free, flags, NULL); } int on_nif_load(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM load_info) { UNUSED(load_info); ATOMS.atomOk = make_atom(env, kAtomOk); ATOMS.atomUndefined = make_atom(env, kAtomUndefined); ATOMS.atomTrue = make_atom(env, kAtomTrue); ATOMS.atomFalse = make_atom(env, kAtomFalse); ATOMS.atomError = make_atom(env, kAtomError); ATOMS.atomBadArg = make_atom(env, kAtomBadArg);
cpp
SDL_FreeSurface(TxtSurfaces[i][j]); } struct_action_res *txt_CreateTTYtext() { struct_action_res *tmp; tmp = ScrSys_CreateActRes(NODE_TYPE_TTYTEXT); tmp->nodes.tty_text = new (struct_ttytext); tmp->nodes.tty_text->delay = 0;
cpp
header_local_stub_generator(); idl_compiler::generator::parameter<OutputIterator, Iterator> parameter; idl_compiler::generator::return_<OutputIterator, Iterator> return_; karma::rule<OutputIterator, idl_parser::param_decl<Iterator>(interface_)> parameter_select; karma::rule<OutputIterator, std::string(std::vector<std::string>)> poa_class_name; karma::rule<OutputIterator> ior_function; karma::rule<OutputIterator> indent; karma::rule<OutputIterator, std::string(std::vector<std::string>)>
cpp
int x,y,prevX,prevY; void draw(); GuiValueBox box; public: void init(); void eventMouseMove(int x, int y); void eventMouseDown(); void eventMouseUp(); bool pushEvent(SDL_Event * evt); void update(); void render(float alpha);
cpp
# define CAIRO_SVG_UTILS_HPP # pragma once struct NSVGImage; struct _cairo; void draw_svg_image(_cairo*, struct NSVGimage*, double, double);
cpp
if (DbgMI) { DbgValues.push_back(std::make_pair(DbgMI, &MI)); DbgMI = nullptr; } if (MI.isDebugValue()) { DbgMI = &MI; continue; } if (MI.isDebugLabel())
cpp
float Variavel::getAtual(){ return _atual; } float Variavel::getMaxima(){ return _maxima; }
cpp
* Wireshark - Network traffic analyzer * By <NAME> <<EMAIL>> * Copyright 1998 <NAME> * * SPDX-License-Identifier: GPL-2.0-or-later */ #include "sctp_all_assocs_dialog.h"
cpp
namespace caffe { template <typename Dtype> void TanHLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) { const Dtype* bottom_data = bottom[0]->cpu_data(); Dtype* top_data = top[0]->mutable_cpu_data(); const int count = bottom[0]->count(); for (int i = 0; i < count; ++i) {
cpp
combine(CImagePtr image) { return combine(0, 0, image); } bool CImage:: combine(int x, int y, CImagePtr image)
cpp
TEST_CASE("Test the solution for problem \"Combination Sum\"") { Solution sln_instance; vector<int> input{ 2,3,6,7 }; vector<vector<int>> expected_output{ {7}, {2, 2, 3} }; vector<vector<int>> output = sln_instance.combinationSum(input, 7); CHECK(ArrayOfArraySame(expected_output, output));
cpp
extension_ime_util::IsKeyboardLayoutExtension(input_method_id) && delegate_->IsInLoginLayoutAllowlist(ime.layout), ime.options_page_url, ime.input_view_url)); } } std::stable_sort(result.begin(), result.end(), InputMethodCompare); return result; } input_method::InputMethodDescriptors ComponentExtensionIMEManager::GetXkbIMEAsInputMethodDescriptor() { input_method::InputMethodDescriptors result;
cpp
namespace evmone { evmc_result execute(AdvancedExecutionState& state, const AdvancedCodeAnalysis& analysis) noexcept { state.analysis.advanced = &analysis; // Allow accessing the analysis by instructions. const auto* instr = &state.analysis.advanced->instrs[0]; // Start with the first instruction. while (instr != nullptr)
cpp
void SourceImpl::Remove() { if (connection_failure_callback_) { connection_failure_callback_(); } } void SourceImpl::UpdateStatus() { status_.has_audio = false;
cpp
// |should_dump| check below susceptible to TOCTTOU bugs // (https://crbug.com/763365). bool is_thread_bound; { // A locked access is required to R/W |disabled| (for the // UnregisterAndDeleteDumpProviderSoon() case). AutoLock lock(lock_); // Unregister the dump provider if it failed too many times consecutively. if (!mdpinfo->disabled && mdpinfo->consecutive_failures >= kMaxConsecutiveFailuresCount) {
cpp
{ std::FILE* input{std::fopen(filename, "r")}; if (!input) { std::fprintf(stderr, "Could not open %s for reading: %s\n", filename, std::strerror(errno)); std::exit(EXIT_FAILURE); } char line[256]{""}; while (std::fgets(line, 256, input)) { if (line[std::strlen(line) - 1] != '\n') { std::fprintf(stderr, "Line longer than 256 chars, aborting\n"); std::exit(EXIT_FAILURE);
cpp
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
cpp
using dfc::Pid; using dfc::SaveOnMatcher; using dfc::test::createCaseInsensitiveImmutablePattern; using dfc::test::createCaseInsensitivePattern; using dfc::test::createImmutablePattern; using dfc::test::createPattern; namespace { TEST_CASE("Compact Table") { SaveOnMatcher onMatcher;
cpp
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #include "libwds/public/source.h" #include "libwds/source/cap_negotiation_state.h" #include "libwds/source/init_state.h" #include "libwds/source/streaming_state.h"
cpp
if (!m_reason.isEmpty()) m_reason.setReference(wrapper, isolate); } const AtomicString& PromiseRejectionEvent::interfaceName() const { return EventNames::PromiseRejectionEvent; }
cpp
return true; } std::shared_ptr<TiledAnimatedSpriteSheetData> AssetManager::GetAnimatedSheetData(std::string name) { auto search = animatedSheetDataRegistry.find(name); if (search == animatedSheetDataRegistry.end())
cpp
#include "ofApp.h" //-------------------------------------------------------------- void ofApp::setup(){ for(int i=0; i<10; i++) { Thing t; things.push_back( t ); } } //-------------------------------------------------------------- void ofApp::update(){ for (int i = 0; i < things.size(); i++) { // For every Thing t[i]
cpp
#include "karma/karma.h" #include "formant/lpc.h" VectorXd Karma::arCoefficients(const ArrayXd &x, int p) { return -Lpc::burg(x, p); }
cpp
if (residualNorm2 < 0) { printf("Warning: residualNorm2=%G is negative. Input matrix might not be SPD. Solution could be incorrect.\n", residualNorm2); } return (iteration-1) * ((residualNorm2 > eps * eps * initialResidualNorm2) ? -1 : 1); }
cpp
if (positionAtEndOfNode == lastPositionInParagraph) { removeNode(element); if (ancestor->nextSibling()) insertNodeBefore(element, ancestor->nextSibling()); else appendNode(element, ancestor->parentNode()); } else { RefPtr<Node> nodeToSplitTo = splitTreeToNode(element.get(), ancestor.get(), true); removeNode(element);
cpp
case USER_UNIT_NONE: case USER_UNIT_METRIC: if (linearmeasure == 0.001f) { unitname = "millimeter"; } else if (linearmeasure == 0.01f) { unitname = "centimeter"; } else if (linearmeasure == 0.1f) { unitname = "decimeter"; }
cpp
string aux= ""; //varre a string caractere a caractere for(int i=0; expressao[i] !='\0'; i++){ //verifica caracteres validos if(((expressao[i] == '+') || (expressao[i] == '-') || (expressao[i] == '*') || (expressao[i] == '^') || (expressao[i] == ' ') || (expressao[i] == '(') || (expressao[i] == ')') || (expressao[i] >= 46)) && (expressao[i] <= 57)){ //adiciona espaco entre os caractere para poder separar no buffer if((expressao[i] == '+') || (expressao[i] == '-') || (expressao[i] == '*') || (expressao[i] == '^') || (expressao[i] == ' ') || (expressao[i] == '(') || (expressao[i] == ')')){
cpp
/// @ref gtc_round #include "../integer.hpp" #include "../ext/vector_integer.hpp" namespace glm { namespace detail { template<bool is_float, bool is_signed> struct compute_roundMultiple { }; template<> struct compute_roundMultiple<true, true> { template<typename genType> GLM_FUNC_QUALIFIER static genType call(genType Source, genType Multiple) {
cpp
return "unchanged"; case PaintPropertyChangeType::kChangedOnlyCompositedValues: return "composited-values"; case PaintPropertyChangeType::kChangedOnlyNonRerasterValues: return "non-reraster"; case PaintPropertyChangeType::kChangedOnlySimpleValues: return "simple-values"; case PaintPropertyChangeType::kChangedOnlyValues: return "values"; case PaintPropertyChangeType::kNodeAddedOrRemoved: return "node-add-remove"; } }
cpp
vector<string> splits; char delimiter = ' '; size_t i = 0; size_t pos = input_string.find(delimiter); while (pos != string::npos) { splits.push_back(input_string.substr(i, pos - i)); i = pos + 1; pos = input_string.find(delimiter, i); } splits.push_back(input_string.substr(i, min(pos, input_string.length()) - i + 1));
cpp
ROM_LOAD16_BYTE( "u39_touchmaster_10-21-97_4a76.u39", 0x200000, 0x100000, CRC(af92cf87) SHA1(cb6baf8b3afe1e61e440be69a90d5c001eb7b388) ) /* U39 TOUCHMASTER 10-21-97 4A76 (date and checksum hand written) */ ROM_LOAD16_BYTE( "u37_touchmaster_10-21-97_40f6.u37", 0x200001, 0x100000, CRC(b5e69eca) SHA1(c548e33a049d17381c9755499940ffc459c0cb48) ) /* U37 TOUCHMASTER 10-21-97 40F6 (date and checksum hand written) */ ROM_LOAD16_BYTE( "u41_touchmaster_10-21-97_f986.u41", 0x400000, 0x100000, CRC(97bc5e19) SHA1(9a9786ec2a9a7b7008d9e2e8624df8301f737dbc) ) /* U41 TOUCHMASTER 10-21-97 F986 (date and checksum hand written) */ ROM_LOAD16_BYTE( "u40_touchmaster_10-21-97_7086.u40", 0x400001, 0x100000, CRC(e3ae6fa6) SHA1(02c98f59553f4343f0dd855794364ad95aa81063) ) /* U40 TOUCHMASTER 10-21-97 7086 (date and checksum hand written) */
cpp
CDXLPhysicalIndexOnlyScan::PstrOpName() const { return CDXLTokens::PstrToken(EdxltokenPhysicalIndexOnlyScan); } // EOF
cpp
virtual void pre_hook() {} virtual void post_hook() {} virtual void init_hook(const expr_t& x) {} virtual void node_hook(const expr_t& x) {} virtual void and_hook(const expr_t& x) {} virtual void or_hook(const expr_t& x) {} virtual void state_hook(const expr_t& x) {} virtual void const_hook(const expr_t& x) {}
cpp
// CHECK-CC1: Symbols: // CHECK-CC1-NEXT: ?helloWindowsMsvc@@YAHXZ // CHECK-IFS: --- !experimental-ifs-v1 // CHECK-IFS: IfsVersion: 1.0 // CHECK-IFS: Triple: // CHECK-IFS: Symbols: // CHECK-IFS: ?helloWindowsMsvc@@YAHXZ: { Type: Func } // CHECK-IFS: ... int helloWindowsMsvc();
cpp
#ifndef P6 #define P6 int sumToN(int n); int sumSquaresToN(int n); int p6solve(int n); #endif /* P6_SUMSQUAREDIFFERENCE_P6_SUMSQUAREDIFFERENCE_HPP_ */
cpp
class Node { public: int data; Node* next;
cpp
using std::cin; using std::cout; using std::endl; using std::cerr; using std::string; int main(int argc, char *argv[]){ if (argc < 2){ cerr << "No filename?" << endl;