Bladeren bron

Temporary fix for stream reader bug

master
Daniel 1 jaar geleden
bovenliggende
commit
e8a9624a20
2 gewijzigde bestanden met toevoegingen van 7 en 5 verwijderingen
  1. +4
    -0
      get.c
  2. +3
    -5
      test.c

+ 4
- 0
get.c Bestand weergeven

@@ -228,6 +228,10 @@ int haplous_next(struct haplous_reader *reader) {
}

if (reader->current_verse >= reader->reference.verse_start) {
if (c != '\n') {
fseek(reader->work.file, -1, SEEK_CUR);
}

break;
}
}


+ 3
- 5
test.c Bestand weergeven

@@ -21,7 +21,7 @@ void testRef(char *name, int chapter, int start, int to)
assert(err == 0);

while (haplous_next(&reader) == HAPLOUS_CONTINUE) {
puts(reader.verse);
//puts(reader.verse);
free(reader.verse);
}

@@ -34,16 +34,14 @@ void testRef(char *name, int chapter, int start, int to)

int main()
{
work = haplous_work_init("kjv.txt", &err);
work = haplous_work_init("../kjv.txt", &err);
if (err != HAPLOUS_OK) {
puts("Err");
return -1;
}

clock_t start_time = clock();
for (int i = 0; i < 5; i++) {
testRef("John", 3, 16, 17);
}
testRef("John", 3, 16, 20);

double elapsed_time =
(double)(clock() - start_time) / CLOCKS_PER_SEC;


Laden…
Annuleren
Opslaan