Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private static int sizeRepeatedFixed64(ProtoFieldInfo field, int numValues) {
public static int sizeRepeatedString(ProtoFieldInfo field, byte[][] utf8Bytes) {
int size = 0;
for (byte[] i : utf8Bytes) {
size += MarshalerUtil.sizeBytes(field, i);
Comment thread
jhalliday marked this conversation as resolved.
size += sizeBytes(field, i, /* skipEmpty= */ false);
}
return size;
}
Expand Down Expand Up @@ -384,7 +384,12 @@ public static int sizeFixed32(ProtoFieldInfo field, int message) {

/** Returns the size of a bytes field. */
public static int sizeBytes(ProtoFieldInfo field, byte[] message) {
if (message.length == 0) {
return sizeBytes(field, message, /* skipEmpty= */ true);
}

/** Returns the size of a bytes field. */
public static int sizeBytes(ProtoFieldInfo field, byte[] message, boolean skipEmpty) {
if (message.length == 0 && skipEmpty) {
return 0;
}
return field.getTagSize() + CodedOutputStream.computeByteArraySizeNoTag(message);
Expand Down
Loading