diff options
| author | Mickael Savinaud <savmickael@users.noreply.github.com> | 2011-07-26 09:30:54 +0000 |
|---|---|---|
| committer | Mickael Savinaud <savmickael@users.noreply.github.com> | 2011-07-26 09:30:54 +0000 |
| commit | f4601aff8bc00cdd379814bbae9cbc8a3bbab3c1 (patch) | |
| tree | ad9660f1402d6ab9ac26821101b602ac69f6b785 /tests | |
| parent | 14799e25c6c648c6eb45eacace0173a4f96bd372 (diff) | |
use ansi c function fgets instead of GNU function getline to avoid build error with win platform
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/comparePGXimages.c | 1 | ||||
| -rw-r--r-- | tests/compare_dump_files.c | 24 |
2 files changed, 15 insertions, 10 deletions
diff --git a/tests/comparePGXimages.c b/tests/comparePGXimages.c index a31a25f1..dc3d9380 100644 --- a/tests/comparePGXimages.c +++ b/tests/comparePGXimages.c @@ -9,6 +9,7 @@ #include <stdlib.h> #include <math.h> #include <string.h> +#include <ctype.h> #include "opj_config.h" #include "getopt.h" diff --git a/tests/compare_dump_files.c b/tests/compare_dump_files.c index a2b8db30..a8f573ae 100644 --- a/tests/compare_dump_files.c +++ b/tests/compare_dump_files.c @@ -8,6 +8,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <ctype.h> #include "getopt.h" @@ -155,8 +156,7 @@ int main(int argc, char **argv) if(chbase != chtest) { size_t nbytes = 2048; - char* strbase, *strtest; - int nbytes_read_base, nbytes_read_test; + char *strbase, *strtest, *strbase_d, *strtest_d; printf("Files differ at line %lu:\n", l); fseek(fbase,pos,SEEK_SET); @@ -164,14 +164,18 @@ int main(int argc, char **argv) strbase = (char *) malloc(nbytes + 1); strtest = (char *) malloc(nbytes + 1); - nbytes_read_base = getline(&strbase, &nbytes, fbase); - nbytes_read_test = getline(&strtest, &nbytes, ftest); - strbase[nbytes_read_base-1] = '\0'; - strtest[nbytes_read_test-1] = '\0'; - printf("<%s> vs. <%s>\n", strbase, strtest); - - free(strbase); - free(strtest); + fgets(strbase, nbytes, fbase); + fgets(strtest, nbytes, ftest); + strbase_d = (char *) malloc(strlen(strbase)); + strtest_d = (char *) malloc(strlen(strtest)); + strncpy(strbase_d, strbase, strlen(strbase)-1); + strncpy(strtest_d, strtest, strlen(strtest)-1); + strbase_d[strlen(strbase)] = '\0'; + strtest_d[strlen(strtest)] = '\0'; + printf("<%s> vs. <%s>\n", strbase_d, strtest_d); + + free(strbase);free(strtest); + free(strbase_d);free(strtest_d); same = 0; break; } |
