fix: error read float value and indent level

This commit is contained in:
Renge 2022-02-19 11:31:42 -05:00
parent 5a494e53c5
commit 3fe193ebca
2 changed files with 10 additions and 3 deletions

View File

@ -369,7 +369,7 @@ int argo_read_number(ARGO_NUMBER *n, FILE *f)
} }
else else
{ {
float_value = float_value + 10 + (c - '0'); float_value = float_value * 10 + (c - '0');
} }
} }
} }
@ -949,6 +949,10 @@ int argo_write_object(ARGO_VALUE *o, FILE *f)
indent_level--; indent_level--;
print_indent(f); print_indent(f);
fprintf(f, "}"); fprintf(f, "}");
if (indent_level == 0)
{
fprintf(f, "\n");
}
return 0; return 0;
} }
@ -971,6 +975,11 @@ int argo_write_array(ARGO_VALUE *a, FILE *f)
indent_level--; indent_level--;
print_indent(f); print_indent(f);
fprintf(f, "]"); fprintf(f, "]");
if (indent_level == 0)
{
fprintf(f, "\n");
}
return 0; return 0;
} }

View File

@ -53,8 +53,6 @@ int main(int argc, char **argv)
if (argo_write_value(json, stdout)) { if (argo_write_value(json, stdout)) {
return EXIT_FAILURE; return EXIT_FAILURE;
} }
fprintf(stdout, "\n");
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
// TO BE IMPLEMENTED // TO BE IMPLEMENTED