id
stringlengths
21
25
content
stringlengths
164
2.33k
codereview_cpp_data_1359
dofs->resize(nbrDofs); /// Add PointSetTopology - typename sofa::component::topology::PointSetTopologyContainer::SPtr tCon = sofa::core::objectmodel::New<sofa::component::topology::PointSetTopologyContainer>(); - typename sofa::component::topology::PointSetTopologyModifier::SPtr tMod = s...
codereview_cpp_data_1360
} if(elektraMountGlobals(handle, ksDup(keys), handle->modules, errorKey) == -1) { - //TODO: errorhandling here #if DEBUG && VERBOSE printf("Mounting global plugins failed\n"); #endif Yes, should be done! } if(elektraMountGlobals(handle, ksDup(keys), handle->modules, errorKey) == -1) { #if DEBUG && ...
codereview_cpp_data_1383
//---------------------------------------------------------------------------- __device__ void verify_warp_convergence( const char * const where ) { This function can go into `#ifdef KOKKOS_DEBUG` //---------------------------------------------------------------------------- +#if defined( KOKKOS_DEBUG ) + __dev...
codereview_cpp_data_1388
// Check if the best chain has changed while we were disconnecting or processing blocks. // If so then we need to return and continue processing the newer chain. pindexNewMostWork = FindMostWorkChain(); if (pindexNewMostWork->nChainWork > pindexMostWork->nChainWork) ...
codereview_cpp_data_1400
{ QPixmap resizedPixmap = avatarPixmap.scaled(avatarLabel.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation); avatarLabel.setPixmap(resizedPixmap); - resize(sizeHint()); QWidget::resizeEvent(event); } resizing the window will result in an infinite recursion now.... { QPixmap resizedPixma...
codereview_cpp_data_1404
/* grep keys */ if (obj->type == MSGPACK_OBJECT_MAP) { map_num = obj->via.map.size; /* allocate map_num + guard byte */ bool_map = flb_calloc(map_num+1, sizeof(bool_map_t)); if (bool_map == NULL) { I think we should have a limit, what do you think ?...
codereview_cpp_data_1411
if (!ofs) throw std::runtime_error(UNABLE_TO_OPEN_FILE); ofs << design.Dump(); } catch (const std::exception& e) { ErrorLogger() << "Error writing design file. Exception: " << ": " << e.what(); Seems like there should be some sent to InfoLogger when the...
codereview_cpp_data_1412
{ struct rp_handler_t *self = (void *)_self; - if (self->config.ssl_ctx != NULL) - SSL_CTX_free(self->config.ssl_ctx); h2o_socketpool_dispose(&self->sockpool); } void h2o_proxy_register_reverse_proxy(h2o_pathconf_t *pathconf, h2o_url_t *upstreams, size_t num_upstreams, - ...
codereview_cpp_data_1417
{ void GetSummaryParams(int res1, int res2, const HeroBase &, u32 exp, int &, std::string &); void SpeedRedraw(const Point &); - void doOnButtonClicked(ButtonWithText& button, Display & display, Cursor& cursor); - void initButtonState(bool state, ButtonWithText& button); } void Battle::SpeedRedraw(co...
codereview_cpp_data_1421
#include <stdio.h> #include <sys/stat.h> #include <iostream> -#include <nonstd/optional.hpp> std::string id_to_name(uint32_t id) { std::string new_id(16, '\0'); Can it be `nonstd::optional`? #include <stdio.h> #include <sys/stat.h> #include <iostream> std::string id_to_name(uint32_t id) { std::string ne...
codereview_cpp_data_1424
ret = prepare_destroy_conn(u_conn); - if (u->thread_safe == FLB_TRUE && locked) { pthread_mutex_unlock(&u->mutex_lists); } `locked` is only assigned if `u->thread_safe` is `FLB_TRUE` so in the unlock section we could just do `if (locked) {` ret = prepare_destroy_conn(u_conn); + if (locke...
codereview_cpp_data_1436
convertOps.setProgress( Progress( ConfigOptions().getJobId(), JOB_SOURCE, Progress::JobState::Running, - (_currentTaskNum - 1) / _numTotalTasks, 1.0 / _numTotalTasks)); convertOps.apply(fullMap); // get back into wgs84 in case some op changed the proj MapProjector::projectToWgs84(fullMap); ...
codereview_cpp_data_1448
soci::session sql(*connection_); // rollback current prepared transaction // if there exists any since last session - rollbackPrepared(sql); sql << init_; prepareStatements(*connection_, pool_size_); } ```suggestion if (prepared_blocks_enabled_) rollbackPrepared(sql); ``` o...
codereview_cpp_data_1454
/* UDP multicast network layer specific internal data */ typedef struct { int ai_family; /* Protocol family for socket. IPv4/IPv6 */ - struct sockaddr_storage *ai_addr; /* https://msdn.microsoft.com/de-de/library/windows/desktop/ms740496(v=vs.85).aspx */ - struct sockaddr_storage *intf_a...
codereview_cpp_data_1458
core::CollisionModel* model1 = outputsIt->first.first; core::CollisionModel* model2 = outputsIt->first.second; - msg_error_when(model1 == nullptr) << "Contact found with a nullptr collision model"; - msg_error_when(model2 == nullptr) << "Contact found with a nullptr colli...
codereview_cpp_data_1472
!sep->IsNumber(3) ) { c->Message(Chat::White, "Usage: #zsafecoords [X] [Y] [Z] [Heading] [Permanent (0 = False, 1 = True)]"); return; } Did you want to show defaults here? !sep->IsNumber(3) ) { c->Message(Chat::White, "Usage: #zsafecoords [X] [Y] [Z] [Heading] [Permanent (0 = False, 1 = True)]");...
codereview_cpp_data_1484
bool isApplicable = highlightCell->isPassable1( false ); if ( isApplicable ) { const Unit * highlightedUnit = highlightCell->GetUnit(); - if ( highlightedUnit != nullptr ) { - isApplicable = !( highlightedUnit->GetMagicResist( humanturn_spell,...
codereview_cpp_data_1487
* @param informationKey contains the statistics in its meta information * @param metaName which statistic to set * @param value which value to set it to, must be a number - * @returns 0 on success, 1 otherwise. * * This enforces that a number is set. */ You can use retval here. * @param informationKey c...
codereview_cpp_data_1493
#include <ctime> // clock(), clock_t, CLOCKS_PER_SEC #include <OpenSim/Simulation/osimSimulation.h> #include <OpenSim/Analyses/osimAnalyses.h> #include <OpenSim/Auxiliary/auxiliaryTestFunctions.h> using namespace OpenSim; A user won't run into this issue? #include <ctime> // clock(), clock_t, CLOCKS_PER_SEC ...
codereview_cpp_data_1511
const char* megaFolderLink = request->getLink(); const char* base64pwkey = request->getPrivateKey(); const char* sessionKey = request->getSessionKey(); - const char* folderAuthKey = request->getSessionKey(); if (!megaFolderLink && (!(login && password)) && ...
codereview_cpp_data_1522
m_aStdColNameOrder->Insert(_("Progress"), COLUMN_PROGRESS); m_aStdColNameOrder->Insert(_("Status"), COLUMN_STATUS); m_aStdColNameOrder->Insert(_("Elapsed"), COLUMN_CPUTIME); - m_aStdColNameOrder->Insert(_("Remaining"), COLUMN_TOCOMPLETION); m_aStdColNameOrder->Insert(_("Estimated Completion"), CO...
codereview_cpp_data_1525
#if defined(__has_builtin) # if __has_builtin(__builtin_add_overflow) && !defined(__ibmxl__) -# define HAVE_BUILTIN_OVERFLOW # endif #elif defined(__GNUC__) && (__GNUC__ >= 5) && (!defined(__INTEL_COMPILER) || (__INTEL_COMPILER >= 1800)) -# define HAVE_BUILTIN_OVERFLOW #endif #if defined(__GNUC__) I think ...
codereview_cpp_data_1528
case BUILD_CAPTAIN: return { 223, 122, 37, 52 }; case BUILD_MAGEGUILD1: - return { 285, 32, 55, 129 }; case BUILD_MAGEGUILD2: - return { 285, 32, 55, 129 }; case BUILD_MAGEGUILD3: - return { 285, 32, 55, 129 }; case BUILD_MAGEGUI...
codereview_cpp_data_1547
} } - WHEN ("A required argument is added") { auto optional_int = parser.add_argument( ```suggestion WHEN ("An optional argument is added") ``` } } + WHEN ("An optional argument is added") { auto optional_int = parser.add_argument(
codereview_cpp_data_1561
namespace lbann { -void im2col(const AbsMat& im, - AbsMat& col, const int num_channels, const int im_num_dims, const int * im_dims, I think im2col should only accommodate CPUMat. namespace lbann { +void im2col(const CPUMat& im, + CPUMat& col, ...
codereview_cpp_data_1574
GetOptionsDB().Get<bool>("verbose-combat-logging"); m_wnd.DeleteChildren(); - GG::Layout* layout = new GG::DeferredLayout(m_wnd.UpperLeft().x, m_wnd.UpperLeft().y - , m_wnd.Width(), m_wnd.Height() - , 1, 1 ...
codereview_cpp_data_1583
void CachedStorage::restoreCache(TableInfo::Ptr table, const std::string& key, Cache::Ptr cache) { RWMutexScoped lockCache(m_cachesMutex, false); auto cacheKey = table->name + "_" + key; Why `tuple` still here ? void CachedStorage::restoreCache(TableInfo::Ptr table, const std::string& key, Cache::Ptr cac...
codereview_cpp_data_1596
return num; } -void wlr_egl_destroy_surface(struct wlr_egl *egl, EGLSurface surface) { - eglDestroySurface(egl->display, surface); } Could you add a NULL check on surface, and then remove the checks from the DRM backend? return num; } +bool wlr_egl_destroy_surface(struct wlr_egl *egl, EGLSurface surface) { + i...
codereview_cpp_data_1624
ids select(const counts& xs, vast::count y, F pred) { ids result; for (auto x : xs) - result.append_bits(pred(x, y), 1); return result; } The single-argument function `append_bit` allows you to skip the second argument. ids select(const counts& xs, vast::count y, F pred) { ids result; for (auto x...
codereview_cpp_data_1633
VAST_DEBUG(this, "ignores empty line at", lines_->line_number()); continue; } - if (!p(line)) - return make_error(ec::type_clash, "unable to parse CSV line", line); ++produced; if (builder_->rows() == max_slice_size) if (auto err = finish(callback)) For JSON, we skip over in...
codereview_cpp_data_1647
if(p) { *p = 0; if(!work_queue_task_specify_file(t, f, p + 1, WORK_QUEUE_INPUT, caching_flag)){ - exit(1); } *p = '='; } else { if(!work_queue_task_specify_file(t, f, f, WORK_QUEUE_INPUT, caching_flag)){ - exit(1); } } f = strtok(0, " \t,"); We want a fatal message...
codereview_cpp_data_1649
static NewSyncConfig from(const SyncConfig& config) { - auto type = SyncConfig::TYPE_TWOWAY; - if (config.isUpSync() && !config.isDownSync()) - { - type = SyncConfig::TYPE_UP; - } - else if (!config.isUpSync() && config.isDownSync()) - { - type =...
codereview_cpp_data_1661
// fix extra border part on higher resolutions if ( displayHeight > fheroes2::Display::DEFAULT_HEIGHT ) { srcrt.x = 478; - srcrt.y = conf.ExtGameEvilInterface() ? 328 : 345; srcrt.width = 3; - srcrt.height = conf.ExtGameEvilInterface() ? 15 : 20; dstpt.x += 14; ...
codereview_cpp_data_1665
rank_in_world = std::to_string(comm->get_rank_in_world()); } rng_name = dirname + "/rng_io_generator_" + rank_in_world; std::ofstream rng_io(rng_name); rng_io << ::io_generator; rng_name = dirname + "/rng_fast_io_generator_" + rank_in_world; std::ofstream rng_fast_io(rng_name); rng_fast_io << ...
codereview_cpp_data_1675
} void wlr_keyboard_destroy(struct wlr_keyboard *kb) { - if (!kb) { - return; - } - - if (kb->impl && kb->impl->destroy) { kb->impl->destroy(kb); } else { free(kb); Better to update the if statement below to ```c if (kb && kb->impl && kb->impl->destroy) ``` imo } void wlr_keyboard_destroy(struct wlr_key...
codereview_cpp_data_1677
} return emsActuator; } else { - LOG(Error, "ATTENTION: Actuated Object " + wsObject.nameString() + " does not reverse translate. ActuatedComponent is NOT set."); openstudio::model::EnergyManagementSystemActuator emsActuator(m_model); OptionalString s1 = workspaceObject...
codereview_cpp_data_1680
precision_(0), multiprecision_repr_([this] { static const std::regex r( - "[1-9][0-9]*(\\.([0-9]+))?|0\\.([0-9]*[1-9])"); // 123.456 will have the following groups: // [0] -> 123.456 [1] -> .456 [2] -> 456 [3] -> // The same ...
codereview_cpp_data_1689
auto checking_transaction = [&command_validator](auto &tx, auto &executor, auto &query) { for (auto command : tx.commands) { executor.execute(*command); if (!command_validator.validate(*command)) { Should add a line that `// TODO permission valida...
codereview_cpp_data_1701
} } - bool anydata = true; - while (anydata) { - anydata = false; for (int i = 0; i < connections; ++i) { // synchronous writes for all remaining outstanding data (for raid, there can be a sequence of output pieces. for ...
codereview_cpp_data_1703
dwellingTobuild = ( Race::NECR == race ? BUILD_SHRINE : BUILD_TAVERN ); return ConstructionDialogResult::Build; } - else if ( le.MouseCursor( buildingThievesGuild.GetArea() ) && buildingThievesGuild.QueueEventProcessing( buttonExit ) ) { dwellingTobuild = BUILD_THI...
codereview_cpp_data_1715
RESULT_ENSURE_LTE(digest_length, data_len); - RESULT_CHECKED_MEMCPY(data, digest_data, data_len); return S2N_RESULT_OK; } Should be `digest_length` otherwise by providing a large buffer the code will cause ub. RESULT_ENSURE_LTE(digest_length, data_len); + RESULT_CHECKED_MEMCPY(data, digest_data,...
codereview_cpp_data_1716
pb.model()); model->setup(io_thread_pool); - if(opts->has_bool("disable_background_io_activity") && opts->get_bool("disable_background_io_activity")) { model->allow_background_io_activity(false); } You don't need has_bool(); The code was changed; instead of throw...
codereview_cpp_data_1753
#include <algorithm> // for std::swap #include <array> // for std::array #include <iostream> // for io operations /** Please make it look like C++ code: ```suggestion if (size <= 1) { return; } ``` Same in other parts of the code. #include <algorithm> // for std::swap #include <array> // for std::...
codereview_cpp_data_1759
*/ GUARD(s2n_config_set_session_cache_onoff(config, 1)); GUARD(config->wall_clock(config->sys_clock_ctx, &now)); - EXPECT_SUCCESS(s2n_config_add_ticket_crypto_key(config, ticket_key_name, strlen((char *)ticket_key_name), ticket_key, strlen((char *)ticket_key), now/ONE_SEC_IN_NANOS)); ...
codereview_cpp_data_1761
} catch (std::bad_alloc &e) { - throw std::runtime_error("ERROR: bad_alloc detected when resizing " - "data buffer with size " + - std::to_string(size) + "\ndescription: " + - ...
codereview_cpp_data_1766
psb->m_cfg.kDF = 1; psb->m_cfg.collisions = btSoftBody::fCollision::SDF_RD; getDeformableDynamicsWorld()->addSoftBody(psb); - getDeformableDynamicsWorld()->addForce(psb, new btDeformableMassSpringForce(2, 0.01, false)); - getDeformableDynamicsWorld()->addForce(psb, new btDeforma...
codereview_cpp_data_1767
{ if ( isValidIndex( position ) && dir != UNKNOWN ) { Board * board = Arena::GetBoard(); - if ( dir == CENTER ) return &board->at( position ); - else if ( isValidDirection( position, dir ) ) return &board->at( GetIndexDirection( position, dir ) ); } retur...
codereview_cpp_data_1773
return result; } - boost::optional<ModelObject> Space_Impl::buildingUnitAsModelObject() const { - OptionalModelObject result; - boost::optional<BuildingUnit> intermediate = buildingUnit(); - if (intermediate) { - result = *intermediate; - } - return result; - } - std::vector<ModelObject...
codereview_cpp_data_1793
{ char path[MAXPATHLEN]; int ret, fd; if (console->path && !strcmp(console->path, "none")) return 0; - ret = snprintf(path, sizeof(path), "%s/dev/console", rootfs->path ? rootfs->mount : ""); if (ret < 0 || (size_t)ret >= sizeof(path)) return -1; Could you please perform this check atop the function onc...
codereview_cpp_data_1795
static char **opt_extensions; static char **opt_metadata; static gboolean opt_no_exports; -static int opt_extension_prio = -10000; static char *opt_sdk; static char *opt_runtime; Might be slightly better to use `G_MININT` static char **opt_extensions; static char **opt_metadata; static gboolean opt_no_exports...
codereview_cpp_data_1797
// benchmarks helpers static int32_t * getRandomSeed (int32_t * seed); -static FILE * openOutFileWithR_PARTITEpostfix (const char * name); static const char * elektraGetString (void * data); static size_t getPower (size_t p, size_t q); size_t getNCount (void); Can you please avoid all-caps and underscore in the m...
codereview_cpp_data_1799
return H2O_HTTP2_ERROR_FRAME_SIZE; } if (conn->timestamps.settings_acked_at.tv_sec == 0 && conn->timestamps.settings_sent_at.tv_sec != 0) { - gettimeofday(&conn->timestamps.settings_acked_at, NULL); } } else { uint32_t prev_initial_window_size = conn->pee...
codereview_cpp_data_1816
if (debug_mode_key_inverted_v) { sprintf(tempstr, "PX = %i PY = %i", plr[myplr]._px, plr[myplr]._py); NetSendCmdString(1 << myplr, tempstr); - // BUGFIX: out-of-bounds access to dungeon; should be `dungeon[(cursmx-16)/2][(cursmy-16)/2]`, was `dungeon[cursmx][cursmy]`. sprintf(tempstr, "CX = %i CY = %...
codereview_cpp_data_1821
{ // Base class if (versionNumber < 30506) { - // Convert body property into a socket to PhysicalFrame with name "frame" SimTK::Xml::element_iterator bodyElement = aNode.element_begin("body"); std::string frame_name(""); if (bodyElement != aNode.element_end()) { this is sti...
codereview_cpp_data_1828
" RETURNING id"); } _insertFolder->bindValue(":displayName", displayName); - _insertFolder->bindValue(":parentId", parentId == -1 ? QVariant() : (qlonglong)parentId); _insertFolder->bindValue(":userId", (qlonglong)userId); _insertFolder->bindValue(":public", isPublic); return _insertRecord(*_inse...
codereview_cpp_data_1833
#include "ElectricEquipmentITEAirCooled.hpp" #include "ElectricEquipmentITEAirCooled_Impl.hpp" -// TODO: Check the following class names against object getters and setters. #include "ElectricEquipmentITEAirCooledDefinition.hpp" #include "ElectricEquipmentITEAirCooledDefinition_Impl.hpp" #include "Schedule.hpp" Wa...
codereview_cpp_data_1838
std::string readData; detail::loggerStatus(detail::db->Get(leveldb::ReadOptions(), key, &readData)); - if (not readData.empty()) { return readData; } else { return ""; `not readData.empty()` really? Maybe `!readData.empty()`? std::stri...
codereview_cpp_data_1848
mp_err(log, "Failed to retrieve the Prime Handle from handle %d (%d).\n", object, descriptor->objects[object].fd); goto fail; } - if(object == 0 && descriptor->objects[object].format_modifier) { modifiers[object] = descriptor->objects[object].fo...
codereview_cpp_data_1855
DiscoveryDataBase::DiscoveryDataBase( fastrtps::rtps::GuidPrefix_t server_guid_prefix) : server_guid_prefix_(server_guid_prefix) - , server_acked_by_all_(true) { } I would not change this until the list of servers is defined in the database construction. Better to change it with the implementation ...
codereview_cpp_data_1859
int flag = 0; for (int i = 0; i < modify->nfix; i++) { if (strcmp(id,modify->fix[i]->id) == 0) before = 0; - else if ((modify->fmask[i] && strcmp(modify->fix[i]->style,"nve")==0) && before) flag = 1; } if (flag && comm->me == 0) error->all(FLERR,"Fix langevin gjf should come befor...
codereview_cpp_data_1872
/** * @brief Checks if it's time for the logic to advance * @param unused - * @return True if the engine shold tick */ BOOL nthread_has_500ms_passed(BOOL unused) { ```suggestion * @return True if the engine should tick ``` /** * @brief Checks if it's time for the logic to advance * @param unused + * @re...
codereview_cpp_data_1880
char errmsg[256]; snprintf(errmsg, 256, "step%d-hbondchk failed: H=%d end(H)=%d str(H+1)=%d\n", step, Hindex, End_Index(Hindex,hbonds), comp ); - system->error_ptr->all(FLERR, errmsg); } } } Same issue here. This looks more likely for calling `erro...
codereview_cpp_data_1881
g2 = guild->search(gid2); if (g1 == NULL || g2 == NULL) { - ShowWarning("buildin_checkguildally: requesting non-existent guild ID.\n"); //guild->search already tell the guild ID script_pushint(st, -1); return false; } guild->search doesn't tell the ID g2 = guild->search(gid2); if (g1 == NULL || g2 ==...
codereview_cpp_data_1933
**/ #include <iostream> -#include <climits> -bool isprime[INT_MAX]; /** * This is the function that finds the primes and eliminates use dynamic memory allocation try to allocate the memory using the `new` keyword instead of using `INT_MAX` and also deallocate the memory after use using `delete` keyword if you wis...
codereview_cpp_data_1934
InitDataDir(); ReadConfigs(); - // generates the default high score list if necessary - GenerateDefaultHighScoreForStandard(); - // getopt { int opt; We should generate it only at the time of opening High Scores. Please remove this code from here. InitDataDir(); ReadConfig...
codereview_cpp_data_1962
#include "stringtools.h" #include "list.h" #include "makeflow_summary.h" -#include "../../dttools/src/catalog_query.h" -#include "../../dttools/src/json.h" -#include "../../dttools/src/json_aux.h" -#include "../../dttools/src/username.h" #include <stdlib.h> #include <stdio.h> I believe you can write this simply a...
codereview_cpp_data_1971
EXPECT_NOT_NULL(client_conn); EXPECT_NOT_NULL(server_conn); - if (security_policy_selection[policy_index].security_policy->minimum_protocol_version == S2N_TLS13 - && !s2n_is_tls13_fully_supported()) { /* We ...
codereview_cpp_data_1973
void MegaApiImpl::syncFolder(const char *localFolder, MegaHandle megaHandle, MegaRegExp *regExp, long long localfp, MegaRequestListener *listener) { MegaRequestPrivate *request = new MegaRequestPrivate(MegaRequest::TYPE_ADD_SYNC); - if (megaHandle != INVALID_HANDLE) request->setNodeHandle(megaHandle); if...
codereview_cpp_data_1989
} else if ((option == "-Setup") || (option == "-S")) { if (argc < 3) { - cout << "Setup file .xml is expected after -S option. Please fix and retry." << endl; PrintUsage(argv[0], cout); exit(-...
codereview_cpp_data_1994
*# A client that attempts to send 0-RTT data MUST fail a connection if *# it receives a ServerHello with TLS 1.2 or older. */ - { EXPECT_SUCCESS(s2n_reset_tls13()); struct s2n_config *config = s2n_config_new(); EXPECT_SUCCESS(s2n_config_add_cert_chain_and_key_to_store(con...
codereview_cpp_data_1996
// Move syncedmem head to HEAD_AT_GPU const vector<Blob<Dtype>*>& params = solver_->net()->learnable_params(); - Dtype* mutable_gpu_data; for (int i = 0; i < params.size(); ++i) { - mutable_gpu_data = params[i]->mutable_gpu_data(); - mutable_gpu_data++; // added to prevent the warning message of compile...
codereview_cpp_data_1998
struct and_op { inline DataType operator()(const DataType& x1, const DataType& x2) const { - const auto& b1 = x1 >= DataType(0.5); - const auto& b2 = x2 >= DataType(0.5); return (b1 && b2) ? one : zero; } inline void operator()(const DataType& x1, I think that it make...
codereview_cpp_data_2000
} else if ( strmatch(fullname+strlen(strippedname)-4, ".svg")==0 && checked!='S' ) { sf = SFReadSVG(fullname,0); } else if ( strmatch(fullname+strlen(fullname)-4, ".ufo")==0 && checked!='u' || - strmatch(fullname+strlen(fullname)-4, ".ufo2")==0 && checked!='u' || - strmatch(fullname+strlen(fullname)...
codereview_cpp_data_2003
* @author ali-mir */ -#include <limits.h> #include <iostream> /** Please use `climits`. * @author ali-mir */ +#include <climits> #include <iostream> /**
codereview_cpp_data_2006
} FakePeer &FakePeer::setProposalStorage( - const std::shared_ptr<ProposalStorage> &proposal_storage) { - proposal_storage_ = proposal_storage; return *this; } please use pass by value for shared pointers } FakePeer &FakePeer::setProposalStorage( + std::shared_ptr<Pr...
codereview_cpp_data_2019
TEST_P(ValidProtoPaginationQueryValidatorTest, ValidPaginationQuery) { auto answer = validator.validate(GetParam()); - ASSERT_FALSE(answer.hasErrors()); } INSTANTIATE_TEST_CASE_P( Maybe print answer and query, the same way as in transaction tests TEST_P(ValidProtoPaginationQueryValidatorTest, ValidPaginationQ...
codereview_cpp_data_2024
return ""; // beginning of a batch if (not batch1) { - if (batch2.get()->transactionHashes().size() == 0) return (boost::format("Tx %s has a batch of 0 transactions") % tr2->hash().hex()) .str(); - if (batch2.get()->transactionHashes().fr...
codereview_cpp_data_2033
boost::optional<protocol::Block> result; storage_->getBlocksFrom(1) - .filter([hash](auto block) { return block->hash() == hash; }) .map([](auto block) { - return std::static_pointer_cast<shared_model::proto::Block>(block) ->getTransport(); }) .as_blocking() Capture ...
codereview_cpp_data_2038
{ case NEW_PUBLIC: case NEW_NODE: - snk.add((nn + i)->nodekey, (nn + i)->nodehandle, tn, 0); break; case NEW_UPLOAD: - snk.add((nn + i)->nodekey, (nn + i)->nodehandle, t...
codereview_cpp_data_2042
_WriteBestBlock(hashBlock); bool ret = db.WriteBatch(batch); - LOG(COINDB, "Committing1 %u changed transactions (out of %u) to coin database with %u batch writes...\n", (unsigned int)changed, (unsigned int)count, (unsigned int)nBatchWrites); return ret; committing1? (extra 1 in there) ...
codereview_cpp_data_2050
return std::atoi(id.c_str()); } int get_gpu(const InitArguments& args) { int use_gpu = args.device_id; const int ndevices = args.ndevices; Why did you define it outside the anonymous namespace? return std::atoi(id.c_str()); } +namespace { + int get_gpu(const InitArguments& args) { int ...
codereview_cpp_data_2065
return defaultPenalty; } -int AIWorldPathfinder::getFogDiscoveryTile( const Heroes & hero, const bool considerWhirlpools ) { // paths have to be pre-calculated to find a spot where we're able to move - reEvaluateIfNeeded( hero, considerWhirlpools ); const int start = hero.GetIndex(); const int ...
codereview_cpp_data_2066
int Heroes::GetMobilityIndexSprite( void ) const { // valid range (0 - 25) - int index = !CanMove() ? 0 : static_cast<int>( std::round( move_point / 100.0f ) ); return 25 >= index ? index : 25; } An alternative solution would be `const int index = CanMove() ? ( move_point + 50 ) / 100 : 0;` without typ...
codereview_cpp_data_2071
-#include "hip/hip_runtime.h" //////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2014-2019, Lawrence Livermore National Security, LLC. // Produced at the Lawrence Livermore National Laboratory. OCD: Let's move this after the boilerplate. /////////////////////////////...
codereview_cpp_data_2073
derived from this software without specific prior written permission of the assimp team. -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 P...
codereview_cpp_data_2082
blacklist ${PATH}/roxterm blacklist ${PATH}/roxterm-config blacklist ${PATH}/terminix Please also add urxvtc. blacklist ${PATH}/roxterm blacklist ${PATH}/roxterm-config blacklist ${PATH}/terminix +blacklist ${PATH}/urxvtc +blacklist ${PATH}/urxvtcd
codereview_cpp_data_2086
conn->req.res.reason = "Request Timeout"; } close_idle_connection(&conn->super); } I think you're assuming `conn->sock->input->size == 0` is always true here, but I'm not sure why it is. could you tell me that when you get a chance? And if it's always true, how about adding `assert(conn->sock->inpu...
codereview_cpp_data_2090
FCMoveContent(temp_objects, matches); } - // No operand condition was selected. State is restored... } - // ... Nothing should match, so move all to non_matches input set. - non_matches.reserve(matches.size() + non_matches.size()); - FCMoveContent(matches, non_matches); } b...
codereview_cpp_data_2091
if (peer_wire_prefs != NULL && peer_wire_prefs->len > 0) { int result = s2n_choose_sig_scheme(conn, peer_wire_prefs, &chosen_scheme); - /* Previous versions can fall back to the default */ if (conn->actual_protocol_version == S2N_TLS13 && result != S2N_SUCCESS) { - /* make the b...
codereview_cpp_data_2092
if ( config.Exists( "vita_keep_aspect_ratio" ) ) { vita_keep_aspect_ratio = config.IntParams( "vita_keep_aspect_ratio" ); - fheroes2::Display::instance().engine()->vitaKeepAspectRatio = vita_keep_aspect_ratio; } #endif This parameter we will re-implement again in the future. if ( confi...
codereview_cpp_data_2095
m_Socket = zmq_socket(m_Context, ZMQ_REP); const std::string fullIP("tcp://" + m_IPAddress + ":" + m_Port); - std::cout << "full IP = " << fullIP << std::endl; zmq_bind(m_Socket, fullIP.c_str()); if (m_Profiler.IsActive) cout in rank 0 m_Socket = zmq_socket(m_Contex...
codereview_cpp_data_2098
if (missingattr) { - #if defined(_WIN32) client->gfx->gendimensionsputfa(NULL, localname, n->nodehandle, n->nodecipher(), missingattr); - ...
codereview_cpp_data_2103
// convert from local encoding, then unescape escaped forbidden characters void FileSystemAccess::local2name(string *filename, const string *localPath) const { string t = *filename; local2path(&t, filename); Maybe we can check if `filename` or `localPath` are null // convert from local encoding, then un...
codereview_cpp_data_2109
using sofa::simulation::PythonEnvironment ; using sofa::core::topology::BaseMeshTopology ; using sofa::helper::vector ; -typedef BaseMeshTopology::Tetra Tetra; static Base* get_base(PyObject* self) { return sofa::py::unwrap<Base>(self); A factory would be beter :) Something like : BaseData* bf = factory(dataR...
codereview_cpp_data_2116
} auto YacInit::createTimer(std::chrono::milliseconds delay_milliseconds) { - return std::make_shared<TimerImpl>(delay_milliseconds, - rxcpp::observe_on_new_thread()); } std::shared_ptr<YacGate> YacInit::initConsensusGate( I think here we can...
codereview_cpp_data_2125
return (long)(floor(x * (10 * (precision - 1)) + 0.5) / (10 * (precision - 1))); } } I'm looking at this, and... I'm thinking it's wrong. I think 10 should be raised to the power of (precision-1), not simply multiplied by (precision-1). Like use pow(10, precision-1) or something. return (long)(floor(x * (10 *...
codereview_cpp_data_2132
//Read each byte into our buffer Vector<U8> buffer(readFile.getStreamSize()); - U8 byte; - while(readFile.read(&byte)) - { - buffer.push_back(byte); - } //Send the buffer send(buffer.address(), buffer.size()); This is not guaranteed to send all the data, especially with a large file. What you need is a mechan...
codereview_cpp_data_2145
for (auto& [id, partition] : qm) { self->state.open_requests.emplace(id, 1 /*qm.size()*/); // TODO: Add a proper configurable timeout. - self->request(partition, caf::infinite, expr, client) .then([=, id = id](atom::done) { auto& num_evaluators = self->state.open_...
codereview_cpp_data_2147
char* aws_secret_access_key; char* aws_region; char* aws_email; - char* manager_env_prefix; }initialized_data; static unsigned int gen_guid(){ Maybe just `env_prefix`, I don't think this is referring to the WQ manager. char* aws_secret_access_key; char* aws_region; char* aws_email; + char* env_prefix; ...
codereview_cpp_data_2168
protected: /** Component Interface */ - void connect(Component& root, const bool topLevel) override { Super::connect(root, topLevel); // do any internal wiring world = dynamic_cast<TheWorld*>(&root); I don't like the extra bool argument in connect. What is it for? And what does a const bool do? sh...