Fixed build related macro bug that assumed that StormPortLinux.cpp and StormPortMac.cpp would only ever be compiled on Windows or the target platform.

This commit is contained in:
clearer 2009-05-07 06:54:52 +00:00
parent 4a36b3af3f
commit 17805d266d
2 changed files with 31 additions and 37 deletions

View File

@ -24,7 +24,7 @@
*
********************************************************************/
#include <string>
#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) {
switch (err)
{
case ERROR_INVALID_FUNCTION:
return strings[0].c_str();
return "function not implemented";
case ERROR_FILE_NOT_FOUND:
return strings[1].c_str();
return "file not found";
case ERROR_ACCESS_DENIED:
return strings[2].c_str();
return "access denied";
case ERROR_NOT_ENOUGH_MEMORY:
return strings[3].c_str();
return "not enough memory";
case ERROR_BAD_FORMAT:
return strings[4].c_str();
return "bad format";
case ERROR_NO_MORE_FILES:
return strings[5].c_str();
return "no more files";
case ERROR_HANDLE_EOF:
return strings[6].c_str();
case ERROR_HANDLE_DISK_FULL:
return strings[7].c_str();
return "access beyond EOF";
case ERROR_INVALID_PARAMETER:
return strings[8].c_str();
return "invalid parameter";
case ERROR_HANDLE_DISK_FULL:
case ERROR_DISK_FULL:
return strings[9].c_str();
return "no space left on device";
case ERROR_ALREADY_EXISTS:
return strings[10].c_str();
return "file exists";
case ERROR_CAN_NOT_COMPLETE:
return strings[11].c_str();
return "operation cannot be completed";
default:
return strings[12].c_str();
return "unknown error";
}
}

View File

@ -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)
{