From b49159ed941388ce4a60a9f260ac4753f0473a97 Mon Sep 17 00:00:00 2001 From: artem Date: Thu, 7 Nov 2024 22:11:58 +0300 Subject: [PATCH] fix build rbdoom3bfg linux arm64 --- .../main/jni/doom3bfg/neo/idlib/DataQueue.h | 50 ++++++++++++------- cmake_linux_build_doom3bfg.sh | 2 +- 2 files changed, 34 insertions(+), 18 deletions(-) mode change 100644 => 100755 cmake_linux_build_doom3bfg.sh diff --git a/Q3E/src/main/jni/doom3bfg/neo/idlib/DataQueue.h b/Q3E/src/main/jni/doom3bfg/neo/idlib/DataQueue.h index fb433518d..2cd60be56 100644 --- a/Q3E/src/main/jni/doom3bfg/neo/idlib/DataQueue.h +++ b/Q3E/src/main/jni/doom3bfg/neo/idlib/DataQueue.h @@ -95,23 +95,39 @@ idDataQueue::Append template< int maxItems, int maxBuffer > bool idDataQueue< maxItems, maxBuffer >::Append( int sequence, const byte* b1, int b1Len, const byte* b2, int b2Len ) { - if( items.Num() == items.Max() ) - { - return false; - } - if( dataLength + b1Len + b2Len >= maxBuffer ) - { - return false; - } - msgItem_t& item = *items.Alloc(); - item.length = b1Len + b2Len; - item.sequence = sequence; - item.dataOffset = dataLength; - memcpy( data + dataLength, b1, b1Len ); - dataLength += b1Len; - memcpy( data + dataLength, b2, b2Len ); - dataLength += b2Len; - return true; + + if (b1 == NULL || b1Len < 0) { + return false; + } + + + if (b2 == NULL) { + b2Len = 0; + } + + if (items.Num() == items.Max()) { + return false; + } + if (dataLength + b1Len + b2Len >= maxBuffer) { + return false; + } + + msgItem_t& item = *items.Alloc(); + item.length = b1Len + b2Len; + item.sequence = sequence; + item.dataOffset = dataLength; + + + memcpy(data + dataLength, b1, b1Len); + dataLength += b1Len; + + + if (b2Len > 0) { + memcpy(data + dataLength, b2, b2Len); + dataLength += b2Len; + } + //ArtemS2 fix :) + return true; } #endif // DATAQUEUE_H diff --git a/cmake_linux_build_doom3bfg.sh b/cmake_linux_build_doom3bfg.sh old mode 100644 new mode 100755 index d7cd9a247..8f2a977a8 --- a/cmake_linux_build_doom3bfg.sh +++ b/cmake_linux_build_doom3bfg.sh @@ -11,7 +11,7 @@ TARGET_PATH="`pwd`/Q3E/src/main/jni/doom3bfg/neo"; cd ${TARGET_PATH}; echo "Configure and generate GNU makefile ......"; -cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} CMakeLists.txt; +cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_CXX_FLAGS="-Werror=nonnull" CMakeLists.txt; echo "Build ${BUILD_TYPE} ......"; make;