summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMickael Savinaud <savmickael@users.noreply.github.com>2011-07-26 09:30:54 +0000
committerMickael Savinaud <savmickael@users.noreply.github.com>2011-07-26 09:30:54 +0000
commitf4601aff8bc00cdd379814bbae9cbc8a3bbab3c1 (patch)
treead9660f1402d6ab9ac26821101b602ac69f6b785
parent14799e25c6c648c6eb45eacace0173a4f96bd372 (diff)
use ansi c function fgets instead of GNU function getline to avoid build error with win platform
-rw-r--r--CHANGES1
-rw-r--r--tests/comparePGXimages.c1
-rw-r--r--tests/compare_dump_files.c24
3 files changed, 16 insertions, 10 deletions
diff --git a/CHANGES b/CHANGES
index 3b1b6bc5..c3a24e90 100644
--- a/CHANGES
+++ b/CHANGES
@@ -7,6 +7,7 @@ What's New for OpenJPEG
July 26, 2011
! [mickael] delete double semi-colon at end of line which generate crash on win platform
+! [mickael] use ansi c function fgets instead of GNU function getline to avoid build error with win platform
July 25, 2011
* [mickael] fixed issue 74 for trunk
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;
}