summaryrefslogtreecommitdiff
path: root/src/shared/util.cpp
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2015-01-04 10:33:37 +0100
committerTannin <devnull@localhost>2015-01-04 10:33:37 +0100
commitb415db619ed027ec2acd283983624293274b090f (patch)
tree3b09112799f2728229ed98bca7b342f1e8d1232a /src/shared/util.cpp
parentbd8267993d1ed0292200f3052e3c30d4fc9c84f7 (diff)
parentb2d04d70fc6284797e1bf29f55a375cb59d012be (diff)
Merge
Diffstat (limited to 'src/shared/util.cpp')
-rw-r--r--src/shared/util.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/shared/util.cpp b/src/shared/util.cpp
index d284b517..8f64277f 100644
--- a/src/shared/util.cpp
+++ b/src/shared/util.cpp
@@ -34,7 +34,7 @@ bool FileExists(const std::string &filename)
{
WIN32_FIND_DATAA findData;
ZeroMemory(&findData, sizeof(WIN32_FIND_DATAA));
- HANDLE search = ::FindFirstFileExA(filename.c_str(), FindExInfoStandard, &findData, FindExSearchNameMatch, NULL, 0);
+ HANDLE search = ::FindFirstFileExA(filename.c_str(), FindExInfoStandard, &findData, FindExSearchNameMatch, nullptr, 0);
if (search == INVALID_HANDLE_VALUE) {
return false;
} else {
@@ -47,7 +47,7 @@ bool FileExists(const std::wstring &filename)
{
WIN32_FIND_DATAW findData;
ZeroMemory(&findData, sizeof(WIN32_FIND_DATAW));
- HANDLE search = ::FindFirstFileExW(filename.c_str(), FindExInfoStandard, &findData, FindExSearchNameMatch, NULL, 0);
+ HANDLE search = ::FindFirstFileExW(filename.c_str(), FindExInfoStandard, &findData, FindExSearchNameMatch, nullptr, 0);
if (search == INVALID_HANDLE_VALUE) {
return false;
} else {
@@ -68,14 +68,14 @@ std::string ToString(const std::wstring &source, bool utf8)
std::string result;
if (source.length() > 0) {
UINT codepage = utf8 ? CP_UTF8 : GetACP();
- int sizeRequired = ::WideCharToMultiByte(codepage, 0, &source[0], -1, NULL, 0, NULL, NULL);
+ int sizeRequired = ::WideCharToMultiByte(codepage, 0, &source[0], -1, nullptr, 0, nullptr, nullptr);
if (sizeRequired == 0) {
throw windows_error("failed to convert string to multibyte");
}
// the size returned by WideCharToMultiByte contains zero termination IF -1 is specified for the length.
// we don't want that \0 in the string because then the length field would be wrong. Because madness
result.resize(sizeRequired - 1, '\0');
- ::WideCharToMultiByte(codepage, 0, &source[0], (int)source.size(), &result[0], sizeRequired, NULL, NULL);
+ ::WideCharToMultiByte(codepage, 0, &source[0], (int)source.size(), &result[0], sizeRequired, nullptr, nullptr);
}
return result;
@@ -86,7 +86,7 @@ std::wstring ToWString(const std::string &source, bool utf8)
std::wstring result;
if (source.length() > 0) {
UINT codepage = utf8 ? CP_UTF8 : GetACP();
- int sizeRequired = ::MultiByteToWideChar(codepage, 0, source.c_str(), source.length(), NULL, 0);
+ int sizeRequired = ::MultiByteToWideChar(codepage, 0, source.c_str(), source.length(), nullptr, 0);
if (sizeRequired == 0) {
throw windows_error("failed to convert string to wide character");
}
@@ -137,7 +137,7 @@ VS_FIXEDFILEINFO GetFileVersion(const std::wstring &fileName)
throw windows_error("failed to determine file version info");
}
- void *versionInfoPtr = NULL;
+ void *versionInfoPtr = nullptr;
UINT versionInfoLength = 0;
if (!::VerQueryValue(buffer, L"\\", &versionInfoPtr, &versionInfoLength)) {
throw windows_error("failed to determine file version");
@@ -166,14 +166,14 @@ std::string GetStack()
::SymSetOptions(SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS);
firstCall = false;
}
- if (!::SymInitialize(process, NULL, TRUE)) {
+ if (!::SymInitialize(process, nullptr, TRUE)) {
log("failed to initialize symbols: %d", ::GetLastError());
}
initialized.insert(::GetCurrentProcessId());
}
LPVOID stack[32];
- WORD frames = ::CaptureStackBackTrace(0, 100, stack, NULL);
+ WORD frames = ::CaptureStackBackTrace(0, 100, stack, nullptr);
char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(TCHAR)];
PSYMBOL_INFO symbol = (PSYMBOL_INFO)buffer;