diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b37adc23..f2b5640fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,10 +78,23 @@ else( MSVC ) set( ZDOOM_OUTPUT_OLDSTYLE OFF ) endif( MSVC ) +# Replacement variables for a possible long list of C/C++ compilers compatible with GCC +if( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) + set( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE TRUE ) +else( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) + set( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE FALSE ) +endif( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) + if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) - set( PROFILE 0 CACHE BOOL "Enable profiling with gprof for Debug and RelWithDebInfo build types." ) + set( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE TRUE ) +else( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) + set( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE FALSE ) endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) +if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) + set( PROFILE 0 CACHE BOOL "Enable profiling with gprof for Debug and RelWithDebInfo build types." ) +endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) + set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}") option( NO_FMOD "Disable FMODEx sound support" OFF ) diff --git a/bzip2/CMakeLists.txt b/bzip2/CMakeLists.txt index 5f35eb346..05dab7ec2 100644 --- a/bzip2/CMakeLists.txt +++ b/bzip2/CMakeLists.txt @@ -2,9 +2,9 @@ cmake_minimum_required( VERSION 2.4 ) make_release_only() -if( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) +if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -fomit-frame-pointer" ) -endif( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) +endif( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE ) add_definitions( -DBZ_NO_STDIO ) add_library( bz2 diff --git a/dumb/CMakeLists.txt b/dumb/CMakeLists.txt index 178de53a9..2b70ee412 100644 --- a/dumb/CMakeLists.txt +++ b/dumb/CMakeLists.txt @@ -13,9 +13,9 @@ endif( NOT CMAKE_BUILD_TYPE MATCHES "Release" ) set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -DDEBUGMODE=1" ) -if( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) +if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-pointer-sign -Wno-uninitialized" ) -endif( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) +endif( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE ) CHECK_FUNCTION_EXISTS( itoa ITOA_EXISTS ) if( NOT ITOA_EXISTS ) @@ -103,6 +103,6 @@ add_library( dumb src/it/xmeffect.c ) target_link_libraries( dumb ) -if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) +if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) set_source_files_properties( src/it/filter.cpp PROPERTIES COMPILE_FLAGS -msse ) -endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) +endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) diff --git a/game-music-emu/CMakeLists.txt b/game-music-emu/CMakeLists.txt index d0cc7af5f..79c528fa3 100644 --- a/game-music-emu/CMakeLists.txt +++ b/game-music-emu/CMakeLists.txt @@ -18,7 +18,7 @@ if( NOT CMAKE_BUILD_TYPE MATCHES "Release" ) set( CMAKE_BUILD_TYPE "RelWithDebInfo" ) endif( NOT CMAKE_BUILD_TYPE MATCHES "Release" ) -if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) +if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra" ) if( NOT PROFILE ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fomit-frame-pointer" ) @@ -27,7 +27,7 @@ if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STRE if( HAVE_NO_ARRAY_BOUNDS ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-array-bounds" ) endif( HAVE_NO_ARRAY_BOUNDS ) -endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) +endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) diff --git a/gdtoa/CMakeLists.txt b/gdtoa/CMakeLists.txt index 72a365bbf..7f394e140 100644 --- a/gdtoa/CMakeLists.txt +++ b/gdtoa/CMakeLists.txt @@ -8,9 +8,9 @@ if( MSVC ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4554 /wd4102" ) endif( MSVC ) -if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) +if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra" ) -endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) +endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) add_definitions( -DINFNAN_CHECK -DMULTIPLE_THREADS ) diff --git a/jpeg-6b/CMakeLists.txt b/jpeg-6b/CMakeLists.txt index dd5055f9b..c70892770 100644 --- a/jpeg-6b/CMakeLists.txt +++ b/jpeg-6b/CMakeLists.txt @@ -2,9 +2,9 @@ cmake_minimum_required( VERSION 2.4 ) make_release_only() -if( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) +if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -fomit-frame-pointer" ) -endif( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) +endif( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE ) add_library( jpeg jcomapi.c diff --git a/lzma/CMakeLists.txt b/lzma/CMakeLists.txt index beebb0fde..7cd330cc8 100644 --- a/lzma/CMakeLists.txt +++ b/lzma/CMakeLists.txt @@ -2,9 +2,9 @@ cmake_minimum_required( VERSION 2.4 ) make_release_only() -if( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) +if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -fomit-frame-pointer" ) -endif( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) +endif( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE ) set( LZMA_FILES C/7zBuf.c diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5b819f29e..d37095174 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -15,14 +15,14 @@ else( NOT APPLE ) # At the moment asm code doesn't work with OS X, so disable by default option( NO_ASM "Disable assembly code" ON ) endif( NOT APPLE ) -if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) +if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) option( NO_STRIP "Do not strip Release or MinSizeRel builds" ) # At least some versions of Xcode fail if you strip with the linker # instead of the separate strip utility. if( APPLE ) set( NO_STRIP ON ) endif( APPLE ) -endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) +endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) option( DYN_FLUIDSYNTH "Dynamically load fluidsynth" ON ) @@ -446,7 +446,7 @@ endif( SSE_MATTERS ) # Set up flags for GCC -if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) +if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) if( PROFILE ) set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -pg" ) set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg" ) @@ -475,7 +475,7 @@ if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STRE set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -s" ) set (CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} -s" ) endif( NOT NO_STRIP ) -endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) +endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) # Check for functions that may or may not exist. @@ -611,15 +611,15 @@ if( WIN32 ) set( SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ) set( OTHER_SYSTEM_SOURCES ${PLAT_SDL_SOURCES} ${PLAT_MAC_SOURCES} ) - if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) + if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) # CMake is not set up to compile and link rc files with GCC. :( add_custom_command( OUTPUT zdoom-rc.o COMMAND windres -o zdoom-rc.o -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zdoom.rc DEPENDS win32/zdoom.rc ) set( SYSTEM_SOURCES ${SYSTEM_SOURCES} zdoom-rc.o ) - else( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) + else( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) set( SYSTEM_SOURCES ${SYSTEM_SOURCES} win32/zdoom.rc ) - endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) + endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) else( WIN32 ) set( SYSTEM_SOURCES_DIR sdl ) set( SYSTEM_SOURCES ${PLAT_SDL_SOURCES} ) @@ -1197,16 +1197,16 @@ if( NOT WIN32 ) COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/link-make COMMAND /bin/sh -c ${CMAKE_CURRENT_BINARY_DIR}/link-make ) endif( NOT WIN32 ) -if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" ) +if( CMAKE_COMPILER_IS_GNUCXX ) # GCC misoptimizes this file set_source_files_properties( oplsynth/fmopl.cpp PROPERTIES COMPILE_FLAGS "-fno-tree-dominator-opts -fno-tree-fre" ) -endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" ) -if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) +endif( CMAKE_COMPILER_IS_GNUCXX ) +if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) # Need to enable intrinsics for this file. if( SSE_MATTERS ) set_source_files_properties( x86.cpp PROPERTIES COMPILE_FLAGS "-msse2 -mmmx" ) endif( SSE_MATTERS ) -endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) +endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) source_group("Assembly Files\\ia32" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/asm_ia32/.+") source_group("Assembly Files\\x86_64" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/asm_x86_64/.+") diff --git a/src/files.cpp b/src/files.cpp index 78936eba9..d018bb62c 100644 --- a/src/files.cpp +++ b/src/files.cpp @@ -33,11 +33,17 @@ ** */ +#ifdef _WIN32 +#define USE_WINDOWS_DWORD +#endif +#include "LzmaDec.h" + #include "files.h" #include "i_system.h" #include "templates.h" #include "m_misc.h" + //========================================================================== // // FileReader @@ -370,6 +376,15 @@ extern "C" void bz_internal_error (int errcode) // //========================================================================== +// This is retarded but necessary to work around the inclusion of windows.h in recent +// LZMA versions, meaning it's no longer possible to include the LZMA headers in files.h. +// As a result we cannot declare the CLzmaDec member in the header so we work around +// it my wrapping it into another struct that can be declared anonymously in the header. +struct FileReaderLZMA::StreamPointer +{ + CLzmaDec Stream; +}; + static void *SzAlloc(void *, size_t size) { return malloc(size); } static void SzFree(void *, void *address) { free(address); } ISzAlloc g_Alloc = { SzAlloc, SzFree }; @@ -398,20 +413,22 @@ FileReaderLZMA::FileReaderLZMA (FileReader &file, size_t uncompressed_size, bool FillBuffer(); - LzmaDec_Construct(&Stream); - err = LzmaDec_Allocate(&Stream, header + 4, LZMA_PROPS_SIZE, &g_Alloc); + Streamp = new StreamPointer; + LzmaDec_Construct(&Streamp->Stream); + err = LzmaDec_Allocate(&Streamp->Stream, header + 4, LZMA_PROPS_SIZE, &g_Alloc); if (err != SZ_OK) { I_Error("FileReaderLZMA: LzmaDec_Allocate failed: %d\n", err); } - LzmaDec_Init(&Stream); + LzmaDec_Init(&Streamp->Stream); } FileReaderLZMA::~FileReaderLZMA () { - LzmaDec_Free(&Stream, &g_Alloc); + LzmaDec_Free(&Streamp->Stream, &g_Alloc); + delete Streamp; } long FileReaderLZMA::Read (void *buffer, long len) @@ -426,7 +443,7 @@ long FileReaderLZMA::Read (void *buffer, long len) size_t out_processed = len; size_t in_processed = InSize; - err = LzmaDec_DecodeToBuf(&Stream, next_out, &out_processed, InBuff + InPos, &in_processed, finish_mode, &status); + err = LzmaDec_DecodeToBuf(&Streamp->Stream, next_out, &out_processed, InBuff + InPos, &in_processed, finish_mode, &status); InPos += in_processed; InSize -= in_processed; next_out += out_processed; diff --git a/src/files.h b/src/files.h index 52cda93f5..a38722738 100644 --- a/src/files.h +++ b/src/files.h @@ -4,7 +4,6 @@ #include #include #include "bzlib.h" -#include "LzmaDec.h" #include "doomtype.h" #include "m_swap.h" @@ -257,6 +256,8 @@ private: // Wraps around a FileReader to decompress a lzma stream class FileReaderLZMA : public FileReaderBase { + struct StreamPointer; + public: FileReaderLZMA (FileReader &file, size_t uncompressed_size, bool zip); ~FileReaderLZMA (); @@ -308,7 +309,7 @@ private: FileReader &File; bool SawEOF; - CLzmaDec Stream; + StreamPointer *Streamp; // anonymous pointer to LKZA decoder struct - to avoid including the LZMA headers globally size_t Size; size_t InPos, InSize; size_t OutProcessed; diff --git a/src/g_heretic/a_hereticmisc.cpp b/src/g_heretic/a_hereticmisc.cpp index 83200068b..279635482 100644 --- a/src/g_heretic/a_hereticmisc.cpp +++ b/src/g_heretic/a_hereticmisc.cpp @@ -187,7 +187,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_VolcanoBlast) DEFINE_ACTION_FUNCTION(AActor, A_VolcBallImpact) { - int i; + unsigned int i; AActor *tiny; angle_t angle; diff --git a/src/g_heretic/a_hereticweaps.cpp b/src/g_heretic/a_hereticweaps.cpp index 23ecf1ae5..17c9621d5 100644 --- a/src/g_heretic/a_hereticweaps.cpp +++ b/src/g_heretic/a_hereticweaps.cpp @@ -797,7 +797,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireBlasterPL1) DEFINE_ACTION_FUNCTION(AActor, A_SpawnRippers) { - int i; + unsigned int i; angle_t angle; AActor *ripper; diff --git a/src/g_heretic/a_ironlich.cpp b/src/g_heretic/a_ironlich.cpp index 5801e6cac..d8c1fd285 100644 --- a/src/g_heretic/a_ironlich.cpp +++ b/src/g_heretic/a_ironlich.cpp @@ -171,7 +171,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_WhirlwindSeek) DEFINE_ACTION_FUNCTION(AActor, A_LichIceImpact) { - int i; + unsigned int i; angle_t angle; AActor *shard; diff --git a/src/g_hexen/a_iceguy.cpp b/src/g_hexen/a_iceguy.cpp index 2d908f974..9d8360d4d 100644 --- a/src/g_hexen/a_iceguy.cpp +++ b/src/g_hexen/a_iceguy.cpp @@ -125,7 +125,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyDie) DEFINE_ACTION_FUNCTION(AActor, A_IceGuyMissileExplode) { AActor *mo; - int i; + unsigned int i; for (i = 0; i < 8; i++) { diff --git a/src/m_swap.h b/src/m_swap.h index 6e0bc88cc..82751fd47 100644 --- a/src/m_swap.h +++ b/src/m_swap.h @@ -29,51 +29,51 @@ // WAD files are stored little endian. #ifdef __APPLE__ -#include +#include inline short LittleShort(short x) { - return (short)CFSwapInt16LittleToHost((uint16_t)x); + return (short)OSSwapLittleToHostInt16((uint16_t)x); } inline unsigned short LittleShort(unsigned short x) { - return CFSwapInt16LittleToHost(x); + return OSSwapLittleToHostInt16(x); } inline short LittleShort(int x) { - return CFSwapInt16LittleToHost((uint16_t)x); + return OSSwapLittleToHostInt16((uint16_t)x); } inline int LittleLong(int x) { - return CFSwapInt32LittleToHost((uint32_t)x); + return OSSwapLittleToHostInt32((uint32_t)x); } inline unsigned int LittleLong(unsigned int x) { - return CFSwapInt32LittleToHost(x); + return OSSwapLittleToHostInt32(x); } inline short BigShort(short x) { - return (short)CFSwapInt16BigToHost((uint16_t)x); + return (short)OSSwapBigToHostInt16((uint16_t)x); } inline unsigned short BigShort(unsigned short x) { - return CFSwapInt16BigToHost(x); + return OSSwapBigToHostInt16(x); } inline int BigLong(int x) { - return CFSwapInt32BigToHost((uint32_t)x); + return OSSwapBigToHostInt32((uint32_t)x); } inline unsigned int BigLong(unsigned int x) { - return CFSwapInt32BigToHost(x); + return OSSwapBigToHostInt32(x); } #else diff --git a/src/resourcefiles/file_7z.cpp b/src/resourcefiles/file_7z.cpp index 53653bb59..72e8d5f0e 100644 --- a/src/resourcefiles/file_7z.cpp +++ b/src/resourcefiles/file_7z.cpp @@ -32,6 +32,12 @@ ** ** */ +#ifdef _WIN32 +#define USE_WINDOWS_DWORD +#endif + +#include "7z.h" +#include "7zCrc.h" #include "resourcefile.h" #include "cmdlib.h" @@ -41,8 +47,6 @@ #include "i_system.h" #include "w_wad.h" -#include "7z.h" -#include "7zCrc.h" //----------------------------------------------------------------------- diff --git a/src/sdl/i_main.cpp b/src/sdl/i_main.cpp index 3c721ae51..27324edf6 100644 --- a/src/sdl/i_main.cpp +++ b/src/sdl/i_main.cpp @@ -303,8 +303,8 @@ int main (int argc, char **argv) vid_defwidth = videoInfo->current_w; vid_defheight = videoInfo->current_h; vid_defbits = videoInfo->vfmt->BitsPerPixel; - vid_vsync = True; - fullscreen = True; + vid_vsync = true; + fullscreen = true; } #endif // __APPLE__ diff --git a/src/sdl/i_system.cpp b/src/sdl/i_system.cpp index f7137d103..88850d9fe 100644 --- a/src/sdl/i_system.cpp +++ b/src/sdl/i_system.cpp @@ -103,10 +103,8 @@ int (*I_GetTime) (bool saveMS); int (*I_WaitForTic) (int); void (*I_FreezeTime) (bool frozen); -void I_Tactile (int on, int off, int total) +void I_Tactile (int /*on*/, int /*off*/, int /*total*/) { - // UNUSED. - on = off = total = 0; } ticcmd_t emptycmd; @@ -323,8 +321,8 @@ void SetLanguageIDs () size_t langlen = strlen(language); DWORD lang = (langlen < 2 || langlen > 3) ? - MAKE_ID('e','n','u','0') : - MAKE_ID(language[0],language[1],language[2],'0'); + MAKE_ID('e','n','u','\0') : + MAKE_ID(language[0],language[1],language[2],'\0'); LanguageIDs[3] = LanguageIDs[2] = LanguageIDs[1] = LanguageIDs[0] = lang; } diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 9055f7b91..048d4d47f 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -1340,14 +1340,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireCustomMissile) self->pitch -= pitch; AActor * misl=P_SpawnPlayerMissile (self, x, y, z, ti, shootangle, &linetarget); self->pitch = SavedPlayerPitch; - if (Flags & FPF_TRANSFERTRANSLATION) - { - misl->Translation = self->Translation; - } // automatic handling of seeker missiles if (misl) { + if (Flags & FPF_TRANSFERTRANSLATION) misl->Translation = self->Translation; if (linetarget && misl->flags2&MF2_SEEKERMISSILE) misl->tracer=linetarget; if (!(Flags & FPF_AIMATANGLE)) { diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index 3b61bedca..81452c7b0 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -167,7 +167,7 @@ INTBOOL CheckActorFlag(const AActor *owner, FFlagDef *fd) { return fd->flagbit & *(DWORD *)(((char*)owner) + fd->structoffset); } -#ifdef __BID_ENDIAN__ +#ifdef __BIG_ENDIAN__ else if (fd->fieldsize == 2) { return fd->flagbit & *(WORD *)(((char*)owner) + fd->structoffset); diff --git a/tools/updaterevision/CMakeLists.txt b/tools/updaterevision/CMakeLists.txt index 2500f64fb..9e814a7d7 100644 --- a/tools/updaterevision/CMakeLists.txt +++ b/tools/updaterevision/CMakeLists.txt @@ -1,12 +1,12 @@ cmake_minimum_required( VERSION 2.4 ) if( WIN32 ) - if( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) + if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE OR ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/trustinfo.o COMMAND windres -o ${CMAKE_CURRENT_BINARY_DIR}/trustinfo.o -i ${CMAKE_CURRENT_SOURCE_DIR}/trustinfo.rc DEPENDS trustinfo.rc ) set( TRUSTINFO trustinfo.o ) - else( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) + else( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE OR ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) if( MSVC_VERSION GREATER 1399 ) # VC 8+ adds a manifest automatically to the executable. We need to # merge ours with it. @@ -14,7 +14,7 @@ if( WIN32 ) else( MSVC_VERSION GREATER 1399 ) set( TRUSTINFO trustinfo.rc ) endif( MSVC_VERSION GREATER 1399 ) - endif( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) + endif( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE OR ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) else( WIN32 ) set( TRUSTINFO "" ) endif( WIN32 ) diff --git a/tools/zipdir/zipdir.c b/tools/zipdir/zipdir.c index 9b521bedf..1479952e0 100644 --- a/tools/zipdir/zipdir.c +++ b/tools/zipdir/zipdir.c @@ -129,7 +129,7 @@ typedef struct compressor_s int method; } compressor_t; -typedef unsigned int DWORD; +typedef unsigned int UINT32; typedef unsigned short WORD; typedef unsigned char BYTE; @@ -139,49 +139,49 @@ typedef unsigned char BYTE; //#pragma pack(push,1) typedef struct { - DWORD Magic; // 0 + UINT32 Magic; // 0 BYTE VersionToExtract[2]; // 4 WORD Flags; // 6 WORD Method; // 8 WORD ModTime; // 10 WORD ModDate; // 12 - DWORD CRC32; // 14 - DWORD CompressedSize; // 18 - DWORD UncompressedSize; // 22 + UINT32 CRC32; // 14 + UINT32 CompressedSize; // 18 + UINT32 UncompressedSize; // 22 WORD NameLength; // 26 WORD ExtraLength; // 28 } LocalFileHeader; typedef struct { - DWORD Magic; + UINT32 Magic; BYTE VersionMadeBy[2]; BYTE VersionToExtract[2]; WORD Flags; WORD Method; WORD ModTime; WORD ModDate; - DWORD CRC32; - DWORD CompressedSize; - DWORD UncompressedSize; + UINT32 CRC32; + UINT32 CompressedSize; + UINT32 UncompressedSize; WORD NameLength; WORD ExtraLength; WORD CommentLength; WORD StartingDiskNumber; WORD InternalAttributes; - DWORD ExternalAttributes; - DWORD LocalHeaderOffset; + UINT32 ExternalAttributes; + UINT32 LocalHeaderOffset; } CentralDirectoryEntry; typedef struct { - DWORD Magic; + UINT32 Magic; WORD DiskNumber; WORD FirstDisk; WORD NumEntries; WORD NumEntriesOnAllDisks; - DWORD DirectorySize; - DWORD DirectoryOffset; + UINT32 DirectorySize; + UINT32 DirectoryOffset; WORD ZipCommentLength; } EndOfCentralDirectory; //#pragma pack(pop) @@ -1373,7 +1373,7 @@ BYTE *find_central_dir(FILE *fin) back_read = 4; while (back_read < max_back) { - DWORD read_size, read_pos; + UINT32 read_size, read_pos; int i; if (back_read + BUFREADCOMMENT > max_back) back_read = max_back; @@ -1420,12 +1420,12 @@ BYTE *find_central_dir(FILE *fin) free(dir); return NULL; } - if (*(DWORD *)dir != ZIP_CENTRALFILE) + if (*(UINT32 *)dir != ZIP_CENTRALFILE) { free(dir); return NULL; } - *(DWORD *)(dir + LittleLong(eod.DirectorySize)) = ZIP_ENDOFDIR; + *(UINT32 *)(dir + LittleLong(eod.DirectorySize)) = ZIP_ENDOFDIR; return dir; } @@ -1444,7 +1444,7 @@ CentralDirectoryEntry *find_file_in_zip(BYTE *dir, const char *path, unsigned in CentralDirectoryEntry *ent; int flags; - while (*(DWORD *)dir == ZIP_CENTRALFILE) + while (*(UINT32 *)dir == ZIP_CENTRALFILE) { ent = (CentralDirectoryEntry *)dir; if (pathlen == LittleShort(ent->NameLength) && @@ -1455,7 +1455,7 @@ CentralDirectoryEntry *find_file_in_zip(BYTE *dir, const char *path, unsigned in } dir += sizeof(*ent) + LittleShort(ent->NameLength) + LittleShort(ent->ExtraLength) + LittleShort(ent->CommentLength); } - if (*(DWORD *)dir != ZIP_CENTRALFILE) + if (*(UINT32 *)dir != ZIP_CENTRALFILE) { return NULL; } @@ -1495,7 +1495,7 @@ int copy_zip_file(FILE *zip, file_entry_t *file, FILE *ozip, CentralDirectoryEnt { LocalFileHeader lfh; BYTE *buf; - DWORD buf_size; + UINT32 buf_size; if (fseek(ozip, LittleLong(ent->LocalHeaderOffset), SEEK_SET) != 0) {