提交 84237ff4 编写于 作者: M Max Bruckner

Replace sizeof('\0') with sizeof("")

Because sizeof('\0') is actually sizeof(int) not sizeof(char).
上级 ab8489a8
......@@ -628,7 +628,7 @@ static const unsigned char *parse_string(cJSON * const item, const unsigned char
/* This is at most how much we need for the output */
allocation_length = (size_t) (input_end - input) - skipped_bytes;
output = (unsigned char*)hooks->allocate(allocation_length + sizeof('\0'));
output = (unsigned char*)hooks->allocate(allocation_length + sizeof(""));
if (output == NULL)
{
goto fail; /* allocation failure */
......@@ -1101,7 +1101,7 @@ static cJSON_bool print_value(const cJSON * const item, const size_t depth, cons
return false;
}
raw_length = strlen(item->valuestring) + sizeof('\0');
raw_length = strlen(item->valuestring) + sizeof("");
output = ensure(output_buffer, raw_length, hooks);
if (output == NULL)
{
......
......@@ -56,7 +56,7 @@ static char *read_file(const char *filename)
}
/* allocate content buffer */
content = (char*)malloc((size_t)length + sizeof('\0'));
content = (char*)malloc((size_t)length + sizeof(""));
if (content == NULL)
{
goto cleanup;
......
......@@ -70,7 +70,7 @@ CJSON_PUBLIC(char*) read_file(const char *filename)
}
/* allocate content buffer */
content = (char*)malloc((size_t)length + sizeof('\0'));
content = (char*)malloc((size_t)length + sizeof(""));
if (content == NULL)
{
goto cleanup;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册