From 73c03544b4523ebeef55b9d4032a33bddbb47e2f Mon Sep 17 00:00:00 2001 From: heinrich5991 Date: Sat, 17 Feb 2018 01:35:07 +0100 Subject: [PATCH] Support older wavpack versions --- CMakeLists.txt | 6 +++--- src/engine/client/sound.cpp | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b8c3b859c..6b7d25b73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -881,12 +881,12 @@ if(CLIENT) set(CMAKE_REQUIRED_INCLUDES ${ORIGINAL_CMAKE_REQUIRED_INCLUDES} ${WAVPACK_INCLUDE_DIRS}) set(CMAKE_REQUIRED_LIBRARIES ${ORIGINAL_CMAKE_REQUIRED_LIBRARIES} ${WAVPACK_LIBRARIES}) - check_symbol_exists(WavpackOpenFileInputEx64 wavpack.h WAVPACK_OPEN_FILE_INPUT_EX64) + check_symbol_exists(WavpackOpenFileInputEx wavpack.h WAVPACK_OPEN_FILE_INPUT_EX) set(CMAKE_REQUIRED_INCLUDES ${ORIGINAL_CMAKE_REQUIRED_INCLUDES}) set(CMAKE_REQUIRED_LIBRARIES ${ORIGINAL_CMAKE_REQUIRED_LIBRARIES}) - if(WAVPACK_OPEN_FILE_INPUT_EX64) - target_compile_definitions(${TARGET_CLIENT} PRIVATE CONF_WAVPACK_OPEN_FILE_INPUT_EX64) + if(WAVPACK_OPEN_FILE_INPUT_EX) + target_compile_definitions(${TARGET_CLIENT} PRIVATE CONF_WAVPACK_OPEN_FILE_INPUT_EX) endif() list(APPEND TARGETS_OWN ${TARGET_CLIENT}) diff --git a/src/engine/client/sound.cpp b/src/engine/client/sound.cpp index d9079806a..7a186fc3f 100644 --- a/src/engine/client/sound.cpp +++ b/src/engine/client/sound.cpp @@ -469,7 +469,7 @@ static int ReadDataOld(void *pBuffer, int Size) return ChunkSize; } -#if defined(CONF_WAVPACK_OPEN_FILE_INPUT_EX64) +#if defined(CONF_WAVPACK_OPEN_FILE_INPUT_EX) static int ReadData(void *pId, void *pBuffer, int Size) { (void)pId; @@ -482,13 +482,13 @@ static int ReturnFalse(void *pId) return 0; } -static int64_t GetPos(void *pId) +static unsigned int GetPos(void *pId) { (void)pId; return s_WVBufferPosition; } -static int64_t GetLength(void *pId) +static unsigned int GetLength(void *pId) { (void)pId; return s_WVBufferSize; @@ -514,14 +514,14 @@ int CSound::DecodeWV(int SampleID, const void *pData, unsigned DataSize) s_WVBufferSize = DataSize; s_WVBufferPosition = 0; -#if defined(CONF_WAVPACK_OPEN_FILE_INPUT_EX64) - WavpackStreamReader64 Callback = {0}; +#if defined(CONF_WAVPACK_OPEN_FILE_INPUT_EX) + WavpackStreamReader Callback = {0}; Callback.can_seek = ReturnFalse; Callback.get_length = GetLength; Callback.get_pos = GetPos; Callback.push_back_byte = PushBackByte; - Callback.read_bytes = ::ReadData; - pContext = WavpackOpenFileInputEx64(&Callback,0, 0, aError, 0, 0); + Callback.read_bytes = ReadData; + pContext = WavpackOpenFileInputEx(&Callback,0, 0, aError, 0, 0); #else pContext = WavpackOpenFileInput(ReadDataOld, aError); #endif