From 1a310981826b800b1a4a405eaef0612cf7b1cb70 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Sun, 2 Jan 2022 12:11:54 +0100 Subject: Fix compilation with Clang 13.0.0 Clang 13 changes: * `-Wreserved-identifier` and `-Wunused-but-set-variable` got added * the `-Wreturn-std-move-in-c++11` option was removed Builds still fail when native optimizations are enabled --- src/ByteBuffer.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/ByteBuffer.cpp') diff --git a/src/ByteBuffer.cpp b/src/ByteBuffer.cpp index 127227180..80be9baee 100644 --- a/src/ByteBuffer.cpp +++ b/src/ByteBuffer.cpp @@ -117,8 +117,8 @@ bool cByteBuffer::Write(const void * a_Bytes, size_t a_Count) size_t CurFreeSpace = GetFreeSpace(); #ifndef NDEBUG size_t CurReadableSpace = GetReadableSpace(); + size_t WrittenBytes = 0; #endif - size_t WrittenBytes = 0; if (CurFreeSpace < a_Count) { @@ -135,7 +135,9 @@ bool cByteBuffer::Write(const void * a_Bytes, size_t a_Count) memcpy(m_Buffer + m_WritePos, Bytes, TillEnd); Bytes += TillEnd; a_Count -= TillEnd; - WrittenBytes = TillEnd; + #ifndef NDEBUG + WrittenBytes = TillEnd; + #endif } m_WritePos = 0; } @@ -145,7 +147,9 @@ bool cByteBuffer::Write(const void * a_Bytes, size_t a_Count) { memcpy(m_Buffer + m_WritePos, Bytes, a_Count); m_WritePos += a_Count; - WrittenBytes += a_Count; + #ifndef NDEBUG + WrittenBytes += a_Count; + #endif } ASSERT(GetFreeSpace() == CurFreeSpace - WrittenBytes); -- cgit v1.2.3