use ansi c function fgets instead of GNU function getline to avoid build error with win platform
This commit is contained in:
parent
14799e25c6
commit
f4601aff8b
1
CHANGES
1
CHANGES
|
@ -7,6 +7,7 @@ What's New for OpenJPEG
|
||||||
|
|
||||||
July 26, 2011
|
July 26, 2011
|
||||||
! [mickael] delete double semi-colon at end of line which generate crash on win platform
|
! [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
|
July 25, 2011
|
||||||
* [mickael] fixed issue 74 for trunk
|
* [mickael] fixed issue 74 for trunk
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "opj_config.h"
|
#include "opj_config.h"
|
||||||
#include "getopt.h"
|
#include "getopt.h"
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "getopt.h"
|
#include "getopt.h"
|
||||||
|
|
||||||
|
@ -155,8 +156,7 @@ int main(int argc, char **argv)
|
||||||
if(chbase != chtest)
|
if(chbase != chtest)
|
||||||
{
|
{
|
||||||
size_t nbytes = 2048;
|
size_t nbytes = 2048;
|
||||||
char* strbase, *strtest;
|
char *strbase, *strtest, *strbase_d, *strtest_d;
|
||||||
int nbytes_read_base, nbytes_read_test;
|
|
||||||
|
|
||||||
printf("Files differ at line %lu:\n", l);
|
printf("Files differ at line %lu:\n", l);
|
||||||
fseek(fbase,pos,SEEK_SET);
|
fseek(fbase,pos,SEEK_SET);
|
||||||
|
@ -164,14 +164,18 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
strbase = (char *) malloc(nbytes + 1);
|
strbase = (char *) malloc(nbytes + 1);
|
||||||
strtest = (char *) malloc(nbytes + 1);
|
strtest = (char *) malloc(nbytes + 1);
|
||||||
nbytes_read_base = getline(&strbase, &nbytes, fbase);
|
fgets(strbase, nbytes, fbase);
|
||||||
nbytes_read_test = getline(&strtest, &nbytes, ftest);
|
fgets(strtest, nbytes, ftest);
|
||||||
strbase[nbytes_read_base-1] = '\0';
|
strbase_d = (char *) malloc(strlen(strbase));
|
||||||
strtest[nbytes_read_test-1] = '\0';
|
strtest_d = (char *) malloc(strlen(strtest));
|
||||||
printf("<%s> vs. <%s>\n", strbase, 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(strbase);free(strtest);
|
||||||
free(strtest);
|
free(strbase_d);free(strtest_d);
|
||||||
same = 0;
|
same = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue