id stringlengths 21 25 | content stringlengths 164 2.33k |
|---|---|
codereview_cpp_data_8626 | repl_module =
swift_ast->GetModule(g_repl_module_name, error);
if (repl_module == nullptr) {
- swift::ModuleDecl *repl_module = nullptr;
repl_module = swift_ast->CreateModule(g_repl_module_name, error);
const swift::SourceFile::ImplicitModuleImportKind implicit_import_kind =
... |
codereview_cpp_data_8636 | */
#include "mega/utils.h"
-#include "mega/base64.h"
namespace mega {
Cachable::Cachable()
We don't need bases64 here if the `pubk` parameter is in a binary format already.
*/
#include "mega/utils.h"
namespace mega {
Cachable::Cachable() |
codereview_cpp_data_8640 | client->isNewSession = false;
}
- fireOnRequestFinish(new MegaRequestPrivate(request), megaError);
-
#ifdef ENABLE_SYNC
- if (e == API_OK && resumeSyncs)
{
resumeActiveSyncs(request->getListener());
}
#endif
}
else // TYPE_CREATE_ACCOUNT
... |
codereview_cpp_data_8653 | plr[rid]._pInvincible = FALSE;
#ifndef HELLFIRE
PlacePlayer(rid);
hp = 640;
if (plr[rid]._pMaxHPBase < 640) {
hp = plr[rid]._pMaxHPBase;
}
-#else
- hp = 640;
#endif
SetPlayerHitPoints(rid, hp);
I would prefer two hellfire `ifdef`s to an `else`.
plr[rid]._pInvincible = FALSE;
#ifndef HELLF... |
codereview_cpp_data_8658 | */
const int linkStart = 0;
-int lineCount = 0;
static inline int linkPossible (int old, int new)
{
return (old == 0 || old == 5) && new == 2;
If possible this should be avoided. For this kind of tools its ok, but it is definitely a code smell.
*/
const int linkStart = 0;
static inline int linkPossible (in... |
codereview_cpp_data_8669 | void ServerRunner::shutdown() {
serverInstance_->Shutdown();
- while (!commandServiceHandler_->isShutdownCompletionQueue())
usleep(1); // wait for shutting down completion queue
commandServiceHandler_->shutdown();
}
Is it need?
void ServerRunner::shutdown() {
serverInstance_->Shutdown();
+ while (!... |
codereview_cpp_data_8672 | comm->intermodel_gather(score, score_list);
comm->intermodel_gather(score_samples, num_samples_list);
for (int i = 0; i < num_models; ++i) {
- std::cout << "Model " << i << " " << m->get_name() << " " << mode_string << " "
<< met->name() << " : "
... |
codereview_cpp_data_8673 | fz >> World::Get() >> conf >> GameOver::Result::Get() >> GameStatic::Data::Get();
// Settings should contain the full path to the current map file, if this map is available
conf.SetMapsFile( Settings::GetLastFile( "maps", System::GetUniversalBasename( conf.MapsFile() ) ) );
// TODO: starting from 0.... |
codereview_cpp_data_8691 | QString JobQueue::pop()
{
_mutex.lock();
- QString job = *_jobs.begin();
- _jobs.erase(_jobs.begin());
_mutex.unlock();
return job;
}
I think you have a race condition here. It is possible that queue->empty() could return false, then another thread pops the last job which would cause you to enter this me... |
codereview_cpp_data_8710 | /* Should throw an error if rewriting would require an invalid stuffer state.
* ( A write cursor being greater than the high water mark is an invalid stuffer state.) */
reservation.write_cursor = stuffer.high_water_mark + 1;
- EXPECT_FAILURE_WITH_ERRNO(s2n_stuffer_write_reservation(re... |
codereview_cpp_data_8715 | LOG(NET, "more getheaders (%d) to end to peer=%s (startheight:%d)\n", pindexLast->nHeight,
pfrom->GetLogName(), pfrom->nStartingHeight);
pfrom->PushMessage(NetMsgType::GETHEADERS, chainActive.GetLocator(pindexLast), uint256());
- CNodeState* state = State(pfrom->Get... |
codereview_cpp_data_8719 | El::Matrix<TensorDataType, Device>& mat) {
El::EntrywiseMap(
mat,
- {[](TensorDataType const& a) -> TensorDataType { return El::Sqrt(a); }});
}
template <typename TensorDataType, data_layout Layout, El::Device Device>
```suggestion {[](TensorDataType const& a) { return El::Sqrt(a); }}); ```
El::Mat... |
codereview_cpp_data_8722 | GUARD(s2n_stuffer_write_uint16(out, total_size));
/* Write server name extension */
- if (s2n_server_should_send_server_name(conn)) {
GUARD(s2n_stuffer_write_uint16(out, TLS_EXTENSION_SERVER_NAME));
GUARD(s2n_stuffer_write_uint16(out, 0));
}
Same thing above (L49)?
GUARD(s2n_s... |
codereview_cpp_data_8727 | { S2N_ERR_ECDHE_GEN_KEY, "Failed to generate an ECDHE key" },
{ S2N_ERR_ECDHE_SHARED_SECRET, "Error computing ECDHE shared secret" },
{ S2N_ERR_ECDHE_UNSUPPORTED_CURVE, "Unsupported EC curve was presented during an ECDHE handshake" },
- { S2N_ERR_ECDHE_SERIALIZING, "Error serializing ECDHE public" }
... |
codereview_cpp_data_8731 | connect(priceTagSource0, SIGNAL(toggled(bool)), this, SLOT(radioPriceTagSourceClicked(bool)));
connect(priceTagSource1, SIGNAL(toggled(bool)), this, SLOT(radioPriceTagSourceClicked(bool)));
QGridLayout *generalGrid = new QGridLayout;
generalGrid->addWidget(priceTagsCheckBox, 0, 0);
generalGrid-... |
codereview_cpp_data_8734 | auto src = unbox(caf::get_if<view<address>>(&src_field));
CHECK_EQUAL(src, unbox(to<address>("192.168.1.1")));
auto community_id_at = [&](size_t row) {
- auto id_field = slice->at(row, 6);
return unbox(caf::get_if<view<std::string>>(&id_field));
};
for (size_t row = 0; row < 44; ++row)
Can we lo... |
codereview_cpp_data_8744 | return 0;
}
- h2o_probe_log_request(&stream->req, stream->quic->stream_id);
-
/* change state */
set_state(stream, H2O_HTTP3_SERVER_STREAM_STATE_RECV_BODY_BEFORE_BLOCK);
Should we better log the request headers at an earlier point? I'd assume that we'd want to log the request headers wheneve... |
codereview_cpp_data_8756 | /* Determines if query_iana_id corresponds to a curve for these ECC preferences. */
bool s2n_ecc_preferences_includes(const struct s2n_ecc_preferences *ecc_preferences, uint16_t query_iana_id) {
- notnull_check(ecc_preferences);
for (size_t i = 0; i < ecc_preferences->count; i++) {
if (query_iana_id ... |
codereview_cpp_data_8757 | {
if (write (fd, buffer, sizeof (buffer)) != sizeof (buffer))
{
- // save the error state but keep on writing in the hope that further writes wont't fail
- error = 1;
}
}
- if (error)
- {
- goto error;
- }
-
return 1;
error:
Wouldn't that write a corrupted file?
{
if (write (fd, buffer, size... |
codereview_cpp_data_8761 | void s2n_mem_init_harness()
{
/* Operation under verification. */
- if(s2n_mem_init( ) == S2N_SUCCESS) {
assert(s2n_mem_is_init());
assert(s2n_mem_get_page_size() > 0);
assert(s2n_mem_get_page_size() <= UINT32_MAX);
We typically space between if and parenthesis.
void s2n_mem_init... |
codereview_cpp_data_8762 | #include <assert.h>
struct wlr_output_layout_state {
- struct wlr_box box;
};
struct wlr_output_layout_output_state {
struct wlr_output_layout *layout;
struct wlr_output_layout_output *l_output;
- struct wlr_box box;
bool auto_configured;
struct wl_listener resolution;
I put an underscore here to emphasize... |
codereview_cpp_data_8768 | if ( spell.MovePoint() ) {
text += '\n';
- text.append( _( "Move points: " ) );
- text += std::to_string( spell.MovePoint() );
}
const uint32_t answer = Dialog::Message( _( "Transcribe Spell Scroll" ), text, Font::BIG, Dialog::YES | D... |
codereview_cpp_data_8769 | * be found
* warnings will be reported to warningsKey
*/
-int ELEKTRA_PLUGIN_FUNCTION (resolver, filename)(Key * forKey, resolverHandle * p, Key * warningsKey)
{
if (!p)
{
there seem to be plenty of whitespace changes, please rerun scripts/reformat-source
* be found
* warnings will be r... |
codereview_cpp_data_8793 | }
#define PROTO(T) \
- template class data_type_layer<T>;
#define LBANN_INSTANTIATE_CPU_HALF
#include "lbann/macros/instantiate.hpp"
```suggestion template class data_type_layer<T> ```
}
#define PROTO(T) \
+ template class data_type_layer<T>
#define LBANN_INSTANTIATE_C... |
codereview_cpp_data_8794 | m_Port(port)
{
m_Context = zmq_ctx_new();
if (m_DebugMode)
{
// TODO verify port is unsigned int
Does this need to be checked for validity in case it fails or will it always be guaranteed to succeed?
m_Port(port)
{
m_Context = zmq_ctx_new();
+ if (m_Context == nullptr || m_Cont... |
codereview_cpp_data_8795 | KeySet * contract = ksNew (4,
keyNew ("system:/elektra/contract/highlevel/check/specproperlymounted", KEY_VALUE, "1", KEY_END),
- keyNew ("system:/elektra/contract/highlevel/check/spectoken/token", KEY_VALUE, "d1987403dc0042f18511dba2b212e33303ae715b69593d924f82710986cc75c0", KEY_END),
keyNew ("system:/elektra/co... |
codereview_cpp_data_8804 | //
bool cxxParserParseBlock(bool bExpectClosingBracket)
{
- cppSetExternalParserState(cppGetExternalParserState() + 1);
bool bRet = cxxParserParseBlockInternal(bExpectClosingBracket);
- cppSetExternalParserState(cppGetExternalParserState() - 1);
return bRet;
}
Does Cxx parser uses the value returned from cppGe... |
codereview_cpp_data_8817 | }
bool open(const char* filename) {
- char buf[256];
- sprintf(buf, "%s.gz", filename);
gz = gzopen(buf, "wb");
return gz != 0;
}
`gzvprintf()` is relatively new addition. RHEL 6 users are not going to like you using it and I don't think RHEL 7 users either. Another probl... |
codereview_cpp_data_8819 | s2n_blocked_status blocked;
EXPECT_NOT_NULL(conn);
- return s2n_negotiate(conn, &blocked);
/* verify client hello cb has been invoked */
EXPECT_EQUAL(ch_ctx->invoked, 1);
- return S2N_SUCCESS;
}
int server_recv(struct s2n_connection *conn)
Just wanted to verify this line, should the rest be... |
codereview_cpp_data_8822 | * extra file descriptor, the poll(2) call is straightforward
* for this use case.
*/
- FD_ZERO(&wait_set);
- FD_SET(fd, &wait_set);
pfd_read.fd = fd + 1;
pfd_read.events = POLLIN;
Now variable `fd_set wait_set`, FD_ZERO and FD_SET are useless.
* ... |
codereview_cpp_data_8823 | void MegaApiImpl::startUploadForSupport(const char *localPath, MegaTransferListener *listener)
{
- return startUpload(false, localPath, nullptr, nullptr, "supportdrop@mega.nz", -1, 0, false, nullptr, false, false, listener);
}
void MegaApiImpl::startDownload(bool startFirst, MegaNode *node, const char* localPath... |
codereview_cpp_data_8835 | {
for (int n=0; n<ncomp; ++n)
{
- face_linear_face_interp(i,j,k,n,0,fine_arr[0],crse_arr[0],mask_arr[0],ratio);
}
});
},
No, we do not need a sync here, because they are on... |
codereview_cpp_data_8838 | // The maximum length of a glyph's name is 31 chars.
#define MAXGLYPHNAME_LEN 31
unsigned int selectmax = fvmv_selectmax < 0 ? fv->b.sf->glyphcnt : fvmv_selectmax;
- char buf[selectmax * MAXGLYPHNAME_LEN], *pt;
char titlebuf[50+strlen(fv->b.sf->fontname)+1];
GTextInfo label;
int i,j,cnt;
L... |
codereview_cpp_data_8841 | bool Battle::Interface::IdleTroopsAnimation( void )
{
- bool redrawNeeded = false;
-
if ( Battle::AnimateInfrequentDelay( Game::BATTLE_IDLE_DELAY ) ) {
- redrawNeeded = arena.GetForce1().animateIdleUnits() || arena.GetForce2().animateIdleUnits();
}
- return redrawNeeded;
}
void Battle::Interf... |
codereview_cpp_data_8858 | Ef[2][2] = h_rate[2]/domain->zprd;
Ef[0][1] = Ef[1][0] = 0.5 * h_rate[5]/domain->yprd;
Ef[0][2] = Ef[2][0] = 0.5 * h_rate[4]/domain->zprd;
- Ef[1][2] = Ef[2][1] = 0.5 * h_rate[3]/domain->xprd;
// copy updated velocity/omega/angmom to the ghost particles
// no need to do this if not shearing ... |
codereview_cpp_data_8874 | mp_edpXML->loadXMLParticipantEndpoint(titleElement, pdata);
EXPECT_EQ(pdata->m_RTPSParticipantName, "HelloWorldSubscriber");
EXPECT_EQ(pdata->m_readers.size(), (size_t)1);
delete pdata;
}
pdata is created inside XMLEndpointParser, it does not need to be created in the Test, jus... |
codereview_cpp_data_8883 | memset(ctx->_module_configs, 0, sizeof(*ctx->_module_configs) * config->_num_config_slots);
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
- static int once = 0;
pthread_mutex_lock(&mutex);
- if (once == 0) {
- once++;
- h2o_socketpool_register_loop(&ctx->globalconf->proxy.... |
codereview_cpp_data_8886 | }
double tm2 = get_time();
do_preload_data_store();
- m_data_store->set_is_preloaded();
if(is_master()) {
std::cout << "Preload complete; time: " << get_time() - tm2 << std::endl;
}
`preload_data_store()` calls `set_is_preloaded` internally, so it should be sufficient to replace ```c+... |
codereview_cpp_data_8915 | hypre_bndry.reset(new MLMGBndry(ba, dm, ncomp, geom));
hypre_bndry->setHomogValues();
- const Real* dx = linop.m_geom[amrlev][mglev].CellSize();
int crse_ratio = linop.m_coarse_data_crse_ratio > 0 ? linop.m_coarse_data_crse_ratio : 1;
RealVect bclocation(AM... |
codereview_cpp_data_8920 | return;
}
- static_args += 2 * cgroup_num_hierarchies();
if (opts->user->verbose)
static_args++;
Stupid question, but why `2 *`? :)
return;
}
+ if (cgroup_num_hierarchies() > 0)
+ static_args += 2 * cgroup_num_hierarchies();
if (opts->user->verbose)
static_args++; |
codereview_cpp_data_8925 | double max_applied_impulse = m_use_multi_dof_params ? m_maxAppliedImpulseMultiDof[row % 3] : m_maxAppliedImpulse;
fillMultiBodyConstraint(constraintRow, data, 0, 0, constraintNormalAng,
btVector3(0,0,0), dummy, dummy,
- posError + velocityError,
infoGlobal,
-max_applied_impulse, ma... |
codereview_cpp_data_8928 | {
bool has_child_methods = false;
- if (is_dynamic_prop)
- {
- injectDynamicName (name, dprop);
- dprop = NULL;
- }
-
/* skip whatever is the value */
while (! isType (token, TOKEN_COMMA) &&
! isType (token, TOKEN_CLOSE_CURLY) &&
couldn't that be done ... |
codereview_cpp_data_8944 | conn->client = &conn->secure;
/* The client session key might have been set to the early traffic key.
- * This is not an problem for most libcrypto implementations, but in older
- * versions of OpenSSL will cause a memory leak when we call init again. */
POSIX_GUARD(conn->secu... |
codereview_cpp_data_8945 | CHECK(test_hipDeviceGetAttribute(deviceId, hipDeviceAttributeMaxTexture3DWidth, props.maxTexture3D[0]));
CHECK(test_hipDeviceGetAttribute(deviceId, hipDeviceAttributeMaxTexture3DHeight, props.maxTexture3D[1]));
CHECK(test_hipDeviceGetAttribute(deviceId, hipDeviceAttributeMaxTexture3DDepth, props.maxTextu... |
codereview_cpp_data_8958 | file->name);
flb_tail_file_remove(file);
}
- if (file->config->exit_on_eof) {
- flb_info("[in_tail] file=%s ended, stop", file->name);
- flb_engine_shutdown(config);
- exit(0);
- }
br... |
codereview_cpp_data_8964 | return 0;
const uint32_t unitsLeft = ( hp - damageTaken ) / Monster::GetHitPoints();
- return unitsLeft * ( Monster::GetDamageMin() + Monster::GetDamageMax() ) / 2;
}
u32 Battle::Unit::CalculateMinDamage( const Unit & enemy ) const
This is incorrect. We don't use Bless and Curse modificators here.
... |
codereview_cpp_data_8973 | }
const AccountResponse::AccountRolesIdType &AccountResponse::roles() const {
- return accountRoles_;
}
} // namespace proto
Please fix the naming of all the fields like that. Please use snake_case_ for them
}
const AccountResponse::AccountRolesIdType &AccountResponse::roles() const ... |
codereview_cpp_data_8974 | try {
LoadOpenSimLibrary("osimActuators");
testStates("arm26.osim");
- if (isGetRSSValid()) {
- testMemoryUsage("arm26.osim");
- testMemoryUsage("PushUpToesOnGroundWithMuscles.osim");
- }
}
catch (const Exception& e) {
cout << "testInitState ... |
codereview_cpp_data_8977 | void SynchronizerImpl::process_commit(network::Commit commit_message) {
log_->info("processing commit");
- auto top_block_height = block_query_factory_->createBlockQuery() |
- [](const auto &block_query) {
- return block_query->getTopBlockHeight();
- };
const auto &b... |
codereview_cpp_data_9000 | common_objects_factory_ =
std::make_shared<shared_model::proto::ProtoCommonObjectsFactory<
shared_model::validation::FieldValidator>>();
- perm_converter_ =
std::make_shared<shared_model::proto::ProtoPermissionToString>();
auto block_converter =
std::make_shared<shared_model::prot... |
codereview_cpp_data_9001 | l.request_output_values == r.request_output_values &&
l.declare_optimization_goal == r.declare_optimization_goal;
}
-template <typename Callback, typename... Args>
-void call_kokkos_callback(const Callback callback, bool ever_needs_fence,
Args... args) {
if (callback !... |
codereview_cpp_data_9006 | (((client->handshake.handshake_type) & HELLO_RETRY_REQUEST) \
&& ((server->handshake.handshake_type) & HELLO_RETRY_REQUEST))
-#define EXPECT_TICKETS_SENT(conn, count) do { \
- uint16_t _tickets_sent = 0; \
- EXPECT_SUCCESS(s2n_connection_get_tickets_sent(conn, &_tickets_sent)); \
- EXPECT_EQUAL(_tic... |
codereview_cpp_data_9007 | wl_signal_emit(&layout->events.destroy, layout);
- struct wlr_output_layout_output *output, *temp = NULL;
- wl_list_for_each_safe(output, temp, &layout->outputs, link) {
- wlr_output_layout_output_destroy(output);
}
free(layout->state);
should be `l_output` for consistency with the rest of the code.
wl_signa... |
codereview_cpp_data_9012 | ipv6deactivationtime = Waiter::ds;
// for IPv6 errors, try IPv4 before sending an error to the engine
- if ((dnsEntry.ipv4.size()
- && (!DNS_CACHE_EXPIRES || (Waiter::ds - dnsEntry.ipv4timestamp) < DNS_CACHE_TIMEOUT_DS))... |
codereview_cpp_data_9019 | return;
}
{
struct phr_header src_headers[MAX_HEADERS];
/* parse response */
How about creating a memory pool as a local variable of the function (i.e. `h2o_mem_pool_t pool; h2o_mem_init_pool(&pool)` at the top scope of the function), and allocate memory from that pool instead of c... |
codereview_cpp_data_9025 | if( !strmatch(tok,"ImageX:"))
{
#ifndef _NO_LIBPNG
ImageList *img = SFDGetImagePNG(sfd);
if ( !u->u.state.images )
A new ImageX label is fine (with me), but there shouldn't be new tags for every format that might be supported in the future. Move the reading of the mime type up to this level and for ... |
codereview_cpp_data_9033 | QMenu *Player::getCardMenu() const
{
- return aCardMenu->menu(); // can return nullptr
}
QString Player::getName() const
I don't like the removal of a NP check
QMenu *Player::getCardMenu() const
{
+ if (aCardMenu != nullptr) {
+ return aCardMenu->menu();
+ } else {
+ return nullptr;
+ ... |
codereview_cpp_data_9036 | creatorNameFilter = QString();
gameTypeFilter.clear();
maxPlayersFilterMin = 1;
- maxPlayersFilterMax = 99;
invalidateFilter();
}
I'd like to see the number here reused from a constant
creatorNameFilter = QString();
gameTypeFilter.clear();
maxPlayersFilterMin = 1;
+ maxPlayer... |
codereview_cpp_data_9042 | void USM_memcpy(void* dst, const void* src, size_t n) {
Experimental::SYCL().fence();
- auto event =
- USM_memcpy(*Kokkos::Experimental::Impl::SYCLInternal::singleton().m_queue,
- dst, src, n);
Experimental::Impl::SYCLInternal::fence(event);
}
} // namespace
Be consistent within the bod... |
codereview_cpp_data_9045 | EdgeDistanceExtractor::EdgeDistanceExtractor(ValueAggregatorPtr a, Meters spacing):
_aggregator(a)
{
setSpacing(spacing);
}
Again, should an "empty" shared pointer be replaced by the default aggregator?
EdgeDistanceExtractor::EdgeDistanceExtractor(ValueAggregatorPtr a, Meters spacing):
_aggregator(a)
{
... |
codereview_cpp_data_9049 | * supplied as quaternions and registered onto a subject via labeled markers *
* OR, by registering IMU rotations on to a model in the calibration pose. *
* *
-* Developed by AMJR Consulting for NSRDEC under subcontract No. XXXXXXXXX, *
... |
codereview_cpp_data_9058 | }
msg_info() << "Found " << m_linearSolvers.size() << " m_linearSolvers";
- for (auto & m_linearSolver : m_linearSolvers)
- msg_info() << m_linearSolver->getName();
}
void GenericConstraintCorrection::cleanup()
```suggestion for (auto & linearSolver : m_linearSolvers) msg_info() << linearSolver->... |
codereview_cpp_data_9067 | whitelist ${HOME}/.local/share/icons
whitelist ${HOME}/.local/share/mime
whitelist ${HOME}/.mime.types
-whitelist ${HOME}/.uim.d
whitelist ${HOME}/.sndio/cookie
# dconf
mkdir ${HOME}/.config/dconf
```suggestion whitelist ${HOME}/.sndio/cookie whitelist ${HOME}/.uim.d ```
whitelist ${HOME}/.local/share/icons
w... |
codereview_cpp_data_9074 | namespace {
bool CompareByHost(const TabletReplica& a, const TabletReplica& b) {
- TSRegistrationPB reg_a = a.ts_desc->GetRegistration();
- TSRegistrationPB reg_b = b.ts_desc->GetRegistration();
- if (!reg_a.common().http_addresses().empty() && !reg_b.common().http_addresses().empty()) {
- return reg_... |
codereview_cpp_data_9076 | d->should_read_archive = should_read_archive;
d->should_write_to_archive = should_write_to_archive;
- /* Makeflow fails by default if we goto FAILURE_LABEL.
This indicates we have correctly initialized. */
makeflow_failed_flag = 0;
while not needed, I would suggest a goto EXIT_WITH_FAILURE here.
d->should_... |
codereview_cpp_data_9085 | model::RolesResponse res{};
std::copy(response.roles().begin(),
response.roles().end(),
- res.roles.begin());
return res;
}
Can't find `res.roles` allocation, missed `std::back_inserter`?
model::RolesResponse res{};
std::copy(resp... |
codereview_cpp_data_9089 | tz.setZoneControlContaminantController(controllerClone);
}
- if( auto t_color = renderingColor() ) {
- auto colorClone = t_color->clone(model).cast<RenderingColor>();
- tz.setRenderingColor(colorClone);
- }
// DLM: do not clone zone mixing objects
@jmarrec all objects need to do this i... |
codereview_cpp_data_9096 | EnterCriticalSection(&sgMemCrit);
if (nNumberOfBytesToWrite) {
- if (log_file == (HANDLE)-1) {
log_file = log_create();
- if (log_file == (HANDLE)-1) {
nNumberOfBytesToWrite = 0;
return;
}
`winbase.h` defines `#define INVALID_HANDLE_VALUE (HANDLE)-1`, could be used here :)
EnterCriticalSect... |
codereview_cpp_data_9100 | AttachChild(m_icon);
m_link_text = new LinkText(GG::X0, GG::Y0, GG::X1, m_sitrep_entry.GetText() + " ",
- ClientUI::GetFont(ClientUI::Pts()),
GG::FORMAT_LEFT | GG::FORMAT_VCENTER | GG::FORMAT_WORDBREAK, ClientUI::Te... |
codereview_cpp_data_9108 | namespace
{
- auto getPressedBuildingHotkey() -> building_t
{
if ( HotKeyPressEvent( Game::EVENT_TOWN_CREATURE_1 ) ) {
return DWELLING_MONSTER1;
Why can't we just do `building_t getPressedBuildingHotkey()` ?
namespace
{
+ building_t getPressedBuildingHotkey()
{
if ( ... |
codereview_cpp_data_9125 | if (!rel->auto_prune && !g_hash_table_contains (used_refs, rel->ref))
{
g_autofree char *related_origin = NULL;
related_origin = flatpak_dir_get_origin (dir, rel->ref, NULL, NULL);
if (related_origin != NULL)
find_used_refs (dir, used_refs, rel->ref, related... |
codereview_cpp_data_9132 | // This shouldn't happen, as the SELECT is bounded by MAXTASKS
LogTasks(
- "Error: Task or activity_information ID ([{}], [{}]) out of range while loading activities from database",
task_id,
activity_id
);
Missing fmt string braces for `activity_id`
// This shouldn't happen, as the SELECT... |
codereview_cpp_data_9155 | request->setSessionKey(sid.c_str());
// chain a fetchnodes to get waitlink for ephemeral account
- requestMap.erase(request->getTag());
- int nextTag = client->nextreqtag();
- request->setTag(nextTag);
- requestMap[nextTag] = request;
-
client->fetchnodes();
}
void MegaApiImpl::sendsignupli... |
codereview_cpp_data_9160 | if(p) {
*p = 0;
if(!work_queue_task_specify_file(t, f, p + 1, WORK_QUEUE_INPUT, caching_flag)){
- fatal("Failed to specify file %s->%s in Work Queue", f, p+1);
}
*p = '=';
} else {
if(!work_queue_task_specify_file(t, f, f, WORK_QUEUE_INPUT, caching_flag)){
- fatal("Failed to spe... |
codereview_cpp_data_9161 | auto current_time = time_provider_->getCurrentTime();
auto size = data.size();
std::for_each(
- data.begin(), data.end(), [this, ¤t_time, &size](const auto &peer) {
auto diff = storage_->getDiffState(peer, current_time);
if (not diff.isEmpty()) {
log_->info... |
codereview_cpp_data_9170 | return false;
}
-bool ArtifactsBar::ActionBarCursor( const fheroes2::Point &, Artifact & art, const fheroes2::Rect & )
{
if ( isSelected() ) {
const Artifact * art2 = GetSelectedItem();
:warning: **readability\-named\-parameter** :warning: all parameters should be named in a function ```suggestion... |
codereview_cpp_data_9175 | rpmostree_origin_set_regenerate_initramfs (origin, self->regenerate, self->args);
rpmostree_sysroot_upgrader_set_origin (upgrader, origin);
- RpmOstreeSysrootUpgraderLayeringType layering_type;
- gboolean layering_changed = FALSE;
- if (!rpmostree_sysroot_upgrader_prep_layering (upgrader, &layering_type, &laye... |
codereview_cpp_data_9179 | TEST_P(PubSubBasic, BestEffortTwoWritersConsecutives)
{
- // Best effort incompatible with best effort
if (use_pull_mode)
{
return;
```suggestion // Pull mode incompatible with best effort ```
TEST_P(PubSubBasic, BestEffortTwoWritersConsecutives)
{
+ // Pull mode incompatible with best ef... |
codereview_cpp_data_9206 | LOG_VARD(poisMergedIntoPolys);
const QString description = MatchCreator::BaseFeatureTypeToString(featureType);
LOG_VARD(description);
- boost::shared_ptr<ElementCriterion> e_criterion(criterion);
double totalFeatures = 0.0;
totalFeatures =
_applyVisitor(
- map, FilteredVisitor(*(e_criterion->c... |
codereview_cpp_data_9209 | auto mst_transport = std::make_shared<MstTransportGrpc>();
auto mst_completer = std::make_shared<DefaultCompleter>();
auto mst_storage = std::make_shared<MstStorageStateImpl>(mst_completer);
- // TODO: @l4l magics should be fixed with options in cli branch
- // check #661 for details
... |
codereview_cpp_data_9214 | /**
* Set the integrator.
*/
-void Manager::setIntegrator(Integrator integMethod)
{
if (_timeStepper) {
std::string msg = "Cannot set a new integrator on this Manager";
Consider changing "method" to "type".
/**
* Set the integrator.
*/
+void Manager::setIntegrator(IntegratorType integType... |
codereview_cpp_data_9215 | int result = s2n_hmac_free(state);
/* Post-conditions. */
- assert (result == S2N_SUCCESS);
if (state != NULL) {
assert(state->inner.hash_impl->free != NULL);
assert(state->inner_just_key.hash_impl->free != NULL);
Nit: you put an extra space on this one, but not on the others. ```su... |
codereview_cpp_data_9218 | * code related to the symbol table. */
typedef enum {
/* parser private items */
- K_IGNORE = -16,
K_DEFINE,
K_UNDEFINED = KEYWORD_NONE,
/* the followings items are also used as indices for VerilogKinds[] and SystemVerilogKinds[] */
s it the best way to tag "foo" of "`define foo ..." with constant kind? Int... |
codereview_cpp_data_9220 | caf::actor_system sys{cfg};
fixup_logger(cfg);
// Print the configuration file(s) that were loaded.
- if (cfg.config_paths.size() == 1)
- VAST_INFO_ANON("loaded configuration file:", cfg.config_paths[0]);
- else if (!cfg.config_paths.empty())
- VAST_INFO_ANON("loaded configuration files:", cfg.config_p... |
codereview_cpp_data_9225 | uint16_t status;
Maps::FileInfo info;
int gameType;
- const uint16_t _saveFileVersion;
};
StreamBase & operator<<( StreamBase & msg, const HeaderSAV & hdr )
Strange but this member is not used anywhere.
uint16_t status;
Maps::FileInfo info;
int ga... |
codereview_cpp_data_9227 | {commit_round.block_round + 1, commit_round.reject_round}));
for (auto i = commit_round.reject_round + 1;
- i < commit_round.reject_round + 1 + proposal_limit + 2;
++i) {
generateTransactionsAndInsert({1, 2});
os->onCollaborationOutcome({commit_round.block_round, i});
Maybe better to ... |
codereview_cpp_data_9234 | /**
* @given initialized storage, all permissions
* @when get account transactions of non existing account
- * @then Return empty account transactions
*/
TEST_F(GetAccountTransactionsExecutorTest, InvalidNoAccount) {
addAllPerms();
```suggestion * @then Return error ```
/**... |
codereview_cpp_data_9266 | auto r_statistics_participant = statistics::dds::DomainParticipant::narrow(r_participant);
ASSERT_NE(nullptr, r_statistics_participant);
- // TODO: some topics get stuck in infinite loop in an error:
// [SUBSCRIBER Error] Change not found on this key, something is wrong -> Function remove_change_sub
... |
codereview_cpp_data_9267 | const Indexes around = Board::GetAroundIndexes( enemy->GetHeadIndex() );
std::set<const Unit *> targetedUnits;
- for ( Indexes::const_iterator it = around.begin(); it != around.end(); ++it ) {
- const Unit * monsterOnCell = Board::GetCe... |
codereview_cpp_data_9281 | namespace vast {
namespace {
-// Translates a key to directory.
auto key_to_dir(std::string key, const path& prefix) {
return prefix / detail::replace_all(std::move(key), ".", path::separator);
}
... `a key to a directory` or `keys to directories`.
namespace vast {
namespace {
+// Translates a key to a direc... |
codereview_cpp_data_9297 | {
#ifdef __linux__
if((fd = open(filename.getFullPath().c_str(), O_RDONLY)) < 0)
- msg_info() << "ERROR: impossible to open the file: " << filename.getValue();
#endif
if(p_outputFilename.isSet())
remove the "ERROR:" message
{
#ifdef __linux__
if((fd = open(filename.getFullPath().c_str(), O_... |
codereview_cpp_data_9304 | return 0;
}
-int link_ssl_wrap_server(struct link *link, const char *key, const char *cert) {
#ifdef HAS_OPENSSL
if(key && cert) {
- debug(D_TCP, "setting up ssl state for %s port %d", link->raddr, link->rport);
link->ctx = _create_ssl_context(/* is client */ 0);
_set_ssl_keys(link->ctx, key, cert);
Drop ... |
codereview_cpp_data_9307 | extern const struct batch_queue_module batch_queue_mesos;
extern const struct batch_queue_module batch_queue_k8s;
extern const struct batch_queue_module batch_queue_dryrun;
-#ifdef MPI
extern const struct batch_queue_module batch_queue_mpi;
#endif
Please change MPI to CCTOOLS_WITH_MPI
extern const struct batch_... |
codereview_cpp_data_9308 | {
/* Somehow, we have a deployment which has gpg-verify=true, but *doesn't* have a valid
* signature. Let's not just bomb out here. We need to return this in the variant so
- * that `status` can show "(unsigned)". */
*out_enabled = TRUE;
*out_results = NULL;
return TRUE;
... |
codereview_cpp_data_9320 | EXPECT_SUCCESS(s2n_connection_free(conn));
}
- /* No non-post handshake messages can be received, except HelloRetry during TLS1.2.
* This means that no handshake message that appears in the handshake state machine
* should be allowed, except TLS_HELLO_REQUEST.
... |
codereview_cpp_data_9335 | void PoliciesListBox::SizeMove(const GG::Pt& ul, const GG::Pt& lr) {
GG::Pt old_size = GG::Wnd::Size();
- double zoom_factor = 1;
auto policy_palette = Parent();
auto gov_wnd = std::dynamic_pointer_cast<GovernmentWnd>(policy_palette->Parent());
if (gov_wnd)
- zoom_factor = gov_wnd->GetPol... |
codereview_cpp_data_9345 | // it contains all of the useful sizing information in the first place,
// even though it does not derive from GG::Wnd and have a virtual
// MinUsableSize function.
- if(m_sizer) {
min_size += m_sizer->GetMinSize();
}
- if(m_options_bar) {
GG::Pt options_bar_min_size(m_option... |
codereview_cpp_data_9346 | namespace lbann {
namespace callback {
-void print_statistics::setup(model *m, const std::string& trainer_name) {
#ifdef LBANN_VERSION
lbann_comm *comm = m->get_comm();
if (comm->am_world_master()) {
```suggestion void print_statistics::setup(model *m, const std::string&) { ```
namespace lbann {
namespace ... |
codereview_cpp_data_9351 | *
* @author [Rakshit Raj](https://github.com/rakshitraj)
*/
-#include <cassert>
-#include <cstdint>
-#include <iostream>
-#include <vector>
/**
* @namespace sorting
Add a brief description of what each library does/adds (see the example below). ```c++ #include <iostream> /// for io operations #include <vector... |
codereview_cpp_data_9352 | if (!ISUNDEF(uh))
{
client->mapuser(uh, u->email.c_str());
- if (u->isTemporary && u->uid == u->email)
{
- char uid[12];
- Base64::btoa((byte*)&uh, Meg... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.