renamed getopt.{c/h} to opj_getopt.{c/h} and forced the use of these files rather than the system ones. This fixed issue 78. Credit to Winfried.

This commit is contained in:
Antonin Descampe
2011-09-01 11:24:08 +00:00
parent 22a2f98ced
commit aba0e602ed
28 changed files with 383 additions and 386 deletions

View File

@@ -37,7 +37,7 @@
#include <math.h>
#include "openjpeg.h"
#include "getopt.h"
#include "opj_getopt.h"
#include "convert.h"
#include "dirent.h"
#include "org_openJpeg_OpenJPEGJavaDecoder.h"
@@ -206,7 +206,7 @@ int get_file_format(char *filename) {
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol) {
/* parse the command line */
int totlen;
option_t long_option[]={
opj_option_t long_option[]={
{"ImgDir",REQ_ARG, NULL ,'y'},
{"OutFor",REQ_ARG, NULL ,'O'},
};
@@ -229,13 +229,13 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
reset_options_reading();
while (1) {
int c = getopt_long(argc, argv,optlist,long_option,totlen);
int c = opj_getopt_long(argc, argv,optlist,long_option,totlen);
if (c == -1)
break;
switch (c) {
case 'i': /* input file */
{
char *infile = optarg;
char *infile = opj_optarg;
parameters->decod_format = get_file_format(infile);
switch(parameters->decod_format) {
case J2K_CFMT:
@@ -256,7 +256,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
case 'o': /* output file */
{
char *outfile = optarg;
char *outfile = opj_optarg;
parameters->cod_format = get_file_format(outfile);
switch(parameters->cod_format) {
case PGX_DFMT:
@@ -279,7 +279,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
case 'O': /* output format */
{
char outformat[50];
char *of = optarg;
char *of = opj_optarg;
sprintf(outformat,".%s",of);
img_fol->set_out_format = 1;
parameters->cod_format = get_file_format(outformat);
@@ -315,7 +315,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
case 'r': /* reduce option */
{
sscanf(optarg, "%d", &parameters->cp_reduce);
sscanf(opj_optarg, "%d", &parameters->cp_reduce);
}
break;
@@ -324,7 +324,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
case 'l': /* layering option */
{
sscanf(optarg, "%d", &parameters->cp_layer);
sscanf(opj_optarg, "%d", &parameters->cp_layer);
}
break;
@@ -338,8 +338,8 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
case 'y': /* Image Directory path */
{
img_fol->imgdirpath = (char*)malloc(strlen(optarg) + 1);
strcpy(img_fol->imgdirpath,optarg);
img_fol->imgdirpath = (char*)malloc(strlen(opj_optarg) + 1);
strcpy(img_fol->imgdirpath,opj_optarg);
img_fol->set_imgdir=1;
}
break;
@@ -351,7 +351,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
{
char *token = NULL;
token = strtok(optarg, ",");
token = strtok(opj_optarg, ",");
while(token != NULL) {
/* search expected number of components */
@@ -418,7 +418,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
/* ----------------------------------------------------- */
default:
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, optarg);
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, opj_optarg);
break;
}
}