mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	Don't add null terminator to each token.
This commit is contained in:
		| @@ -23,5 +23,8 @@ char* JsonObjectBase::getTokenString(jsmntok_t* token) | |||||||
| 	if (token->type != JSMN_PRIMITIVE && token->type != JSMN_STRING) | 	if (token->type != JSMN_PRIMITIVE && token->type != JSMN_STRING) | ||||||
| 		return 0; | 		return 0; | ||||||
|  |  | ||||||
|  | 	// add null terminator to the string | ||||||
|  | 	json[token->end] = 0; | ||||||
|  |  | ||||||
| 	return json + token->start; | 	return json + token->start; | ||||||
| } | } | ||||||
| @@ -20,11 +20,5 @@ jsmntok_t* JsonParserBase::parse(char* jsonString) | |||||||
| 	if (JSMN_SUCCESS != jsmn_parse(&parser, jsonString, tokens, maxTokenCount)) | 	if (JSMN_SUCCESS != jsmn_parse(&parser, jsonString, tokens, maxTokenCount)) | ||||||
| 		return 0; | 		return 0; | ||||||
|  |  | ||||||
| 	// Add null termination to each token |  | ||||||
| 	for (int i = 1; i < parser.toknext; i++) |  | ||||||
| 	{ |  | ||||||
| 		jsonString[tokens[i].end] = 0; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return tokens; | 	return tokens; | ||||||
| } | } | ||||||
		Reference in New Issue
	
	Block a user