id stringlengths 21 25 | content stringlengths 164 2.33k |
|---|---|
codereview_cpp_data_764 | }
ViewingLayerPtr Layer::get_parent_layer_pointer(size_t index) const {
- if (index >= m_child_layers.size()) {
LBANN_ERROR(
"attempted to get pointer to parent ",index," of ",
get_type()," layer \"",get_name(),"\", ",
@timmoon10 this should be m_parent_layers.size()
}
ViewingLayerPtr Layer::g... |
codereview_cpp_data_767 | if (s2n_stuffer_space_remaining(stuffer) < n) {
if (stuffer->growable) {
/* Always grow a stuffer by at least 1k */
- uint32_t growth = MIN(n, 1024);
GUARD(s2n_stuffer_resize(stuffer, stuffer->blob.size + growth));
} else {
I think this should be MAX
if... |
codereview_cpp_data_772 | return CommitResult::ERROR_PARENT_HASH;
}
- block.header().setGasLimit(m_gasLimit);
- block.header().setGasUsed(block.gasUsed());
-
try
{
{
gassed should be stetted when finish the execution of block
return CommitResult::ERROR_PARENT_HASH;
}
try
{
... |
codereview_cpp_data_774 | if (it != m_fields.end())
{
- m_capacity -= (key.size() + it->second.size());
it->second = value;
- m_capacity += (key.size() + value.size());
}
else
{
m_fields.insert(std::make_pair(key, value));
- m_capacity += (key.size() + value.size());
}
m_... |
codereview_cpp_data_776 | , qos_(&qos == &TOPIC_QOS_DEFAULT ? participant_->get_default_topic_qos() : qos)
, listener_(listen)
, user_topic_(nullptr)
- , handle_()
, num_refs_(0u)
{
}
This is not necessary. Topic inherits from DomainEntity which already has instance_handle_
, qos_(&qos == &TOPIC_QOS_DEFAULT ? par... |
codereview_cpp_data_779 | c, "paths", H2O_CONFIGURATOR_FLAG_HOST | H2O_CONFIGURATOR_FLAG_EXPECT_MAPPING | H2O_CONFIGURATOR_FLAG_DEFERRED,
on_config_paths);
h2o_configurator_define_command(
- c, "strict-match", H2O_CONFIGURATOR_FLAG_HOST | H2O_CONFIGURATOR_FLAG_EXPECT_SCALAR | H2O_CONFIGURATOR_FLAG_D... |
codereview_cpp_data_803 | leaf_value_[0] = 0.0f;
leaf_weight_[0] = 0.0f;
leaf_parent_[0] = -1;
- internal_parent_[0] = -1;
shrinkage_ = 1.0f;
num_cat_ = 0;
cat_boundaries_.push_back(0);
how do the changes here and in `tree.h` relate to the R package?
leaf_value_[0] = 0.0f;
leaf_weight_[0] = 0.0f;
leaf_parent_[0] = ... |
codereview_cpp_data_804 | struct flb_dns_lookup_context *lookup_context;
lookup_context = (struct flb_dns_lookup_context *) event;
- if (0 == lookup_context->finished) {
event->handler(event);
- if (1 == lookup_context->finished) {
... |
codereview_cpp_data_808 | #include "backend/protobuf/proto_block_factory.hpp"
using namespace shared_model::proto;
ProtoBlockFactory::ProtoBlockFactory(
Capturing `block_payload`, which is a pointer, by reference? Is it good?
#include "backend/protobuf/proto_block_factory.hpp"
+#include "backend/protobuf/block.hpp"
+#include "backend/prot... |
codereview_cpp_data_817 | case TYPE_PUBLIC_LINK_INFORMATION: return "PUBLIC_LINK_INFORMATION";
case TYPE_GET_BACKGROUND_UPLOAD_URL: return "GET_BACKGROUND_UPLOAD_URL";
case TYPE_COMPLETE_BACKGROUND_UPLOAD: return "COMPLETE_BACKGROUND_UPLOAD";
- case TYPE_GET_CLOUDSTORAGEUSED: return "TYPE_GET_CLOUDSTORAGEUSED";... |
codereview_cpp_data_834 | EXPECT_NO_THROW(TopicPayloadPoolRegistry::release(pool_b2));
EXPECT_FALSE(pool_b2);
- // Repeat allocations and check a different pointer is returned
- cfg.memory_policy = DYNAMIC_RESERVE_MEMORY_MODE;
- pool_a3 = TopicPayloadPoolRegistry::get("topic_a", cfg);
- EXPECT_NE(pool_a3.get(), pool_backup... |
codereview_cpp_data_841 | m_Socket = zmq_socket(m_Context, ZMQ_REQ);
const std::string fullIP("tcp://" + m_IPAddress + ":" + m_Port);
int err = zmq_connect(m_Socket, fullIP.c_str());
if (m_Profiler.IsActive)
{
Does err need to be checked? What happens if zmq_connect fails?
m_Socket = zmq_s... |
codereview_cpp_data_847 | // ---------------------------------------------------------------------------
-TEST_F(CApi, use_proj4_init_rules__from_global_context) {
int initial_rules = proj_context_get_use_proj4_init_rules(nullptr, true);
proj_context_use_proj4_init_rules(nullptr, true);
```suggestion TEST_F(CApi, use_proj4_init_rule... |
codereview_cpp_data_850 | /* First Count the number of digits
in the given number */
while(temp != 0) {
- rem = temp%10;
temp /= 10;
count++;
}
Looks like the variable's value is never used here. ```suggestion ```
/* First Count the number of digits
in the given number */
whi... |
codereview_cpp_data_853 | if(priceTagSource1->isChecked())
source=1;
- QMetaObject::invokeMethod( settingsCache, "setPriceTagSource", Qt::QueuedConnection, Q_ARG(int, source));
}
MessagesSettingsPage::MessagesSettingsPage()
Is this different than using the slots mechanism?
if(priceTagSource1->isChecked())
sour... |
codereview_cpp_data_855 | }
void TSDescriptor::UpdateHeartbeat(const TSHeartbeatRequestPB* req) {
- std::lock_guard<decltype(lock_)> l(lock_);
- last_heartbeat_ = MonoTime::Now();
-
DCHECK_GE(req->num_live_tablets(), 0);
DCHECK_GE(req->leader_count(), 0);
num_live_replicas_ = req->num_live_tablets();
leader_count_ = req->leader_... |
codereview_cpp_data_857 | // if conversion failed, check for the "//" separator used in split cards
if (!convertSuccess) {
int cmcSum = 0;
- foreach (QString cmc, info->getCmc().split("//")) {
cmcInt = cmc.toInt();
cmcSum += cmcInt;
if (relationCheck(cmcInt)) {
can you change thi... |
codereview_cpp_data_860 | POSIX_ENSURE_REF(security_policy->signature_preferences);
POSIX_ENSURE_REF(security_policy->ecc_preferences);
- /* If the Security Policies Minimum version is higher than what libcrypto supports, return an error. */
POSIX_ENSURE((security_policy->minimum_protocol_version <= s2n_get_highest_fully_suppo... |
codereview_cpp_data_871 | conn->actual_protocol_version = S2N_TLS13;
EXPECT_SUCCESS(s2n_connection_set_config(conn, config));
- /* Check that s2n_is_pss_certs_supported() is a superset of s2n_is_rsa_pss_supported() */
- {
- if (s2n_is_pss_certs_supported()) {
- EXPECT_TRUE(s2n_is_rsa_pss... |
codereview_cpp_data_875 | //Insert the new char entry to the database
if( SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `class`, `zeny`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`,"
"`max_sp`, `sp`, `hair`, `hair_color`, `last_map`, `last_x`, `last_y`, `save_map`, `s... |
codereview_cpp_data_879 | },
[=](caf::error err) {
VAST_ERROR(self, "failed to load partition:", render(err));
self->quit(std::move(err));
});
return {
Let's double-check if we need to `deliver()` the outstanding evalutions here
},
[=](caf::error err) {
VAST_ERROR(self, "failed ... |
codereview_cpp_data_884 | {
bool ret;
- if (!strncmp(snapname, "ALL", strlen(snapname)))
ret = c->snapshot_destroy_all(c);
else
ret = c->snapshot_destroy(c, snapname);
`== 0` syntax, please
{
bool ret;
+ if (strncmp(snapname, "ALL", strlen(snapname)) == 0)
ret = c->snapshot_destroy_all(c);
else
ret = c->snapshot_destroy(... |
codereview_cpp_data_892 | .build();
}
-template <typename Builder>
-auto createValidQuery(Builder builder,
- const shared_model::crypto::Keypair &keypair) {
- return builder.signAndAddSignature(keypair).finish();
-}
-
template <typename Query>
auto createInvalidQuery(Query query,
const sh... |
codereview_cpp_data_909 | // bultin transport, and instead use a lossy shim layer variant.
auto testTransport = std::make_shared<test_UDPv4TransportDescriptor>();
testTransport->sendBufferSize = 1024;
testTransport->receiveBufferSize = 65536;
// We drop 20% of all data frags
testTransport->dropDataFragMessagesPerce... |
codereview_cpp_data_921 | log_->info("check proposal");
// fetch first proposal from proposal queue
ProposalType proposal;
- log_->info("fetching from queue");
fetchFromQueue(
proposal_queue_, proposal, proposal_waiting, "missed proposal");
- log_->info("validating proposal");
validation(proposal);
r... |
codereview_cpp_data_928 | btnGroup.createButton( area.x + 5, area.y + 222, okayButtonIcn, 0, 1, Dialog::OK );
btnGroup.createButton( area.x + 187, area.y + 222, cancelButtonIcn, 0, 1, Dialog::CANCEL );
- drawButtonWithShadow( fheroes2::AGG::GetICN( okayButtonIcn, 1 ), display, btnGroup.button( 0 ).area() );
- drawButtonWithShado... |
codereview_cpp_data_933 | * an undirected graph can be represented simply by storing each each as
* two directed edges in both directions.
*/
-typedef std::vector<std::vector<int> > adjacency_list;
/**
* \brief
```suggestion using adjacency_list = std::vector<std::vector<int>>; ```
* an undirected graph can be represented simply by... |
codereview_cpp_data_948 | }
fflush(output_model_file);
}
- fprintf(output_model_file, "feature importances=%s\n", FeatureImportance(models_.size()).c_str());
- fflush(output_model_file);
fclose(output_model_file);
}
I think it is better to put "feature importances=%s\n" into FeatureImportance function.
}
f... |
codereview_cpp_data_957 | };
static struct s2n_cipher_suite *s2n_tls13_null_key_exchange_alg_cipher_suites[] = {
- &s2n_tls13_aes_256_gcm_sha384, /* 0x13,0x02 */
&s2n_tls13_aes_128_gcm_sha256, /* 0x13,0x01 */
&s2n_tls13_chacha20_poly1305_sha256, /* 0x13,0x03 */
};
nit: reorder these.... |
codereview_cpp_data_966 | if (!checkSql())
return true;
- if (!usernameIsValid(user))
return true;
QSqlQuery *passwordQuery = prepareQuery("select password_sha512 from {prefix}_users where name = :name");
Is the query deleted by some other function? Will this leak?
if (!checkSql())
return true;
+ ... |
codereview_cpp_data_969 | *
*/
-int partition(int *arr, int low, int high) {
int pivot = arr[high]; // taking the last element as pivot
int i = (low - 1); // Index of smaller element
Would be better to use `std::vector` or `std::array` instead of C-style arrays.
*
*/
+int partition(vector<int> arr, int low, int high) {... |
codereview_cpp_data_971 | return str1 > str2;
}
-bool Army::isFootsloggingArmy() const
{
double meleeInfantry = 0;
double other = 0;
This method name is a bit confusing. Maybe we could rename it into isMeleeDominantArmy()? What do you think?
return str1 > str2;
}
+bool Army::isMeleeDominantArmy() const
{
double me... |
codereview_cpp_data_972 | ySize = p->srcPtr.ysize;
dstPitch = p->dstPtr.pitch;
}
-
hc::completion_future marker;
try {
if((widthInBytes == dstPitch) && (widthInBytes == srcPitch)) {
Think it is better to keep it here.
ySize = p->srcPtr.ysize;
dstPitch ... |
codereview_cpp_data_976 | wlr_log(L_DEBUG, "got shell surface toplevel");
struct wlr_wl_shell_surface *surface = wl_resource_get_user_data(resource);
- if (surface->transient_state != NULL) {
return;
}
- surface->toplevel = true;
- wl_signal_emit(&surface->events.set_toplevel, surface);
}
static void shell_surface_set_transient(struc... |
codereview_cpp_data_979 | UniValue generate(const UniValue ¶ms, bool fHelp)
{
- if (fHelp || params.size() < 1 || params.size() > 3)
- throw runtime_error("generate numblocks ( maxtries ) (genmode)\n"
"\nMine up to numblocks blocks immediately (before the RPC call returns)\n"
... |
codereview_cpp_data_981 | if(0){ // WIP(leveldb don't active) Send transaction data separated block to new peer.
logger::debug("peer-service") << "send all transaction infomation";
auto transactions = repository::transaction::findAll();
- int block_size = 500;
... |
codereview_cpp_data_983 | EXPECT_SUCCESS(s2n_connection_set_io_pair(server_conn, &io_pair));
EXPECT_SUCCESS(try_handshake(server_conn, client_conn, async_handler_sign_with_different_pkey_and_apply));
- EXPECT_EQUAL(async_handler_called, 1);
-
- /* Reset counter */
- async_handler_called... |
codereview_cpp_data_987 | std::sort(childrenNodes.begin(), childrenNodes.end(), comparatorFunction);
}
}
- return new MegaNodeListPrivate(childrenNodes.data(), int(childrenNodes.size()));;
}
MegaNodeList *MegaApiImpl::getVersions(MegaNode *node)
We could take this chance to apply the same improvements to the oth... |
codereview_cpp_data_1000 | {"swift-module-search-paths", OptionValue::eTypeFileSpecList, false, 0,
nullptr, nullptr,
"List of directories to be searched when locating modules for Swift."},
- {"swift-create-module-contexts-in-parallel", OptionValue::eTypeBoolean, false, true,
- nullptr, nullptr, "Create modules AST context... |
codereview_cpp_data_1007 | std::string classname = arg->getAttribute( "type", "");
std::string templatename = arg->getAttribute( "template", "");
templatename = sofa::defaulttype::TemplateAliases::resolveAlias(templatename); // Resolve template aliases
ClassEntryMap::iterator it = registry.find(classname);
if (it == registr... |
codereview_cpp_data_1011 | && (0xBF == mio_getc (mio)))
r = true;
- if (r && skipIfFound)
mio_rewind (mio);
return r;
}
Is this condition correct? Shouldn't be `! (r && skipIfFound)`?
&& (0xBF == mio_getc (mio)))
r = true;
+ if (! (r && skipIfFound))
mio_rewind (mio);
return r;
} |
codereview_cpp_data_1012 | parser::parseValue<boost::multiprecision::uint256_t>(params[2]);
auto precision = parser::parseValue<uint32_t>(params[3]);
if (not val_int or not precision) {
- std::cout << "Wrong format for amount or precision should be greater than 0" << std::endl;
return nullptr;
}
- ... |
codereview_cpp_data_1021 | return false;
},
[this](const auto &status) {
- log_->warn(
- "Received already processed batch. Duplicate transaction: {}",
- status.hash.hex());
return true;
});
});
From the log it will be uncl... |
codereview_cpp_data_1022 | */
void WrapTorus::constructProperties()
{
- constructProperty_inner_radius(1.0);
- constructProperty_outer_radius(1.0);
}
void WrapTorus::extendScale(const SimTK::State& s, const ScaleSet& scaleSet)
Consider using more reasonable defaults (inner radius of 0.05 cm, outer radius of 0.01 cm).
*/
void Wra... |
codereview_cpp_data_1023 | ametsuchi_factory_(std::move(factory)),
block_queries_(std::move(blockQuery)),
crypto_signer_(std::move(crypto_signer)),
- block_factory_(std::move(block_factory)) {
- log_ = logger::log("Simulator");
ordering_gate->on_proposal().subscribe(
proposal_subsc... |
codereview_cpp_data_1024 | return false;
}
if (last_tx_status_received) {
// force stream to end because no more tx statuses will arrive.
// it is thread safe because of synchronization on current_thread
return false;
}
-
- log_->debug("status written, ... |
codereview_cpp_data_1026 | }
auto const* comma = std::strchr(resource_str, ',');
- if (!comma || strncmp(resource_str, "id:", 3) != 0) {
std::ostringstream ss;
ss << "Error: invalid value of " << ctest_resource_group_id_name << ": '"
<< resource_str << "'. Raised by Kokkos::Impl::get_ctest_gpu().";
maybe extra paren aro... |
codereview_cpp_data_1030 | }
}
-CommandQueryBandwidthQuota::CommandQueryBandwidthQuota(MegaClient* client, m_off_t size)
{
cmd("qbq");
arg("s", size);
Shouldn't we return `API_EINTERNAL` in this case??
}
}
+CommandQueryTransferQuota::CommandQueryTransferQuota(MegaClient* client, m_off_t size)
{
cmd("qbq");
arg... |
codereview_cpp_data_1043 | # include "../../_Plugin_Helper.h"
# include "../Helpers/ESPEasyStatistics.h"
# include "../Static/WebStaticData.h"
-//HELPERS_ESPEASY_MATH_H //clumsy-stefan: what's this for?
#ifdef WEBSERVER_METRICS
#ifdef ESP32
# include <esp_partition.h>
#endif // ifdef ESP32
No idea why it ended up in the code. You can re... |
codereview_cpp_data_1048 | HifPackage *pkg = k;
/* Set noscripts since we already validated them above */
- if (!add_to_transaction (rpmdb_ts, pkg, tmp_metadata_dfd, TRUE,
- self->ignore_scripts,
cancellable, error))
goto out;
}
Change t... |
codereview_cpp_data_1049 | printf(" %-30s Add node id symbol tags in the makeflow log. (default is false)\n", " --log-verbose");
printf(" %-30s Run each task with a container based on this docker image.\n", "--docker=<image>");
printf(" %-30s Load docker image from the tar file.\n", "--docker-tar=<tar file>");
- printf(" %-30s Indicate ... |
codereview_cpp_data_1056 | */
#include <utils/s2n_socket.h>
void s2n_socket_read_snapshot_harness()
{
- struct s2n_socket_read_io_context *cbmc_allocate_s2n_socket_read_io_context();
/* Non-deterministic inputs. */
struct s2n_connection *s2n_connection = malloc(sizeof(*s2n_connection));
if (s2n_connection != NULL) {
(Nitpick - sa... |
codereview_cpp_data_1058 | std::move(cache),
std::move(proposal_factory),
std::move(tx_cache),
- initial_round,
max_number_of_transactions,
ordering_log_manager->getChild("Gate")->getLogger());
}
Header has to be fixed as well.
std::move(cache),
std::mov... |
codereview_cpp_data_1061 | argv[argc - 1] = NULL;
// check that the gpg binary exists and that it is executable
- if (isExecutable (argv[0], errorKey) < 0)
{
elektraFree (argv[0]);
return -1; // error set by isExecutable()
Why not free `argv[0]`?
argv[argc - 1] = NULL;
// check that the gpg binary exists and that it is executab... |
codereview_cpp_data_1068 | TEST(StatusConditionImplTests, notify_trigger)
{
- ConditionNotifier notifier;
StatusConditionImpl uut(¬ifier);
StatusMask mask_all = StatusMask::all();
Use StrictMock to fail if undesired mock calls are made. Specifically, we do not want calls to `notifier.notify` to occur when not expected. ```sugg... |
codereview_cpp_data_1073 | }
// Only the first time, initialize environment file watch if the corresponding environment variable is set
- if (m_RTPSParticipantIDs.empty())
{
if (!SystemInfo::get_environment_file().empty())
{
What if we create a participant, remove it, and create another one? Could we base thi... |
codereview_cpp_data_1081 | * OLD: This routine inverts this relation using the iterative scheme given
* by Snyder (1987), Eqs. (7-9) - (7-11).
*
- * NEW: This routine writes converts t = exp(-psi) to
*
* tau' = sinh(psi) = (1/t - t)/2
*
```suggestion * NEW: This routine converts t = exp(-psi) to ```
* OLD: This ... |
codereview_cpp_data_1084 | while(*c && isspacetab(*c))
c++;
- if(*c && (*c != ','))
{
paramBegin[iParamCount] = c;
c++;
Hum, won't this add one parameter too many, as it'll be entered by the closing `)`?
while(*c && isspacetab(*c))
c++;
+ if(*c && (*c != ',') && (*c != ')'))
{
paramBegin[iParamCount... |
codereview_cpp_data_1086 | boost::optional<std::unique_ptr<FlatFile>> FlatFile::create(
const std::string &path) {
- auto log_ = logger::log("KeyValueStorage::create()");
boost::system::error_code err;
if (not boost::filesystem::is_directory(path, err)
`FlatFile` seemed more appropriate, because this method is not called from `KeyV... |
codereview_cpp_data_1097 | stream << QString("%1 %2\n").arg(
card->getNumber()
).arg(
- card->getName().replace("//", "/").replace("Who / What / When / Where / Why", "Who/What/When/Where/Why")
);
}
}
Instead of hardcoding a specific card name, what about doing `.replace("//", "/").replac... |
codereview_cpp_data_1102 | lbann_data::LbannPB& p,
std::vector<int>& root_random_seeds,
std::vector<int>& random_seeds,
- std::vector<int>& data_seq_random_seeds,
- int procs_per_trainer)
{
if (!comm.am_world_master()) {
return... |
codereview_cpp_data_1104 | * 1) create a global script for running docker container
* 2) add this script to the global wrapper list
*/
- makeflow_create_docker_sh();
- //makeflow_wrapper_add_input_file(CONTAINER_SH);
- char global_cmd[64];
- sprintf(global_cmd, "./%s", CONTAINER_SH);
... |
codereview_cpp_data_1106 | }
}
}
- }
- for (handledrn_map::iterator it = hdrns.begin(); it != hdrns.end();)
- {
- (it++)->second->retry(API_OK);
}
}
Should the loop over `hdrns` (the direct read nodes) be included in this check for EPAYWALL? If we a... |
codereview_cpp_data_1112 | QSqlQuery *query = servatriceDatabaseInterface->prepareQuery(
"insert into {prefix}_uptime (id_server, timest, uptime, users_count, mods_count, mods_list, games_count, "
- "tx_bytes, "
- "rx_bytes) "
- "values(:id, NOW(), :uptime, :users_count, :mods_count, :mods_list, :games_count, :... |
codereview_cpp_data_1119 | // ...then pass those pairs one at a time through the merger, since it only merges pairs
NodeMap nodes = map->getNodeMap();
OsmMapPtr mergedMap(map);
- const ElementId firstId = ElementId::node(((nodes.begin()->second))->getId());
//LOG_DEBUG("First ID: " << firstId.getId());
- int count = 0;
... |
codereview_cpp_data_1120 | m_httpResponse = client
.request(web::http::methods::GET, builder.to_string())
.then([](web::http::http_response resp) { return resp.extract_utf8string(); })
- .then([this](std::string xml) {
auto remoteQueryResponse = processReply(xml);
if (remoteQueryResponse) {
... |
codereview_cpp_data_1126 | if ( !Parent::preload( server, errorBuffer ) )
return false;
- if( server ) return true;
-
// If we don't have a physics plugin active then
// we have to fail completely.
if ( !PHYSICSMGR )
This needs to be removed, it stops the TSShape and PhysicsCollisionRef from been created server side.
... |
codereview_cpp_data_1130 | EXPECT_SUCCESS(s2n_client_hello_send(client_conn));
EXPECT_SUCCESS(s2n_stuffer_copy(&client_conn->handshake.io, &server_conn->handshake.io,
s2n_stuffer_data_available(&client_conn->handshake.io)));
- if (s2n_is_tls_12_self_downgrade_required(client_conn)) {
- ... |
codereview_cpp_data_1131 | server->clientsLock.lockForRead();
while (allUsersIterator.hasNext()) {
Server_AbstractUserInterface *userHandler = server->findUser(allUsersIterator.next());
- if (userHandler)
- if (server->getStoreReplaysEnabled())
userHandler->sendProtocolItem(*sessionEvent);
... |
codereview_cpp_data_1146 | namespace config {
namespace detail {
-std::string appendSlashIfNeeded(const std::string& str) {
if (str.empty()) {
return std::string("/");
}
why camelCase name? (and below also)
namespace config {
namespace detail {
+std::string append_slash_if_needed(const std::string& str) {
if (str.empty()) {
... |
codereview_cpp_data_1153 | {
const char *cmd = argv[0], *opt_config_file = H2O_TO_STR(H2O_CONFIG_PATH);
int n, error_log_fd = -1;
- size_t num_threads = h2o_numproc();
- h2o_vector_reserve(NULL, &conf.thread_map, num_threads);
- for (n = 0; n < num_threads; n++)
conf.thread_map.entries[conf.thread_map.size++] = -1;
... |
codereview_cpp_data_1165 | cb = proceed_handshake;
break;
default:
cb = on_handshake_fail_complete;
break;
}
lgtm, thank you. suppose `PTLS_ERROR_STATELESS_RETRY` is OK to be handled here.
cb = proceed_handshake;
break;
default:
+ ... |
codereview_cpp_data_1168 | }
auto sql = std::make_unique<soci::session>(*connection_);
if (block_is_prepared) {
rollbackPrepared(*sql);
}
Please add a note here that it is safely rolled back because `createMutableStorage` is not called before `commitPrepared` in good case. Otherwise it is a bit confusing tha... |
codereview_cpp_data_1181 | if (!nodebyhandle(config.getRemoteNode()))
{
// remote node gone
- syncConfigs->remove(config.getLocalPath());
continue;
}
const auto e = addsync(config, DEBRISFOLDER, nullptr);
The sync should not be removed in this case. It would change the cur... |
codereview_cpp_data_1183 | // assumptions between DecorativeCylinder aligned with y and
// WrapCylinder aligned with z
ztoy.updR().setRotationFromAngleAboutX(SimTK_PI / 2);
- // B: base Frame (Body or Ground)
- // F: PhysicalFrame that this ContactGeometry is connected to
- // P: the frame defined... |
codereview_cpp_data_1184 | }
// what is the port chosen for the server?
- char addr[LINK_ADDRESS_MAX];
- int local = link_address_local(server_link, &addr, &server_port);
if(!local){
printf("could not get local address: %s\n", strerror(errno));
return 1;
The name of an array is the address of its first elemen... |
codereview_cpp_data_1192 | #ifdef AMREX_USE_HYPRE
if (init_hypre) {
HYPRE_Init();
-#ifdef AMREX_USE_CUDA
hypre_HandleDefaultExecPolicy(hypre_handle()) = HYPRE_EXEC_DEVICE;
hypre_HandleSpgemmUseCusparse(hypre_handle()) = 0;
#endif
```suggestion #if defined(AMREX_USE_HYPRE) && defined(HYPRE_USING_CUDA) if (init_h... |
codereview_cpp_data_1203 | });
PostgresOrderingServicePersistentState::create(pg_conn_).match(
- [&](expected::Value<std::shared_ptr<ametsuchi::PostgresOrderingServicePersistentState>> &_storage) {
- ordering_service_storage_ = _storage.value;
- },
[](expected::Error<std::string> &error) {
throw std::ru... |
codereview_cpp_data_1207 | const char *policy = rpmostree_sysroot_get_automatic_update_policy (sysroot_proxy);
g_print ("State: %s\n", txn_proxy ? "busy" : "idle");
- g_print ("Automatic Updates: ");
if (g_str_equal (policy, "none"))
g_print ("disabled\n");
else
Minor/bikeshed: lowercase `updates` to make consistent with "Avai... |
codereview_cpp_data_1218 | }
else
{
- ELEKTRA_SET_ERROR(97, parentKey, "Encountered a multiline value but multiline support is not enabled");
ret = -1;
}
}
Usability maybe not ideal here, please give a hint the user should read "kdb info ini"
}
else
{
+ ELEKTRA_SET_ERROR(97, parentKey, "Enco... |
codereview_cpp_data_1221 | if (owner && owner->IsClient()) {
if (!(owner->CastToClient()->ClientVersionBit() & EQ::versions::maskUFAndLater)) {
if ((typeofpet != petFamiliar && typeofpet != petAnimation) ||
- GetAA(aaAnimationEmpathy) >= 3) {
taunting=true;
}
}
We should check aabonuses.PetCommands array instead.
if ... |
codereview_cpp_data_1222 | * SPDX-License-Identifier: Apache-2.0
*/
-#include <validators/protobuf/proto_transaction_validator.hpp>
#include "model/sha3_hash.hpp"
#include "module/irohad/ametsuchi/ametsuchi_mocks.hpp"
#include "module/irohad/multi_sig_transactions/mst_mocks.hpp"
change to <> -> ""
* SPDX-License-Identifier: Apache-2.0... |
codereview_cpp_data_1227 | // front(), which will cause iterating over the *entire* trajectory. To
// prevent this, we have to detect if front().getTime() > endTime.
if (m_states.empty() || front().getTime() > endTime) {
- return makeIteratorRange(end(), end());
}
// Must add one to the last iterator since it's su... |
codereview_cpp_data_1252 | writer_two{write_two};
writer_one.join();
reader.join();
}
Why you removed that joins?
writer_two{write_two};
writer_one.join();
reader.join();
+ releaser.join();
} |
codereview_cpp_data_1260 | // diagonal move costs 50% extra
if ( direction & ( Direction::TOP_RIGHT | Direction::BOTTOM_RIGHT | Direction::BOTTOM_LEFT | Direction::TOP_LEFT ) )
- penalty *= 1.5;
return penalty;
}
Let's avoid type conversion here and use `penalty = penalty * 3 / 2;`. We really want to reduce the number of ... |
codereview_cpp_data_1266 | ASSERT_TRUE(account_asset);
ASSERT_EQ((*account_asset)->accountId(), account);
ASSERT_EQ((*account_asset)->assetId(), asset);
- ASSERT_EQ((*account_asset)->balance().toString(), amount.toString());
}
/**
```suggestion ASSERT_EQ((*account_asset)->balance(), amount); ```
ASSERT_TRUE(account_asset);
AS... |
codereview_cpp_data_1279 | emit muteDeafStateChanged();
}
-void ClientUser::setLocalVolume(float volume) {
- fLocalVolume = volume;
- emit muteDeafStateChanged();
-}
-
void ClientUser::setDeaf(bool deaf) {
bDeaf = deaf;
if (bDeaf)
Why do you need this? If this is not needed, I think you should just simply assign to fLocalVolume like I d... |
codereview_cpp_data_1282 | int max = security_policy->signature_preferences->signature_schemes[i]->maximum_protocol_version;
s2n_signature_algorithm sig_alg = security_policy->signature_preferences->signature_schemes[i]->sig_alg;
- if (min >= S2N_TLS13 || max <= S2N_TLS13) {
h... |
codereview_cpp_data_1283 | EXPECT_SUCCESS(s2n_tls13_keys_init(&secrets, S2N_HMAC_SHA256));
- struct s2n_psk *psk = NULL;
/* Derive Early Secrets */
- EXPECT_SUCCESS(s2n_tls13_derive_early_secrets(&secrets, psk));
S2N_BLOB_EXPECT_EQUAL(secrets.extract_secret, expected_early_secret);
S2N_BLOB_EXPECT_EQUAL(secrets.derive_s... |
codereview_cpp_data_1289 | nmax = 0;
rho = NULL;
fp = NULL;
- count_embed = NULL;
map = NULL;
type2frho = NULL;
looks good - except let's call this numforce[], similar to numneigh[], since it is the number of atoms within the force cutoff
nmax = 0;
rho = NULL;
fp = NULL;
+ numforce = NULL;
map = NULL;
type2frho ... |
codereview_cpp_data_1290 | };
} __attribute__((aligned(4)));
__device__ unsigned int __byte_perm(unsigned int x, unsigned int y, unsigned int s) {
struct uchar2Holder cHoldVal;
struct ucharHolder cHoldKey;
This struct is used by ```__byte_perm``` device function. So we cannot remove it.
};
} __attribute__((aligned(4)));
... |
codereview_cpp_data_1297 | RedistributeArmy( selectedTroop, destTroop, _army );
return true;
}
- else if ( destTroop.isValid() ) {
Army::SwapTroops( selectedTroop, destTroop );
return true;
}
:warning: **readability\-else\-after\-return** :warning: do not use `` else `` after `` return `` ```sugg... |
codereview_cpp_data_1307 | } else if (lhs.attr == system::type_atom::value) {
result_type result;
for (auto& [part_id, part_syn] : partition_synopses_)
- for (auto& pair : part_syn) {
- VAST_INFO(this, "checking", pair.first.name());
if (evaluate(pair.first.name(),... |
codereview_cpp_data_1313 | for (int i = 0; i < user_data_entries.size(); ++i) {
const std::string key = user_data_entries.getKeyAtIndex(i).m_string1;
const std::string* value = user_data_entries.getAtIndex(i);
- addUserData(bodyUniqueId, linkIndex, visualShapeIndex, key.c_str(), value->c_str(),
- value->size()+1, USER_DATA_VALUE_TYP... |
codereview_cpp_data_1316 | zero_vert_normal_bulk = zero_vert_normal_bulk_SSE;
#endif
}
- else if(Platform::SystemInfo.processor.properties & CPU_PROP_ALTIVEC)
- {
- #if defined(TORQUE_CPU_PPC)
- zero_vert_normal_bulk = zero_vert_normal_bulk_gccvec;
- #endif
- }
}
MODULE... |
codereview_cpp_data_1325 | int ret;
if (is_encrypt) {
- /* encrypt given data, witch the QUIC tag appended if necessary */
uint8_t srcbuf[src.len + sizeof(self->quic_tag)];
if (self->is_quic) {
memcpy(srcbuf, src.base, src.len);
This line has no effect? Did you mean `memcpy`?
int ret;
i... |
codereview_cpp_data_1330 | void Rpc::checkRequest(int _groupID)
{
- auto _nodeList = service()->getNodeListByGroupID(_groupID);
- if (_nodeList.size() == 0)
{
BOOST_THROW_EXCEPTION(
JsonRpcException(RPCExceptionType::GroupID, RPCMsg[RPCExceptionType::GroupID]));
}
auto it = std::find(_nodeList.begin()... |
codereview_cpp_data_1333 | const char* localname = ptr;
ptr += localnamelen;
- bool syncable = true;
if (hasExtensionBytes)
{
- syncable = MemAccess::get<bool>(ptr);
- ptr += sizeof(syncable);
for (int i = 7; i--;)
{
this function would benefit a lot from using CacheableReader/CacheableWrit... |
codereview_cpp_data_1339 | for (size_t i = 0; i < num_partitions; ++i) {
auto name = i % 2 == 0 ? "foo"s : "foobar"s;
auto& part = mock_partitions.emplace_back(std::move(name), ids[i], i);
- auto ps = make_partition_synopsis(part.slice, {});
meta_idx.merge(part.id, std::move(ps));
}
MESSAGE("verify genera... |
codereview_cpp_data_1343 | b->yy_bs_column = 0;
}
- b->yy_is_interactive = file ? (isatty( _fileno(file) ) > 0) : 0;
-
errno = oerrno;
}
I assume you're getting a warning only in Visual Studio about this as _fileno() doesn't exist anywhere else except in VC++'s headers. This change isn't acceptable. Define `_CRT_SECU... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.