tisonkun commented on code in PR #2024:
URL: https://github.com/apache/zookeeper/pull/2024#discussion_r1256894529


##########
zookeeper-jute/src/main/java/org/apache/jute/BinaryOutputArchive.java:
##########
@@ -108,18 +116,22 @@ public void writeString(String s, String tag) throws 
IOException {
             return;
         }
         ByteBuffer bb = stringToByteBuffer(s);
-        writeInt(bb.remaining(), "len");
+        int strLen = bb.remaining();
+        writeInt(strLen, "len");
         out.write(bb.array(), bb.position(), bb.limit());
+        dataSize += strLen;

Review Comment:
   Since we write an int first, share will `+4` here? Ditto `writeBuffer`. 



##########
zookeeper-jute/src/main/java/org/apache/jute/BinaryOutputArchive.java:
##########
@@ -108,18 +116,22 @@ public void writeString(String s, String tag) throws 
IOException {
             return;
         }
         ByteBuffer bb = stringToByteBuffer(s);
-        writeInt(bb.remaining(), "len");
+        int strLen = bb.remaining();
+        writeInt(strLen, "len");
         out.write(bb.array(), bb.position(), bb.limit());
+        dataSize += strLen;

Review Comment:
   Since we write an int first, share we `+4` here? Ditto `writeBuffer`. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to