kits/shared/JsonTextWriter: Correct misaligned while compare

This commit is contained in:
Alexander von Gluck IV 2018-10-08 15:23:10 -05:00
parent 4a3dae2bac
commit 20e420cdbe

View File

@ -627,7 +627,7 @@ BJsonTextWriter::StreamStringEncoded(const char* string,
{
status_t writeResult = B_OK;
uint8* string8bit = (uint8*)string;
off_t i = 0;
size_t i = 0;
while (i < length && writeResult == B_OK) {
uint8 c = string8bit[offset + i];
@ -648,7 +648,7 @@ BJsonTextWriter::StreamStringEncoded(const char* string,
size_t l = 1 + b_json_len_7bit_clean_non_esc(
&string8bit[offset + i + 1], length - (offset + i + 1));
writeResult = StreamStringVerbatim(&string[offset + i], 0, l);
i += static_cast<off_t>(l);
i += static_cast<size_t>(l);
} else {
if (b_json_is_illegal(c)) {
fprintf(stderr, "! string encoding error - illegal "
@ -663,7 +663,7 @@ BJsonTextWriter::StreamStringEncoded(const char* string,
&unicodeStr);
writeResult = StreamStringUnicodeCharacter(
unicodeCharacter);
i += static_cast<off_t>(unicodeStr - &string[offset + i]);
i += static_cast<size_t>(unicodeStr - &string[offset + i]);
}
}
}
@ -703,4 +703,4 @@ status_t
BJsonTextWriter::StreamChar(char c)
{
return fDataIO->WriteExactly(&c, 1);
}
}