Skip to content

Commit

Permalink
Merge branch '2.16' into iocontext-close
Browse files Browse the repository at this point in the history
  • Loading branch information
pjfanning committed Aug 31, 2023
2 parents fb03737 + d041c71 commit 3968b27
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,9 @@ public int getMask() {
/**********************************************************
*/

public CBORGenerator(IOContext ctxt, int stdFeatures, int formatFeatures,
public CBORGenerator(IOContext ioCtxt, int stdFeatures, int formatFeatures,
ObjectCodec codec, OutputStream out) {
super(stdFeatures, codec, ctxt, null);
super(stdFeatures, codec, ioCtxt, /* Write Context */ null);
DupDetector dups = JsonGenerator.Feature.STRICT_DUPLICATE_DETECTION.enabledIn(stdFeatures)
? DupDetector.rootDetector(this)
: null;
Expand All @@ -295,13 +295,13 @@ public CBORGenerator(IOContext ctxt, int stdFeatures, int formatFeatures,
_formatFeatures = formatFeatures;
_cfgMinimalInts = Feature.WRITE_MINIMAL_INTS.enabledIn(formatFeatures);
_cfgMinimalDoubles = Feature.WRITE_MINIMAL_DOUBLES.enabledIn(formatFeatures);
_streamWriteConstraints = ctxt.streamWriteConstraints();
_streamWriteConstraints = ioCtxt.streamWriteConstraints();
_out = out;
_bufferRecyclable = true;
_stringRefs = Feature.STRINGREF.enabledIn(formatFeatures) ? new HashMap<>() : null;
_outputBuffer = ctxt.allocWriteEncodingBuffer(BYTE_BUFFER_FOR_OUTPUT);
_outputBuffer = ioCtxt.allocWriteEncodingBuffer(BYTE_BUFFER_FOR_OUTPUT);
_outputEnd = _outputBuffer.length;
_charBuffer = ctxt.allocConcatBuffer();
_charBuffer = ioCtxt.allocConcatBuffer();
_charBufferLength = _charBuffer.length;
// let's just sanity check to prevent nasty odd errors
if (_outputEnd < MIN_BUFFER_LENGTH) {
Expand All @@ -320,10 +320,10 @@ public CBORGenerator(IOContext ctxt, int stdFeatures, int formatFeatures,
* Offset pointing past already buffered content; that is, number
* of bytes of valid content to output, within buffer.
*/
public CBORGenerator(IOContext ctxt, int stdFeatures, int formatFeatures,
public CBORGenerator(IOContext ioCtxt, int stdFeatures, int formatFeatures,
ObjectCodec codec, OutputStream out, byte[] outputBuffer,
int offset, boolean bufferRecyclable) {
super(stdFeatures, codec, ctxt, null);
super(stdFeatures, codec, ioCtxt, /* Write Context */ null);
DupDetector dups = JsonGenerator.Feature.STRICT_DUPLICATE_DETECTION.enabledIn(stdFeatures)
? DupDetector.rootDetector(this)
: null;
Expand All @@ -332,14 +332,14 @@ public CBORGenerator(IOContext ctxt, int stdFeatures, int formatFeatures,
_formatFeatures = formatFeatures;
_cfgMinimalInts = Feature.WRITE_MINIMAL_INTS.enabledIn(formatFeatures);
_cfgMinimalDoubles = Feature.WRITE_MINIMAL_DOUBLES.enabledIn(formatFeatures);
_streamWriteConstraints = ctxt.streamWriteConstraints();
_streamWriteConstraints = ioCtxt.streamWriteConstraints();
_out = out;
_bufferRecyclable = bufferRecyclable;
_outputTail = offset;
_outputBuffer = outputBuffer;
_stringRefs = Feature.STRINGREF.enabledIn(formatFeatures) ? new HashMap<>() : null;
_outputEnd = _outputBuffer.length;
_charBuffer = ctxt.allocConcatBuffer();
_charBuffer = ioCtxt.allocConcatBuffer();
_charBufferLength = _charBuffer.length;
// let's just sanity check to prevent nasty odd errors
if (_outputEnd < MIN_BUFFER_LENGTH) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,21 +299,21 @@ public SharedStringNode(String value, int index, SharedStringNode next)
/**********************************************************
*/

public SmileGenerator(IOContext ctxt, int stdFeatures, int smileFeatures,
public SmileGenerator(IOContext ioCtxt, int stdFeatures, int smileFeatures,
ObjectCodec codec, OutputStream out)
{
super(stdFeatures, codec, ctxt, null);
super(stdFeatures, codec, ioCtxt, /*WriteContext*/ null);
DupDetector dups = JsonGenerator.Feature.STRICT_DUPLICATE_DETECTION.enabledIn(stdFeatures)
? DupDetector.rootDetector(this)
: null;
// NOTE: we passed `null` for default write context
_streamWriteContext = SmileWriteContext.createRootContext(dups);
_formatFeatures = smileFeatures;
_streamWriteConstraints = ctxt.streamWriteConstraints();
_streamWriteConstraints = ioCtxt.streamWriteConstraints();
_smileBufferRecycler = _smileBufferRecycler();
_out = out;
_bufferRecyclable = true;
_outputBuffer = ctxt.allocWriteEncodingBuffer();
_outputBuffer = ioCtxt.allocWriteEncodingBuffer();
_outputEnd = _outputBuffer.length;
// let's just sanity check to prevent nasty odd errors
if (_outputEnd < MIN_BUFFER_LENGTH) {
Expand Down Expand Up @@ -344,18 +344,18 @@ public SmileGenerator(IOContext ctxt, int stdFeatures, int smileFeatures,
}
}

public SmileGenerator(IOContext ctxt, int stdFeatures, int smileFeatures,
public SmileGenerator(IOContext ioCtxt, int stdFeatures, int smileFeatures,
ObjectCodec codec, OutputStream out, byte[] outputBuffer, int offset,
boolean bufferRecyclable)
{
super(stdFeatures, codec, ctxt, null);
super(stdFeatures, codec, ioCtxt, null);
DupDetector dups = JsonGenerator.Feature.STRICT_DUPLICATE_DETECTION.enabledIn(stdFeatures)
? DupDetector.rootDetector(this)
: null;
// NOTE: we passed `null` for default write context
_streamWriteContext = SmileWriteContext.createRootContext(dups);
_formatFeatures = smileFeatures;
_streamWriteConstraints = ctxt.streamWriteConstraints();
_streamWriteConstraints = ioCtxt.streamWriteConstraints();
_smileBufferRecycler = _smileBufferRecycler();
_out = out;
_bufferRecyclable = bufferRecyclable;
Expand Down

0 comments on commit 3968b27

Please sign in to comment.