Skip to content

Commit

Permalink
Fix _updateToken() wrt NOT_AVAILABLE token/state
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jun 28, 2024
1 parent 7af6e97 commit 8f2da17
Showing 1 changed file with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ protected JsonToken _finishHeader(int state) throws IOException
case 0:
if (_inputPtr >= _inputEnd) {
_pending32 = state;
return _updateToken(JsonToken.NOT_AVAILABLE);
return _updateTokenToNA();
}
ch = _inputBuffer[_inputPtr++];
if (ch!= SmileConstants.HEADER_BYTE_2) {
Expand All @@ -354,7 +354,7 @@ protected JsonToken _finishHeader(int state) throws IOException
case 1:
if (_inputPtr >= _inputEnd) {
_pending32 = state;
return _updateToken(JsonToken.NOT_AVAILABLE);
return _updateTokenToNA();
}
ch = _inputBuffer[_inputPtr++];
if (ch != SmileConstants.HEADER_BYTE_3) {
Expand All @@ -365,7 +365,7 @@ protected JsonToken _finishHeader(int state) throws IOException
case 2:
if (_inputPtr >= _inputEnd) {
_pending32 = state;
return _updateToken(JsonToken.NOT_AVAILABLE);
return _updateTokenToNA();
}
ch = _inputBuffer[_inputPtr++];
{
Expand Down Expand Up @@ -490,7 +490,7 @@ private final JsonToken _startValue(int ch) throws IOException
// did not get it all; mark the state so we know where to return:
_pending32 = ch;
_minorState = MINOR_VALUE_STRING_SHARED_2BYTE;
return _updateToken(JsonToken.NOT_AVAILABLE);
return _updateTokenToNA();
case 0x18: // START_ARRAY
return _startArrayScope();
case 0x19: // END_ARRAY
Expand Down Expand Up @@ -541,7 +541,7 @@ protected final JsonToken _startFieldName(int ch) throws IOException
{
_minorState = MINOR_FIELD_NAME_2BYTE;
_pending32 = (ch & 0x3) << 8;
return _updateToken(JsonToken.NOT_AVAILABLE);
return _updateTokenToNA();
}
case 0x34: // long ASCII/Unicode name
return _finishLongFieldName(0);
Expand Down Expand Up @@ -581,7 +581,7 @@ protected final JsonToken _startFieldName(int ch) throws IOException
}
}
_minorState = MINOR_FIELD_NAME_SHORT_ASCII;
return _updateToken(JsonToken.NOT_AVAILABLE);
return _updateTokenToNA();

case 3: // short Unicode; possibly doable
// all valid, except for 0xFF
Expand Down Expand Up @@ -622,7 +622,7 @@ protected final JsonToken _startFieldName(int ch) throws IOException
System.arraycopy(_inputBuffer, inputPtr, _inputCopy, 0, left);
}
_minorState = MINOR_FIELD_NAME_SHORT_UNICODE;
return _updateToken(JsonToken.NOT_AVAILABLE);
return _updateTokenToNA();
}
}
// Other byte values are illegal
Expand Down Expand Up @@ -653,7 +653,7 @@ private final JsonToken _finishLongFieldName(int outPtr) throws IOException
_inputPtr = srcPtr;
_minorState = MINOR_FIELD_NAME_LONG;
_inputCopyLen = outPtr;
return _updateToken(JsonToken.NOT_AVAILABLE);
return _updateTokenToNA();
}
// otherwise increase copy buffer length
int oldLen = copyBuffer.length;
Expand Down Expand Up @@ -733,7 +733,7 @@ private final JsonToken _startShortASCII(final int len) throws IOException
System.arraycopy(_inputBuffer, inputPtr, _inputCopy, 0, left);
}
_minorState = MINOR_VALUE_STRING_SHORT_ASCII;
return _updateToken(JsonToken.NOT_AVAILABLE);
return _updateTokenToNA();
}

private final JsonToken _startShortUnicode(final int len) throws IOException
Expand All @@ -756,7 +756,7 @@ private final JsonToken _startShortUnicode(final int len) throws IOException
_inputPtr = inPtr + left;
}
_minorState = MINOR_VALUE_STRING_SHORT_UNICODE;
return _updateToken(JsonToken.NOT_AVAILABLE);
return _updateTokenToNA();
}

