diff --git a/docs/rh-log.txt b/docs/rh-log.txt index e0a7c4262..f08cc3bec 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,8 @@ +April 13, 2006 +- Fix farchive.cpp swappers for GCC again. Now that they use entirely integer + math, they should work with all GCC versions. +- Update FLAC readers to #define FLAC__NO_DLL to match the new FLAC builds. + April 13, 2006 (Changes by Graf Zahl) - Fixed: The decal stretcher is supposed to stretch the decal to a specifiable size but it used that size as a scaling factor instead. The old code allowed diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index f640b420a..f01747c10 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -704,7 +704,7 @@ CCMD(monster) { if (mo->flags3&MF3_ISMONSTER && !(mo->flags&MF_CORPSE) && !(mo->flags&MF_FRIENDLY)) { - Printf ("%s at (%d,%d,%d)\n", mo->GetClass()->Name+1, mo->x>>16, mo->y>>16, mo->z>>16); + Printf ("%s at (%ld,%ld,%ld)\n", mo->GetClass()->Name+1, mo->x>>16, mo->y>>16, mo->z>>16); } } } @@ -725,7 +725,7 @@ CCMD(items) { if (mo->IsKindOf(RUNTIME_CLASS(AInventory)) && mo->flags&MF_SPECIAL) { - Printf ("%s at (%d,%d,%d)\n",mo->GetClass()->Name+1,mo->x>>16,mo->y>>16,mo->z>>16); + Printf ("%s at (%ld,%ld,%ld)\n",mo->GetClass()->Name+1,mo->x>>16,mo->y>>16,mo->z>>16); } } } diff --git a/src/farchive.cpp b/src/farchive.cpp index ecfbf5286..49075aa43 100644 --- a/src/farchive.cpp +++ b/src/farchive.cpp @@ -83,13 +83,18 @@ static inline WORD SWAP_WORD(x) { return x; } static inline DWORD SWAP_DWORD(x) { return x; } static inline QWORD SWAP_QWORD(x) { return x; } -static inline float SWAP_FLOAT(x) { return x; } -static inline double SWAP_DOUBLE(x) { return x; } +static inline void SWAP_FLOAT(x) { } +static inline void SWAP_DOUBLE(double &dst, double src) { dst = src; } #else #ifdef _MSC_VER static inline WORD SWAP_WORD(WORD x) { return _byteswap_ushort(x); } static inline DWORD SWAP_DWORD(DWORD x) { return _byteswap_ulong(x); } static inline QWORD SWAP_QWORD(QWORD x) { return _byteswap_uint64(x); } +static inline void SWAP_DOUBLE(double &dst, double &src) +{ + union twiddle { QWORD q; double d; } *tdst = (twiddle *)&dst, *tsrc = (twiddle *)&src; + tdst->q = _byteswap_uint64(tsrc->q); +} #else static inline WORD SWAP_WORD(WORD x) { return (((x)<<8) | ((x)>>8)); } static inline DWORD SWAP_DWORD(DWORD x) { return x = (((x)>>24) | (((x)>>8)&0xff00) | ((x)<<8)&0xff0000 | ((x)<<24)); } @@ -101,9 +106,20 @@ static inline QWORD SWAP_QWORD(QWORD x) u.d[1] = SWAP_DWORD(t.d[0]); return u.q; } +static inline void SWAP_DOUBLE(double &dst, double &src) +{ + union twiddle { double f; DWORD d[2]; } *tdst = (twiddle *)&dst, *tsrc = (twiddle *)&src; + DWORD t; + t = tsrc->d[0]; + tdst->d[0] = SWAP_DWORD(tsrc->d[1]); + tdst->d[1] = SWAP_DWORD(t); +} #endif -static inline float SWAP_FLOAT(float x) { DWORD t = *(DWORD *)&x; t = SWAP_DWORD(t); return *(float *)&t; } -static inline double SWAP_DOUBLE(double x) { QWORD t = *(QWORD *)&x; t = SWAP_QWORD(t); return *(double *)&t; } +static inline void SWAP_FLOAT(float &x) +{ + union twiddle { DWORD i; float f; } *t = (twiddle *)&x; + t->i = SWAP_DWORD(t->i); +} #endif // Output buffer size for compression; need some extra space. @@ -872,13 +888,14 @@ FArchive &FArchive::operator<< (float &w) { if (m_Storing) { - float temp = SWAP_FLOAT(w); + float temp = w; + SWAP_FLOAT(temp); Write (&temp, sizeof(float)); } else { Read (&w, sizeof(float)); - w = SWAP_FLOAT(w); + SWAP_FLOAT(w); } return *this; } @@ -887,13 +904,14 @@ FArchive &FArchive::operator<< (double &w) { if (m_Storing) { - double temp = SWAP_DOUBLE(w); + double temp; + SWAP_DOUBLE(temp,w); Write (&temp, sizeof(double)); } else { Read (&w, sizeof(double)); - w = SWAP_DOUBLE(w); + SWAP_DOUBLE(w,w); } return *this; } diff --git a/src/sound/music_flac.cpp b/src/sound/music_flac.cpp index b6991a48e..3b9fff4e6 100644 --- a/src/sound/music_flac.cpp +++ b/src/sound/music_flac.cpp @@ -2,6 +2,8 @@ #include "templates.h" #include + +#define FLAC__NO_DLL #include class FLACSong::FLACStreamer : protected FLAC::Decoder::Stream diff --git a/src/sound/sample_flac.h b/src/sound/sample_flac.h index 05cd7bfa5..a037ccd84 100644 --- a/src/sound/sample_flac.h +++ b/src/sound/sample_flac.h @@ -1,3 +1,4 @@ +#define FLAC__NO_DLL #include #include #include "s_sound.h"