summaryrefslogtreecommitdiff
path: root/applications/codec
diff options
context:
space:
mode:
authorMathieu Malaterre <mathieu.malaterre@gmail.com>2014-03-18 16:26:39 +0000
committerMathieu Malaterre <mathieu.malaterre@gmail.com>2014-03-18 16:26:39 +0000
commitdac95eff3a972f5686316db39ed0b8431aff8908 (patch)
tree09d6667b5b52793641ec4efa295becdd1c29440a /applications/codec
parent4f4de7070e2a9c769b41c5cdc38a0b19eb4cfa07 (diff)
[1.5] Rework r2768 in fact getopt_long is slightly different on GNU. Adapt signature to handle BSD signature and GNU one.
Update issue 301
Diffstat (limited to 'applications/codec')
-rw-r--r--applications/codec/image_to_j2k.c9
-rw-r--r--applications/codec/j2k_dump.c7
-rw-r--r--applications/codec/j2k_to_image.c7
3 files changed, 19 insertions, 4 deletions
diff --git a/applications/codec/image_to_j2k.c b/applications/codec/image_to_j2k.c
index ed8b4198..d9cafd6a 100644
--- a/applications/codec/image_to_j2k.c
+++ b/applications/codec/image_to_j2k.c
@@ -590,7 +590,8 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
{"OutFor",REQ_ARG, NULL ,'O'},
{"POC",REQ_ARG, NULL ,'P'},
{"ROI",REQ_ARG, NULL ,'R'},
- {"jpip",NO_ARG, NULL, 'J'}
+ {"jpip",NO_ARG, NULL, 'J'},
+ {0,0,0,0} /* GNU getopt_long requirement */
};
/* parse the command line */
@@ -600,12 +601,16 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
#endif /* USE_JPWL */
"h";
- totlen=sizeof(long_option);
+ totlen=sizeof(long_option)-1;
img_fol->set_out_format=0;
raw_cp->rawWidth = 0;
do{
+#ifdef USE_SYSTEM_GETOPT
+ c = opj_getopt_long(argc, argv, optlist,long_option,0);
+#else
c = opj_getopt_long(argc, argv, optlist,long_option,totlen);
+#endif
if (c == -1)
break;
switch (c) {
diff --git a/applications/codec/j2k_dump.c b/applications/codec/j2k_dump.c
index 5ffc7736..63cce3a2 100644
--- a/applications/codec/j2k_dump.c
+++ b/applications/codec/j2k_dump.c
@@ -201,15 +201,20 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
int totlen, c;
opj_option_t long_option[]={
{"ImgDir",REQ_ARG, NULL ,'y'},
+ {0,0,0,0} /* GNU getopt_long requirement */
};
const char optlist[] = "i:o:h";
OPJ_ARG_NOT_USED(indexfilename);
- totlen=sizeof(long_option);
+ totlen=sizeof(long_option)-1;
img_fol->set_out_format = 0;
do {
+#ifdef USE_SYSTEM_GETOPT
+ c = opj_getopt_long(argc, argv,optlist,long_option,0);
+#else
c = opj_getopt_long(argc, argv,optlist,long_option,totlen);
+#endif
if (c == -1)
break;
switch (c) {
diff --git a/applications/codec/j2k_to_image.c b/applications/codec/j2k_to_image.c
index b0dbf547..6f215a2c 100644
--- a/applications/codec/j2k_to_image.c
+++ b/applications/codec/j2k_to_image.c
@@ -243,6 +243,7 @@ static int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *param
opj_option_t long_option[]={
{"ImgDir",REQ_ARG, NULL ,'y'},
{"OutFor",REQ_ARG, NULL ,'O'},
+ {0,0,0,0} /* GNU getopt_long requirement */
};
const char optlist[] = "i:o:r:l:x:"
@@ -253,10 +254,14 @@ static int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *param
#endif /* USE_JPWL */
/* <<UniPG */
"h" ;
- totlen=sizeof(long_option);
+ totlen=sizeof(long_option) - 1;
img_fol->set_out_format = 0;
do {
+#ifdef USE_SYSTEM_GETOPT
+ c = opj_getopt_long(argc, argv,optlist,long_option,0);
+#else
c = opj_getopt_long(argc, argv,optlist,long_option,totlen);
+#endif
if (c == -1)
break;
switch (c) {