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'},
|
||||||
|
#ifdef USE_SYSTEM_GETOPT
|
||||||
{0,0,0,0} /* GNU getopt_long requirement */
|
{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;
|
||||||
|
|
||||||
|
@ -1392,8 +1394,8 @@ 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);
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -243,7 +243,9 @@ static int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *param
|
||||||
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'},
|
||||||
|
#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: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
|
||||||
|
|
Loading…
Reference in New Issue