summaryrefslogtreecommitdiff
path: root/shared/systemFunctions.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:01:29 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:01:29 +0200
commit9a2a524f1e311853d08050be2dcdddc09ac7759a (patch)
treed8e4a24169fce88c2d89931d58514889a0bcb0ea /shared/systemFunctions.cpp
parent2.3 (diff)
downloadFreeFileSync-9a2a524f1e311853d08050be2dcdddc09ac7759a.tar.gz
FreeFileSync-9a2a524f1e311853d08050be2dcdddc09ac7759a.tar.bz2
FreeFileSync-9a2a524f1e311853d08050be2dcdddc09ac7759a.zip
3.0
Diffstat (limited to 'shared/systemFunctions.cpp')
-rw-r--r--shared/systemFunctions.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/shared/systemFunctions.cpp b/shared/systemFunctions.cpp
index 4fd17fc1..3d6915cd 100644
--- a/shared/systemFunctions.cpp
+++ b/shared/systemFunctions.cpp
@@ -11,27 +11,29 @@
#ifdef FFS_WIN
-wxString FreeFileSync::getLastErrorFormatted(const unsigned long lastError) //try to get additional Windows error information
+wxString FreeFileSync::getLastErrorFormatted(unsigned long lastError) //try to get additional Windows error information
{
//determine error code if none was specified
- const unsigned long lastErrorCode = lastError == 0 ? ::GetLastError() : lastError;
+ if (lastError == 0)
+ lastError = ::GetLastError();
- wxString output = wxString(wxT("Windows Error Code ")) + wxString::Format(wxT("%u"), lastErrorCode);
+ wxString output = wxString(wxT("Windows Error Code ")) + wxString::Format(wxT("%u"), lastError);
WCHAR buffer[1001];
- if (::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_MAX_WIDTH_MASK, 0, lastErrorCode, 0, buffer, 1001, NULL) != 0)
+ if (::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_MAX_WIDTH_MASK, 0, lastError, 0, buffer, 1001, NULL) != 0)
output += wxString(wxT(": ")) + buffer;
return output;
}
#elif defined FFS_LINUX
-wxString FreeFileSync::getLastErrorFormatted(const int lastError) //try to get additional Linux error information
+wxString FreeFileSync::getLastErrorFormatted(int lastError) //try to get additional Linux error information
{
//determine error code if none was specified
- const int lastErrorCode = lastError == 0 ? errno : lastError;
+ if (lastError == 0)
+ lastError = errno; //don't use :: errno is a macro!
- wxString output = wxString(wxT("Linux Error Code ")) + wxString::Format(wxT("%i"), lastErrorCode);
- output += wxString(wxT(": ")) + ::strerror(lastErrorCode);
+ wxString output = wxString(wxT("Linux Error Code ")) + wxString::Format(wxT("%i"), lastError);
+ output += wxString(wxT(": ")) + wxString::FromUTF8(::strerror(lastError));
return output;
}
#endif
bgstack15