id
stringlengths
21
25
content
stringlengths
164
2.33k
codereview_cpp_data_10086
_model->updForceSet() = _originalForceSet; // ExternalLoads were added as miscellaneous ModelComponents - int exfIx = _model->getMiscModelComponentSet().getIndex("externalloads"); - if (exfIx >= 0) { - _model->updMiscModelComponentSet().remove(exfIx); } // CMC was added as a model contr...
codereview_cpp_data_10093
case WIZARDS_ISLE_CAMPAIGN: return getWizardsIsleCampaignAwardData( scenarioID ); // no campaign award for voyage home! } return std::vector<Campaign::CampaignAwardData>(); Could we please still add the case for this campaign but with just break inside? In the futur...
codereview_cpp_data_10104
else if (setstoragestatus(isPaywall ? STORAGE_PAYWALL : STORAGE_RED)) { LOG_warn << "Storage overquota"; - int end = (isPaywall) ? PUT : GET; // in Paywall state, none DLs/UPs can progress - for (int d = GET; d <= end; d += PUT - GET) { for (transfer_map::iterator...
codereview_cpp_data_10113
_Wcoarse.clear(); - dmsg_error_when( (sizeCoarseSystem==0) ) <<"no constraint" ; _Wcoarse.resize(sizeCoarseSystem,sizeCoarseSystem); for (unsigned int i=0; i<constraintCorrections.size(); i++) What is the warning needing this? Maybe it could be done directly in the macro to preserve a good looking sy...
codereview_cpp_data_10145
auto omp_threads = omp_get_max_threads(); auto processes_on_node = comm->get_procs_per_node(); - auto io_threads_per_process = std::max(1, static_cast<int>((max_threads / processes_on_node) - omp_threads)); return io_threads_per_process; } Note that this excludes any threads our communication libraries (Alu...
codereview_cpp_data_10146
void ExportSceneObj(const char*,IOSystem*, const aiScene*, const ExportProperties*); void ExportSceneObjNoMtl(const char*,IOSystem*, const aiScene*, const ExportProperties*); #endif -#ifdef ASSIMP_BUILD_NO_STL_EXPORTER void ExportSceneSTL(const char*,IOSystem*, const aiScene*, const ExportProperties*); void Export...
codereview_cpp_data_10167
auto *card = static_cast<CardItem *>(item); QString pt = card->getPT(); int sep = pt.indexOf('/'); - int pow = pt.left(sep).toInt(); // if not found this will be set to 0 int tou = pt.mid(sep + 1).toInt(); QString newpt = QString::number(pow + deltaP) + "/" + QString:...
codereview_cpp_data_10169
_pathfinder.reEvaluateIfNeeded( *bestHero ); bestHero->GetPath().setPath( _pathfinder.buildPath( bestTargetIndex ), bestTargetIndex ); - const int32_t idxToErase = bestHero->GetPath().GetDestinationIndex(); const size_t heroesBefore = heroes.size(); :warning: **clang\-...
codereview_cpp_data_10171
strategy_(std::move(strategy)), time_provider_(std::move(time_provider)), propagation_subscriber_(strategy_->emitter().subscribe( - [this](auto data) { this->onPropagate(data); }, [] {})) { log_ = logger::log("FairMstProcessor"); } The last lambda looks not obvious. Maybe ...
codereview_cpp_data_10177
pthread_mutex_lock(&pool->_shared.mutex); destroy_expired(pool); - /* TODO is this needed in this critical section? */ if (is_global_pool(pool)) { target = lookup_target(pool, url); if (target == SIZE_MAX) { No. I think that you should move the call to `lookup_target` outside of the...
codereview_cpp_data_10183
desktop->server = server; desktop->config = config; - desktop->xcursor_theme = roots_xcursor_theme_create("default"); - if (desktop->xcursor_theme == NULL) { wlr_list_free(desktop->views); free(desktop); return NULL; Does it make sense for this to be fatal? Could there be an embedded application that does...
codereview_cpp_data_10187
[](iroha::expected::Error<std::string> &error) { FAIL() << "MutableStorage: " << error.error; }); - auto bl = shared_model::proto::from_old(block1); - ms->apply(bl, [](const auto &blk, auto &query, const auto &top_hash) { return true; }); storage->comm...
codereview_cpp_data_10198
auto status = active_segment_->WriteFooterAndClose(footer_builder_); if (status.ok() && metrics_) { - metrics_->wal_size->IncrementBy(active_segment_->written_offset()); } return status; } Lets use the Size() function. auto status = active_segment_->WriteFooterAndClose(footer_builder_); if (s...
codereview_cpp_data_10208
caf::put(tr_status, "types", keys); // The list of defined concepts auto& concepts_status = put_dictionary(tr_status, "concepts"); - for (auto& concept_ : taxonomies.concepts.data) { - auto& concept_status = put_dictionary(concepts_status, concept_.first); - concept_status["fields"] = concep...
codereview_cpp_data_10222
return 0; } -std::function<bool (Node*, Node*)> MegaApiImpl::getComparatorFunction(int order, MegaClient* mc) { switch(order) { Can we handle all enum values here so that we get a compiler warning if a new enum value wasn't handled? A `assert(false)` at the end would also be good. return 0; } +...
codereview_cpp_data_10234
if (IsTileType(tile, MP_STATION) || IsTileType(tile, MP_INDUSTRY)) { const Station *st = nullptr; - if (IsTileType(tile, MP_STATION)){ st = Station::GetByTile(tile); } else { const Industry *in = Industry::GetByTile(tile); missing space ```suggestion if (IsTileType(tile, MP_STATION)) { ``` if (IsTi...
codereview_cpp_data_10237
namespace { // kernel for initializing GWS -// nwm1 is the total number of wavefronts minus 1 and rid is the GWS resource id __global__ void init_gws(uint nwm1, uint rid) { __ockl_gws_init(nwm1, rid); } This barrier should be initialized with the number of work groups minus 1 since that is what the sync is ex...
codereview_cpp_data_10248
//@HEADER */ -#include <Kokkos_Macros.hpp> -#ifdef KOKKOS_ENABLE_SYCL - #include <cstdint> #include <iostream> #include <iomanip> You shouldn't need that header guard //@HEADER */ #include <cstdint> #include <iostream> #include <iomanip>
codereview_cpp_data_10252
-#include <wlr/util/signal.h> static void handle_noop(struct wl_listener *listener, void *data) { // Do nothing Do you think this should be an internal header? +#include "util/signal.h" static void handle_noop(struct wl_listener *listener, void *data) { // Do nothing
codereview_cpp_data_10266
highQualityURLLabel.setText(tr("Custom Card Download URL:")); highQualityURLLinkLabel.setText(QString("<a href='%1'>%2</a>").arg(LINKING_FAQ_URL).arg(tr("Linking FAQ"))); clearDownloadedPicsButton.setText(tr("Reset/Clear Downloaded Pictures")); - updateNotificationCheckBox.setText(tr("Notify when new ...
codereview_cpp_data_10269
CHECK_EQUAL(*f, '5'); CHECK_EQUAL(x, 1234); MESSAGE("partial match with non-digits character"); - str = "6789x"sv; f = str.begin(); l = str.end(); CHECK(p.parse(f, l, x)); REQUIRE(f + 1 == l); CHECK_EQUAL(*f, 'x'); - CHECK_EQUAL(x, 6789); } TEST(real) { I think this test should cover the ca...
codereview_cpp_data_10270
return TRUE; if ( a1 && gbMaxPlayers > 1 ) - MI_Dummy(save_num); // some eliminated function... return FALSE; } This is `mpqapi_update_multi_creation_time` from the debug release. return TRUE; if ( a1 && gbMaxPlayers > 1 ) + mpqapi_update_multi_creation_time(save_num); return FALSE; }
codereview_cpp_data_10272
if (strstr(update->integrate_style,"respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; - if (strstr(update->integrate_style,"respa") && gjfflag) error->all(FLERR,"Fix langevin gjf and respa are not compatible"); if (gjfflag) gjfa = (1.0-update->dt/2.0/t_period)/(1.0+update->dt/2.0/t_perio...
codereview_cpp_data_10294
// Catch termination signals only once to allow forced termination by the OS // upon sending the signal a second time. if (sig == SIGINT || sig == SIGTERM) { - std::cerr << "\rInitiating shutdown... (repeat request to terminate)\n"; std::signal(sig, SIG_DFL); } signals[0] = true; I can't remembe...
codereview_cpp_data_10299
static inline structs::ItemSlotStruct TitaniumToRoFSlot(uint32 TitaniumSlot) { structs::ItemSlotStruct RoFSlot; - RoFSlot.SlotType = 0xff; RoFSlot.Unknown02 = 0; - RoFSlot.MainSlot = 0xff; - RoFSlot.SubSlot = 0xff; - RoFSlot.AugSlot = 0xff; RoFSlot.Unknown01 = 0; uint32 TempSlot = 0; These changes 0xffff to ...
codereview_cpp_data_10300
if (rootNode && !rootNode->isEmpty()) { ol.startParagraph(); ol.disableAllBut(OutputGenerator::Man); ol.writeString(" - "); - ol.enableAll(); ol.writeDoc(rootNode,this,0); ol.pushGeneratorState(); ol.disable(OutputGenerator::RTF); This is not correct. You need t...
codereview_cpp_data_10310
break; } - - case WID_CL_CLIENT_NUMBER: { - /* Number of clients */ - int text_y_offset = std::max(0, ((int)this->line_height - (int)FONT_HEIGHT_NORMAL) / 2); - SetDParam(0, NetworkClientInfo::GetNumItems()); - SetDParam(1, Company::GetNumItems()); - DrawString(r.left + WD_FRAMERECT_LEFT, r.ri...
codereview_cpp_data_10318
log_->warn("Could not fetch last block: " + e->error); return; } - block_query_opt = boost::none; last_block = boost::get< Use braces instead (aka `{` & `}`) for dealing with lifetimes, it's easier to understand stuff like that log_->warn("Could not fetch last ...
codereview_cpp_data_10324
} request = requestMap.at(client->restag); if (!request || ((request->getType() != MegaRequest::TYPE_FETCH_NODES) && - (request->getType() != MegaRequest::TYPE_CREATE_ACCOUNT)) ) { return; } when TYPE_FETCH_NODES we are using megaError instead of e (which is a copy)...
codereview_cpp_data_10335
{ const BitModes & modes = player; msg << modes << player.id << player.control << player.color << player.race << player.friends << player.name << player.focus << *player._ai; - if ( player._ai ) { - msg << *player._ai; - } - else { - DEBUG_LOG( DBG_GAME, DBG_WARN, "Player object withou...
codereview_cpp_data_10346
return err; } -void default_table_slice::apply_column(size_type col, value_index& idx) const { for (size_type row = 0; row < rows(); ++row) idx.append(make_view(caf::get<vector>(xs_[row])[col]), offset() + row); } This is essentially the same algorithm that is implemented in the base class, so why even ov...
codereview_cpp_data_10379
cout << cmd << endl; if (!env.empty()) { setenv("HIP_VISIBLE_DEVICES", env.c_str(), 1); cout << "set env HIP_VISIBLE_DEVICES = " << env.c_str() << endl; // verify if the environment variable is set The test needs to run on nvcc path as well. So what you probably need is somethi...
codereview_cpp_data_10381
, rtps_participant_(p->rtps_participant()) , default_datareader_qos_(DATAREADER_QOS_DEFAULT) { - SubscriberAttributes pub_attr; - XMLProfileManager::getDefaultSubscriberAttributes(pub_attr); - set_qos_from_attributes(default_datareader_qos_, pub_attr); } void SubscriberImpl::disable() ```suggesti...
codereview_cpp_data_10384
if (opt_show_metadata) { g_autoptr(GFile) file = NULL; g_autofree char *data = NULL; gsize data_size; file = g_file_get_child (deploy_dir, "metadata"); if (!g_file_load_contents (file, cancellable, &data, &data_size, NULL, error)) Actually, this de...
codereview_cpp_data_10397
for (int i = 23; i < 46; ++i){ rms_tols2[i] = 0.75; // velocities } - for (int i = 46; i < rms_tols2.size(); ++i){ rms_tols2[i] = 0.15; // muscle activations and fiber-lengths } `size()` returns an unsigned so I believe some compilers will give a warning when attempting to compare `...
codereview_cpp_data_10411
* 2. It will not produce the same results on little-endian and big-endian * machines. */ -unsigned int gen_hash(const void *key, int len) { /* 'm' and 'r' are mixing constants generated offline. They're not really 'magic', they just happen to work well. */ public interfaces must be prefixed wit...
codereview_cpp_data_10414
std::unique_ptr<optimizer> build_no_optimizer_from_pbuf( google::protobuf::Message const& msg, lbann_comm* comm) { - return std::unique_ptr<optimizer>(); } using factory_type = lbann::generic_factory< This can just return `nullptr;` All that extra typing... what would @ndryden think?? std::unique_ptr<optim...
codereview_cpp_data_10422
auto before = maybe_parse(caf::get_if<std::string>(&options, "explore.before")); auto after = maybe_parse(caf::get_if<std::string>(&options, "explore.after")); - std::optional<std::string> by - = to_std(caf::get_if<std::string>(&options, "explore.by")); explorer_state::event_limits limits; limits.t...
codereview_cpp_data_10423
for (auto &batch : batches) { if (auto answer = batch_validator.validate(batch)) { reason.second.emplace_back(answer.reason()); - break; } } If several batches are invalid, there will be an error only for one of them. Consider removing break. for (auto &batch...
codereview_cpp_data_10430
void TabMessage::processUserMessageEvent(const Event_UserMessage &event) { - const UserLevelFlags userLevel(event.sender_name() == otherUserInfo->name() ? otherUserInfo->user_level() : ownUserInfo->user_level()); - const QString userPriv(event.sender_name() == otherUserInfo->name() ? QString::fromStdString(othe...
codereview_cpp_data_10437
} if (pindex->IsValid(BLOCK_VALID_TRANSACTIONS) && (pindex->nChainTx || pindex->pprev == nullptr)) setBlockIndexCandidates.insert(pindex); - if (pindex->nStatus & BLOCK_FAILED_MASK && - (!pindexBestInvalid || pindex->nChainWork > pindexBestInvalid.load()->nChainWork)) ...
codereview_cpp_data_10440
* @param arr array to shuffle * @returns new array with elements shuffled from a given array */ -template<typename T, size_t N> -std::array <T, N> shuffle(std::array <T, N> arr) { - for(int i = 0; i < N; i ++) { // Swaps i'th index with random index (less than array size) std::swap(arr[i], a...
codereview_cpp_data_10453
else if (victim->GetOwnerID()) { Message(0, "You cannot steal from pets!"); } - else if (!CombatRange(victim, 3.0)) { //Give benefit of the doubt due to pathing NPCs Message(Chat::Red, "Attempt to pickpocket out of range detected."); database.SetMQDetectionFlag(this->AccountName(), this->GetName(), "OP_Pic...
codereview_cpp_data_10454
} } else { sprintf(msg_buf, - "No data_dir= found in %s. Try reinstalling BOINC.", - LINUX_CONFIG_FILE ); msg = msg_buf; return ERR_FOPEN; Please add another "in %s" and ", LINUX_DEF...
codereview_cpp_data_10458
g_hash_table_replace (metadata_hash, g_strdup ("rpmostree.inputhash"), g_variant_ref_sink (g_variant_new_string (new_inputhash))); - const char *gpgkey; if (!_rpmostree_jsonutil_object_get_optional_string_member (treefile, "gpg_key", &gpgkey, error)) goto out; Shouldn't this be ini...
codereview_cpp_data_10468
clif->clearunit_area(&sd->bl, CLR_DEAD); else { skill->usave_trigger(sd); - if (battle_config.player_warp_keep_direction) clif->changed_dir(&sd->bl, SELF); // Visually updates player facing direction } kindly use == 1 here please clif->clearunit_area(&sd->bl, CLR_DEAD); else { skill->usave_trig...
codereview_cpp_data_10491
g_autoptr(GOptionContext) context = g_option_context_new (""); glnx_unref_object RPMOSTreeOS *os_proxy = NULL; glnx_unref_object RPMOSTreeSysroot *sysroot_proxy = NULL; - g_autoptr(GVariant) default_deployment = NULL; g_autofree char *transaction_address = NULL; _cleanup_peer_ GPid peer_pid = 0; cons...
codereview_cpp_data_10512
Plugin_128_pixels->Show(); if (mode != lastmode) { - String log; - log = F("NeoPixelBus: Mode Change: "); - log += P128_modeType_toString(mode); - addLog(LOG_LEVEL_INFO, log); NeoPixelSendStatus(event); } return true; Check for logLevelActiveFor missing Plugin_128_pixels->Show(); i...
codereview_cpp_data_10515
return ok; } -static mrb_state *maybe_init_mrb(struct mruby_configurator_t *self) { if (self->mrb == NULL) { self->mrb = mrb_open(); configurator also should use one shared mrb_state for compile testing, because handlers may cause side-effects to other handlers, and it may cause compile (accuratel...
codereview_cpp_data_10527
return s->lookup(xs_); } -// TODO: return expected<segment_store_ptr> for better error propagation. caf::expected<segment_store_ptr> segment_store::make(std::filesystem::path dir, size_t max_segment_size, size_t in_memory_segments) { The `TODO` can be removed now. return s->lookup(xs_); ...
codereview_cpp_data_10530
// now do the same but connect the elbow from humerus to humerus auto elbowInHumerus = new PhysicalOffsetFrame("elbow_in_humerus", model.getComponent<Body>("r_humerus"), - SimTK::Transform(SimTK::Vec3(0, -0.33, 0.0))); model.addComponent(elbowInHumerus); // update the elbow Joint and...
codereview_cpp_data_10542
rubyInterpreter.evalString(embedded_extensions_string); } catch (const std::exception& e) { rubyInterpreter.evalString(R"(STDOUT.flush)"); - std::cout << "Exception in embedded_help: " << e.what() << '\n'; // endl will flush return ruby_cleanup(1); } catch (...) { rubyInterpr...
codereview_cpp_data_10545
#include <wlr/types/wlr_tablet_v2.h> #include <wlr/util/log.h> -static const struct wlr_tablet_tool_v2_grab_interface default_tool_interface; static const struct wlr_surface_role tablet_tool_cursor_surface_role = { .name = "wp_tablet_tool-cursor", This variable name should probably contain `grab` #include <wlr/...
codereview_cpp_data_10557
bool RTPSParticipantImpl::update_attributes( const RTPSParticipantAttributes& patt) { - (void)patt; return false; } More c++ like ```suggestion static_cast<void>(patt); ``` bool RTPSParticipantImpl::update_attributes( const RTPSParticipantAttributes& patt) { + static_cast<void>(pat...
codereview_cpp_data_10565
stillmore = false; for ( i=0; i<=mm->instance_count; ++i ) if ( ss[i]!=NULL ) stillmore = true; if ( stillmore ) -{ -free(ss); -free(sp); return( false ); -} -free(ss); -free(sp); return( true ); } else { stillmore = true; This can be simplified by moving the free statements before `if ( stillmore...
codereview_cpp_data_10569
if (iarg+3 > narg) error->all(FLERR,"Illegal pair_style mliap command"); descriptor = new MLIAPDescriptorSNAP(lmp,arg[iarg+2]); iarg += 3; - }else if (strcmp(arg[iarg+1],"so3") == 0) { - if (iarg+3 > narg) error->all(FLERR,"Illegal pair_style mliap command"); - descript...
codereview_cpp_data_10575
QStringList ptDbSplit = db->getCard(name)->getPowTough().split("/"); QStringList ptSplit = pt.split("/"); - if ((ptDbSplit.at(0) != ptSplit.at(0) || ptDbSplit.at(1) != ptSplit.at(1)) && !getFaceDown()) painter->setPen(QColor(255, 150, 0)); else painter->setPen...
codereview_cpp_data_10577
{ switch (t) { case TypeAnd: - return QString("AND"); case TypeOr: - return QString("OR"); case TypeAndNot: - return QString("AND NOT"); case TypeOrNot: - return QString("OR NOT"); default: return QString(""); ...
codereview_cpp_data_10578
#include "AirflowNetworkDistributionLinkage.hpp" #include "AirflowNetworkDistributionLinkage_Impl.hpp" // TODO: Check the following class names against object getters and setters. #include "AirflowNetworkNode.hpp" #include "AirflowNetworkNode_Impl.hpp" #include "AirflowNetworkComponent.hpp" #include "AirflowNetw...
codereview_cpp_data_10582
return result; } -static void on_context_init(h2o_handler_t *_handler, h2o_context_t *ctx, h2o_pathconf_t *pathconf) { h2o_mruby_handler_t *handler = (void *)_handler; h2o_mruby_context_t *handler_ctx = h2o_mem_alloc(sizeof(*handler_ctx)); handler_ctx->handler = handler; handler_ctx->shared =...
codereview_cpp_data_10583
using namespace iroha; using namespace iroha::ametsuchi; -using namespace iroha::model; -using namespace iroha::model::converters; using namespace iroha::network; BlockLoaderService::BlockLoaderService(std::shared_ptr<BlockQuery> storage) Remove redundant using-namespaces plz (iroha::model and maybe smth else) u...
codereview_cpp_data_10590
* This will properly maintain the copyright information. DigitalGlobe * copyrights will be updated automatically. * - * @copyright Copyright (C) 2015 DigitalGlobe (http://www.digitalglobe.com/) */ #include "LongIntegerFieldDefinition.h" Do you know why we are setting _min as -numeric_limits<long long>::max(),...
codereview_cpp_data_10616
{ //allow for calculating the changeset with a slightly larger AOI than the default specified //bounding box; useful in certain situations - Envelope convertBounds = GeometryUtils::envelopeFromConfigString(ConfigOptions().getConvertBoundingBox()); convertBounds.expandBy(changeset...
codereview_cpp_data_10619
*/ QVariantMap resultMap = array.at(0).toObject().toVariantMap(); - if (resultMap.size() == 0) { qWarning() << "No reply received from the release update server:" << QString(jsonData); emit error(tr("No reply received from the release update server.")); return; `array.at(0)` ca...
codereview_cpp_data_10628
const Scalar val = a((i*32 + j)*32 + k); if(val>lmax) lmax = val; if((k == 11) && (j==17) && (i==2)) lmax = 11.5; -#ifdef GENERIC_REDUCER - },Kokkos::Max<Scalar>(t_max)); -#else },Kokkos::Experimental::Max<Scalar>(t_max)); -#endif if(t_max>thread_max) thread_max = t_max; -...
codereview_cpp_data_10630
int na = _model->getActuators().getSize(); double p = 0.0; for(int i=0;i<na;i++) { - if (ScalarActuator* act = dynamic_cast<ScalarActuator*>(&_model->getActuators().get(i))) p += pow(fabs(parameters[i]),_activationExponent); } performance = p; This seems like the wrong tim...
codereview_cpp_data_10632
}*/ // calculate the 2 sigma for the distance between the two objects - const double sigma1 = poi->getCircularError() / 2.0; - const double sigma2 = poly->getCircularError() / 2.0; - const double ce = sqrt(sigma1 * sigma1 + sigma2 * sigma2) * 2; - const double reviewDistancePlusCe = _reviewDistanceThreshold +...
codereview_cpp_data_10635
VisualNode->addObject(mapping); } else - std::cout << "Error: mapping visual not possible"; return VisualNode; } Usage of std::cout is allowed only for debugging not for within a PR. Please use msg_error(this) << "Mapping visual not possible" Bonus point if you explain why it is not pos...
codereview_cpp_data_10647
} } // namespace util_functions namespace { class Layer { public: // To store activation function and it's derivative ```suggestion assert(machine_learning::argmax(myNN.single_predict({{5,3.4,1.6,0.4}})) == 0); assert(machine_learning::a...
codereview_cpp_data_10650
!= roles->end()); } - TEST_F(AppendRole, AppendRoleTestInvalidNoAccount) { addAllPerms(); ASSERT_TRUE(val(execute( buildCommand(TestTransactionBuilder().createRole(another_role, {})), You can remove "AppendRoleTest" from test name, since it is contained in the test f...
codereview_cpp_data_10658
* SPDX-License-Identifier: Apache-2.0 */ -#include "flat_file.hpp" #include <boost/filesystem.hpp> #include <boost/range/adaptor/indexed.hpp> Please use file path relative to irohad directory. `ametsuchi/impl/flat_file/flat_file.cpp` * SPDX-License-Identifier: Apache-2.0 */ +#include "ametsuchi/impl/flat_fi...
codereview_cpp_data_10670
return i - 2; } -int __fastcall gmenu_presskeys(int a1) { if (!dword_634480) return 0; From it usage and return values I would say that this was probably returning BOOL (long), does it still compile as bin exact if changed to do so? return i - 2; } +BOOL __fastcall gmenu_presskeys(int a1) { if (!dword_...
codereview_cpp_data_10680
* @author [Ghanashyam](https://github.com/g-s-k-zoro) */ -#include <cassert> /// for testing -#include <cctype> /// for case manipulation of alphabets #include <cstring> /// for string operations #include <iostream> /// for IO Operations #include <queue> /// for std::priority_queue `assert` is the n...
codereview_cpp_data_10698
* Get transactions from the given batches queue. Does not break batches - * continues getting all the transactions from the ongoing batch until the * required amount is collected. - * @tparam Lambda - type of side effect function for batches * @param requested_tx_amount - amount of transactions to get * @para...
codereview_cpp_data_10730
shared_ptr<QSqlQuery> changesetItr = _db.getChangesetsCreatedAfterTime(timeStr); - Envelope allChangesetsBounds; while (changesetItr->next()) { shared_ptr<Envelope> changesetBounds( what if: instead of accumulating all of the changeset bounds into one big envelope, you checked each changeset bounds agai...
codereview_cpp_data_10743
const int32_t* row = mat.ptr<int32_t>(y); for (int x = 0; x < qImage->width(); x++) { - int v = log1p(row[x]) / log(maxValue); - int r = std::max(0, std::min<int>(255, v * _colorMultiplier[0] + qRed(_baseColors))); - int g = std::max(0, std::min<int>(255, v * _colorMultiplier[1] + qGreen(_...
codereview_cpp_data_10747
void testTutorialOne(); // Test different default activations are respected when activation -// states are not provided. Note if default_activation is 1.0 it -// reproduces the "skyscraper" bug issue #83 in OpenSim32 repo void testTugOfWar(const string& dataFileName, const double& defaultAct); void reportTendonAn...
codereview_cpp_data_10750
* npctalk (sends message to surrounding area) * usage: npctalk "<message>"{,"<npc name>"{,<show_npcname>}}; * <show_npcname>: - * 0: shows npc name like "Npc : message" - * 1: hide npc name *------------------------------------------*/ BUILDIN(npctalk) { struct npc_data* nd; - int show_npcname = ...
codereview_cpp_data_10753
Object* dependency = Object::newInstanceOfType(dependencyTypeName); - if (dependency == nullptr){ - // Get a concrete instance of a PhysicalFrame, which is a Body - size_t n = dependencyTypeName.length(); - if (n > 4 && dependencyType...
codereview_cpp_data_10756
int main() { BEGIN_TEST(); - EXPECT_SUCCESS(s2n_disable_tls13()); if (!s2n_pq_is_enabled()) { END_TEST(); Since this is a new test, I'd try to write it without disabling TLS1.3. S2N now runs with TLS1.3 enabled by default but turned on/off via security policies. int main() { BEGIN_TEST();...
codereview_cpp_data_10758
PropagationData peers; std::transform( ids.begin(), ids.end(), std::back_inserter(peers), [](auto &s) { - return makePeer(s, empty_pubkey); }); return peers; } Public key can be constructed from string - `shared_model::interface::types::PubkeyType("")` PropagationData peers; std::...
codereview_cpp_data_10772
break; case execution_mode::validation: case execution_mode::testing: - if (get_step() % cb->get_batch_interval() == 0) { - cb->on_batch_evaluate_begin(this); - } break; default: LBANN_ERROR("invalid execution mode"); I agree with making this the default behavior, b...
codereview_cpp_data_10779
select_subset_of_data(); } -bool mesh_reader::fetch_datum(CPUMat& X, int data_id, int mb_idx, thread_pool& io_thread_pool) { - // int tid = io_thread_pool.get_local_thread_id(); if (m_random_flips) { fast_rng_gen& gen = get_fast_generator(); std::uniform_int_distribution<int> dist(0, 1); If this is ...
codereview_cpp_data_10788
IdfObject idfObject(openstudio::IddObjectType::EnergyManagementSystem_Program); m_idfObjects.push_back(idfObject); - m_map.insert(std::make_pair(modelObject.handle(), idfObject)); //Name s = modelObject.name(); if (s) { Again, this shouldn't be here. IdfObject idfObject(openstudio::IddObjectType::E...
codereview_cpp_data_10792
class QueueBehaviorTest : public ::testing::Test { public: - QueueBehaviorTest(): ordering_gate(transport, 1, false) {}; void SetUp() override { - std::shared_ptr<OrderingGateTransport> transport = - std::make_shared<MockOrderingGateTransport>(); - std::shared_ptr<MockPeerCommunicationService> pcs =...
codereview_cpp_data_10793
// setup cursor const CursorRestorer cursorRestorer( true, Cursor::POINTER ); - const u32 min = std::min( 1u, redistributeMax ); const int spacer = 10; const int defaultYPosition = 160; :warning: **readability\-uppercase\-literal\-suffix** :warning: integer literal has suffix `` u ``, which is n...
codereview_cpp_data_10797
// We don't have to look into the synopses for type queries, just // at the layout names. result_type result; - for (auto& [part_id, part_syn] : synopses_) for (auto& pair : part_syn) { // TODO: provide an overload for view of evaluate() ...
codereview_cpp_data_10801
// List the device outputs we wish to display during the simulation. std::vector<std::string> deviceOutputs{ "length", "tension", "power" }; - std::vector<std::string> controllerOutputs{ "myo_control" }; // Add a ConsoleReporter to report deviceOutputs. //addDeviceConsoleRepor...
codereview_cpp_data_10809
ch->writerGUID = c_Guid_Unknown; ch->serializedPayload.length = 0; ch->serializedPayload.pos = 0; - for(uint8_t i=0;i<16;++i) - ch->instanceHandle.value[i] = 0; ch->isRead = 0; ch->sourceTimestamp.seconds(0); ch->sourceTimestamp.fraction(0); Use memset here (needs `#include <cst...
codereview_cpp_data_10811
*/ /* HIT_START - * BUILD: %t %s ../../test_common.cpp EXCLUDE_HIP_PLATFORM nvcc * TEST: %t * HIT_END */ Why is this disabled on cuda path? Looking at your previous changes in this ticket, I think the issue is that you are trying to use the same context on all the threads. Creating a new context for the same d...
codereview_cpp_data_10815
FontSize size = this->DefaultSize(); if (str != NULL) *str = text; for (WChar c = Utf8Consume(&text); c != '\0'; c = Utf8Consume(&text)) { - - if (c >= SCC_NORMALFONT && c <= SCC_MONOFONT) { - size = (FontSize)(c - SCC_NORMALFONT); } else if (!IsInsideMM(c, SCC_SPRITE_START, SCC_SPRITE_END) && IsPrint...
codereview_cpp_data_10817
namespace { shared_model::interface::types::TimestampType oldestTimestamp( const iroha::BatchPtr &batch) { auto timestamps = batch->transactions() | boost::adaptors::transformed( It looks like assertion will check only case when batch is empty so maybe better check this explicitly? Al...
codereview_cpp_data_10829
#define IfFailRet(EXPR) do { Status = (EXPR); if(FAILED(Status)) { return (Status); } } while (0) #endif -bool IsWindowsTarget() -{ - return (g_pRuntime->GetRuntimeConfiguration() == IRuntime::WindowsCore) || - (g_pRuntime->GetRuntimeConfiguration() == IRuntime::WindowsDesktop); -} - #ifdef FEATURE_PAL ...
codereview_cpp_data_10832
CoinAccessor::CoinAccessor(const CCoinsViewCache &view, const uint256 &txid) : cache(&view), lock(cache->csCacheInsert) { - cache->cs_utxo.lock_shared(); EnterCritical("CCoinsViewCache.cs_utxo", __FILE__, __LINE__, (void *)(&cache->cs_utxo)); COutPoint iter(txid, 0); coin = &emptyCoin; while (i...
codereview_cpp_data_10834
} else { - const char *const* p = { NULL }; g_variant_builder_add (&metadata_builder, "{sv}", "rpmostree.packages", g_variant_new_strv (p, -1)); Kind of wonder if we need both the flag and the...
codereview_cpp_data_10838
namespace parse { namespace detail { condition_parser_rules_3::condition_parser_rules_3( const parse::lexer& tok, - parse::detail::Labeller& labeller, const condition_parser_grammar& condition_parser, const parse::value_ref_grammar<std::string>& string_grammar ) : Is the `p...
codereview_cpp_data_10842
const consensus::RejectRoundType kNextCommitRoundConsumer = kFirstRejectRound; - consensus::Round nextCommitRound(consensus::Round round) { return {round.block_round + 1, kFirstRejectRound}; } - consensus::Round nextRejectRound(consensus::Round round) { return {round.block_round, ...
codereview_cpp_data_10844
* overloaded to accommodate (mathematical) field operations. */ #include <cmath> #include <iostream> #include <stdexcept> -#include <cassert> /** * Class Complex to represent complex numbers as a field. maybe put the complex number within parentheses? * overloaded to accommodate (mathematical) field opera...
codereview_cpp_data_10868
return sounds.rangeAttack; } return sounds.meleeAttack; } Why meleeAttack sound can be M82::UNKNOWN, but rangeAttack isn't? return sounds.rangeAttack; } + assert( sounds.meleeAttack != M82::UNKNOWN ); return sounds.meleeAttack; }
codereview_cpp_data_10870
} break; case LONG_OPT_DISABLE_BATCH_CACHE: - cache_mode = 1; break; case LONG_OPT_WQ_WAIT_FOR_WORKERS: wq_wait_queue_size = optarg; cache_mode = 1 should be with cache on, otherwise it gets confusing with the double negatives. } break; case LONG_OPT_DISABLE_BATCH_CACHE: +...