Browse Source

Fix SErrGet/SetLastError

SErrGet/SetLastError were not propagating errors from 3rdParty/StormLib
because StormLib uses native Windows functions on Windows and defines
its own on Linux.

Also removes storm_full.h
pull/1551/head
Gleb Mazovetskiy 5 years ago committed by Anders Jenbo
parent
commit
e1278cba7b
  1. 2
      Source/miniwin/miniwin.h
  2. 18
      Source/storm/storm.cpp
  3. 9
      Source/storm/storm_full.h

2
Source/miniwin/miniwin.h

@ -11,8 +11,6 @@
#include <string.h>
#include <time.h>
#include "storm/storm_full.h"
namespace devilution {
#ifndef MAX_PATH

18
Source/storm/storm.cpp

@ -23,9 +23,19 @@
#include "utils/sdl_compat.h"
#include "utils/stubs.h"
namespace devilution {
// Include Windows headers for Get/SetLastError.
#if defined(_WIN32)
// Suppress definitions of `min` and `max` macros by <windows.h>:
#define NOMINMAX 1
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#else // !defined(_WIN32)
// On non-Windows, these are defined in 3rdParty/StormLib.
extern "C" void SetLastError(std::uint32_t dwErrCode);
extern "C" std::uint32_t GetLastError();
#endif
uint32_t nLastError = 0;
namespace devilution {
namespace {
@ -801,12 +811,12 @@ void SVidPlayEnd(HANDLE video)
DWORD SErrGetLastError()
{
return nLastError;
return ::GetLastError();
}
void SErrSetLastError(DWORD dwErrCode)
{
nLastError = dwErrCode;
::SetLastError(dwErrCode);
}
bool SFileSetBasePath(const char *path)

9
Source/storm/storm_full.h

@ -1,9 +0,0 @@
#pragma once
#include <stdint.h>
namespace devilution {
extern uint32_t nLastError;
} // namespace devilution
Loading…
Cancel
Save