aboutsummaryrefslogtreecommitdiff
path: root/src/SMemUtf8.cpp
diff options
context:
space:
mode:
authorLadislav Zezula <zezula@volny.cz>2025-08-06 09:38:55 +0200
committerGitHub <noreply@github.com>2025-08-06 09:38:55 +0200
commit36d76cddbfa02624617bb112da0b72e919f0cf33 (patch)
treecbe34ab3d2d2c7ab784ba890b7d2a3436bb6795b /src/SMemUtf8.cpp
parentb41cda40f9c3fbdb802cf63e739425cd805eecaa (diff)
parentdb410fd564af358cb7c1e2e72cdbaeaeef510e09 (diff)
Merge pull request #393 from ladislav-zezula/LZ_BlizzardCompatibleNames
* Replaced GetLastError with SErrGetLastError * Members of TMPQHash have now the same names like in Blizzard sources * Fixed bug in SFileRenameFile that falsely reported an existing file if it had different locale.
Diffstat (limited to 'src/SMemUtf8.cpp')
-rw-r--r--src/SMemUtf8.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/SMemUtf8.cpp b/src/SMemUtf8.cpp
index abc16ee..b9d5e9d 100644
--- a/src/SMemUtf8.cpp
+++ b/src/SMemUtf8.cpp
@@ -551,3 +551,32 @@ DWORD WINAPI SMemFileNameToUTF8(
pOutLength[0] = nOutLength;
return dwErrCode;
}
+
+//-----------------------------------------------------------------------------
+// (Set/Get)LastError wrapper
+
+#ifndef STORMLIB_WINDOWS
+#ifndef STORMLIB_WIIU
+static thread_local DWORD dwLastError = ERROR_SUCCESS;
+#else
+static DWORD dwLastError = ERROR_SUCCESS;
+#endif
+#endif
+
+void SErrSetLastError(DWORD dwErrCode)
+{
+#ifdef STORMLIB_WINDOWS
+ SetLastError(dwErrCode);
+#else
+ dwLastError = dwErrCode;
+#endif
+}
+
+DWORD SErrGetLastError()
+{
+#ifdef STORMLIB_WINDOWS
+ return GetLastError();
+#else
+ return dwLastError;
+#endif
+}