fix some warnings

This commit is contained in:
Max Lv
2014-01-05 11:22:43 +00:00
parent 2c78ccfbf8
commit 6663ebb70a
2 changed files with 7 additions and 5 deletions
+2 -1
View File
@@ -76,7 +76,8 @@ jconf_t *read_jconf(const char* file)
buf = malloc(pos + 1);
if (buf == NULL) FATAL("No enough memory.");
fread(buf, pos, 1, f);
int err = fread(buf, pos, 1, f);
if (err) FATAL("Failed to read the config file.");
fclose(f);
buf[pos] = '\0'; // end of string
+5 -4
View File
@@ -205,8 +205,9 @@ json_value * json_parse_ex (json_settings * settings,
json_value * top, * root, * alloc = 0;
json_state state = { 0 };
long flags;
long num_digits, num_e;
json_int_t num_fraction;
long num_digits = 0;
long num_e = 0;
json_int_t num_fraction = 0;
error[0] = '\0';
end = (json + length);
@@ -229,8 +230,8 @@ json_value * json_parse_ex (json_settings * settings,
{
json_uchar uchar;
unsigned char uc_b1, uc_b2, uc_b3, uc_b4;
json_char * string;
unsigned int string_length;
json_char * string = NULL;
unsigned int string_length = 0;
top = root = 0;
flags = flag_seek_value;