kpumuk commented on code in PR #3741:
URL: https://github.com/apache/thrift/pull/3741#discussion_r3839466948


##########
lib/rb/ext/compact_protocol.c:
##########
@@ -174,27 +174,29 @@ static int32_t message_seqid_from_varint32(uint32_t 
seqid) {
 }
 
 static void write_varint32(VALUE transport, uint32_t n) {
-  while (true) {
-    if ((n & ~0x7FU) == 0U) {
-      write_byte_direct(transport, n & 0x7FU);
-      break;
-    } else {
-      write_byte_direct(transport, (n & 0x7FU) | 0x80U);
-      n = n >> 7;
-    }
+  unsigned char bytes[5];
+  long length = 0;
+
+  while ((n & ~0x7FU) != 0U) {
+    bytes[length++] = (n & 0x7FU) | 0x80U;
+    n >>= 7;
   }
+  bytes[length++] = n;
+
+  WRITE(transport, (const char*)bytes, length);

Review Comment:
   Added a native-path recording transport regression in 19af32b91. It covers 
maximum-length i32 and i64 varints and asserts that each is delivered as a 
single write containing the complete canonical encoding.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to