id
stringlengths
27
29
content
stringlengths
226
3.24k
codereview_new_cpp_data_10558
bool SharedTaskManager::HandleCompletedActivities(SharedTask* s) std::array<bool, MAXACTIVITIESPERTASK> completed_steps; completed_steps.fill(true); auto activity_states = s->GetActivityState(); std::sort(activity_states.begin(), activity_states.end(), [](const auto& lhs, const auto& rhs) { return lhs.ste...
codereview_new_cpp_data_10559
void Client::CompleteConnect() if (GetGMInvul()) { state.emplace_back("invulnerable to all damage"); } - if (flymode == 1) { state.emplace_back("flying"); } - else if (flymode == 2) { state.emplace_back("levitating"); } if (tellsoff) { Can use `GravityBehavior::Flying` here maybe? void ...
codereview_new_cpp_data_10560
void Client::CompleteConnect() if (GetGMInvul()) { state.emplace_back("invulnerable to all damage"); } - if (flymode == 1) { state.emplace_back("flying"); } - else if (flymode == 2) { state.emplace_back("levitating"); } if (tellsoff) { Can use `GravityBehavior::Levitating` here maybe? v...
codereview_new_cpp_data_10561
bool SharedDatabase::SetGMFlymode(uint32 account_id, uint8 flymode) { auto a = AccountRepository::FindOne(*this, account_id); if (a.id > 0) { - a.flymode = flymode ? 1 : 0; AccountRepository::UpdateOne(*this, a); } Does this allow flymodes other than just Fly Mode 0 (Ground) and Fly Mode 1 (Flying)? Ther...
codereview_new_cpp_data_10562
void ConsoleGuildSay( } auto from = args[0]; - auto guild_id = std::stoul(args[1]); auto join_args = args; join_args.erase(join_args.begin(), join_args.begin() + 2); Since `stoul` can throw you might want to just use `strtoul` here and abort if 0 to avoid crashing world with a bad input void ConsoleGuil...
codereview_new_cpp_data_10563
void command_reload(Client *c, const Seperator *sep) return; } - ServerPacket* pack; if (is_aa) { c->Message(Chat::White, "Attempting to reload Alternate Advancement Data globally."); Initialize this with `= nullptr` since it might contain a non-null garbage value void command_reload(Client *c, const...
codereview_new_cpp_data_10564
void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac } // Character does not have the required skill. - if(spec.skill_needed > 0 && user->GetSkill(spec.tradeskill) < spec.skill_needed ) { // Notify client. user->Message(Chat::Red, "You are not skilled enough."); user->QueuePa...
codereview_new_cpp_data_10565
void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac } // Character does not have the required skill. - if(spec.skill_needed > 0 && user->GetSkill(spec.tradeskill) < spec.skill_needed ) { // Notify client. user->Message(Chat::Red, "You are not skilled enough."); user->QueuePa...
codereview_new_cpp_data_10588
OSIMMOCO_API void RegisterTypes_osimMoco() { Object::registerType(MocoMarkerTrackingGoal()); Object::registerType(MocoMarkerFinalGoal()); Object::registerType(MocoContactTrackingGoal()); - Object::registerType(MocoContactTrackingGoalGroup()); - Object::registerType(MocoContactImpulseTracki...
codereview_new_cpp_data_11561
bool SecurityManager::discovered_participant( restore_discovered_participant_info(participant_data.m_guid, remote_participant_info); return returnedValue; } I think we should add the following code here: ``` if (notify_part_authorized) { notify_participant_authorized(participant...
codereview_new_cpp_data_11562
void PDPSimple::announceParticipantState( { auto endpoints = static_cast<fastdds::rtps::SimplePDPEndpoints*>(builtin_endpoints_.get()); StatelessWriter& writer = *(endpoints->writer.writer_); - WriterHistory& history = *endpoints->writer.history_; PDP::announceParticipantState(...
codereview_new_cpp_data_11563
#include <statistics/rtps/StatisticsBase.hpp> #include <fastdds/rtps/reader/RTPSReader.h> - -#include "../../types/types.h" using namespace eprosima::fastdds::statistics; Maybe this could point to <statistics/types/types.h> instead of a relative path #include <statistics/rtps/StatisticsBase.hpp> #inclu...
codereview_new_cpp_data_11564
#include "LogMacros.hpp" #include <gtest/gtest.h> -// Check that logInfo logWarning and logError and its private ones does not exist. TEST_F(LogMacrosTests, check_old_not_compiled) { ```suggestion // Check that logInfo, logWarning and logError and its private definitions does not exist. ``` #include "Log...
codereview_new_cpp_data_11565
XMLP_ret XMLParser::parseXMLEnumDynamicType( XMLP_ret ret = XMLP_ret::XML_OK; const char* enumName = p_root->Attribute(NAME); - if(enumName == nullptr) { logError(XMLPARSER, "Error parsing 'enum' type. No name attribute given."); return XMLP_ret::XML_ERROR; Uncrustify fails here:...
codereview_new_cpp_data_11566
void DynamicDataHelper::print_complex_element( MemberId id, const std::string& tabs) { -<<<<<<< HEAD - const TypeDescriptor* desc = data->type_->get_type_descriptor(); - switch(desc->get_kind()) -======= DynamicData* st_data = data->loan_value(id); const TypeDescriptor* desc = st_dat...
codereview_new_cpp_data_11567
struct Arg : public option::Arg bool msg) { char* endptr = 0; - if ( option.arg != nullptr) { strtol(option.arg, &endptr, 10); if (endptr != option.arg && *endptr == 0) ```suggestion if ( option.arg != nullptr ) ``` struct Arg : public o...
codereview_new_cpp_data_11568
void set_attributes_from_qos( attr.multicastLocatorList = qos.endpoint().multicast_locator_list; attr.remoteLocatorList = qos.endpoint().remote_locator_list; attr.historyMemoryPolicy = qos.endpoint().history_memory_policy; - attr.setUserDefinedID((uint8_t)qos.endpoint().user_defined_id); - attr.se...
codereview_new_cpp_data_11569
RTPSWriter* RTPSDomain::createRTPSWriter( WriterHistory* hist, WriterListener* listen) { - RTPSParticipantImpl* impl = RTPSDomainImpl::find_local_participant(p->getGuid()); - if (impl) - { - RTPSWriter* ret_val = nullptr; - if (impl->create_writer(&ret_val, watt, payload_pool,...
codereview_new_cpp_data_11570
ReturnCode_t DataWriterImpl::check_qos( logError(RTPS_QOS_CHECK, "DATA_SHARING cannot be used with memory policies other than PREALLOCATED."); return ReturnCode_t::RETCODE_INCONSISTENT_POLICY; } - if (qos.resource_limits().max_samples < - (qos.resource_limits().max_instances * qos....
codereview_new_cpp_data_11571
ReturnCode_t TopicImpl::check_qos( return ReturnCode_t::RETCODE_INCONSISTENT_POLICY; } } - if (qos.resource_limits().max_samples < - (qos.resource_limits().max_instances * qos.resource_limits().max_samples_per_instance)) { logError(DDS_QOS_CHECK, "max_samples shou...
codereview_new_cpp_data_11572
ReturnCode_t TopicImpl::check_qos_including_resource_limits( const TopicQos& qos, const TypeSupport& type) { - ReturnCode_t check_qos_return; - check_qos_return = check_qos(qos); - if (!check_qos_return) - { - return check_qos_return; - } - if (type->m_isGetKeyDefined) ...
codereview_new_cpp_data_11617
TreeLearner* TreeLearner::CreateTreeLearner(const std::string& learner_type, con if (config->num_gpu == 1) { return new CUDASingleGPUTreeLearner(config, boosting_on_cuda); } else { - Log::Fatal("cuda only supports training on a single GPU."); } } else { - Log::Fatal("cuda...
codereview_new_cpp_data_11620
ObjectiveFunction* ObjectiveFunction::CreateObjectiveFunction(const std::string& } else if (type == std::string("binary")) { return new CUDABinaryLogloss(config); } else if (type == std::string("lambdarank")) { - Log::Warning("Objective lambdarank is not implemented in cuda_exp version. Fall back...
codereview_new_cpp_data_11630
void Metadata::Init(data_size_t num_data, int32_t has_weights, int32_t has_init_ num_data_ = num_data; label_ = std::vector<label_t>(num_data_); if (has_weights) { - weights_ = std::vector<label_t>(num_data_, 0.0f); num_weights_ = num_data_; weight_load_from_file_ = false; } if (has_init_sc...
codereview_new_cpp_data_11663
auto PythonServer::FillListPlayers(std::vector<PlayerSetupData>& players) const const py::extract<py::list> py_players(r); if (py_players.check()) { py::stl_input_iterator<PlayerSetupData> players_begin(py_players), players_end; - players.reserve(std::distance(players_begin, players_end)); ...
codereview_new_cpp_data_11664
auto PythonServer::FillListPlayers(std::vector<PlayerSetupData>& players) const const py::extract<py::list> py_players(r); if (py_players.check()) { py::stl_input_iterator<PlayerSetupData> players_begin(py_players), players_end; - players.reserve(std::distance(players_begin, players_end)); ...
codereview_new_cpp_data_11666
#include "../util/i18n.h" namespace ValueRef { - const std::string& MeterToName(const MeterType& meter); } UniverseObject::UniverseObject(UniverseObjectType type, std::string name, `MeterType` is an enum so is better passed by value in cases like this #include "../util/i18n.h" namespace ValueRef { + ...
codereview_new_cpp_data_11667
MeterType NameToMeter(const std::string_view name) { return MeterType::INVALID_METER_TYPE; } -const std::string_view MeterToName(const MeterType meter) { return NAME_BY_METER[static_cast<std::underlying_type_t<MeterType>>(meter) + 1]; } I'd add a comment here noting that the lowest value for `meter` s...
codereview_new_cpp_data_11668
double Variable<double>::Eval(const ScriptingContext& context) const { IF_CURRENT_VALUE(double) - const std::string property_name = m_property_name.empty() ? "" : m_property_name.back(); if (m_ref_type == ReferenceType::NON_OBJECT_REFERENCE) { if ((property_name == "UniverseCentreX") || why...
codereview_new_cpp_data_11669
namespace { // shouldn't be possible to instantiate with this block enabled, but if so, // try to generate some useful compiler error messages to indicate what // type MappedObjectType is - // TODO: Unused alias? using GenerateCompileError = typename Mappe...
codereview_new_cpp_data_11670
unsigned int ValueTest::GetCheckSum() const { std::unique_ptr<Condition> ValueTest::Clone() const { return std::make_unique<ValueTest>(*this); } /////////////////////////////////////////////////////////// // Location // ///////////////////////////////////////////////...
codereview_new_cpp_data_11677
int s2n_config_set_status_request_type(struct s2n_config *config, s2n_status_req S2N_ERROR_IF(type == S2N_STATUS_REQUEST_OCSP && !s2n_x509_ocsp_stapling_supported(), S2N_ERR_OCSP_NOT_SUPPORTED); POSIX_ENSURE_REF(config); - config->ocsp_status_requested_by_user = type == S2N_STATUS_REQUEST_OCSP; r...
codereview_new_cpp_data_11678
int s2n_connection_set_config(struct s2n_connection *conn, struct s2n_config *co conn->multirecord_send = true; } - /* Users can enable OCSP status requests via s2n_config_set_status_request_type. - * To ensure backwards compatibility, s2n_config_set_verification_ca_location can - * also ena...
codereview_new_cpp_data_11679
int s2n_connection_get_session(struct s2n_connection *conn, uint8_t *session, si POSIX_ENSURE_REF(session); const int len = s2n_connection_get_session_length(conn); const size_t size = len; - if (len == 0) { return 0; } - POSIX_ENSURE(size < max_length, S2N_ERR_SERIALIZED_SESSI...
codereview_new_cpp_data_11680
S2N_RESULT s2n_early_data_record_bytes(struct s2n_connection *conn, ssize_t data if (data_len < 0 || !s2n_is_early_data_io(conn)) { return S2N_RESULT_OK; } - /* Check to ensure data_len is non-negative */ - RESULT_ENSURE_GTE(data_len, 0); /* Ensure the bytes read are within the bounds o...
codereview_new_cpp_data_11681
static int s2n_utf8_string_from_extension_data(const uint8_t *extension_data, ui int len = ASN1_STRING_length(asn1_str); if (out_data != NULL) { - POSIX_ENSURE(*out_len >= (uint32_t) len, S2N_ERR_INSUFFICIENT_MEM_SIZE); /* ASN1_STRING_data() returns an internal pointer to the data. ...
codereview_new_cpp_data_11682
static int s2n_rsa_decrypt(const struct s2n_pkey *priv, struct s2n_blob *in, str /* Safety: RSA_private_decrypt does not mutate the key */ int r = RSA_private_decrypt(in->size, (unsigned char *) in->data, intermediate, s2n_unsafe_rsa_get_non_const(priv_key), RSA_NO_PADDING); - POSIX_ENSURE((i...
codereview_new_cpp_data_11683
int s2n_kem_client_key_send(struct s2n_connection *conn, struct s2n_blob *shared POSIX_ENSURE_REF(shared_key); S2N_ERROR_IF(shared_key != &(conn->kex_params.kem_params.shared_secret), S2N_ERR_SAFETY); - const struct s2n_kem_preferences *kem_pref = NULL; - POSIX_GUARD(s2n_connection_get_kem_preference...
codereview_new_cpp_data_11684
bool s2n_kem_preferences_includes_tls13_kem_group(const struct s2n_kem_preferenc return false; } -/* Whether the client should include the length prefix in the PQ TLS 1.3 KEM KeyShares that it sends. Earlier drafts of - * the PQ TLS 1.3 standard required length prefixing, and later drafts removed this length p...
codereview_new_cpp_data_11685
const struct s2n_kem_group *ALL_SUPPORTED_KEM_GROUPS[S2N_SUPPORTED_KEM_GROUPS_CO * The old format is used by draft 0 of the Hybrid PQ TLS 1.3 specification, and all revisions of the Hybrid PQ TLS 1.2 * draft specification. Only draft revisions 1-5 of the Hybrid PQ TLS 1.3 specification use the new format. */ -in...
codereview_new_cpp_data_11686
static int s2n_client_key_share_recv_pq_hybrid(struct s2n_connection *conn, stru bool is_hybrid_share_length_prefixed = 0; uint16_t actual_hybrid_share_size = key_share->blob.size; - /* The length of the hybrid key share must be one of two possible lengths. It's internal values are either length *...
codereview_new_cpp_data_11687
int s2n_config_set_ktls_mode(struct s2n_config *config, s2n_ktls_mode ktls_mode) config->ktls_send_requested = true; break; case S2N_KTLS_MODE_SEND: config->ktls_send_requested = true; break; case S2N_KTLS_MODE_RECV: config->ktls_recv_r...
codereview_new_cpp_data_11688
static int s2n_server_cert_status_request_send(struct s2n_connection *conn, stru static bool s2n_server_cert_status_request_should_send(struct s2n_connection *conn) { - return conn->config->status_request_type != S2N_STATUS_REQUEST_NONE; } Why not == S2N_STATUS_REQUEST_OCSP? static int s2n_server_cert_statu...
codereview_new_cpp_data_11689
int wait_for_shutdown(struct s2n_connection *conn, int fd) } /* Otherwise, IO errors are fatal and should be investigated */ fprintf(stderr, "Unexpected IO error during shutdown: %s\n", strerror(errno_val)); - exit(1); default: - ...
codereview_new_cpp_data_11690
int s2n_server_status_request_recv(struct s2n_connection *conn, struct s2n_stuff /* Old-style extension functions -- remove after extensions refactor is complete */ -/* used in fuzz test */ int s2n_recv_server_status_request(struct s2n_connection *conn, struct s2n_stuffer *extension) { return s2n_extension...
codereview_new_cpp_data_11691
struct s2n_cipher_suite *cipher_suites_cloudfront_tls_1_2_2017[] = { &s2n_ecdhe_rsa_with_aes_256_cbc_sha384, &s2n_ecdhe_ecdsa_with_aes_256_cbc_sha, &s2n_ecdhe_rsa_with_aes_256_cbc_sha, &s2n_ecdhe_rsa_with_aes_128_cbc_sha, &s2n_rsa_with_aes_128_gcm_sha256, &s2n_rsa_with_aes_256_gcm_sha384,...
codereview_new_cpp_data_11692
static int s2n_signature_scheme_valid_to_accept(struct s2n_connection *conn, con POSIX_ENSURE_LTE(conn->actual_protocol_version, scheme->maximum_protocol_version); } - if (conn->actual_protocol_version >= S2N_TLS13 - || conn->actual_protocol_version == S2N_UNKNOWN_PROTOCOL_VERSION) { ...
codereview_new_cpp_data_11693
static int s2n_signature_scheme_valid_to_accept(struct s2n_connection *conn, con if (conn->actual_protocol_version >= S2N_TLS13) { POSIX_ENSURE_NE(scheme->hash_alg, S2N_HASH_SHA1); POSIX_ENSURE_NE(scheme->sig_alg, S2N_SIGNATURE_RSA); - } - - if (conn->actual_protocol_version < S2N_TLS13) {...
codereview_new_cpp_data_11694
#include "tls/extensions/s2n_extension_type.h" #include "tls/s2n_cipher_suites.h" #include "tls/s2n_security_policies.h" -#include "tls/s2n_signature_algorithms.h" #include "tls/s2n_tls13_secrets.h" #include "utils/s2n_mem.h" #include "utils/s2n_random.h" Is this include needed? #include "tls/extensions/s2n_...
codereview_new_cpp_data_11774
void handle_controllers_ControllerSettingsPage(controllerIndex_t controllerindex const protocolIndex_t ProtocolIndex = getProtocolIndex_from_ControllerIndex(controllerindex); addRTDControllerButton(Protocol[ProtocolIndex].Number); if (Settings.Protocol[controllerindex]) { Please do not include this ...
codereview_new_cpp_data_11775
bool CPlugin_014(CPlugin::Function function, struct EventStruct *event, String& cmd = F("GPIO,"); cmd += valueName.substring(gpio_value_tag_length).toInt(); // get the GPIO - if ((equals(event->String2, F("true"))) || (equals(event->String2, F("1")))) { ...
codereview_new_cpp_data_11776
void handle_dumpcache() { if (isWrappedWithQuotes(sep)) { removeChar(sep, sep[0]); } - separator = sep[0]; - } - if (hasArg(F("jointimestamp"))) { - joinTimestamp = true; } if (hasArg(F("jointimestamp"))) { This seems to be duplicated? Or has GH messed something up? void handle_du...
codereview_new_cpp_data_11777
bool CPlugin_006(CPlugin::Function function, struct EventStruct *event, String& String name = topicSplit[4]; - if (name.equals(Settings.getUnitname())) { String cmd = topicSplit[5]; cmd += ','; This may break existing setups. bool CPlugin_006(CPlugin::Function function, stru...
codereview_new_cpp_data_11778
void html_add_script(bool defer) { if (defer) { addHtml(F(" defer")); } - addHtml(F(">")); } void html_add_script_end() { After your change, the "text" has been reduced to a single char. So it is better to use `addHtml('>');` which is of type `char` instead of a FlashString. A char is much smaller a...
codereview_new_cpp_data_11779
#include "../Helpers/StringConverter.h" -#include "..//Globals/Settings.h" // ******************************************************************************** // HTML string re-use to keep the executable smaller Double slash used, typo? #include "../Helpers/StringConverter.h" +#include "../Globals/Set...
codereview_new_cpp_data_11780
void handle_notifications() { } else { - //MFD: we display the GPIO - if (NotificationSettings.Pin1>=0){ - addHtml(F("GPIO-")); - addHtmlInt(NotificationSettings.Pin1); - } if (NotificationSettings.Pin2>=0) { html_...
codereview_new_cpp_data_11781
void handle_notifications() { } else { - //MFD: we display the GPIO - if (NotificationSettings.Pin1>=0){ - addHtml(F("GPIO-")); - addHtmlInt(NotificationSettings.Pin1); - } if (NotificationSettings.Pin2>=0) { html_...
codereview_new_cpp_data_11783
void ControllerSettingsStruct::reset() { MinimalTimeBetweenMessages = CONTROLLER_DELAY_QUEUE_DELAY_DFLT; MaxQueueDepth = CONTROLLER_DELAY_QUEUE_DEPTH_DFLT; MaxRetry = CONTROLLER_DELAY_QUEUE_RETRY_DFLT; - DeleteOldest = DEFAULT_MQTT_DELETE_OLDEST; ClientTimeout ...
codereview_new_cpp_data_11787
uint64_t OsmXmlWriter::getPos() return _fp->pos(); } -void OsmXmlWriter::flush() -{ - //if (_fp && _fp->isOpen()) - // _fp-> -} - void OsmXmlWriter::write(const ConstOsmMapPtr& map, const QString& path) { open(path); Is the flushing code not necessary or just not implemented yet? uint64_t OsmXmlWriter...
codereview_new_cpp_data_11789
static bool lclif_send_server_list(struct login_session_data *sd) packet->packet_id = HEADER_AC_ACCEPT_LOGIN; #else packet->packet_id = HEADER_AC_ACCEPT_LOGIN2; #endif packet->packet_len = length; packet->auth_code = sd->login_id1; Is this needed? You can use postHook and create a method in the plugin itsel...
codereview_new_cpp_data_11790
#include "flatbuffers/code_generators.h" #include "flatbuffers/flatbuffers.h" -#include "flatbuffers/flatc.h" #include "flatbuffers/idl.h" #include "flatbuffers/util.h" is this necessary? #include "flatbuffers/code_generators.h" #include "flatbuffers/flatbuffers.h" #include "flatbuffers/idl.h" #includ...
codereview_new_cpp_data_11851
void FlagTreeItem::showUnknownTokenMessage(const std::map<std::string, bool, Fla } std::stringstream tmp; - tmp << "Unknown token '" << token << "'" << ". The closest existing flags are:" << msgendl; for(auto& [name, score] : sofa::helper::getClosestMatch(token, allFlagNames, 2, 0.6)) { ...
codereview_new_cpp_data_11852
bool TopologicalMapping::checkTopologyInputTypes() { if (m_inputType == TopologyElementType::UNKNOWN) { - dmsg_error() << "The input TopologyElementType has not be set. Define 'm_inputType' to the correct TopologyElementType in the constructor."; return false; } if (m_outputType ...
codereview_new_cpp_data_11853
Edge2QuadTopologicalMapping::Edge2QuadTopologicalMapping() , d_nbPointsOnEachCircle( initData(&d_nbPointsOnEachCircle, "nbPointsOnEachCircle", "Discretization of created circles")) , d_radius( initData(&d_radius, 1_sreal, "radius", "Radius of created circles in yz plan")) , d_radiusFocal( initData(&d_ra...
codereview_new_cpp_data_11854
objectmodel::BaseObject::SPtr ObjectFactory::createObject(objectmodel::BaseConte { msg_error(object.get()) << "Requested template '" << usertemplatename << "' " << "cannot be found in the list of available templates [" << ss.str() << "]. " - ...
codereview_new_cpp_data_11855
void init() const char* getModuleComponentList() { /// string containing the names of the classes provided by the plugin - static std::string classes = core::ObjectFactory::getInstance()->listClassesFromTarget(sofa_tostring(SOFA_TARGET)); return classes.c_str(); } } // namespace sofa::component::anima...
codereview_new_cpp_data_11856
void init() const char* getModuleComponentList() { /// string containing the names of the classes provided by the plugin - static std::string classes = core::ObjectFactory::getInstance()->listClassesFromTarget(sofa_tostring(MODULE_NAME)); return classes.c_str(); } } // namespace sofa::component::anima...
codereview_new_cpp_data_11857
void CarvingManager::init() if (d_surfaceModelPath.getValue().empty()) { // We look for a CollisionModel identified with the CarvingSurface Tag. - std::vector<core::CollisionModel*> models; - getContext()->get<core::CollisionModel>(&models, core::objectmodel::Tag("CarvingSurface"), cor...
codereview_new_cpp_data_11858
void FixedConstraint<Rigid3Types>::draw(const core::visual::VisualParams* vparam std::vector< Vector3 > points; - if (d_fixAll.getValue() == true) { for (unsigned i = 0; i < x.size(); i++) points.push_back(x[i].getCenter()); ```suggestion if (d_fixAll.getValue()) `...
codereview_new_cpp_data_11859
std::string PluginManager::getDefaultSuffix() #endif } -auto PluginManager::loadPluginByPath(const std::string& pluginPath, std::ostream* errlog) -> PluginLoadStatus { if (pluginIsLoaded(pluginPath)) { not sure you want to print an error for already loaded plugins. There will be a lot of print at eac...
codereview_new_cpp_data_11860
bool Base::parseField( const std::string& attribute, const std::string& value) if (dataVec.empty() && linkVec.empty()) { std::vector<std::string> possibleNames; for(auto& data : m_vecData) possibleNames.emplace_back(data->getName()); for(auto& link : m_vecLink) ```sug...
codereview_new_cpp_data_11863
std::string BPBase::ReadBPString(const std::vector<char> &buffer, // static members const std::set<std::string> BPBase::m_TransformTypes = { {"unknown", "none", "identity", "bzip2", "sz", "zfp", "mgard", "png", - "blosc", "blosc2", "sirius", "mgardplus", "plugin"}}; const std::map<int, std::string> BPBas...
codereview_new_cpp_data_11936
void ImproperAmoeba::init_style() // check if PairAmoeba disabled improper terms Pair *pair = nullptr; - pair = force->pair_match("amoeba",1,0); - if (!pair) pair = force->pair_match("amoeba/gpu",1,0); - if (!pair) pair = force->pair_match("hippo",1,0); - if (!pair) pair = force->pair_match("hippo/gpu",1,0...
codereview_new_cpp_data_11937
void PairAmoeba::init_style() // request standard neighbor list - -// int irequest = neighbor->request(this,instance_me); - - // for DEBUGGING with GPU - //neighbor->requests[irequest]->half = 0; - //neighbor->requests[irequest]->full = 1; - neighbor->add_request(this); } More debug comments. The com...
codereview_new_cpp_data_11938
MLIAPModelPython::MLIAPModelPython(LAMMPS *lmp, char *coefffilename, bool is_chi MLIAPModelPython::~MLIAPModelPython() { - if (model_loaded) MLIAPPY_unload_model(this); - model_loaded=false; } /* ---------------------------------------------------------------------- model_loaded is an integer variable ...
codereview_new_cpp_data_11939
FixWallReflect::FixWallReflect(LAMMPS *lmp, int narg, char **arg) : for (int m = 0; m < nwall; m++) { if ((wallwhich[m] == XLO || wallwhich[m] == XHI) && domain->xperiodic) - error->all(FLERR,"Cannot use fix wall/reflect in xperiodic dimension"); if ((wallwhich[m] == YLO || wallwhich[m] == YHI) && ...
codereview_new_cpp_data_11964
void flb_ml_parser_destroy_all(struct mk_list *list) struct mk_list *head; struct flb_ml_parser *parser; - /* Ensure list is initialized */ - if (list->next == NULL) { - return; - } - mk_list_foreach_safe(head, tmp, list) { parser = mk_list_entry(head, struct flb_ml_parser, _h...
codereview_new_cpp_data_11965
static flb_sds_t add_aws_signature(struct flb_http_client *c, struct flb_bigquer signature = flb_signv4_do(c, FLB_TRUE, FLB_TRUE, time(NULL), ctx->aws_region, "sts", - 0, ctx->aws_provider); if (!signature) { flb_plg_error(ctx->ins, "Coul...
codereview_new_cpp_data_11966
static struct flb_config_map config_map[] = { "Set the parser" }, { - FLB_CONFIG_MAP_SIZE, "buffer_rcv_size", (char *)NULL, - 0, FLB_TRUE, offsetof(struct flb_syslog, buffer_rcv_size), "Set the socket receiving buffer size" }, /* EOF */ please rename it to `receive_buffer_si...
codereview_new_cpp_data_11967
static int get_mode(unsigned int attr) static int64_t filetime_to_epoch(FILETIME ft) { - int64_t ldap; /* * The LDAP timestamp represents the number of * 100-nanosecond intervals since Jan 1, 1601 UTC. */ - ldap = UINT64(ft.dwHighDateTime, ft.dwLowDateTime); - return (ldap / LDAP_...
codereview_new_cpp_data_11968
int api_v1_registration(struct flb_hs *hs) api_v1_metrics(hs); api_v1_plugins(hs); -#ifdef FLB_TRACE api_v1_trace(hs); -#endif // FLB_TRACE if (hs->config->health_check == FLB_TRUE) { api_v1_health(hs); wrong macro name int api_v1_registration(struct flb_hs *hs) api_v1_metrics(...
codereview_new_cpp_data_11980
bool OpenMP::in_parallel(OpenMP const &exec_space) noexcept { int OpenMP::impl_thread_pool_size() const noexcept { #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - return OpenMP::in_parallel() ? omp_get_num_threads() : (Impl::t_openmp_instance ? Impl::t_openmp_instance->m_...
codereview_new_cpp_data_11981
TEST(hpx, independent_instances_delayed_execution) { KOKKOS_LAMBDA(int) { ran() = true; }); #if defined(KOKKOS_ENABLE_HPX_ASYNC_DISPATCH) - ASSERT_TRUE(!ran()); #else ASSERT_TRUE(ran()); #endif ```suggestion ASSERT_FALSE(ran()); ``` TEST(hpx, independent_instances_delayed_execution) { KOK...
codereview_new_cpp_data_11982
void hpx_thread_buffer::resize(const std::size_t num_threads, } void *hpx_thread_buffer::get(std::size_t thread_num) const noexcept { - KOKKOS_ASSERT(thread_num < m_num_threads); if (m_data == nullptr) { return nullptr; } return &m_data[thread_num * m_size_per_thread]; } void *hpx_thread_buffer:...
codereview_new_cpp_data_11983
void hpx_thread_buffer::resize(const std::size_t num_threads, m_num_threads * m_size_per_thread + m_extra_space; if (m_size_total < size_total_new) { - delete[] m_data; - m_data = new char[size_total_new]; m_size_total = size_total_new; } } void *hpx_thread_buffer::get(std::size_t t...
codereview_new_cpp_data_11984
int get_device_count() { return acc_get_num_devices( Kokkos::Experimental::Impl::OpenACC_Traits::dev_type); #elif defined(KOKKOS_ENABLE_OPENMPTARGET) - return Kokkos::Experimental::OpenMPTarget::detect_device_count(); #else Kokkos::abort("implementation bug"); return -1; ```suggestion #elif define...
codereview_new_cpp_data_11994
namespace model { OS_ASSERT(getImpl<detail::ZoneAirHeatBalanceAlgorithm_Impl>()); setAlgorithm("ThirdOrderBackwardDifference"); - setDoSpaceHeatBalanceforSizing("No"); - setDoSpaceHeatBalanceforSimulation("No"); } /// @endcond Well see, why would we have a Default and yet still force them he...
codereview_new_cpp_data_11995
namespace model { OS_ASSERT(ok); ok = setOutdoorUnitEvaporatorRatedBypassFactor(0.4); OS_ASSERT(ok); - ok = ok = setOutdoorUnitCondenserRatedBypassFactor(0.2); OS_ASSERT(ok); ok = setDifferencebetweenOutdoorUnitEvaporatingTemperatureandOutdoorAirTemperatureinHeatRecoveryMode(5); OS_ASS...
codereview_new_cpp_data_11996
namespace model { bool ok = true; ok = setCompressorSpeed(compressorSpeed); OS_ASSERT(ok); - ok = setEvaporativeCapacityMultiplierFunctionofTemperatureCurve(evaporativeCapacityMultiplierFunctionofTemperatureCurve); - OS_ASSERT(ok); - ok = setCompressorPowerMultiplierFunctionofTemperatureCurve(c...
codereview_new_cpp_data_11997
TEST_F(ModelFixture, AirConditionerVariableRefrigerantFlow_addToNode) { TEST_F(ModelFixture, AirConditionerVariableRefrigerantFlow_Remove) { Model model; auto size = model.modelObjects().size(); AirConditionerVariableRefrigerantFlow vrf(model); EXPECT_EQ(0u, model.getObjectsByType(CurveQuadratic::iddObj...
codereview_new_cpp_data_11998
TEST_F(ModelFixture, AirConditionerVariableRefrigerantFlow_addToNode) { TEST_F(ModelFixture, AirConditionerVariableRefrigerantFlow_Remove) { Model model; auto size = model.modelObjects().size(); AirConditionerVariableRefrigerantFlow vrf(model); EXPECT_EQ(0u, model.getObjectsByType(CurveQuadratic::iddObj...
codereview_new_cpp_data_11999
namespace energyplus { std::vector<AirConditionerVariableRefrigerantFlowFluidTemperatureControl> vrfftcs = model.getConcreteModelObjects<AirConditionerVariableRefrigerantFlowFluidTemperatureControl>(); std::sort(vrfftcs.begin(), vrfftcs.end(), WorkspaceObjectNameLess()); - for (AirConditionerVariab...
codereview_new_cpp_data_12000
std::ostream& operator<<(std::ostream& os, const BoostMultiPolygon& boostPolygon return os; } -// Scale factor for parameters passed to boost -double scaleBy = 1000.0; // Cleans a polygon by shrinking and expanding. Can return multiple polygons std::vector<BoostPolygon> removeSpikesEx(const BoostPolygon& pol...
codereview_new_cpp_data_12001
namespace osversion { IdfObject newObject(iddObject.get()); for (size_t i = 0; i < object.numFields(); ++i) { - auto value = object.getString(i); - if (value) { if (i < 3) { newObject.setString(i, value.get()); } else { ```suggestion ...
codereview_new_cpp_data_12002
namespace energyplus { // for CeilingHeight, Volume, FloorArea: only FT if hard set (same logic as for ThermalZone) // CeilingHeight - if (modelObject.getDouble(OS_SpaceFields::CeilingHeight)) { - idfObject.setDouble(SpaceFields::CeilingHeight, modelObject.getDouble(SpaceFields::CeilingHeight).get(...
codereview_new_cpp_data_12003
namespace energyplus { // for CeilingHeight, Volume, FloorArea: only FT if hard set (same logic as for ThermalZone) // CeilingHeight - if (modelObject.getDouble(OS_SpaceFields::CeilingHeight)) { - idfObject.setDouble(SpaceFields::CeilingHeight, modelObject.getDouble(SpaceFields::CeilingHeight).get(...
codereview_new_cpp_data_12004
namespace energyplus { // for CeilingHeight, Volume, FloorArea: only FT if hard set (same logic as for ThermalZone) // CeilingHeight - if (modelObject.getDouble(OS_SpaceFields::CeilingHeight)) { - idfObject.setDouble(SpaceFields::CeilingHeight, modelObject.getDouble(SpaceFields::CeilingHeight).get(...
codereview_new_cpp_data_12005
namespace energyplus { boost::optional<IdfObject> ForwardTranslator::translateOutputConstructions(OutputConstructions& modelObject) { // If nothing to write, don't - bool constructions = modelObject.constructions(); - bool materials = modelObject.materials(); - if (!constructions && !materials) { ...
codereview_new_cpp_data_12006
namespace energyplus { boost::optional<IdfObject> ForwardTranslator::translateOutputConstructions(OutputConstructions& modelObject) { // If nothing to write, don't - bool constructions = modelObject.constructions(); - bool materials = modelObject.materials(); - if (!constructions && !materials) { ...
codereview_new_cpp_data_12007
TEST_F(ModelFixture, 4678_SurfaceGlassUFactorSqlError) { ASSERT_TRUE(surface->uFactor()); double uFactor = surface->uFactor().get(); - EXPECT_TRUE(openstudio::equal(0.310, uFactor, 1.0E-3)); ASSERT_TRUE(surface->thermalConductance()); double thermalConductance = surface->thermalConductance().get(); - ...