summaryrefslogtreecommitdiff
path: root/codec
diff options
context:
space:
mode:
Diffstat (limited to 'codec')
-rw-r--r--codec/compat/getopt.c8
-rw-r--r--codec/image_to_j2k.c2
2 files changed, 7 insertions, 3 deletions
diff --git a/codec/compat/getopt.c b/codec/compat/getopt.c
index 23270e6a..f434924b 100644
--- a/codec/compat/getopt.c
+++ b/codec/compat/getopt.c
@@ -59,7 +59,11 @@ typedef struct option
#define BADARG (int)':'
#define EMSG ""
-
+/* As this class remembers its values from one Java call to the other, reset the values before each use */
+void reset_options_reading() {
+ opterr = 1;
+ optind = 1;
+}
/*
* getopt --
@@ -132,7 +136,7 @@ struct option *longopts, int totlen) {
char param = 1;
again:
- if (optind>argc || !argv[optind] || *argv[optind]!='-')
+ if (optind >= argc || !argv[optind] || *argv[optind]!='-')
return -1;
if (argv[optind][0]=='-' && argv[optind][1]==0) {
diff --git a/codec/image_to_j2k.c b/codec/image_to_j2k.c
index f505e997..7fbd5a8a 100644
--- a/codec/image_to_j2k.c
+++ b/codec/image_to_j2k.c
@@ -1692,7 +1692,7 @@ int main(int argc, char **argv) {
if (*indexfilename) {
bSuccess = write_index_file(&cstr_info, indexfilename);
if (bSuccess) {
- fprintf(stderr, "Failed to output index file\n");
+ fprintf(stderr, "Failed to output index file into [%s]\n", indexfilename);
}
}