Skip to content

Commit

Permalink
Minor fix for custom escape handling wrt "long" (>6 chars) escape han…
Browse files Browse the repository at this point in the history
…dling
  • Loading branch information
cowtowncoder committed Jan 3, 2020
1 parent 69c844c commit d7fb44c
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1720,11 +1720,11 @@ private final int _writeCustomEscape(byte[] outputBuffer, int outputPtr, Seriali
return (outputPtr + len);
}

private final int _handleLongCustomEscape(byte[] outputBuffer, int outputPtr, int outputEnd, byte[] raw,
int remainingChars)
private final int _handleLongCustomEscape(byte[] outputBuffer, int outputPtr, int outputEnd,
byte[] raw, int remainingChars)
throws IOException, JsonGenerationException
{
int len = raw.length;
final int len = raw.length;
if ((outputPtr + len) > outputEnd) {
_outputTail = outputPtr;
_flushBuffer();
Expand All @@ -1733,11 +1733,12 @@ private final int _handleLongCustomEscape(byte[] outputBuffer, int outputPtr, in
_outputStream.write(raw, 0, len);
return outputPtr;
}
System.arraycopy(raw, 0, outputBuffer, outputPtr, len);
outputPtr += len;
}
System.arraycopy(raw, 0, outputBuffer, outputPtr, len);
outputPtr += len;
// but is the invariant still obeyed? If not, flush once more
if ((outputPtr + 6 * remainingChars) > outputEnd) {
_outputTail = outputPtr;
_flushBuffer();
return _outputTail;
}
Expand Down

0 comments on commit d7fb44c

Please sign in to comment.