cleanup and fixes

This commit is contained in:
Jack Andersen 2015-07-19 10:52:22 -10:00
parent 662c2bc689
commit 7a5fc8236a
9 changed files with 35 additions and 27 deletions

View File

@ -4,6 +4,8 @@ set(HECL_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
set(ATHENA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/Athena/include) set(ATHENA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/Athena/include)
set(LOG_VISOR_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/LogVisor/include) set(LOG_VISOR_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/LogVisor/include)
set(ANGELSCRIPT_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/AngelScript/angelscript/include) set(ANGELSCRIPT_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/AngelScript/angelscript/include)
set(LIBPNG_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/libpng)
set(SQUISH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/libSquish)
add_definitions(-DAS_USE_NAMESPACE=1) add_definitions(-DAS_USE_NAMESPACE=1)
add_subdirectory(extern) add_subdirectory(extern)
include_directories(include ${LOG_VISOR_INCLUDE_DIR} ${ATHENA_INCLUDE_DIR} ${ANGELSCRIPT_INCLUDE_DIR}) include_directories(include ${LOG_VISOR_INCLUDE_DIR} ${ATHENA_INCLUDE_DIR} ${ANGELSCRIPT_INCLUDE_DIR})

View File

@ -21,5 +21,5 @@ list(APPEND DATA_SPEC_LIBS
target_link_libraries(hecl target_link_libraries(hecl
"-Wl,-whole-archive" HECLDatabaseInit ${DATA_SPEC_LIBS} "-Wl,-no-whole-archive" "-Wl,-whole-archive" HECLDatabaseInit ${DATA_SPEC_LIBS} "-Wl,-no-whole-archive"
HECLDatabase HECL AthenaCore AngelScript NOD LogVisor blowfish z lzo2 HECLDatabase HECL AthenaCore AngelScript NOD LogVisor png squish blowfish z lzo2
) )

View File

@ -1,4 +1,5 @@
add_subdirectory(libpng) add_subdirectory(libpng)
add_subdirectory(libSquish)
add_subdirectory(blowfish) add_subdirectory(blowfish)
add_subdirectory(LogVisor) add_subdirectory(LogVisor)
add_subdirectory(AngelScript) add_subdirectory(AngelScript)

@ -1 +1 @@
Subproject commit dea341d27b52e60ab3b8f4ee7e7b808ef516b39d Subproject commit 149165ee97f1ab310e8fc6f8643c501297a18fe2

View File

@ -4,19 +4,19 @@
#define N 16 #define N 16
extern const unsigned long BLOWFISH_P[N + 2]; extern const uint32_t BLOWFISH_P[N + 2];
extern const unsigned long BLOWFISH_S[4][256]; extern const uint32_t BLOWFISH_S[4][256];
#define P BLOWFISH_P #define P BLOWFISH_P
#define S BLOWFISH_S #define S BLOWFISH_S
static unsigned long F(unsigned long x) static uint32_t F(uint32_t x)
{ {
unsigned short a; uint16_t a;
unsigned short b; uint16_t b;
unsigned short c; uint16_t c;
unsigned short d; uint16_t d;
unsigned long y; uint32_t y;
d = x & 0x00FF; d = x & 0x00FF;
x >>= 8; x >>= 8;
@ -32,11 +32,11 @@ static unsigned long F(unsigned long x)
return y; return y;
} }
void Blowfish_encipher(unsigned long *xl, unsigned long *xr) void Blowfish_encipher(uint32_t *xl, uint32_t *xr)
{ {
unsigned long Xl; uint32_t Xl;
unsigned long Xr; uint32_t Xr;
unsigned long temp; uint32_t temp;
short i; short i;
Xl = *xl; Xl = *xl;
@ -62,11 +62,11 @@ void Blowfish_encipher(unsigned long *xl, unsigned long *xr)
*xr = Xr; *xr = Xr;
} }
void Blowfish_decipher(unsigned long *xl, unsigned long *xr) void Blowfish_decipher(uint32_t *xl, uint32_t *xr)
{ {
unsigned long Xl; uint32_t Xl;
unsigned long Xr; uint32_t Xr;
unsigned long temp; uint32_t temp;
short i; short i;
Xl = *xl; Xl = *xl;
@ -99,13 +99,13 @@ int64_t Blowfish_hash(const void* buf, size_t len)
unsigned i,j; unsigned i,j;
union union
{ {
unsigned long h32[2]; uint32_t h32[2];
int64_t h64; int64_t h64;
} hash = {}; } hash = {};
for (i=0 ; i<len/4 ; ++i) for (i=0 ; i<len/4 ; ++i)
{ {
unsigned long block = *(unsigned long*)buf; uint32_t block = *(uint32_t*)buf;
Blowfish_encipher(&hash.h32[i&1], &block); Blowfish_encipher(&hash.h32[i&1], &block);
buf += 4; buf += 4;
} }
@ -115,11 +115,11 @@ int64_t Blowfish_hash(const void* buf, size_t len)
{ {
union union
{ {
unsigned long b32; uint32_t b32;
char b[4]; char b[4];
} block = {0}; } block = {0};
for (j=0 ; j<rem ; ++j) for (j=0 ; j<rem ; ++j)
block.b[j] = *(unsigned long*)buf; block.b[j] = *(char*)buf;
Blowfish_encipher(&hash.h32[i&1], &block.b32); Blowfish_encipher(&hash.h32[i&1], &block.b32);
} }

View File

@ -5,8 +5,8 @@ extern "C" {
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
void Blowfish_encipher(unsigned long *xl, unsigned long *xr); void Blowfish_encipher(uint32_t *xl, uint32_t *xr);
void Blowfish_decipher(unsigned long *xl, unsigned long *xr); void Blowfish_decipher(uint32_t *xl, uint32_t *xr);
int64_t Blowfish_hash(const void* buf, size_t len); int64_t Blowfish_hash(const void* buf, size_t len);
#ifdef __cplusplus #ifdef __cplusplus

@ -1 +1 @@
Subproject commit 1d3ed2763636ef7d049644c7ddc7fb905e52e254 Subproject commit ac84440bec8284050cb9ad746a75821e8521e9a5

View File

@ -522,6 +522,8 @@ static inline int32_t SBig(int32_t val) {return bswap32(val);}
static inline uint32_t SBig(uint32_t val) {return bswap32(val);} static inline uint32_t SBig(uint32_t val) {return bswap32(val);}
static inline int64_t SBig(int64_t val) {return bswap64(val);} static inline int64_t SBig(int64_t val) {return bswap64(val);}
static inline uint64_t SBig(uint64_t val) {return bswap64(val);} static inline uint64_t SBig(uint64_t val) {return bswap64(val);}
#define SBIG(q) ( ( (q) & 0x000000FF ) << 24 | ( (q) & 0x0000FF00 ) << 8 \
| ( (q) & 0x00FF0000 ) >> 8 | ( (q) & 0xFF000000 ) >> 24 )
static inline int16_t SLittle(int16_t val) {return val;} static inline int16_t SLittle(int16_t val) {return val;}
static inline uint16_t SLittle(uint16_t val) {return val;} static inline uint16_t SLittle(uint16_t val) {return val;}
@ -529,6 +531,7 @@ static inline int32_t SLittle(int32_t val) {return val;}
static inline uint32_t SLittle(uint32_t val) {return val;} static inline uint32_t SLittle(uint32_t val) {return val;}
static inline int64_t SLittle(int64_t val) {return val;} static inline int64_t SLittle(int64_t val) {return val;}
static inline uint64_t SLittle(uint64_t val) {return val;} static inline uint64_t SLittle(uint64_t val) {return val;}
#define SLITTLE(q) (q)
#else #else
static inline int16_t SLittle(int16_t val) {return bswap16(val);} static inline int16_t SLittle(int16_t val) {return bswap16(val);}
static inline uint16_t SLittle(uint16_t val) {return bswap16(val);} static inline uint16_t SLittle(uint16_t val) {return bswap16(val);}
@ -536,6 +539,8 @@ static inline int32_t SLittle(int32_t val) {return bswap32(val);}
static inline uint32_t SLittle(uint32_t val) {return bswap32(val);} static inline uint32_t SLittle(uint32_t val) {return bswap32(val);}
static inline int64_t SLittle(int64_t val) {return bswap64(val);} static inline int64_t SLittle(int64_t val) {return bswap64(val);}
static inline uint64_t SLittle(uint64_t val) {return bswap64(val);} static inline uint64_t SLittle(uint64_t val) {return bswap64(val);}
#define SLITTLE(q) ( ( (q) & 0x000000FF ) << 24 | ( (q) & 0x0000FF00 ) << 8 \
| ( (q) & 0x00FF0000 ) >> 8 | ( (q) & 0xFF000000 ) >> 24 )
static inline int16_t SBig(int16_t val) {return val;} static inline int16_t SBig(int16_t val) {return val;}
static inline uint16_t SBig(uint16_t val) {return val;} static inline uint16_t SBig(uint16_t val) {return val;}
@ -543,6 +548,7 @@ static inline int32_t SBig(int32_t val) {return val;}
static inline uint32_t SBig(uint32_t val) {return val;} static inline uint32_t SBig(uint32_t val) {return val;}
static inline int64_t SBig(int64_t val) {return val;} static inline int64_t SBig(int64_t val) {return val;}
static inline uint64_t SBig(uint64_t val) {return val;} static inline uint64_t SBig(uint64_t val) {return val;}
#define SBIG(q) (q)
#endif #endif
} }

View File

@ -22,9 +22,8 @@ static SystemString canonRelPath(const SystemString& path)
std::vector<SystemString> comps; std::vector<SystemString> comps;
HECL::SystemRegexMatch matches; HECL::SystemRegexMatch matches;
SystemString in = path; SystemString in = path;
while (std::regex_search(in, matches, regPATHCOMP)) for (; std::regex_search(in, matches, regPATHCOMP) ; in = matches.suffix())
{ {
in = matches.suffix();
const SystemString& match = matches[1]; const SystemString& match = matches[1];
if (!match.compare(_S("."))) if (!match.compare(_S(".")))
continue; continue;