ref: 0a411d3dee850a3beae87b95256523df7aa6104d
parent: ff3cdf8959575c3018d03ecee76a7cb98a4b2754
author: Fabien Sanglard <[email protected]>
date: Thu Dec 13 16:27:02 EST 2012
Fixed a 'few unit8_t instead of char' broken on MacOS Xwq from Windows
--- a/Engine/src/cache1d.h
+++ b/Engine/src/cache1d.h
@@ -44,7 +44,7 @@
int32_t uncompress(uint8_t *lzwinbuf, int32_t compleng, uint8_t *lzwoutbuf);
extern uint8_t game_dir[512];
-extern int32_t TCkopen4load(const uint8_t *filename, int readfromGRP);
+extern int32_t TCkopen4load(const char *filename, int readfromGRP);
#endif /* !defined _INCLUDE_CACHE1D_H_ */
--- a/Engine/src/enet/unix.c
+++ b/Engine/src/enet/unix.c
@@ -67,7 +67,7 @@
}
int
-enet_address_set_host (ENetAddress * address, const uint8_t * name)
+enet_address_set_host (ENetAddress * address, const char * name)
{
struct hostent * hostEntry = NULL;
#ifdef HAS_GETHOSTBYNAME_R
--- a/Engine/src/sdl_driver.c
+++ b/Engine/src/sdl_driver.c
@@ -1182,7 +1182,7 @@
}
-void _platform_init(int argc, uint8_t **argv, const char *title, const char *iconName)
+void _platform_init(int argc, char **argv, const char *title, const char *iconName)
{
int i;
int32_t timeElapsed;
--- a/Game/src/dummy_audiolib.c
+++ b/Game/src/dummy_audiolib.c
@@ -74,7 +74,7 @@
//Dummy music
#include "audiolib/music.h"
-uint8_t *MUSIC_ErrorString(int ErrorNumber)
+char *MUSIC_ErrorString(int ErrorNumber)
{
return "";
}
--- a/Game/src/global.c
+++ b/Game/src/global.c
@@ -539,7 +539,7 @@
fclose(pFile);
}
-int32 SafeOpenAppend (const uint8_t *_filename, int32 filetype)
+int32 SafeOpenAppend (const char *_filename, int32 filetype)
{
int handle;
uint8_t filename[MAX_PATH];
@@ -596,7 +596,7 @@
return handle;
}
-int32 SafeOpenRead (const uint8_t *_filename, int32 filetype)
+int32 SafeOpenRead (const char *_filename, int32 filetype)
{
int handle;
uint8_t filename[MAX_PATH];
--- a/Game/src/midi/xmidi.cpp
+++ b/Game/src/midi/xmidi.cpp
@@ -603,224 +603,7 @@
}
}
-#ifdef _MSC_VER
-typedef unsigned __int64 uint64;
-#elif !defined(BEOS)
-// Unsigned 64 Bit Int emulation. Only supports SOME operations
-struct uint64 {
- uint32 low; // Low is first so uint64 can be cast as uint32 to get low dword
- uint32 high; //
-
- uint64() : low(0), high(0) { }
- uint64(uint32 i) : low(i), high(0) { }
- uint64(uint32 h, uint32 l) : low(l), high(h) { }
- uint64(const uint64 &i) : low(i.low), high(i.high) { }
-
- inline void addlow(uint32 l) {
- uint32 mid = (low >> 16);
- low = (low & 0xFFFF) + (l & 0xFFFF);
- mid += (low >> 16) + (l >> 16);
- low = (low&0xFFFF) + (mid << 16);
- high += mid >> 16;
- }
-
- // uint64 operations
-
- inline uint64 & operator = (uint64 &o) {
- low = o.low;
- high = o.high;
- return *this;
- }
-
- inline uint64 & operator += (uint64 &o) {
- addlow(o.low);
- high += o.high;
- return *this;
- }
-
- inline uint64 operator + (uint64 &o) {
- uint64 n(*this);
- n.addlow(o.low);
- n.high += o.high;
- return n;
- }
-
- // uint32 operations
-
- inline uint64 & operator = (uint32 i) {
- low = i;
- high = 0;
- return *this;
- }
-
- inline uint64 & operator += (uint32 i) {
- addlow(i);
- return *this;
- }
-
- inline uint64 operator + (uint32 i) {
- uint64 n(*this);
- n.addlow(i);
- return n;
- }
-
- inline uint64 & operator *= (uint32 i) {
- // High 16 bits
- uint32 h1 = i >> 16;
- uint32 h2 = low >> 16;
- //uint32 h3 = high >> 16;
-
- // Low 16 Bits
- uint32 l1 = i & 0xFFFF;
- uint32 l2 = low & 0xFFFF;
- uint32 l3 = high & 0xFFFF;
-
- // The accumulator
- uint32 accum;
-
- // 0 -> 32
- low = l1*l2;
- high = 0;
-
- // 16 -> 48
- accum = h1*l2;
- addlow(accum<<16);
- high += accum>>16;
-
- // 16 -> 48
- accum = l1*h2;
- addlow(accum<<16);
- high += accum>>16;
-
- // 32 -> 64
- high += h1*h2;
-
- // 32 -> 64
- high += l1*l3;
-
- // 48 -> 80
- high += (h1*l3) << 16;
-
- // 48 -> 80
- high += (l1*l3) << 16;
-
- return *this;
- }
-
- inline uint64 operator * (uint32 i) {
- uint64 n(*this);
- return n*=i;
- }
-
- inline uint64 & operator /= (uint32 div) {
-
- // If there isn't a high dword, we only need to work on the low dword
- if (!high) {
- low /= div;
- return *this;
- }
-
- // modulus of last division
- uint32 mod = high;
- uint32 l = low;
-
- // Low shift
- uint32 shift = 32;
- low = 0;
-
- // Only High DWORD
- // Can divide
- if (mod >= div) {
- high = mod / div;
- mod %= div;
- }
- else high = 0;
-
- // Only Both high and low
- while (--shift) {
-
- mod <<= 1;
- mod |= (l>>shift) & 1;
-
- // Can divide
- if (mod >= div) {
- uint32 v = mod / div;
- mod %= div;
- addlow(v << shift);
- high += v >> (32 - shift);
- }
- }
-
-
- // Only Low DWORD
- mod <<= 1;
- mod |= l & 1;
-
- // Can divide
- if (mod >= div) {
- uint32 v = mod / div;
- mod %= div;
- addlow(v << shift);
- }
-
- return *this;
- }
-
- inline uint64 operator / (uint32 i) {
- uint64 n(*this);
- return n/=i;
- }
-
- inline uint64 & operator %= (uint32 div) {
-
- // If there isn't a high dword, we only need to work on the low dword
- if (!high) {
- low %= div;
- return *this;
- }
-
- // Remainder of last division
- uint32 mod = high;
-
- // Low shift
- uint32 shift = 32;
-
- while (1) {
-
- // Can divide
- if (mod >= div) mod %= div;
-
- if (shift == 0) break;
-
- mod <<= 1;
- shift--;
- mod |= (low>>shift) & 1;
- }
-
- high = 0;
- low = mod;
-
- return *this;
- }
-
- inline uint64 operator % (uint32 i) {
- uint64 n(*this);
- return n%=i;
- }
-
- inline operator uint32 ()
- {
- return low;
- }
-
- void printx() {
- if (high) printf ("%lX%08lX", high, low);
- else printf ("%lX", low);
- }
-};
-#endif
-
//
// AdjustTimings
//
@@ -846,7 +629,7 @@
// Note 64 bit int is required because multiplication by tempo can
// require 52 bits in some circumstances
- uint64 aim = event->time - time_prev;
+ uint64_t aim = event->time - time_prev;
aim *= tempo;
hs_rem += aim%ppqn;