Various cleanups and fixes due to feedback

This commit is contained in:
leak
2014-06-22 16:29:49 +02:00
parent ca3327dbed
commit bfcbde1c97
5 changed files with 11 additions and 14 deletions

View File

@@ -35,13 +35,13 @@ bool ConfigMgr::LoadInitial(char const* file)
try
{
ptree temp;
boost::property_tree::ini_parser::read_ini(file, temp);
ptree fullTree;
boost::property_tree::ini_parser::read_ini(file, fullTree);
for (auto bla : temp)
// Since we're using only one section per config file, we skip the section and have direct property access
for (auto section : fullTree)
{
_config = bla.second;
_config = section.second;
break;
}
}

View File

@@ -168,7 +168,7 @@ bool BigNumber::isZero() const
return BN_is_zero(_bn);
}
std::unique_ptr<uint8> BigNumber::AsByteArray(int32 minSize, bool littleEndian)
std::unique_ptr<uint8[]> BigNumber::AsByteArray(int32 minSize, bool littleEndian)
{
int length = (minSize >= GetNumBytes()) ? minSize : GetNumBytes();
@@ -184,7 +184,7 @@ std::unique_ptr<uint8> BigNumber::AsByteArray(int32 minSize, bool littleEndian)
if (littleEndian)
std::reverse(array, array + length);
std::unique_ptr<uint8> ret(array);
std::unique_ptr<uint8[]> ret(array);
return ret;
}

View File

@@ -88,7 +88,7 @@ class BigNumber
uint32 AsDword();
std::unique_ptr<uint8> AsByteArray(int32 minSize = 0, bool littleEndian = true);
std::unique_ptr<uint8[]> AsByteArray(int32 minSize = 0, bool littleEndian = true);
char * AsHexStr() const;
char * AsDecStr() const;

View File

@@ -139,16 +139,13 @@ void stripLineInvisibleChars(std::string &str)
}
#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__))
struct tm* localtime_r(const time_t* time, struct tm *result)
{
#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__))
localtime_s(result, time);
return result;
#else
return localtime_r(&time, &result); // POSIX
#endif
}
#endif
std::string secsToTimeString(uint64 timeInSecs, bool shortText, bool hoursOnly)
{

View File

@@ -171,7 +171,7 @@ int Master::Run()
std::thread worldThread(WorldThread);
std::thread* cliThread = NULL;
std::thread* cliThread = nullptr;
#ifdef _WIN32
if (sConfigMgr->GetBoolDefault("Console.Enable", true) && (m_ServiceStatus == -1)/* need disable console in service mode*/)