From 27943482c15474b2f14bf30ab28b244fb55beb42 Mon Sep 17 00:00:00 2001 From: godotg Date: Mon, 15 Jul 2024 17:01:37 +0800 Subject: [PATCH] ref[C#]: C# protocol --- .../src/main/resources/csharp/Buffer/ByteBuffer.cs | 14 ++++++-------- .../src/test/csharp/zfoocs/Buffer/ByteBuffer.cs | 14 ++++++-------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/protocol/src/main/resources/csharp/Buffer/ByteBuffer.cs b/protocol/src/main/resources/csharp/Buffer/ByteBuffer.cs index 3234a786..a231ada0 100644 --- a/protocol/src/main/resources/csharp/Buffer/ByteBuffer.cs +++ b/protocol/src/main/resources/csharp/Buffer/ByteBuffer.cs @@ -89,12 +89,11 @@ namespace zfoocs { if (writeIndex > buffer.Length) { - throw new Exception("writeIndex[" + writeIndex + "] out of bounds exception: readerIndex: " + + throw new Exception("writeIndex[" + writeIndex + "] out of bounds exception: readOffset: " + readOffset + - ", writerIndex: " + writeOffset + - "(expected: 0 <= readerIndex <= writerIndex <= capacity:" + buffer.Length); + ", writeOffset: " + writeOffset + + "(expected: 0 <= readOffset <= writeOffset <= capacity:" + buffer.Length); } - writeOffset = writeIndex; } @@ -107,11 +106,10 @@ namespace zfoocs { if (readIndex > writeOffset) { - throw new Exception("readIndex[" + readIndex + "] out of bounds exception: readerIndex: " + readOffset + - ", writerIndex: " + writeOffset + - "(expected: 0 <= readerIndex <= writerIndex <= capacity:" + buffer.Length); + throw new Exception("readIndex[" + readIndex + "] out of bounds exception: readIndex: " + readOffset + + ", writeOffset: " + writeOffset + + "(expected: 0 <= readOffset <= writeOffset <= capacity:" + buffer.Length); } - readOffset = readIndex; } diff --git a/protocol/src/test/csharp/zfoocs/Buffer/ByteBuffer.cs b/protocol/src/test/csharp/zfoocs/Buffer/ByteBuffer.cs index 3234a786..a231ada0 100644 --- a/protocol/src/test/csharp/zfoocs/Buffer/ByteBuffer.cs +++ b/protocol/src/test/csharp/zfoocs/Buffer/ByteBuffer.cs @@ -89,12 +89,11 @@ namespace zfoocs { if (writeIndex > buffer.Length) { - throw new Exception("writeIndex[" + writeIndex + "] out of bounds exception: readerIndex: " + + throw new Exception("writeIndex[" + writeIndex + "] out of bounds exception: readOffset: " + readOffset + - ", writerIndex: " + writeOffset + - "(expected: 0 <= readerIndex <= writerIndex <= capacity:" + buffer.Length); + ", writeOffset: " + writeOffset + + "(expected: 0 <= readOffset <= writeOffset <= capacity:" + buffer.Length); } - writeOffset = writeIndex; } @@ -107,11 +106,10 @@ namespace zfoocs { if (readIndex > writeOffset) { - throw new Exception("readIndex[" + readIndex + "] out of bounds exception: readerIndex: " + readOffset + - ", writerIndex: " + writeOffset + - "(expected: 0 <= readerIndex <= writerIndex <= capacity:" + buffer.Length); + throw new Exception("readIndex[" + readIndex + "] out of bounds exception: readIndex: " + readOffset + + ", writeOffset: " + writeOffset + + "(expected: 0 <= readOffset <= writeOffset <= capacity:" + buffer.Length); } - readOffset = readIndex; }