kits/shared/JsonTextWriter: Correct misaligned while compare
This commit is contained in:
@@ -627,7 +627,7 @@ BJsonTextWriter::StreamStringEncoded(const char* string,
|
|||||||
{
|
{
|
||||||
status_t writeResult = B_OK;
|
status_t writeResult = B_OK;
|
||||||
uint8* string8bit = (uint8*)string;
|
uint8* string8bit = (uint8*)string;
|
||||||
off_t i = 0;
|
size_t i = 0;
|
||||||
|
|
||||||
while (i < length && writeResult == B_OK) {
|
while (i < length && writeResult == B_OK) {
|
||||||
uint8 c = string8bit[offset + i];
|
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(
|
size_t l = 1 + b_json_len_7bit_clean_non_esc(
|
||||||
&string8bit[offset + i + 1], length - (offset + i + 1));
|
&string8bit[offset + i + 1], length - (offset + i + 1));
|
||||||
writeResult = StreamStringVerbatim(&string[offset + i], 0, l);
|
writeResult = StreamStringVerbatim(&string[offset + i], 0, l);
|
||||||
i += static_cast<off_t>(l);
|
i += static_cast<size_t>(l);
|
||||||
} else {
|
} else {
|
||||||
if (b_json_is_illegal(c)) {
|
if (b_json_is_illegal(c)) {
|
||||||
fprintf(stderr, "! string encoding error - illegal "
|
fprintf(stderr, "! string encoding error - illegal "
|
||||||
@@ -663,7 +663,7 @@ BJsonTextWriter::StreamStringEncoded(const char* string,
|
|||||||
&unicodeStr);
|
&unicodeStr);
|
||||||
writeResult = StreamStringUnicodeCharacter(
|
writeResult = StreamStringUnicodeCharacter(
|
||||||
unicodeCharacter);
|
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)
|
BJsonTextWriter::StreamChar(char c)
|
||||||
{
|
{
|
||||||
return fDataIO->WriteExactly(&c, 1);
|
return fDataIO->WriteExactly(&c, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user