From d444cd582b6ee7424aec47c1ac239b191718c0bb Mon Sep 17 00:00:00 2001 From: godotg Date: Mon, 15 Jul 2024 16:56:13 +0800 Subject: [PATCH] ref[protocol]: cpp protocol --- protocol/src/main/resources/cpp/ByteBuffer.h | 12 ++++++------ protocol/src/test/cpp/zfoocpp/ByteBuffer.h | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/protocol/src/main/resources/cpp/ByteBuffer.h b/protocol/src/main/resources/cpp/ByteBuffer.h index 00ad6293..52d69bb0 100644 --- a/protocol/src/main/resources/cpp/ByteBuffer.h +++ b/protocol/src/main/resources/cpp/ByteBuffer.h @@ -120,10 +120,10 @@ namespace zfoo { void setWriteOffset(int32_t writeIndex) { if (writeIndex > max_capacity) { string errorMessage = - "writeIndex[" + std::to_string(writeIndex) + "] out of bounds exception: readIndex: " + + "writeIndex[" + std::to_string(writeIndex) + "] out of bounds exception: readOffset: " + std::to_string(readOffset) + - ", writIndex: " + std::to_string(writeOffset) + - "(expected: 0 <= readIndex <= writeIndex <= capacity:" + std::to_string(max_capacity); + ", writeOffset: " + std::to_string(writeOffset) + + "(expected: 0 <= readOffset <= writeOffset <= capacity:" + std::to_string(max_capacity); throw errorMessage; } writeOffset = writeIndex; @@ -132,10 +132,10 @@ namespace zfoo { void setReadOffset(int32_t readIndex) { if (readIndex > writeOffset) { string errorMessage = - "readIndex[" + std::to_string(readIndex) + "] out of bounds exception: readIndex: " + + "readIndex[" + std::to_string(readIndex) + "] out of bounds exception: readOffset: " + std::to_string(readOffset) + - ", writeIndex: " + std::to_string(writeOffset) + - "(expected: 0 <= readIndex <= writeIndex <= capacity:" + std::to_string(max_capacity); + ", writeOffset: " + std::to_string(writeOffset) + + "(expected: 0 <= readOffset <= writeOffset <= capacity:" + std::to_string(max_capacity); throw errorMessage; } readOffset = readIndex; diff --git a/protocol/src/test/cpp/zfoocpp/ByteBuffer.h b/protocol/src/test/cpp/zfoocpp/ByteBuffer.h index 00ad6293..52d69bb0 100644 --- a/protocol/src/test/cpp/zfoocpp/ByteBuffer.h +++ b/protocol/src/test/cpp/zfoocpp/ByteBuffer.h @@ -120,10 +120,10 @@ namespace zfoo { void setWriteOffset(int32_t writeIndex) { if (writeIndex > max_capacity) { string errorMessage = - "writeIndex[" + std::to_string(writeIndex) + "] out of bounds exception: readIndex: " + + "writeIndex[" + std::to_string(writeIndex) + "] out of bounds exception: readOffset: " + std::to_string(readOffset) + - ", writIndex: " + std::to_string(writeOffset) + - "(expected: 0 <= readIndex <= writeIndex <= capacity:" + std::to_string(max_capacity); + ", writeOffset: " + std::to_string(writeOffset) + + "(expected: 0 <= readOffset <= writeOffset <= capacity:" + std::to_string(max_capacity); throw errorMessage; } writeOffset = writeIndex; @@ -132,10 +132,10 @@ namespace zfoo { void setReadOffset(int32_t readIndex) { if (readIndex > writeOffset) { string errorMessage = - "readIndex[" + std::to_string(readIndex) + "] out of bounds exception: readIndex: " + + "readIndex[" + std::to_string(readIndex) + "] out of bounds exception: readOffset: " + std::to_string(readOffset) + - ", writeIndex: " + std::to_string(writeOffset) + - "(expected: 0 <= readIndex <= writeIndex <= capacity:" + std::to_string(max_capacity); + ", writeOffset: " + std::to_string(writeOffset) + + "(expected: 0 <= readOffset <= writeOffset <= capacity:" + std::to_string(max_capacity); throw errorMessage; } readOffset = readIndex;