id
stringlengths
21
25
content
stringlengths
164
2.33k
codereview_cpp_data_2929
SpellStorage tmpSpells = spells; std::sort( tmpSpells.begin(), tmpSpells.end() ); for ( int32_t i = 0; i < spellsPerPage; ++i ) { - if ( spells.size() <= index + i ) return; const int32_t ox = 84 + 81 * ( i & 1 ); Hi @undef21 Wouldn't it be logical to check `index + i` again...
codereview_cpp_data_2933
priority.PopBack(); } Assign( priority ); } I think we need to break the loop if `JoinTroop` returns false: ``` if ( rightTroop && rightTroop->isValid() ) { if ( !JoinTroop( *rightTroop ) ) break; rightTroop->Reset(); } ``` priority.PopBack(); } + // as...
codereview_cpp_data_2934
} } -void GTabSetRemoveTabByPos(GGadget *g, int pos); static void GTabSetChangeSel(GTabSet *gts, int sel,int sendevent) { int i, width; int oldsel = gts->sel; Since this is in `ggadget.h` not sure why it's needed here. } } static void GTabSetChangeSel(GTabSet *gts, int sel,int sendevent) { ...
codereview_cpp_data_2941
} /* validate a header value against https://tools.ietf.org/html/rfc7230#section-3.2 */ -static bool contains_invalid_field_value_char(const char *s, size_t len) { /* all printable chars + horizontal tab */ - static const bool valid_h2_field_value_char[] = { 0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0...
codereview_cpp_data_2944
} void PostgresQueryExecutorVisitor::setQueryHash( - const shared_model::crypto::Hash &query_hash) { query_hash_ = query_hash; } You can use shared_model::interface::types::HashType, so that you do not depend on cryptography directly } void PostgresQueryExecutorVisitor::setQuery...
codereview_cpp_data_2961
if (predictor_ != nullptr) { delete predictor_; } bool is_predict_leaf = false; bool is_raw_score = false; - if (predict_type == 2) { is_predict_leaf = true; - } else if (predict_type == 1) { - is_raw_score = false; - } else { is_raw_score = true; } predictor_ = new ...
codereview_cpp_data_2962
} } errno = 0; - int = strtol(buf, &end, 0); if (errno) return false; if (end != buf+strlen(buf)) return false; Build failed because of this with next error: ``` 1>..\lib\parse.cpp(658): error C2513: 'int' : no variable declared before '=' 1>..\lib\parse.cpp(666): error C2065: 'val' : u...
codereview_cpp_data_2966
if ( buttonGift.isEnabled() && le.MouseClickLeft( buttonGift.area() ) ) { Dialog::MakeGiftResource( kingdom ); - resourceTo = resourceFrom = Resource::UNKNOWN; gui.ShowTradeArea( kingdom, resourceFrom, resourceTo, 0, 0, 0, 0, fromTradingPost, firstExchange ); c...
codereview_cpp_data_2969
LocalEvent & le = LocalEvent::Get(); - while ( 1 ) { if ( !le.HandleEvents( true, true ) ) { break; } :warning: **modernize\-use\-bool\-literals** :warning: converting integer literal to bool, use bool literal instead ```suggestion while ( true ) { ``` ...
codereview_cpp_data_2977
int result = Dialog::CANCEL; bool need_redraw = false; - int alphaHero = 241; fheroes2::Image surfaceHero( 552, 107 ); // dialog menu loop It is unknown why we assign the value 241 to this variable. Shall we assign 255 instead? int result = Dialog::CANCEL; bool need_redraw = false; + ...
codereview_cpp_data_2992
void DotNode::renumberNodes(int &number) { - if (!m_renumbered) - { - m_renumbered = true; - m_number = number++; - } for (const auto &cn : m_children) { if (!cn->isRenumbered()) I don't think this is correct in general. Now the code at line 808 will set `m_renumbered` to `true` and then `cn->ren...
codereview_cpp_data_2996
#include "vast/test/test.hpp" -// CAF 0.17.2 added a test DSL macro named `inject`, which conflicts with -// `range_map::inject` -#undef inject - #include "vast/detail/range_map.hpp" #include "vast/load.hpp" #include "vast/save.hpp" For a follow-up issue: maybe we should not include the DSL unconditionally in `vas...
codereview_cpp_data_2997
free (value); } -int elektraIniSet(Plugin *handle ELEKTRA_UNUSED, KeySet *returned, Key *parentKey) { /* set all keys */ int errnosave = errno; doing this when plugin is opened would reduce this code duplication free (value); } +int elektraIniSet(Plugin *handle, KeySet *returned, Key *parentKey) { /* se...
codereview_cpp_data_3003
if (line == "$continue" || line == "$quit" || line == "$exit") break; else if (line == "$help") - std::cout << "Welcome to the Icinga 2 console/script debugger.\n" "Usable commands:\n" " $continue, $quit, $exit Quit the console\n" " $help Print this help\n\n" P...
codereview_cpp_data_3017
template <typename TensorDataType> bool adam<TensorDataType>::load_from_checkpoint_shared(persist& p, std::string name_prefix) { - load_from_shared_cereal_archive<adam<TensorDataType>>(*this, p, this->get_comm(), "adam.xml"); char l_name[512]; sprintf(l_name, "%s_optimizer_adam_moment1_%lldx%lld.bin", name_pre...
codereview_cpp_data_3029
{ ResultRelInfo *resultRelInfo; ResultRelInfo *saved_resultRelInfo = NULL; - /* if copies are directed to a chunk that is compressed, we redirect - * them to the internal compressed chunk. But we still - * need to check triggers, constrainst etc. against the original - * chunk (not the internal compressed chunk...
codereview_cpp_data_3030
assert( activeHumanColors <= 1 ); const Kingdom & myKingdom = world.GetKingdom( humanColors ); - const Settings & conf = Settings::Get(); if ( myKingdom.isControlHuman() ) { if ( !continueAfterVictory && GameOver::COND_NONE != ( result = world.CheckKingdomWins( myKingdom )...
codereview_cpp_data_3034
using namespace sofa::defaulttype; -#ifndef SOFA_FLOAT -template class SOFA_RIGID_API JointSpring<defaulttype::Rigid3dTypes>; -#endif -#ifndef SOFA_DOUBLE -template class SOFA_RIGID_API JointSpring<defaulttype::Rigid3fTypes>; -#endif } // namespace interactionforcefield Nooooo ! The Sofa float are trying to re-enter...
codereview_cpp_data_3035
// node update sc_updatenode(); #ifdef ENABLE_SYNC - // run syncdown() before continuing - applykeys(); - return false; #endif ...
codereview_cpp_data_3036
return descriptions; } -void HeroesIndicator::SetHero( const Heroes & h ) { - hero = &h; } void HeroesIndicator::SetPos( const Point & pt ) Hmm... passing a reference and taking a pointer from it is not a very good way to do. We should pass a pointer then. return descriptions; } +void HeroesIndicato...
codereview_cpp_data_3042
namespace { - const std::bitset<256> ObjMnts1ShadowBitset = fheroes2::makeBitsetFromVector<256>( { 0, 5, 11, 17, 21, 26, 32, 38, 42, 45, 49, 52, 55, 59, 62, 65, 68, 71, 74, 75, 79, 80 } ); - const std::bitset<256> ObjMnts2ShadowBitset = fheroes2::makeBitsetFromVector<256>( { 0, 5, 11, 17, 21, ...
codereview_cpp_data_3049
u32 Heroes::GetVisionsDistance( void ) const { - uint32_t crystalBallCount = std::max( 1u, artifactCount( Artifact::CRYSTAL_BALL ) ); return 8 * crystalBallCount; } :warning: **readability\-uppercase\-literal\-suffix** :warning: integer literal has suffix `` u ``, which is not uppercase ```suggestion uint32...
codereview_cpp_data_3051
{ LBANN_ASSERT_MSG_HAS_FIELD(proto_layer, gather); using BuilderType = Builder<TensorDataType, Layout, Device>; - auto axis = proto_layer.gather().axis().value(); return BuilderType::Build(axis); } What do we want to be the default value? Right now the default for `axis` is 0. We could alternatively do som...
codereview_cpp_data_3052
// Write conn log slices (as record batches) to the stream. for (auto& slice : zeek_conn_log) writer.write(slice); - // Cause the writer to close its current Arrow writer by switching the layout. - REQUIRE(writer.layout(::arrow::schema({}))); // Deserialize record batches, store them in arrow_table_slic...
codereview_cpp_data_3057
is_bn ? context.m_damping_bn_act : context.m_damping_act, is_bn ? context.m_damping_bn_err : context.m_damping_err, is_gru ? m_learning_rate_factor_gru : m_learning_rate_factor, m_print_matrix, m_print_matrix_summary, m_print_time); prof_region_end(("kfac-inverse/" + bl...
codereview_cpp_data_3064
} catch (const std::exception& e) { - std::cout << "Visualizer couldn't read " << attempts.back() << " because:\n" << e.what() << "\n"; return; We should probably update the exception message that the file could not be found and opened since t...
codereview_cpp_data_3070
SQLEXEC(); } - SQLPREP("UPDATE `%1users` SET `pw`=?, `salt`=?, `kdfmeter`=? WHERE `server_id` = ? AND `user_id`=?"); query.addBindValue(pwHash); query.addBindValue(saltHash); query.addBindValue(Meta::mp.kdfIterations); const QString &pw? SQLEXEC(); } + SQLPREP("UPDATE `%1users` SET `pw`=?, `salt`=?, `...
codereview_cpp_data_3073
return emitent.subscribe_on(rxcpp::observe_on_new_thread()); } - GossipPropagationStrategy::~GossipPropagationStrategy() {} - bool GossipPropagationStrategy::initQueue() { - return query_factory->createPeerQuery() | [](const auto &query) { return query->getLedgerPeers(); } | [](auto &&data) -...
codereview_cpp_data_3080
void addFormNote(const String& text, const String& id) { addRowLabel_tr_id("", id); - addHtmlDiv(F("note"), text); } // ******************************************************************************** Is that _Note:_ prefix no longer part of a note? I find it quite useful. void addFormNote(const String& text...
codereview_cpp_data_3085
} cvtsize = cvtindex; - cvt = realloc(cvt, cvtsize * sizeof(uint8)); /* Try to implant the new cvt table */ gic->cvt_done = 0; This is both not safe and does not match the `calloc` on line 695. } cvtsize = cvtindex; + cvt = realloc(cvt, cvtsize * 2 * sizeof(uint8)); /* Try to ...
codereview_cpp_data_3090
// Checks whether a component can be spawned at most once. bool is_singleton(const std::string& component) { - static detail::flat_set<std::string> singletons = {"archive", "index", - "consensus"}; - return singletons.find(component) != singletons.end(); } } // ...
codereview_cpp_data_3097
/* Load policy from / if SELinux is enabled, and we haven't already loaded * a policy. This is mostly for the "compose tree" case. */ - if (selinux) { glnx_autofd int host_rootfs_dfd = -1; /* Ensure that the imported packages are labeled with *a* policy if Though... this now overwrites ...
codereview_cpp_data_3105
errno = 0; if (env_ndevices_str != nullptr && env_rdevices_str != nullptr) { Impl::throw_runtime_exception( - "Error: cannot specify KOKKOS_NUM_DEVICES and KOKKOS_RAND_DEVICES. " "Raised by Kokkos::initialize(int narg, char* argc[])."); } int rdevices = -1; specify "both"...
codereview_cpp_data_3116
} void FreeOrionNode::send_chat_message(godot::String text) { - std::string text8 = std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t>{}.to_bytes(text.unicode_str()); m_app->Networking().SendMessage(PlayerChatMessage(text8, {}, false)); } Does Godot use UTF-16 internally on all platforms? } ...
codereview_cpp_data_3117
hasStatus = true; if (_textStatus) { - writer.writeAttribute("v", QString("%1").arg(w->getStatus().toTextStatus())); } else { QString("%1") not needed - OR I'm going to feel really dumb when it turns out I'm wrong :) hasStatus = t...
codereview_cpp_data_3125
* @param aBody Pointer to body. * @param rDirCos Orientation of the body with respect to the ground frame. */ -void SimbodyEngine::getDirectionCosines(const SimTK::State& s, const - OpenSim::Body &aBody, double *rDirCos) const { Mat33::updAs(rDirCos) = aBody.getMobilizedBody().getBodyRotatio...
codereview_cpp_data_3126
log_(logger::log("OrderingGate")) {} void OrderingGateTransportGrpc::propagateTransaction( - const std::shared_ptr<const shared_model::interface::Transaction> - &transaction) { log_->info("Propagate tx (on transport)"); auto call = new AsyncClientCall; Why pass pointer by reference? log...
codereview_cpp_data_3128
auto keysManager = iroha::KeysManagerImpl(FLAGS_name); if (not keysManager.createKeys(FLAGS_pass_phrase)) { logger->error("Keys already exist"); - return EXIT_FAILURE; } else { logger->info( "Public and private key has been generated in current directory"); Execution should...
codereview_cpp_data_3136
#define PROTO_DEVICE(T, Device) \ template class fully_connected_layer<T, data_layout::DATA_PARALLEL, Device>; \ - template class fully_connected_layer<T, data_layout::MODEL_PARALLEL, Device>; #define LBANN_INSTANTIATE_CPU_HALF #define LBANN_INSTANTIATE_GPU_HALF ```suggestion template class fully_connected_laye...
codereview_cpp_data_3144
if ( hero.HasArtifact( Artifact::BALLISTA ) ) catShots += Artifact( Artifact::BALLISTA ).ExtraValue(); - - const int maxCatShots = 3; - if ( catShots > maxCatShots ) { - catShots = maxCatShots; - } } u32 Battle::Catapult::GetDamage() const Hi @tau3 may be just change `extra` value for `...
codereview_cpp_data_3153
else { notRelevantChanges.add_sequence_number(seq_num, remoteReader); - remoteReader->set_change_to_status(seq_num, UNDERWAY, false); //TODO(Ricardo) Review } }; - remoteReader->for_each_unsent_change(unse...
codereview_cpp_data_3159
* * So, since the user is probably using this feature to test variable fonts, * ask them if they even want FontForge to force compatibility. */ -bool InterpolationSanity(SplineSet* base, SplineSet *other, int order2) { SplineSet *bss=NULL, *oss=NULL; int bmcc = 0, omcc = 0; if (base == NULL || othe...
codereview_cpp_data_3164
*/ #ifdef _WIN32 # include <ws2tcpip.h> -# ifndef AI_ADDRCONFIG -# define AI_ADDRCONFIG 0 -# endif -# ifndef AI_NUMERICSERV -# define AI_NUMERICSERV 8 -# endif #else # include <arpa/inet.h> # include <netdb.h> Please move the includes and defines (e.g. `AI_ADDRCONFIG`) mandatory to use the functions provided ...
codereview_cpp_data_3166
} key = pkidh.pkcs11_provider->load_private_key(certificate, file, password, exception); - - if ( nullptr == key ) - { - exception = _SecurityException_(std::string("PKCS11 URIs require libp11 ") + file); - } } else { Method `pkcs11_provider->load_privat...
codereview_cpp_data_3167
client_ctx->websocket_timeout = NULL; } client_ctx->ssl_ctx = self->config.ssl_ctx; - client_ctx->ssl_session_cache = h2o_cache_create(0, 4096, 86400 * 1000, h2o_socket_ssl_destroy_session_cache_entry); h2o_context_set_handler_context(ctx, &self->super, client_ctx); } Don't we need to set `...
codereview_cpp_data_3169
MODULE_END; -String ShaderGen::smCommonShaderPath(Con::getVariable("$Core::CommonShaderPath", "shaders/common")); ShaderGen::ShaderGen() { This will always evaluate to "shaders/common" as console subsystem won't be initialized until way later, unless it segfaults. Keep in mind when you do object initialization like...
codereview_cpp_data_3171
{ if (client->json.isnumeric()) { - return client->app->resendverificationemail_result((error)client->json.getint()); } else { client->json.storeobject(); - return client->app->resendverificationemail_result((error)API_EINTERNAL); } } This method returns `void`. A...
codereview_cpp_data_3173
opt_group{custom_options_, "vast"} .add<size_t>("table-slice-size", "Maximum size for sources that generate table slices."); - // Initialize factories. - factory<synopsis>::initialize(); - factory<table_slice>::initialize(); - factory<table_slice_builder>::initialize(); - factory<value_index>...
codereview_cpp_data_3179
void MainWindow::notifyUserAboutUpdate() { - QMessageBox::information(this, tr("Information"), tr("This server supports additional features that your client doesn't have.\nThis is most likely not a problem, but this message might mean there is a new version of Cockatrice available.\n\nTo update your client, go to ...
codereview_cpp_data_3182
using namespace iroha::ametsuchi; using PropagationData = GossipPropagationStrategy::PropagationData; -const shared_model::interface::types::PubkeyType empty_pubkey( - shared_model::crypto::Hash::fromHexString("")); - /** * Generates peers with empty pub keys * @param ids generated addresses of peers Variabl...
codereview_cpp_data_3186
} // Some times the interval could be negative if a writer expired during the call to this function - // Once in this situation there is not much we can do but let asio timers expire inmediately auto interval = timer_owner_->time - steady_clock::now(); timer_.update_interval_millisec((double)dura...
codereview_cpp_data_3190
// hook up stderr to a specially-named file // if (freopen(STDERR_FILE, "a", stderr) == NULL) { } // lower our priority if needed If this fails, then 'stderr' is not a valid file handler anymore, and then any further 'write' operations will fail. Maybe some handling of such...
codereview_cpp_data_3196
{ // Get the transform from the station's frame to the other frame SimTK::Vec3 currentLocation = get_location(); - return getReferenceFrame().findLocationInAnotherFrame(s, currentLocation, getModel().getGround()); } SimTK::Vec3 Station::findVelocityInGround(const SimTK::State& s) const The flavor here ...
codereview_cpp_data_3201
} if (!chat->title.empty()) { - char tstr[chat->title.size() * 4 / 3 + 4]; Base64::btoa((const byte *)chat->title.data(), chat->title.size(), tstr); cout << "\tTitle: " << tstr << endl; } } Local buffer of variable size. This probably won't compile on all platforms. ...
codereview_cpp_data_3205
const shared_model::interface::types::AccountIdType &account_id, const shared_model::interface::types::AssetIdType &asset_id, const std::string &amount, - const int precision) { std::string query = (boost::format( // clang-format off R"...
codereview_cpp_data_3217
ifs.close(); } else { // show message: - std::cout << "Can't open file " << filepath << "Log will not be created." << std::endl; return; } m_filesink = std::make_shared<spdlog::sinks::basic_file_sink_mt>(filepath); Should use the logger: `log_warn(...)`. We could add a ...
codereview_cpp_data_3236
ERR_ENTRY(S2N_ERR_INVALID_X509_EXTENSION_TYPE, "Invalid X509 extension type") \ ERR_ENTRY(S2N_ERR_INSUFFICIENT_MEM_SIZE, "The provided buffer size is not large enough to contain the output data. Try increasing the allocation size.") \ ERR_ENTRY(S2N_ERR_KEYING_MATERIAL_EXPIRED, "The lifetime of the connec...
codereview_cpp_data_3257
#define GJK_MAX_ITERATIONS 128 #ifdef BT_USE_DOUBLE_PRECISION - #define GJK_ACCURARY ((btScalar)1e-12) #define GJK_MIN_DISTANCE ((btScalar)1e-12) #define GJK_DUPLICATED_EPS ((btScalar)1e-12) #else - #define GJK_ACCURARY ((btScalar)0.0001) #define GJK_MIN_DISTANCE ((btScalar)0.0001) #define GJK_DUPLICATED_E...
codereview_cpp_data_3258
{ error e = (error)client->json.getint(); MegaApp *app = client->app; - if(!e || e == API_ESID) { if (client->sctable) { I think that API_ESID can't be received as a command-level response, only as a request-level response. { error e = (error)client->json.getint(); Mega...
codereview_cpp_data_3266
} /* Copy the CLIENT_HELLO -> SERVER_FINISHED hash. - * We'll need it later to calculate the application secrets. */ - if (s2n_conn_get_current_message_type(conn) == SERVER_FINISHED) { GUARD(s2n_tls13_conn_copy_server_finished_hash(conn)); } Does this need to be called in other TLS versi...
codereview_cpp_data_3277
void wlr_scene_node_reparent(struct wlr_scene_node *node, struct wlr_scene_node *new_parent) { if (node->parent == new_parent) { return; } Do we want to allow a node without any parent? I think I'd rather not. void wlr_scene_node_reparent(struct wlr_scene_node *node, struct wlr_scene_node *new_parent) ...
codereview_cpp_data_3293
const struct s2n_ecc_named_curve s2n_ecc_supported_curves[2] = { {.iana_id = TLS_EC_CURVE_SECP_256_R1, .libcrypto_nid = NID_X9_62_prime256v1, .name = "secp256r1"}, - {.iana_id = TLS_EC_CURVE_SECP_384_R1, .libcrypto_nid = NID_secp384r1, .name="secp384r1"}, }; static EC_KEY *s2n_ecc_generate_own_key(const stru...
codereview_cpp_data_3300
PYPKGCONFIG="$( cd "$PYLIBDIR/../../pkgconfig" && pwd )" export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$PYPKGCONFIG" echo "found python pkg_config information: $PYPKGCONFIG" - export PYTHON="${HOMEBREW_PREFIX}/bin/python" fi AM_PATH_PYTHON([2.7]) Are you sure we want hard overrides for these variables rathe...
codereview_cpp_data_3301
const TypeIdentifier *type_id_complete = objectFactory->get_type_identifier(dpst->getName(), true); const TypeObject *type_obj_complete = objectFactory->get_type_object(dpst->getName(), true); objectFactory->add_type_object(dpst->getName(), type_id_complete, type_obj_c...
codereview_cpp_data_3302
#include "common/byteutils.hpp" #include "cryptography/crypto_provider/crypto_defaults.hpp" -#include "cryptography/ed25519_sha3_impl/internal/sha3_hash.hpp" using iroha::operator|; Remove that header as well plz. Hash function can be replaced with custom blob #include "common/byteutils.hpp" #include "cryptograp...
codereview_cpp_data_3310
} else { rtps_participant_->update_attributes(rtps_participant_->getRTPSParticipantAttributes()); } } ```suggestion // Trigger update of network interfaces by calling update_attributes rtps_participant_->update_attributes(rtps_participant_->getRTPSParticipantAttrib...
codereview_cpp_data_3313
_engine->updatePalette( StandardPaletteIndexes() ); } -#if SDL_VERSION_ATLEAST( 2, 0, 0 ) && !defined( __WIN32__ ) - fheroes2::Size Display::getOutputSize() const - { - SDL_DisplayMode DM; - SDL_GetCurrentDisplayMode( 0, &DM ); - return fheroes2::Size( DM.w, DM.h ); - } -#end...
codereview_cpp_data_3315
// List the device outputs we wish to display during the simulation. std::vector<std::string> kneeDeviceOutputs{ "tension", "height" }; - std::vector<std::string> controllerOutputs{ "myo_control" }; // Add a ConsoleReporter to report deviceOutputs. //addDeviceConsoleReporterTo...
codereview_cpp_data_3323
} // namespace gui -} // namespace sofa \ No newline at end of file I think your editor remove empty line at end of file. I don't know if this is still an issue on linux? } // namespace gui \ No newline at end of file +} // namespace sofa
codereview_cpp_data_3327
case HPDT_AUTOTRADE_VEND: ret->HPDataSRCPtr = (void**)(&((struct autotrade_vending *)ptr)->hdata); ret->hdatac = &((struct autotrade_vending *)ptr)->hdatac; case HPDT_BGDATA: ret->HPDataSRCPtr = (void**)(&((struct battleground_data *)ptr)->hdata); ret->hdatac = &((struct battleground_data *)ptr)->...
codereview_cpp_data_3333
Steps for Matrix Expo 1. Create vector F1 : which is the copy of B. -2. Create transpose matrix (Learn more abput it on the llernet) 3. Perform T^(n-1) [transpose matrix to the power n-1] 4. Multiply with F to get the last matrix of size (1xk). The first element of this matrix is the required result. about and In...
codereview_cpp_data_3341
#ifdef ENABLE_SYNC if (e.getErrorCode() == API_EBUSINESSPASTDUE) { - //Ideally, this piece of code should be in MegaClient, but that would entail handling it for every request client->disableSyncs(BUSINESS_EXPIRED); } #endif This block can be moved to the new `checkError()`, which is c...
codereview_cpp_data_3349
} } void test_tree() { node *root = new node; root->val = 4; should perform self-check without manual intervention; something like below: ```cpp for(int i = 1; i < 8; i++) assert(root[i] == i); ``` } } +int arr[7] = { 0 };//for test tree use only +int index = 0;//for test tree use only +void te...
codereview_cpp_data_3350
double *T = new double[vT->m_AvailableSteps * readsize[0] * readsize[1]]; // Create a 2D selection for the subset - vT->SetSelection(offset_size_t, readsize_size_t); vT->SetStepSelection(0, vT->m_AvailableSteps); // Arrays are read by scheduling one or more of them @JasonRuonanWang please follow...
codereview_cpp_data_3359
//TODO add all the global variables to one object in the IDF IdfObject idfObject(openstudio::IddObjectType::EnergyManagementSystem_GlobalVariable); m_idfObjects.push_back(idfObject); - m_map.insert(std::make_pair(modelObject.handle(), idfObject)); //AddErlVariable s = modelObject.name(); Why are you do...
codereview_cpp_data_3360
const char * origTrueValue; const char * origFalseValue; - bool restoreAs = data->booleanRestore >= 0; if (value[0] == '1' && value[1] == '\0') { - if (restoreAs) { keySetMeta (key, "origvalue", data->booleans[data->booleanRestore].trueValue); } Inconsistent naming: restoreAs on the left side, Resto...
codereview_cpp_data_3366
m_sbes_array[gindex + i1mindex + j] = m_sbes_array[gindex + i1mindex + j - 2] - (2 * j - 1) / rb * m_sbes_array[gindex + i1mindex + j - 1]; - exts = m_sbes_array[gindex + (i - 1) * mindex + j - 2] - (2 * j - 1) / rb * m_sbes_array[gindex + i1mindex + j - 1]; m_sbes...
codereview_cpp_data_3371
} /* - * flb_sds_snprintf_realloc is a wrapper of snprintf. * The difference is that this function can increase the buffer of flb_sds_t. */ -int flb_sds_snprintf_realloc(flb_sds_t *str, size_t size, const char *fmt, ...) { va_list va; flb_sds_t tmp; I think this function is not necessary and we can si...
codereview_cpp_data_3372
#include "lbann/utils/lbann_library.hpp" #include "lbann/callbacks/callback_checkpoint.hpp" -#include "lbann/data_store/data_store_jag.hpp" namespace lbann { Why do you need to load a specific data reader in lbann_library? #include "lbann/utils/lbann_library.hpp" #include "lbann/callbacks/callback_checkpoint.hpp...
codereview_cpp_data_3383
#include "../Empire/EmpireManager.h" #include "../Empire/Supply.h" -#include <boost/algorithm/cxx11/all_of.hpp> #include <boost/algorithm/string/case_conv.hpp> #include <boost/bind.hpp> #include <boost/graph/adjacency_list.hpp> why boost not std? #include "../Empire/EmpireManager.h" #include "../Empire/Supply....
codereview_cpp_data_3390
"Number of bytes logged since service start"); METRIC_DEFINE_counter(tablet, log_wal_size, "Size of WAL Files", - yb::MetricUnit::kUnits, "Size of wal files"); METRIC_DEFINE_histogram(tablet, log_sync_latency, "Log Sync Latency", Lets make the units ...
codereview_cpp_data_3393
* @returns 0 on exit */ int main() { // the complete string const std::string s = "applepenapple"; // the dictionary to be used ```suggestion test(); // call the test function :) // the complete string ``` * @returns 0 on exit */ int main() { + test(); // call the test function :) + ...
codereview_cpp_data_3396
static string signupemail, signupname; // true by default, to register a new account v2 (false means account v1) -bool signupV2; // signup code being confirmed static string signupcode; Maybe we want to initialize to true as default value. ```suggestion bool signupV2 = true; ``` static string signupemail, signup...
codereview_cpp_data_3413
skill->level_set_value(tmp_db.num, 1); // Default 1 /* Interrupt Cast */ - if (libconfig->setting_lookup_bool(conf, "InterruptCast", &tmp_db.castcancel) == CONFIG_FALSE) - tmp_db.castcancel = 0; /* Cast Defense Rate */ libconfig->setting_lookup_int(conf, "CastDefRate", &tmp_db.cast_def_rate); Didn't we...
codereview_cpp_data_3416
DEV_TIMED_ABOVE("Stop worker", 100) while (m_state != WorkerState::Stopped) { - m_state_notifier.wait_for(l, chrono::microseconds(5)); - this_thread::sleep_for(chrono::milliseconds(20)); } } } I think this sleep_for is useless. DEV_TIMED_ABOVE("...
codereview_cpp_data_3422
{ allocated = TO_TADDR(heap.alloc_allocated); } - if (taddrObj >= TO_TADDR(dacpSeg.mem) && taddrObj && taddrObj < allocated) { rngSeg.segAddr = (TADDR)dacpSeg.segmentAddr; rngSeg.start = (TAD...
codereview_cpp_data_3429
deleteNode = true; } - mThread = std::thread ([this, deleteNode, node]() { LocalPath path; if (transfer->getParentPath()) { Mutual exclusion violated here. deleteNode = true; } + std::thread thread([this, deleteNode, node]() { LocalPath path; ...
codereview_cpp_data_3450
for (const auto& [key, value] : r) { auto us = duration_cast<microseconds>(value.duration).count(); auto rate = value.events * 1'000'000 / us; - record(self, key+".events", value.events); - record(self, key+".duration", us); - record(self, key+".rate", rate); } ...
codereview_cpp_data_3451
#include "s2n_test.h" #include "testlib/s2n_testlib.h" -#include <fcntl.h> - static uint32_t write_pem_file_to_stuffer_as_chain(struct s2n_stuffer *chain_out_stuffer, const char *pem_data) { struct s2n_stuffer chain_in_stuffer, cert_stuffer, temp_out_stuffer; s2n_stuffer_alloc_ro_from_string(&chain_in_stuf...
codereview_cpp_data_3452
#include <stdlib.h> #include <limits.h> -#ifndef _MSC_VER -#define MAY_HAVE_FTRUNCATE -#include <unistd.h> -#endif - #ifdef READTAGS_DSL #define xMalloc(n,Type) (Type *)eMalloc((size_t)(n) * sizeof (Type)) #define xRealloc(p,n,Type) (Type *)eRealloc((p), (n) * sizeof (Type)) Isn't this line redundant? If `WIN3...
codereview_cpp_data_3481
{ 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2 }, { 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2 } }; - unsigned char urtoll[5] = { 6, 7, 8, 9, 10 }; - unsigned char ultolr[5] = { 6, 5, 4, 3, 2 }; - unsigned char lltour[5] = { 14, 13, 12, 11, 10 }; - unsigned char lrtoul[5] = { 14, 15, 0, 1, 2 }; int mx, ...
codereview_cpp_data_3502
<< "DefaultPipeline::doCollisionReset" ; // clear all contacts - if (contactManager!=nullptr) { const helper::vector<Contact::SPtr>& contacts = contactManager->getContacts(); for (const auto& contact : contacts) Could you remember me how does the contact manager can return n...
codereview_cpp_data_3508
const std::string DISCOVERY_QUESTION = "Yo, can I play Free-O here, dog?"; const std::string DISCOVERY_ANSWER = "Word!"; #ifdef FREEORION_OPENBSD const int SOCKET_LINGER_TIME = 1 << (sizeof(unsigned short) * 4 - 1); #else const int SOCKET_LINGER_TIME = 1 << (sizeof(unsigned short) * 8 - 1); What ...
codereview_cpp_data_3511
POSIX_ENSURE_REF(conn); POSIX_GUARD(s2n_connection_free_managed_send_io(conn)); conn->send_io_context = ctx; - return 0; } int s2n_connection_set_recv_cb(struct s2n_connection *conn, s2n_recv_fn recv) This is the only one you didn't update ;) ```suggestion conn->send_io_context = ctx; return S2N_SU...
codereview_cpp_data_3512
{ } -//_____________________________________________________________________________ -/** -* Copy constructor. -* -* @param aWrapDoubleCylinderObst WrapDoubleCylinderObst to be copied. -*/ -WrapDoubleCylinderObst::WrapDoubleCylinderObst(const WrapDoubleCylinderObst& aWrapDoubleCylinderObst) -{ - constructPropertie...
codereview_cpp_data_3534
SP_ADD_CLASS_IN_FACTORY(TriangleSetTopologyModifier,sofa::component::topology::TriangleSetTopologyModifier) /// Custom Exception - const char* name = "Sofa.SofaException"; - const char* doc = "Base exception class for the SofaPython module." ; PyObject* PyExc_SofaException = PyErr_NewExceptionWithD...
codereview_cpp_data_3535
public: CommandExecutorTest() { domain_id = "domain"; - account_id = "id@" + domain_id; role_permissions.set( shared_model::interface::permissions::Role::kAddMySignatory); `"id"` repeats several times as well - maybe move it to named constant? public: Co...
codereview_cpp_data_3539
if ( System::IsFile( *it ) ) { if ( conf.Read( *it ) ) { isValidConfigurationFile = true; - std::string sval; - sval = conf.externalMusicCommand(); - if ( !sval.empty() ) - Music::SetExtCommand( sval ); ...
codereview_cpp_data_3540
} query q; q.cmd = query::erase{}; - auto rp = self->make_response_promise<atom::done>(); - return rp.delegate(self->state.store, q, all_ids); }, [self](atom::status, status_verbosity /*v*/) -> caf::config_value::dictionary { Isn't this just `self->delegate`? ...
codereview_cpp_data_3548
const Actions & plannedActions = _battlePlanner.planUnitTurn( arena, currentUnit ); actions.insert( actions.end(), plannedActions.begin(), plannedActions.end() ); // Do not end the turn if we only cast a spell - if ( !( plannedActions.size() == 1 && plannedActions.front().isType( MSG_B...