aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorleak <leak@bitmx.net>2014-06-22 16:29:49 +0200
committerleak <leak@bitmx.net>2014-06-22 16:29:49 +0200
commitbfcbde1c97971211d2ecdf5c5f8033eb138658d1 (patch)
tree9d32b87a6d4ef9164faaeaf3eeb730cc368c1fe1
parentca3327dbed76d7d13b9e2754990b717267700be9 (diff)
Various cleanups and fixes due to feedback
-rw-r--r--src/server/shared/Configuration/Config.cpp10
-rw-r--r--src/server/shared/Cryptography/BigNumber.cpp4
-rw-r--r--src/server/shared/Cryptography/BigNumber.h2
-rw-r--r--src/server/shared/Utilities/Util.cpp7
-rw-r--r--src/server/worldserver/Master.cpp2
5 files changed, 11 insertions, 14 deletions
diff --git a/src/server/shared/Configuration/Config.cpp b/src/server/shared/Configuration/Config.cpp
index 95336457428..9e0e57eb198 100644
--- a/src/server/shared/Configuration/Config.cpp
+++ b/src/server/shared/Configuration/Config.cpp
@@ -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;
}
}
diff --git a/src/server/shared/Cryptography/BigNumber.cpp b/src/server/shared/Cryptography/BigNumber.cpp
index ed355b5f63c..c5e0635c5ec 100644
--- a/src/server/shared/Cryptography/BigNumber.cpp
+++ b/src/server/shared/Cryptography/BigNumber.cpp
@@ -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;
}
diff --git a/src/server/shared/Cryptography/BigNumber.h b/src/server/shared/Cryptography/BigNumber.h
index d0a09dca6c4..848b3da3e2d 100644
--- a/src/server/shared/Cryptography/BigNumber.h
+++ b/src/server/shared/Cryptography/BigNumber.h
@@ -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;
diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp
index f80730af05d..1290a7dbae4 100644
--- a/src/server/shared/Utilities/Util.cpp
+++ b/src/server/shared/Utilities/Util.cpp
@@ -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)
{
diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp
index 32ca89f3c45..765ab0f09a6 100644
--- a/src/server/worldserver/Master.cpp
+++ b/src/server/worldserver/Master.cpp
@@ -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*/)