Kriskras99 commented on code in PR #336:
URL: https://github.com/apache/avro-rs/pull/336#discussion_r2524833092


##########
avro/src/util.rs:
##########
@@ -100,25 +105,34 @@ pub(crate) fn zag_i64<R: Read>(reader: &mut R) -> 
AvroResult<i64> {
     })
 }
 
-fn encode_variable<W: Write>(mut z: u64, mut writer: W) -> AvroResult<usize> {
+/// Write the number as a varint to the writer.
+///
+/// Note: this function does not do zigzag encoding, for that see [`zig_i32`] 
and [`zig_i64`].
+fn encode_variable<W: Write>(mut zigzagged: u64, mut writer: W) -> 
AvroResult<usize> {
+    // Ensure the number is little endian for the varint encoding (no-op on LE 
systems)
+    zigzagged = zigzagged.to_le();

Review Comment:
   I don't think this is correct. Encoding a varint on BE and then decoding 
that on LE should give the same result (but the specification doesn't actually 
specify which endianness to use).



-- 
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