Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow changing buffer size #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion JsonStreamingParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ void JsonStreamingParser::parse(char c) {
}

void JsonStreamingParser::increaseBufferPointer() {
bufferPos = min(bufferPos + 1, BUFFER_MAX_LENGTH - 1);
bufferPos = min(bufferPos + 1, JSON_PARSER_BUFFER_MAX_LENGTH - 1);
}

void JsonStreamingParser::endString() {
Expand Down
6 changes: 4 additions & 2 deletions JsonStreamingParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ See more at http://blog.squix.ch and https://github.com/squix78/json-streaming-p
#define STACK_KEY 2
#define STACK_STRING 3

#define BUFFER_MAX_LENGTH 512
#ifndef JSON_PARSER_BUFFER_MAX_LENGTH
#define JSON_PARSER_BUFFER_MAX_LENGTH 512
#endif

class JsonStreamingParser {
private:
Expand All @@ -62,7 +64,7 @@ class JsonStreamingParser {

boolean doEmitWhitespace = false;
// fixed length buffer array to prepare for c code
char buffer[BUFFER_MAX_LENGTH];
char buffer[JSON_PARSER_BUFFER_MAX_LENGTH];
int bufferPos = 0;

char unicodeEscapeBuffer[10];
Expand Down