1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Apply suggestions from code review

Co-authored-by: Nordsoft91 <nordsoft@yahoo.com>
This commit is contained in:
Andrey Filipenkov 2022-09-23 19:22:37 +03:00
parent 5f0a8419d3
commit 9f46bf5bff
5 changed files with 7 additions and 10 deletions

View File

@ -90,7 +90,7 @@ private:
std::shared_ptr<CLabel> labelTabTitle;
std::shared_ptr<CLabel> labelMapSizes;
ESelectionScreen tabType;
Rect inputNameRect;
Rect inputNameRect;
void parseMaps(const std::unordered_set<ResourceID> & files);
void parseSaves(const std::unordered_set<ResourceID> & files);

View File

@ -87,7 +87,7 @@ void setThreadName(const std::string &name)
#elif defined(__linux__)
prctl(PR_SET_NAME, name.c_str(), 0, 0, 0);
#elif defined(VCMI_APPLE)
pthread_setname_np(name.c_str());
pthread_setname_np(name.c_str());
#endif
}

View File

@ -27,7 +27,7 @@ namespace
template<typename Node>
Node & resolvePointer(Node & in, const std::string & pointer)
{
if (pointer.empty())
if(pointer.empty())
return in;
assert(pointer[0] == '/');
@ -36,12 +36,12 @@ Node & resolvePointer(Node & in, const std::string & pointer)
std::string entry = pointer.substr(1, splitPos - 1);
std::string remainer = splitPos == std::string::npos ? "" : pointer.substr(splitPos);
if (in.getType() == VCMI_LIB_WRAP_NAMESPACE(JsonNode)::JsonType::DATA_VECTOR)
if(in.getType() == VCMI_LIB_WRAP_NAMESPACE(JsonNode)::JsonType::DATA_VECTOR)
{
if (entry.find_first_not_of("0123456789") != std::string::npos) // non-numbers in string
if(entry.find_first_not_of("0123456789") != std::string::npos) // non-numbers in string
throw std::runtime_error("Invalid Json pointer");
if (entry.size() > 1 && entry[0] == '0') // leading zeros are not allowed
if(entry.size() > 1 && entry[0] == '0') // leading zeros are not allowed
throw std::runtime_error("Invalid Json pointer");
size_t index = boost::lexical_cast<size_t>(entry);

View File

@ -177,8 +177,5 @@ struct DLL_LINKAGE LobbyInfo : public LobbyState
TeamID getPlayerTeamId(PlayerColor color);
};
class ExceptionMapMissing : public std::exception {};
class ExceptionNoHuman : public std::exception {};
class ExceptionNoTemplate : public std::exception {};
VCMI_LIB_NAMESPACE_END

View File

@ -927,7 +927,7 @@ int main(int argc, char * argv[])
logConfig.configureDefault();
logGlobal->info(SERVER_NAME);
boost::program_options::variables_map opts;
boost::program_options::variables_map opts;
handleCommandOptions(argc, argv, opts);
preinitDLL(console);
settings.init();