Skip to content
Snippets Groups Projects
Commit 05289134 authored by Andrea Censi's avatar Andrea Censi
Browse files

Fixed spurious error at EOF -- must still modify rest of programs

parent 37fc1bc5
No related branches found
No related tags found
No related merge requests found
......@@ -15,9 +15,15 @@ int main(int argc, const char * argv[]) {
return -1;
}
JO jo;
while((jo = json_read_stream(stdin))) {
while(1) {
JO jo = json_read_stream(stdin);
if(!jo) {
if(feof(stdin)) break;
sm_error("Malformed JSON\n");
return -1;
}
const char * s = json_object_to_json_string(jo);
int i; for(i=0;i<n;i++) {
puts(s); puts("\n");
......
......@@ -97,8 +97,17 @@ int main(int argc, const char*argv[]) {
LDP ld1, ld2;
while(1) {
ld1 = ld_from_json_stream(file1);
if(!ld1) {
if(feof(file1)) break;
sm_error("Invalid data in file1 '%s' \n", p.file1);
return 2;
}
ld2 = ld_from_json_stream(file2);
if(!ld1 || !ld2) break;
if(!ld2) {
if(feof(file2)) break;
sm_error("Invalid data in file2 '%s' \n", p.file2);
return 3;
}
params.laser_ref = ld1;
params.laser_sens = ld2;
......
......@@ -223,7 +223,8 @@ LDP ld_from_json_stream(FILE*file) {
jo = json_read_stream(file);
if(!jo) {
sm_error("Invalid JSON found.\n");
if(!feof(file))
sm_error("Invalid JSON found.\n");
return 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment