id
stringlengths
21
25
content
stringlengths
164
2.33k
codereview_cpp_data_2
exit(EXIT_FAILURE); } } - if(runos_os) { cmd = string_format("cp \"$(which vc3-builder)\" '%s'", scratch_dir); int k = system(cmd); free(cmd), since it was allocated in the if-else block above. exit(EXIT_FAILURE); } } + + free(cmd); + if(runos_os) { cmd = string_format("cp \"$(which v...
codereview_cpp_data_8
g_autoptr(GString) txn_title = g_string_new (""); if (is_install) g_string_append (txn_title, "install"); else if (self->revision) g_string_append (txn_title, "deploy"); else Another `else if (self->refspec` for rebases? g_autoptr(GString) txn_title = g_string_new (""); if (is_install) ...
codereview_cpp_data_19
} if( - cxxTokenTypeIs(t->pPrev,CXXTokenTypeKeyword) && - (t->pPrev->eKeyword == CXXKeywordDECLTYPE) && t->pNext ) { Cannot we unify the two lines into ``` cxxTokenIsKeyword(t->pPrev, CXXKeywordDECLTYPE) && ``` ? } if( + cxxTokenIsKeyword(t->pPrev,CXXKeywordDECLTYPE) &&...
codereview_cpp_data_29
bool Battle::Arena::CanRetreatOpponent( int color ) const { - const Force * const force = ( army1->GetColor() == color ) ? army1 : army2; - const HeroBase * const commander = force->GetCommander(); - if ( !commander ) { - return false; - } - const Castle * const castle = commander->inCastle(); -...
codereview_cpp_data_38
plink = NULL; memset(&changed, 0, sizeof changed); - changed.newnode = true; Node* p; It might be clearer to keep it false in constructor and set the flag at `MegaClient::readnodes` call to new Node. plink = NULL; memset(&changed, 0, sizeof changed); Node* p;
codereview_cpp_data_43
movePointsLeft = _remainingMovePoints - consumedMovePoints; } else { - movePointsLeft = _maxMovePoints - ( consumedMovePoints - _remainingMovePoints ) % _maxMovePoints; } lastMove = movePointsLeft >= srcTilePenalty && movePointsLeft <= dstTilePenalty; Please ...
codereview_cpp_data_50
#ifdef HAVE_ERRNO_H #include <errno.h> -#elif defined(__APPLE__) -#include <errno.h> #endif - /********************************************* * UID, GID access methods * *********************************************/ I think we should fix HAVE_ERRNO_H for APPLE #ifdef HAVE_ERRNO_H #include ...
codereview_cpp_data_51
megaApi[0] = new MegaApi(APP_KEY.c_str(), megaApiCacheFolder(0).c_str(), USER_AGENT.c_str()); - MegaApiImpl* impl = *((MegaApiImpl**)(((char*)megaApi[0]) + sizeof(*megaApi[0])) - 1); //megaApi[0]->pImpl; - MegaClient* client = impl->getMegaClient(); - client->clientname = "0 "; - ...
codereview_cpp_data_70
const { if (not transactions_) { types::SharedTxsCollectionType result; - auto transactions_amount = 0u; - for (const auto &batch : batches_) { - transactions_amount += batch->transactions().size(); - } result.reserve(transactions_amount); for (co...
codereview_cpp_data_73
Tnode &operator=(Tnode &&) = default; /** - * numberOfChildren : To count the number of children a node in the trie has - * @param node : A trie node whose children need to be counted * @return count of the number of children of the given node (max 26) */ inline int numberOfChildren(T...
codereview_cpp_data_75
template <typename TensorDataType> bool hypergradient_adam<TensorDataType>::save_to_checkpoint_distributed(persist& p, std::string name_prefix) { - write_cereal_archive<hypergradient_adam<TensorDataType>>(*this, p, "hypergradient_adam.xml"); char l_name[512]; sprintf(l_name, "%s_optimizer_adam_moment1_%lldx%ll...
codereview_cpp_data_78
return f(x.a, x.b); } -template <class T, size_t N> -std::string hexify(const std::array<T, N>& xs) { - std::stringstream ss; - ss << std::setfill('0') << std::hex; - auto ptr = reinterpret_cast<const uint8_t*>(xs.data()); - for (auto i = 0u; i < N * sizeof(T); ++i) - ss << std::setw(2) << static_cast<int>(p...
codereview_cpp_data_94
struct st_h2o_hpack_header_table_entry_t { h2o_iovec_t *name; h2o_iovec_t *value; - int decode_return_value; /* record the soft error for bad chars in headers */ const char *err_desc; /* the recorded soft error description */ }; I think we do not need to retain the value, since if a soft error has ...
codereview_cpp_data_107
auto &db = dbname.value(); log_->info("Drop database {}", db); freeConnections(); std::unique_lock<std::shared_timed_mutex> lock(drop_mutex); soci::session sql(*soci::factory_postgresql(), postgres_options_.optionsStringWithoutDbName()); Pls, add ...
codereview_cpp_data_108
q->long_timeout = 3600; q->stats->time_when_started = timestamp_get(); - q->stats->time_when_compatibility_checked = timestamp_get(); q->task_reports = list_create(); q->time_last_wait = 0; @Cpreciad I think this one is better as a field of q (e.g. `q->last_time_tasks_fit_check`), as this is not really a stat....
codereview_cpp_data_111
* @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 - * @retval 0 on success, -1 otherwise. * * This enforces that a number is set. */ for every different retval you can make its own line....
codereview_cpp_data_116
#ifdef UA_DEBUG_DUMP_PKGS UA_dump_hex_pkg(buffer->data, buffer->length); #endif - break; } } } // TODO check if warning is correct here and error code carries correct info UA_CHECK_WARN(processed, return UA_STATUSCODE...
codereview_cpp_data_122
std::shared_ptr<lbann_summary> const&>, default_key_error_policy>; -namespace -{ template <typename... Ts> std::string BuildErrorMessage(Ts... args) { This doesn't need to be nested in yet another anonymous namespace (it's already in one). std::shared_ptr<lbann_...
codereview_cpp_data_123
//Handle layout statusLabel = new QLabel(this); descriptionLabel = new QLabel(tr("Current release channel:") + " " + tr(settingsCache->getUpdateReleaseChannel()->getName().toUtf8()), this); progress = new QProgressBar(this); QDialogButtonBox *buttonBox = new QDialogButtonBox(this); ok = ne...
codereview_cpp_data_128
return true; } -std::string TaskManager::SaveClientStateQuery(Client *c, ClientTaskState *state) { // I am saving the slot in the ActiveTasks table, because unless a Task is cancelled/completed, the client // doesn't seem to like tasks moving slots between zoning and you can end up with 'bogus' activities if th...
codereview_cpp_data_135
} void printCommandParameters(std::string &command, - ParamsDescription parameters) { std::cout << "Run " << command << " with following parameters: " << std::endl; std::for_each(parameters.begin(), parameters.end(), [](auto el) { - std::cou...
codereview_cpp_data_140
static PyObject* __Pyx_Globals(void) { Py_ssize_t i; - PyObject *names; #if CYTHON_COMPILING_IN_LIMITED_API PyObject *globals = PyDict_New(); if (unlikely(!globals)) goto bad; This would prevent modifying `globals()`. Can't we read and use `(this_module).__dict__` instead? static PyObject* __Pyx_...
codereview_cpp_data_141
//Get the number of state variables added (or exposed) by this Component int ns = getNumStateVariablesAddedByComponent(); // And then include the states of its subcomponents for(unsigned int i=0; i<_propertySubcomponents.size(); i++) ns += _propertySubcomponents[i]->getNumStateVariables();...
codereview_cpp_data_150
* @then there is an empty proposal */ TEST_F(TransferAsset, NonexistentAsset) { - const std::string &nonexistent = "inexist#test"s; IntegrationTestFramework(1) .setInitialState(kAdminKeypair) .sendTx(makeUserWithPerms(kUser1, kUser1Keypair, kPerms, kRole1)) Same as about omitting skip proposal a...
codereview_cpp_data_157
"block until the IMPORTER forwarded all data") .add<bool>("node,N", "spawn a node instead of connecting to one") - .add<size_t>("num,n", "the maximum number of events to import")); import_-...
codereview_cpp_data_158
*/ #include <gmock/gmock.h> -#include <validators/transactions_collection/batch_order_validator.hpp> #include "framework/batch_helper.hpp" #include "framework/result_fixture.hpp" #include "interfaces/iroha_internal/transaction_batch.hpp" #include "validators/field_validator.hpp" #include "validators/transaction...
codereview_cpp_data_166
using namespace iroha::consensus::yac; -// TODO mboldyrev 13.12.2018 IR- Parametrize the tests with consistency models static const iroha::consensus::yac::ConsistencyModel kConsistencyModel = iroha::consensus::yac::ConsistencyModel::kBft; Same issue as for yac tests using namespace iroha::consensus::yac; +// ...
codereview_cpp_data_190
switch (index.row()) { case MaxGeneratedBlock: - return QVariant((unsigned int)maxGeneratedBlock); case ExcessiveBlockSize: - return QVariant((unsigned int)excessiveBlockSize); case ExcessiveAcceptDepth: return QVariant(excessiveAcceptDepth...
codereview_cpp_data_195
static LogPatterns default_patterns; if (not is_initialized.test_and_set()) { default_patterns.setPattern( - LogLevel::kTrace, R"([%Y-%m-%d %H:%M:%S.%F][th:%t][%=7l][%n]: %v)"); default_patterns.setPattern(LogLevel::kInfo, R"([%Y-%m-%d %H:%M:%S.%F][%L]...
codereview_cpp_data_212
amount_{ [this] { return proto::Amount(add_asset_quantity_.amount()); }} {} template AddAssetQuantity::AddAssetQuantity( AddAssetQuantity::TransportType &); template AddAssetQuantity::AddAssetQuantity( Add todo about boilerplate here. amount_{ [th...
codereview_cpp_data_215
return pt; } - virtual void OnGameTick() - { - // hello! hunt for trees here - // ...maybe - } - virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) { if (pt.x != -1) { Ok? I guess you didn't mean...
codereview_cpp_data_230
// A non-empty queue means that the server has received a change while it is running the processing routine. while (!discovery_db_.data_queue_empty()); - // must restart the routin after the period time return pending_work; } ```suggestion // Must restart the routine after the period time ``` ...
codereview_cpp_data_253
using namespace vast; using namespace std::string_literals; -using namespace std::string_view_literals; TEST(functionality) { std::string str = "1"; I don't spot any `""sv`, is this really used? using namespace vast; using namespace std::string_literals; TEST(functionality) { std::string str = "1";
codereview_cpp_data_257
{} void StartUsing() { - if (m_failed_init || (!GetOptionsDB().Get<bool>("UI.system-fog-of-war"))) return; if (!m_scanline_shader) { - if (m_failed_init) - return; - boost::filesystem::path shader_path = GetRootDataDir() / "default" / "shader...
codereview_cpp_data_266
total_size += (sizeof(s2n_preferred_hashes) * num_signature_algs * 2) + 6; } - struct s2n_blob *app_protocols; - GUARD(s2n_connection_get_protocol_preferences(conn, &app_protocols)); - uint16_t application_protocols_len = app_protocols->size; uint16_t server_name_len = strlen(conn->server_na...
codereview_cpp_data_286
// the MissionGroup if not specified. SimGroup* missionGroup = dynamic_cast<SimGroup*>(Sim::findObject("MissionGroup")); SimGroup* group = 0; - if ( parentGroup != "" ) { if (!Sim::findObject(parentGroup, group)) { // Create the group if it could not be found group = new SimGrou...
codereview_cpp_data_306
fprintf(stderr, " Turn on experimental TLS1.3 support.\n"); fprintf(stderr, " -w --https-server\n"); fprintf(stderr, " Run s2nd in a simple https server mode.\n"); fprintf(stderr, " -h,--help\n"); fprintf(stderr, " Display this message and quit.\n"); no help for the `--https-bench` ...
codereview_cpp_data_310
bool success = false; if (!isInitialized()) { - if (_stripType == P038_STRIP_TYPE_RGBW) { - Plugin_038_pixels = new (std::nothrow) Adafruit_NeoPixel(_maxPixels, _gpioPin, NEO_GRBW + NEO_KHZ800); - } - else { - Plugin_038_pixels = new (std::nothrow) Adafruit_NeoPixel(_maxPixels, _gpioPin, NEO_GR...
codereview_cpp_data_320
* (1,0) - current round. The diagram is similar to the initial case. */ - size_t discarded_txs_amount; - auto get_transactions = [this, &discarded_txs_amount](auto &queue) { - return getTransactions(transaction_limit_, queue, discarded_txs_amount); - }; - auto now = iroha::time::now(); - auto generate...
codereview_cpp_data_327
bool Way::isSimpleLoop() const { - if (getNodeId(0) == getNodeId(getNodeCount()-1)) - { - return true; - } - return false; } bool Way::isValidPolygon() const This looks good. I'm a simple kind of man: ``` return (getNodeId(0) == getNodeId(getNodeCount()-1); ``` But like Seth says "it'll probably be optimize...
codereview_cpp_data_332
uint all_sum = 0; for (int i = 0; i < numDevices; ++i) { - mg_info *mg_info_temp; result = hip_internal::ihipHostMalloc(tls, (void **)&mg_info_temp, sizeof(mg_info), hipHostMallocDefault); if (result != hipSuccess) { hip_internal::ihipHostFree(tls, mg_sync_ptr); Uninitia...
codereview_cpp_data_344
size_t maxIndexRequested = currentPrimitive * numOffsets * numPoints + (currentVertex + 1) * numOffsets - 1; ai_assert(maxIndexRequested < indices.size()); - // read all indices for this vertex. Yes, in a hacky local array - ai_assert(numOffsets < 20 && perVertexOffset < 20); - size_t vindex[20]; for (size_t offs...
codereview_cpp_data_351
bool do_mscgen_generate(const QCString& inFile,const QCString& outFile,mscgen_format_t msc_format, const QCString &srcFile,int srcLine) { - QCString const& external_mscgen = Config_getString(MSCGEN); if (!external_mscgen.isEmpty()) { QCString type; switch (msc_format) This indicat...
codereview_cpp_data_355
XMLDocument::renameChildNode(aNode,"ZAttachment", "z_location"); } if (documentVersion < 30505) { - // replace old properties with latest use of Sockets SimTK::Xml::element_iterator xCoord = aNode.element_begin("x_coordinate"); SimTK::Xml::element_iterator yCoord = aNode.elem...
codereview_cpp_data_363
for (const auto &tx : proposal.transactions()) { if (auto tx_answer = transaction_validator_->validate(tx)) { reason.second.emplace_back(tx_answer.reason()); - break; } } Why not validate all transactions in proposal here? Right now there can ve several invalid trans...
codereview_cpp_data_368
// (*adj)[v - 1].push_back(std::make_pair(u - 1, w)); } /** - *@brief This function returns the shortest distance from the source * to the target if there is path between vertices 's' and 't'. * * @param workset_ vertices visited in the search ```suggestion * @brief This function returns the shortest dist...
codereview_cpp_data_373
} #endif -double GetShootingAngle( const Point & start, const Point & target ) { const int dx = target.x - start.x; const int dy = target.y - start.y; It is good to rename it to `GetAngle` as this function does not have any code related to shooting. } #endif +double GetAngle( const Point & start, const...
codereview_cpp_data_374
nullpo_retv(sd); fd = sd->fd; - - WFIFOHEAD(fd, 4+37*MAX_HOMUNSKILL); - hd = sd->hd; - if ( !hd ) // FIXME: If nothing is going to be sent should WFIFOHEAD be above this check? [panikon] return; WFIFOW(fd,0)=0x235; for ( i = 0; i < MAX_HOMUNSKILL; i++){ if( (id = hd->homunculus.hskill[i].id) != 0 ){ Go...
codereview_cpp_data_379
case 'x': req.connect_to = h2o_mem_alloc(sizeof(*req.connect_to)); if (h2o_url_init(req.connect_to, NULL, h2o_iovec_init(optarg, strlen(optarg)), h2o_iovec_init(NULL, 0)) != 0 || - req.connect_to->_port == 0 || req.connect_to->_port == 65535) { - fprintf(...
codereview_cpp_data_386
} numUploads = uploadTags.size(); - notificationNumber = notificationNumber; } MegaTransferDataPrivate::MegaTransferDataPrivate(const MegaTransferDataPrivate *transferData) Add `this` to the first variable } numUploads = uploadTags.size(); + this->notificationNumber = notificationNumber; ...
codereview_cpp_data_394
namespace caffe { bool ReadProtoFromTextFile(const char* filename, Message* proto) { -#ifdef _MSC_VER - int fd = open(filename, O_RDONLY | O_BINARY); -#else int fd = open(filename, O_RDONLY); -#endif CHECK_NE(fd, -1) << "File not found: " << filename; FileInputStream* input = new FileInputStream(fd); boo...
codereview_cpp_data_409
#define LONGEST_STR \ ELEMENT_LONGEST_STR("connect") \ - DELIMITER ELEMENT_LONGEST_STR("header") DELIMIT...
codereview_cpp_data_418
fireOnRequestFinish(request, megaError); } -void MegaApiImpl::querybandwidthquota_result(int code) { if(requestMap.find(client->restag) == requestMap.end()) return; MegaRequestPrivate* request = requestMap.at(client->restag); - if(!request || (request->getType() != MegaRequest::TYPE_QUERY_BANDWIDTH_...
codereview_cpp_data_423
QMessageBox::warning(this, tr("Load sets/cards"), tr("Selected file cannot be found.")); return; } - else if (QFileInfo(fileName).suffix() != "xml") { // fileName = *.xml QMessageBox::warning(this, tr("Load sets/cards"), tr("You can only import XML databases at this time.")); ...
codereview_cpp_data_424
#include <thrift/transport/TSocket.h> #include <thrift/transport/TServerSocket.h> #include "TestPortFixture.h" -#include "TestTServerSocket.h" using apache::thrift::transport::TServerSocket; using apache::thrift::transport::TSocket; This should really be 'accept()' and not 'acceptImpl()'. #include <thrift/trans...
codereview_cpp_data_428
for(const auto key: m_scalar_keys) { std::string conduit_field = m_output_scalar_prefix + key; - std::string conduit_obj = '/' + pad(std::to_string(sample_id), LBANN_SAMPLE_ID_PAD, '0') + '/' + conduit_field; if(sample[conduit_obj].schema().dtype().is_empty()) { if (data_store_active()) { ...
codereview_cpp_data_437
const DataType norm_img_val = (img_buf[img_offset + row + col*dims[1]] - min) / norm_denom; cv_buf[dims[0]*(col + row*dims[2]) + channel] = - static_cast<uint8_t>(std::round(norm_img_val) * 255); } } } Microoptimization: It looks like we're biasing away from 0 and 2...
codereview_cpp_data_440
// bugs. auto schedule_teardown = [&](const std::string& type_or_label) { if (is_singleton(type_or_label)) { - auto component = self->state.registry.remove(type_or_label); - if (component) { VAST_VERBOSE("{} schedules {} for shutdown", self, type_or_label); self->dem...
codereview_cpp_data_442
{1," Quit when the option is processed. Useful to debug the chain"}, {1," of loading option files."}, #ifdef HAVE_JANSSON - {0," --_interactive" -#ifdef HAVE_SECCOMP - "=[default|sandbox]" -#endif - }, {0," Enter interactive mode (json over stdio)."}, -#ifdef HAVE_SECCOMP - {0," Enter f...
codereview_cpp_data_458
// assemble a multibody tree according to the PhysicalFrames in the // OpenSim model, which include Ground and Bodies - _multibodyTree.addBody("/" + getName() + "/" + ground.getName(), 0, false, &ground); auto bodies = getComponentList<Body>(); Does this mean that `ground....
codereview_cpp_data_464
else if (refspec) { const char *refspec_value; - if (!rpmostree_refspec_classify (refspec, &ret->refspec_type, &refspec_value, error)) return FALSE; /* Note the lack of a prefix here so that code that just calls * rpmostree_origin_get_refspec() in the ostree:// case *...
codereview_cpp_data_472
} ARR_FIND(0, MAX_PARTY, j, p->party.member[j].leader == 1); - if( j == MAX_PARTY ) { // Leader has changed - int i; - ARR_FIND(0, MAX_PARTY, i, sp->member[i].leader == 1); - if( i < MAX_PARTY ) { - clif->PartyLeaderChanged(map->id2sd(sp->member[i].account_id), 0, sp->member[i].account_id); } el...
codereview_cpp_data_479
Time_t ts(data.ts.seconds, data.ts.fraction); Time_t current_ts; Time_t::now(current_ts); - auto latency = static_cast<double>((current_ts - ts).to_ns()); Locator2LocatorData notification; notification.src_locator(to_statistics_type(source_locator)); use `float` to match the `Locator2Locato...
codereview_cpp_data_486
PMIX_DESTRUCT(&pbkt); cbfunc(rc, NULL, 0, cbdata, NULL, NULL); return rc; - } - if (rank == PMIX_RANK_WILDCARD) found++; } while (NULL != *htptr) { Minor nit: coding standards require use of braces around every if clause as it helps when running a debugger ...
codereview_cpp_data_496
} // 2.6- Need to wait several ms for the scheduler to be well launched and retrieving correct device information before updating information on the SOFA side. -#ifndef WIN32 - usleep(42); -#else - Sleep(42); -#endif updatePosition(); } Please use ` std::this_thread::sleep_for(std::chrono...
codereview_cpp_data_507
msg_deprecated("SofaComponentAllCommonComponents") << "This plugin was renamed into SofaComponentAll. Backward compatiblity will be stopped at SOFA v20.06"; #endif - sofa::component::initBase(); - sofa::component::initCommon(); - sofa::component::initGeneral(); - sofa::component::initAdvanced(); - ...
codereview_cpp_data_519
{ int rank = 0; #ifdef ADIOS2_HAVE_MPI - int size = 1; MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &size); #endif adios2::ADIOS ad; try size isn't actually being used here and can be removed { int rank = 0; #ifdef ADIOS2_HAVE_M...
codereview_cpp_data_524
void ContactListener::init(void) { -// helper::vector<ContactManager*> contactManagers; m_NarrowPhase = getContext()->get<core::collision::NarrowPhaseDetection>(); if ( m_NarrowPhase != nullptr ) { To be removed if not needed ;) void ContactListener::init(void) { m_NarrowPhase = getContext(...
codereview_cpp_data_532
chrif->buildfamelist = chrif_buildfamelist; chrif->save_scdata = chrif_save_scdata; chrif->ragsrvinfo = chrif_ragsrvinfo; - //chrif->char_offline = chrif_char_offline; chrif->char_offline_nsd = chrif_char_offline_nsd; chrif->char_reset_offline = chrif_char_reset_offline; chrif->send_users_tochar = send_user...
codereview_cpp_data_534
Player *newPlayer = addPlayer(playerId, playerInfo.user_info()); messageLog->logJoin(newPlayer); if (trayIcon) { - trayIcon->showMessage(tr("A player has joined your game"), - tr("%1 has joined your game").arg(newPlayer->getName())); } ...
codereview_cpp_data_536
ASSERT_EQ(boost::size(resp_assets), account_assets_.size()); // check that every initially created asset is present in the result for (const auto &asset : account_assets_) { - bool presented = false; - std::for_each(resp_assets.begin(), resp_assets.end(), [&asset, &presented](const au...
codereview_cpp_data_551
ObjectColor & objcol = ( *it ).second.objcol; if ( objcol.isColor( color ) ) { - MP2::MapObjectType objectType = static_cast<MP2::MapObjectType>( objcol.first ); objcol.second = objectType == MP2::OBJ_CASTLE ? Color::UNUSED : Color::NONE; world.GetTiles( ( *it ).fi...
codereview_cpp_data_566
LogPrint("thin", "Received block %s in %.2f seconds\n", hash.ToString(), nResponseTime); LogPrint("thin", "Average block response time is %.2f seconds\n", avgResponseTime); - if (maxBlocksInTransitPerPeer.value != 0) - { - MAX_BLOCKS_IN_TRANSIT_PER_PEER = maxBlocksInTransitPerPeer....
codereview_cpp_data_590
#endif #include <iostream> #include <chrono> #define NUM_GROUPS 1 #define GROUP_SIZE 1 are you planning to verify status of all HIP APIs? If not, remove it. #endif #include <iostream> #include <chrono> +#include <algorithm> #define NUM_GROUPS 1 #define GROUP_SIZE 1
codereview_cpp_data_607
void StatusBar::SetCenter( s32 cx, s32 cy ) { center.x = cx; - center.y = cy + 1; } void StatusBar::ShowMessage( const std::string & msg ) This is an incorrect way to do. We should modify values of callers of this function. void StatusBar::SetCenter( s32 cx, s32 cy ) { center.x = cx; + center.y ...
codereview_cpp_data_609
// Insert the new char entry to the database if (SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `class`, `zeny`, `status_point`,`str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`," "`max_sp`, `sp`, `hair`, `hair_color`, `last_map`, `last_x`, `last_y`, `save_...
codereview_cpp_data_617
* This will properly maintain the copyright information. DigitalGlobe * copyrights will be updated automatically. * - * @copyright Copyright (C) 2017 DigitalGlobe (http://www.digitalglobe.com/) */ // Hoot #include "../TestUtils.h" Looks like the copyright stuff needs to be run on the new files. * This wil...
codereview_cpp_data_634
pal[i].unused = 0; } - if (BlitterFactory::GetCurrentBlitter()->GetScreenDepth() == 8) { - SDL_SetColors(_sdl_screen, pal, _local_palette.first_dirty, _local_palette.count_dirty); - } if (_sdl_screen != _sdl_realscreen && init) { /* When using a shadow surface, also set our palette on the real screen. This l...
codereview_cpp_data_637
commitBlocks(); - std::vector<decltype(hash3)> hashes; hashes.push_back(hash1); hashes.emplace_back("AbsolutelyInvalidHash"); hashes.push_back(hash2); Why to change that? commitBlocks(); + std::vector<decltype(hash1)> hashes; hashes.push_back(hash1); hashes.e...
codereview_cpp_data_652
if (--(sce->val4) >= 0) { // Needed to check the caster's location for the range check. struct block_list *src = map->id2bl(sce->val2); - if (!src || status->isdead(src) || src->m != bl->m || !check_distance_bl(bl, src, 11)) break; status->heal(bl, 150 * sce->val1, 0, 2); should be used ``status...
codereview_cpp_data_654
os << std::endl << "# auto combat spell casting: on/off" << std::endl; os << "auto spell casting = " << ( opt_global.Modes( GLOBAL_BATTLE_AUTO_SPELLCAST ) ? "on" : "off" ) << std::endl; - os << std::endl << "# game language (empty field is for English)" << std::endl; os << "lang = " << force_lang << s...
codereview_cpp_data_655
return true; } -bool ArtifactsBar::ActionBarLeftMouseDoubleClick( const fheroes2::Point &, Artifact & art, const fheroes2::Rect & ) { if ( art.GetID() == Artifact::SPELL_SCROLL && Settings::Get().ExtHeroAllowTranscribingScroll() && !read_only && _hero->CanTranscribeScroll( art ) ) { Spell spell = a...
codereview_cpp_data_657
#if !defined(_WIN32) || defined(__CYGWIN__) #include <signal.h> #define HAS_SIGNALS -extern "C" -{ - int killpg(pid_t pgrp, int sig); -} #endif // globally accessible variables I don't really like forward declaring of standard functions. Can you check if putting `#define _DEFAULT_SOURCE` before the `#include <si...
codereview_cpp_data_661
assert_fatal(src.IsObject(), path + " Irohad config top element must be an object."); const auto obj = src.GetObject(); - getValByKey(path, dest.blok_store_path, obj, config_members::BlockStorePath); getValByKey(path, dest.torii_port, obj, config_members::ToriiPort); getValByKey(path, dest....
codereview_cpp_data_663
* pulled a flatpak ref using flatpak_installation_install_full() and * specified %FLATPAK_INSTALL_FLAGS_NO_DEPLOY but then decided not to * deploy the ref later on and want to remove the local ref to prevent it - * from taking up disk space. Note that this will not remove the objects - * referred to by @ref from ...
codereview_cpp_data_669
{ if (m_RankMPI == 0) { - std::cout << "Warning substreams is less than zero, using " "substreams=1, in call to Open\n"; } subStreams = 1; Warning substreams is less than ONE { if (m_RankMPI...
codereview_cpp_data_672
return true; } - check_acked_status(); logInfo(RTPS_HISTORY, "Reader Proxy doesn't exist in this writer"); return false; } As we have not modified the list of matched readers, I don't think this is necessary return true; } logInfo(RTPS_HISTORY, "Reader Proxy doesn't exis...
codereview_cpp_data_689
auto sig = proto_->mutable_signature(); sig->set_signature(crypto::toBinaryString(signed_blob)); sig->set_public_key(crypto::toBinaryString(public_key)); signatures_.emplace(proto_->signature()); return true; } I wonder how did it work before. Please add a task and a TODO to cov...
codereview_cpp_data_691
return ihipLogStatus(hipErrorInvalidSymbol); } - return ihipLogStatus(hip_internal::memcpySync(dst, (char*)src+offset, count, kind, hipStreamNull)); } Since you are adding error checks don't you think symbol_name and hipMemcpyKind should also be vali...
codereview_cpp_data_695
// from disk, but an active partition does not have any files // on disk, so it should never get selected for deletion. VAST_WARN("{} got erase atom as an active partition", self); - return atom::done_v; }, [self](caf::stream<table_slice> in) { self->state.streaming_initiated ...
codereview_cpp_data_706
{ slocalname = new string(); } - if (sync->client->fsaccess->getsname(newlocalpath, slocalname) && slocalname->size() && *slocalname != localname) { parent->schildren[slocalname] = this; } It seems that `slocalname->size()` is always true if `getsnam...
codereview_cpp_data_707
MEventType MEvent::getType() { - return (MEventType) (megaEvent ? megaEvent->getType() : 0); } String^ MEvent::getText() I'd use -1 by default, since 0 is a valid type of event. Anyway, the callback `onEvent(e)` always provide a valid object `e` (not like `onUserUpdate()` and similar, which are called with `NUL...
codereview_cpp_data_716
k2ch = k2c/hbar; K6h = K6/hbar; - if (strstr(update->integrate_style,"respa")) { ilevel_respa = ((Respa *) update->integrate)->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } this change should be reverted. k2ch = k2c/hbar; K6h = K6/hbar; + if (utils::strmat...
codereview_cpp_data_718
&& (msg.source == self->state.archive || msg.source == self->state.index)) report_statistics(self); - // Without sinks and resumable sessions, there's not reason to proceed. self->quit(msg.reason); } ); ```suggestion // Without sinks and resumable sessions, there'...
codereview_cpp_data_724
#include "framework/integration_framework/fake_peer/proposal_storage.hpp" namespace integration_framework { namespace fake_peer { might be a bit clearer: `return it->second ? OrderingProposalRequestResult{*it->second}: boost::none;` #include "framework/integration_framework/fake_peer/proposal_storage.hpp" +#inc...
codereview_cpp_data_725
proposed_kems.data = s2n_stuffer_raw_read(extension, proposed_kems.size); notnull_check(proposed_kems.data); - if (s2n_kem_find_supported_kem(&proposed_kems, s2n_sike_supported_params, 1, &conn->secure.s2n_kem_keys.negotiated_kem) != 0) { - /* Can't agree on a kem. Return success to proceed with the...
codereview_cpp_data_749
//{ Close(it->second); //} - m_OutputFileMap.erase(it); } for (auto it = m_InputFileMap.begin(); it != m_InputFileMap.end(); ++it) { @pnorbert the test failures on Windows are due to invalidating the loop iterator here (and in the input loop below). The `.erase()` remov...
codereview_cpp_data_752
if(connection->state == UA_CONNECTION_CLOSED) return; connection->state = UA_CONNECTION_CLOSED; #endif /* only "shutdown" here. this triggers the select, where the socket is "closed" in the mainloop */ i still do not get why you deleted this? the "normal" network layer has the pointer ...
codereview_cpp_data_759
void ScalarActuator::constructOutputs() { - constructOutput<double>("Actuation", &ScalarActuator::getActuation, SimTK::Stage::Velocity); constructOutput<double>("speed", &ScalarActuator::getSpeed, SimTK::Stage::Velocity); } lower case `A` void ScalarActuator::constructOutputs() { + constructOutput<double>("a...
codereview_cpp_data_763
pScene->mNumMaterials = sib.mtls.size(); pScene->mNumMeshes = sib.meshes.size(); pScene->mNumLights = sib.lights.size(); - pScene->mMaterials = pScene->mNumMaterials ? new aiMaterial*[pScene->mNumMaterials] : 0; - pScene->mMeshes = pScene->mNumMeshes ? new aiMesh*[pScene->mNumMeshes] : 0; - pScene->mLigh...