preventde seg fault when unknown long options and fixed ability to use USE_SYSTEM_GETOPT
This commit is contained in:
parent
2d47938b25
commit
31e35fcf7b
|
@ -591,7 +591,9 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||||
{"POC",REQ_ARG, NULL ,'P'},
|
{"POC",REQ_ARG, NULL ,'P'},
|
||||||
{"ROI",REQ_ARG, NULL ,'R'},
|
{"ROI",REQ_ARG, NULL ,'R'},
|
||||||
{"jpip",NO_ARG, NULL, 'J'},
|
{"jpip",NO_ARG, NULL, 'J'},
|
||||||
{0,0,0,0} /* GNU getopt_long requirement */
|
#ifdef USE_SYSTEM_GETOPT
|
||||||
|
{0,0,0,0} /* GNU getopt_long requirement */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/* parse the command line */
|
/* parse the command line */
|
||||||
|
@ -601,7 +603,7 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||||
#endif /* USE_JPWL */
|
#endif /* USE_JPWL */
|
||||||
"h";
|
"h";
|
||||||
|
|
||||||
totlen=sizeof(long_option)-1;
|
totlen=sizeof(long_option);
|
||||||
img_fol->set_out_format=0;
|
img_fol->set_out_format=0;
|
||||||
raw_cp->rawWidth = 0;
|
raw_cp->rawWidth = 0;
|
||||||
|
|
||||||
|
@ -1391,10 +1393,10 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||||
/* ------------------------------------------------------ */
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "ERROR -> Command line not valid\n");
|
fprintf(stderr, "[WARNING] An invalid option has been ignored\n");
|
||||||
return 1;
|
break;
|
||||||
}
|
}
|
||||||
}while(c != -1);
|
}while(c != -1);
|
||||||
|
|
||||||
/* check for possible errors */
|
/* check for possible errors */
|
||||||
|
|
|
@ -201,13 +201,15 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||||
int totlen, c;
|
int totlen, c;
|
||||||
opj_option_t long_option[]={
|
opj_option_t long_option[]={
|
||||||
{"ImgDir",REQ_ARG, NULL ,'y'},
|
{"ImgDir",REQ_ARG, NULL ,'y'},
|
||||||
|
#ifdef USE_SYSTEM_GETOPT
|
||||||
{0,0,0,0} /* GNU getopt_long requirement */
|
{0,0,0,0} /* GNU getopt_long requirement */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
const char optlist[] = "i:o:h";
|
const char optlist[] = "i:o:h";
|
||||||
|
|
||||||
OPJ_ARG_NOT_USED(indexfilename);
|
OPJ_ARG_NOT_USED(indexfilename);
|
||||||
|
|
||||||
totlen=sizeof(long_option)-1;
|
totlen=sizeof(long_option);
|
||||||
img_fol->set_out_format = 0;
|
img_fol->set_out_format = 0;
|
||||||
do {
|
do {
|
||||||
#ifdef USE_SYSTEM_GETOPT
|
#ifdef USE_SYSTEM_GETOPT
|
||||||
|
@ -265,7 +267,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||||
/* ----------------------------------------------------- */
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, opj_optarg);
|
fprintf(stderr,"[WARNING] An invalid option has been ignored\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}while(c != -1);
|
}while(c != -1);
|
||||||
|
|
|
@ -242,8 +242,10 @@ static int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *param
|
||||||
int totlen, c;
|
int totlen, c;
|
||||||
opj_option_t long_option[]={
|
opj_option_t long_option[]={
|
||||||
{"ImgDir",REQ_ARG, NULL ,'y'},
|
{"ImgDir",REQ_ARG, NULL ,'y'},
|
||||||
{"OutFor",REQ_ARG, NULL ,'O'},
|
{"OutFor",REQ_ARG, NULL ,'O'},
|
||||||
{0,0,0,0} /* GNU getopt_long requirement */
|
#ifdef USE_SYSTEM_GETOPT
|
||||||
|
{0,0,0,0} /* GNU getopt_long requirement */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
const char optlist[] = "i:o:r:l:x:"
|
const char optlist[] = "i:o:r:l:x:"
|
||||||
|
@ -254,7 +256,7 @@ static int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *param
|
||||||
#endif /* USE_JPWL */
|
#endif /* USE_JPWL */
|
||||||
/* <<UniPG */
|
/* <<UniPG */
|
||||||
"h" ;
|
"h" ;
|
||||||
totlen=sizeof(long_option) - 1;
|
totlen=sizeof(long_option);
|
||||||
img_fol->set_out_format = 0;
|
img_fol->set_out_format = 0;
|
||||||
do {
|
do {
|
||||||
#ifdef USE_SYSTEM_GETOPT
|
#ifdef USE_SYSTEM_GETOPT
|
||||||
|
@ -461,7 +463,7 @@ static int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *param
|
||||||
/* ----------------------------------------------------- */
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, opj_optarg);
|
fprintf(stderr,"[WARNING] An invalid option has been ignored\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}while(c != -1);
|
}while(c != -1);
|
||||||
|
|
|
@ -12,14 +12,34 @@ include_directories(
|
||||||
set(compare_images_SRCS compare_images.c
|
set(compare_images_SRCS compare_images.c
|
||||||
${OPENJPEG_SOURCE_DIR}/applications/codec/convert.c
|
${OPENJPEG_SOURCE_DIR}/applications/codec/convert.c
|
||||||
# ${OPENJPEG_SOURCE_DIR}/applications/codec/converttif.c
|
# ${OPENJPEG_SOURCE_DIR}/applications/codec/converttif.c
|
||||||
${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c
|
# ${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(NOT USE_SYSTEM_GETOPT)
|
||||||
|
list(APPEND compare_images_SRCS
|
||||||
|
${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(compare_dump_files_SRCS compare_dump_files.c
|
set(compare_dump_files_SRCS compare_dump_files.c
|
||||||
${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c)
|
#${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT USE_SYSTEM_GETOPT)
|
||||||
|
list(APPEND compare_dump_files_SRCS
|
||||||
|
${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(compare_raw_files_SRCS compare_raw_files.c
|
set(compare_raw_files_SRCS compare_raw_files.c
|
||||||
${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c)
|
#${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT USE_SYSTEM_GETOPT)
|
||||||
|
list(APPEND compare_raw_files_SRCS
|
||||||
|
${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_executable(compare_images ${compare_images_SRCS})
|
add_executable(compare_images ${compare_images_SRCS})
|
||||||
target_link_libraries(compare_images
|
target_link_libraries(compare_images
|
||||||
|
|
|
@ -510,7 +510,7 @@ foreach(kdu_file ${kdu_j2k_conf_files})
|
||||||
set( filenameInput "${kdu_file}.j2c" )
|
set( filenameInput "${kdu_file}.j2c" )
|
||||||
set( filenameRef "${kdu_file}.ppm" )
|
set( filenameRef "${kdu_file}.ppm" )
|
||||||
|
|
||||||
if("${kdu_file}" STREQUAL "a6_mono_colr")
|
if("${kdu_file}" STREQUAL "a6_mono_colr")
|
||||||
set(kdu_test_args -upsample -split-pnm )
|
set(kdu_test_args -upsample -split-pnm )
|
||||||
else()
|
else()
|
||||||
set(kdu_test_args -upsample )
|
set(kdu_test_args -upsample )
|
||||||
|
|
Loading…
Reference in New Issue