/*
Expand Down Expand Up @@ -792,7 +792,7 @@ private final JsonToken _startLongASCII() throws IOException
// denote current length; no partial input to save
_textBuffer.setCurrentLength(outPtr);
_minorState = MINOR_VALUE_STRING_LONG_ASCII;
return _updateToken(JsonToken.NOT_AVAILABLE);
return _updateTokenToNA();
}

private final JsonToken _finishLongASCII() throws IOException
Expand Down Expand Up @@ -932,7 +932,7 @@ protected final JsonToken _startLongUnicode() throws IOException
}
_textBuffer.setCurrentLength(outPtr);
_minorState = MINOR_VALUE_STRING_LONG_UNICODE;
return _updateToken(JsonToken.NOT_AVAILABLE);
return _updateTokenToNA();
}

private final JsonToken _finishLongUnicode() throws IOException
Expand Down Expand Up @@ -1199,7 +1199,7 @@ private final JsonToken _finishInt(int value, int bytesRead) throws IOException
_minorState = MINOR_VALUE_NUMBER_INT;
_pending32 = value;
_inputCopyLen = bytesRead;
return _updateToken(JsonToken.NOT_AVAILABLE);
return _updateTokenToNA();
}

private final JsonToken _startLong() throws IOException
Expand Down Expand Up @@ -1253,7 +1253,7 @@ private final JsonToken _finishLong(long value, int bytesRead) throws IOExceptio
_minorState = MINOR_VALUE_NUMBER_LONG;
_pending64 = value;
_inputCopyLen = bytesRead;
return _updateToken(JsonToken.NOT_AVAILABLE);
return _updateTokenToNA();
}

private final JsonToken _startBigInt() throws IOException
Expand Down Expand Up @@ -1285,7 +1285,7 @@ private final JsonToken _finishBigIntLen(int value, int bytesRead) throws IOExce
_minorState = MINOR_VALUE_NUMBER_BIGINT_LEN;
_pending32 = value;
_inputCopyLen = bytesRead;
return _updateToken(JsonToken.NOT_AVAILABLE);
return _updateTokenToNA();
}

private final JsonToken _finishBigIntBody() throws IOException
Expand All @@ -1299,7 +1299,7 @@ private final JsonToken _finishBigIntBody() throws IOException
return _valueComplete(JsonToken.VALUE_NUMBER_INT);
}
_minorState = MINOR_VALUE_NUMBER_BIGINT_BODY;
return _updateToken(JsonToken.NOT_AVAILABLE);
return _updateTokenToNA();
}

/*
Expand Down Expand Up @@ -1339,7 +1339,7 @@ protected final JsonToken _finishFloat(int value, int bytesRead) throws IOExcept
_minorState = MINOR_VALUE_NUMBER_FLOAT;
_pending32 = value;
_inputCopyLen = bytesRead;
return _updateToken(JsonToken.NOT_AVAILABLE);
return _updateTokenToNA();
}

protected final JsonToken _startDouble() throws IOException
Expand Down Expand Up @@ -1378,7 +1378,7 @@ protected final JsonToken _finishDouble(long value, int bytesRead) throws IOExce
_minorState = MINOR_VALUE_NUMBER_DOUBLE;
_pending64 = value;
_inputCopyLen = bytesRead;
return _updateToken(JsonToken.NOT_AVAILABLE);
return _updateTokenToNA();
}

private final JsonToken _startBigDecimal() throws IOException
Expand Down Expand Up @@ -1411,7 +1411,7 @@ private final JsonToken _finishBigDecimalScale(int value, int bytesRead) throws
// note! Scale stored here, need _pending32 for byte length
_pending64 = value;
_inputCopyLen = bytesRead;
return _updateToken(JsonToken.NOT_AVAILABLE);
return _updateTokenToNA();
}

private final JsonToken _finishBigDecimalLen(int value, int bytesRead) throws IOException
Expand All @@ -1432,7 +1432,7 @@ private final JsonToken _finishBigDecimalLen(int value, int bytesRead) throws IO
_minorState = MINOR_VALUE_NUMBER_BIGDEC_LEN;
_pending32 = value;
_inputCopyLen = bytesRead;
return _updateToken(JsonToken.NOT_AVAILABLE);
return _updateTokenToNA();
}

private final JsonToken _finishBigDecimalBody() throws IOException
Expand All @@ -1449,7 +1449,7 @@ private final JsonToken _finishBigDecimalBody() throws IOException
return _valueComplete(JsonToken.VALUE_NUMBER_FLOAT);
}
_minorState = MINOR_VALUE_NUMBER_BIGDEC_BODY;
return _updateToken(JsonToken.NOT_AVAILABLE);
return _updateTokenToNA();
}

/*
Expand Down Expand Up @@ -1490,7 +1490,7 @@ private final JsonToken _finishRawBinaryLen(int value, int bytesRead) throws IOE
_minorState = MINOR_VALUE_BINARY_RAW_LEN;
_pending32 = value;
_inputCopyLen = bytesRead;
return _updateToken(JsonToken.NOT_AVAILABLE);
return _updateTokenToNA();
}

private final JsonToken _finishRawBinaryBody() throws IOException
Expand All @@ -1512,7 +1512,7 @@ private final JsonToken _finishRawBinaryBody() throws IOException
_pending32 = totalLen;
_inputCopyLen = offset+avail;
_minorState = MINOR_VALUE_BINARY_RAW_BODY;
return _updateToken(JsonToken.NOT_AVAILABLE);
return _updateTokenToNA();
}

private final JsonToken _start7BitBinary() throws IOException
Expand Down Expand Up @@ -1544,7 +1544,7 @@ private final JsonToken _finish7BitBinaryLen(int value, int bytesRead) throws IO
_minorState = MINOR_VALUE_BINARY_7BIT_LEN;
_pending32 = value;
_inputCopyLen = bytesRead;
return _updateToken(JsonToken.NOT_AVAILABLE);
return _updateTokenToNA();
}

private final JsonToken _finish7BitBinaryBody() throws IOException
Expand All @@ -1554,7 +1554,7 @@ private final JsonToken _finish7BitBinaryBody() throws IOException
return _valueComplete(JsonToken.VALUE_EMBEDDED_OBJECT);
}
_minorState = MINOR_VALUE_BINARY_7BIT_BODY;
return _updateToken(JsonToken.NOT_AVAILABLE);
return _updateTokenToNA();
}

/*
Expand Down

0 comments on commit 8f2da17

Please sign in to comment.