Merge pull request #157 from nicowilliams/argfile-fixes

Argfile fixes
This commit is contained in:
Stephen Dolan committed 2013-06-21 09:40:32 -07:00
commit dc2fe63e42
2 files changed
+5 -2

No files matched your search

+4 -1
View File
@@ -28,12 +28,15 @@ jv jv_load_file(const char* filename, int raw) {
if (raw) {
data = jv_string_concat(data, jv_string_sized(buf, (int)n));
} else {
jv_parser_set_buf(&parser, buf, strlen(buf), !feof(file));
jv_parser_set_buf(&parser, buf, n, !feof(file));
jv value;
while (jv_is_valid((value = jv_parser_next(&parser))))
data = jv_array_append(data, value);
jv_free(value);
}
}
if (!raw)
jv_parser_free(&parser);
int badread = ferror(file);
fclose(file);
if (badread) {
+1 -1
View File
@@ -202,7 +202,7 @@ int main(int argc, char* argv[]) {
jv_free(data);
return 1;
}
if (jv_array_length(data) == 1)
if (jv_get_kind(data) == JV_KIND_ARRAY && jv_array_length(jv_copy(data)) == 1)
data = jv_array_get(data, 0);
arg = jv_object_set(arg, jv_string("value"), data);
program_arguments = jv_array_append(program_arguments, arg);