fixed linux compilation errors

This commit is contained in:
qeed 2009-10-12 19:04:28 +00:00
parent 841e8f4c3b
commit d0b9f45f02
2 changed files with 22 additions and 10 deletions

View File

@ -24,7 +24,6 @@ extern "C"
#include <lualib.h> #include <lualib.h>
} }
#include "types.h" #include "types.h"
#include "fceu.h" #include "fceu.h"
#include "video.h" #include "video.h"
@ -48,6 +47,11 @@ extern "C"
#define FALSE 0 #define FALSE 0
#endif #endif
#ifdef __unix__
#define stricmp strcasecmp
#define strnicmp strncasecmp
#endif
#define __forceinline __attribute__ ((always_inline))
#ifdef WIN32 #ifdef WIN32
extern void AddRecentLuaFile(const char *filename); extern void AddRecentLuaFile(const char *filename);
#endif #endif
@ -144,7 +148,9 @@ static const char* luaCallIDStrings [] =
"CALL_AFTEREMULATION", "CALL_AFTEREMULATION",
"CALL_BEFOREEXIT", "CALL_BEFOREEXIT",
}; };
static const int _makeSureWeHaveTheRightNumberOfStrings [sizeof(luaCallIDStrings)/sizeof(*luaCallIDStrings) == LUACALL_COUNT ? 1 : 0];
//make sure we have the right number of strings
CTASSERT(sizeof(luaCallIDStrings)/sizeof(*luaCallIDStrings) == LUACALL_COUNT)
static const char* luaMemHookTypeStrings [] = static const char* luaMemHookTypeStrings [] =
{ {
@ -156,7 +162,9 @@ static const char* luaMemHookTypeStrings [] =
"MEMHOOK_READ_SUB", "MEMHOOK_READ_SUB",
"MEMHOOK_EXEC_SUB", "MEMHOOK_EXEC_SUB",
}; };
static const int _makeSureWeHaveTheRightNumberOfStrings2 [sizeof(luaMemHookTypeStrings)/sizeof(*luaMemHookTypeStrings) == LUAMEMHOOK_COUNT ? 1 : 0];
//make sure we have the right number of strings
CTASSERT(sizeof(luaMemHookTypeStrings)/sizeof(*luaMemHookTypeStrings) == LUAMEMHOOK_COUNT)
/** /**
* Resets emulator speed / pause states after script exit. * Resets emulator speed / pause states after script exit.
@ -577,14 +585,13 @@ struct TieredRegion
lastEnd = addr+1; lastEnd = addr+1;
} }
} }
bool Contains(unsigned int address, int size) const bool Contains(unsigned int address, int size) const
{ {
std::vector<Island>::const_iterator iter = islands.begin(); for (size_t i = 0; i != islands.size(); ++i)
std::vector<Island>::const_iterator end = islands.end(); {
for(; iter != end; ++iter) if (islands[i].Contains(address, size))
if(iter->Contains(address, size))
return true; return true;
}
return false; return false;
} }
}; };
@ -604,7 +611,8 @@ struct TieredRegion
TieredRegion() TieredRegion()
{ {
Calculate(std::vector<unsigned int>()); std::vector <unsigned int> temp;
Calculate(temp);
} }
__forceinline int NotEmpty() __forceinline int NotEmpty()

View File

@ -125,4 +125,8 @@ typedef uint8 (*readfunc)(uint32 A);
#include "utils/endian.h" #include "utils/endian.h"
#ifndef CTASSERT
#define CTASSERT(x) typedef char __assert ## y[(x) ? 1 : -1];
#endif
#endif #endif