Use byteread_vlen in logreader.c
@@ -130,25 +130,22 @@ static int binlog_convert_event(bytestream * s, void * ptr)
while (ret == 0 && bytestream_remain(s) > 0) {
- uint64_t len_read = 0;
- ret |= byteread_vint(s, &len_read);
-
- size_t len = (size_t)len_read;
- if (len != len_read) {
- ret = -1;
- break;
- }
+ size_t len = 0;
+ ret = byteread_vlen(s, &len);
+ if (ret == 0) {
bytestream stream;
bytestream* frame = bytestream_ref_init(&stream, bytestream_ptr(s), len);
- ret |= bytestream_skip(s, len);
+ ret = bytestream_skip(s, len);
if (ret == 0) {
- ret |= ctx->callbacks->packet_frame(frame, cbptr);
+ ret = ctx->callbacks->packet_frame(frame, cbptr);
+ }
}
}
+
if (ret == 0) {
- ret |= ctx->callbacks->packet_end(cbptr);
+ ret = ctx->callbacks->packet_end(cbptr);
}
}
