From 17805d266de28f69b4f7a336fd8cb770200960fc Mon Sep 17 00:00:00 2001 From: clearer Date: Thu, 7 May 2009 06:54:52 +0000 Subject: [PATCH] Fixed build related macro bug that assumed that StormPortLinux.cpp and StormPortMac.cpp would only ever be compiled on Windows or the target platform. --- .../stuffextract/StormLib/StormPortLinux.cpp | 63 +++++++++---------- .../stuffextract/StormLib/StormPortMac.cpp | 5 +- 2 files changed, 31 insertions(+), 37 deletions(-) diff --git a/src/tools/stuffextract/StormLib/StormPortLinux.cpp b/src/tools/stuffextract/StormLib/StormPortLinux.cpp index 79edf34..f446be0 100644 --- a/src/tools/stuffextract/StormLib/StormPortLinux.cpp +++ b/src/tools/stuffextract/StormLib/StormPortLinux.cpp @@ -24,7 +24,7 @@ * ********************************************************************/ #include -#ifndef _WIN32 +#if defined(__linux) || defined(linux) #include "StormPort.h" int globalerr; @@ -41,40 +41,33 @@ int GetLastError() const char *ErrString(int err) { - std::string strings[] = -{ -"function not implemented", "file not found", "access denied", "not enough memory", -"bad format", "no more files", "access beyond EOF", "no space left on device", -"invalid parameter", "no space left on device", "file exists", "operation cannot be completed", -"unknown error" -}; - switch (err) { - case ERROR_INVALID_FUNCTION: - return strings[0].c_str(); - case ERROR_FILE_NOT_FOUND: - return strings[1].c_str(); - case ERROR_ACCESS_DENIED: - return strings[2].c_str(); - case ERROR_NOT_ENOUGH_MEMORY: - return strings[3].c_str(); - case ERROR_BAD_FORMAT: - return strings[4].c_str(); - case ERROR_NO_MORE_FILES: - return strings[5].c_str(); - case ERROR_HANDLE_EOF: - return strings[6].c_str(); - case ERROR_HANDLE_DISK_FULL: - return strings[7].c_str(); - case ERROR_INVALID_PARAMETER: - return strings[8].c_str(); - case ERROR_DISK_FULL: - return strings[9].c_str(); - case ERROR_ALREADY_EXISTS: - return strings[10].c_str(); - case ERROR_CAN_NOT_COMPLETE: - return strings[11].c_str(); - default: - return strings[12].c_str(); + switch (err) + { + case ERROR_INVALID_FUNCTION: + return "function not implemented"; + case ERROR_FILE_NOT_FOUND: + return "file not found"; + case ERROR_ACCESS_DENIED: + return "access denied"; + case ERROR_NOT_ENOUGH_MEMORY: + return "not enough memory"; + case ERROR_BAD_FORMAT: + return "bad format"; + case ERROR_NO_MORE_FILES: + return "no more files"; + case ERROR_HANDLE_EOF: + return "access beyond EOF"; + case ERROR_INVALID_PARAMETER: + return "invalid parameter"; + case ERROR_HANDLE_DISK_FULL: + case ERROR_DISK_FULL: + return "no space left on device"; + case ERROR_ALREADY_EXISTS: + return "file exists"; + case ERROR_CAN_NOT_COMPLETE: + return "operation cannot be completed"; + default: + return "unknown error"; } } diff --git a/src/tools/stuffextract/StormLib/StormPortMac.cpp b/src/tools/stuffextract/StormLib/StormPortMac.cpp index 26f6787..476ab60 100644 --- a/src/tools/stuffextract/StormLib/StormPortMac.cpp +++ b/src/tools/stuffextract/StormLib/StormPortMac.cpp @@ -15,7 +15,8 @@ * ********************************************************************/ -#ifndef _WIN32 || _WIN64 +#if defined(__APPLE__) & defined( __MACH__) + #include "StormPort.h" #include "StormLib.h" @@ -269,7 +270,7 @@ int GetLastError() /******************************************************************** * ErrString ********************************************************************/ -char *ErrString(int err) +const char *ErrString(int err) { switch (err) {