summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorAntonin Descampe <antonin@gmail.com>2015-02-02 16:11:23 +0000
committerAntonin Descampe <antonin@gmail.com>2015-02-02 16:11:23 +0000
commit8b5e2a51430245c06185f46c796670d9c17ff4e9 (patch)
tree256513d71a0ff158933f34e66eae30bab2781419 /src/bin
parent3ed5858902055d3500a6ab183f1395686921d026 (diff)
[trunk] fixes a bug that prevented opj_decompress to take directory as input (fixes issue 463)
Thanks Aaron.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/jp2/opj_decompress.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/bin/jp2/opj_decompress.c b/src/bin/jp2/opj_decompress.c
index 0f1dc6bf..a6bc182a 100644
--- a/src/bin/jp2/opj_decompress.c
+++ b/src/bin/jp2/opj_decompress.c
@@ -403,6 +403,12 @@ int get_file_format(const char *filename) {
return -1;
}
+#ifdef _WIN32
+const char* path_separator = "\\";
+#else
+const char* path_separator = "/";
+#endif
+
/* -------------------------------------------------------------------------- */
char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_decompress_parameters *parameters){
char image_filename[OPJ_PATH_LEN], infilename[OPJ_PATH_LEN],outfilename[OPJ_PATH_LEN],temp_ofname[OPJ_PATH_LEN];
@@ -410,10 +416,10 @@ char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_decompre
strcpy(image_filename,dirptr->filename[imageno]);
fprintf(stderr,"File Number %d \"%s\"\n",imageno,image_filename);
- parameters->decod_format = infile_format(image_filename);
+ sprintf(infilename, "%s%s%s", img_fol->imgdirpath, path_separator, image_filename);
+ parameters->decod_format = infile_format(infilename);
if (parameters->decod_format == -1)
return 1;
- sprintf(infilename,"%s/%s",img_fol->imgdirpath,image_filename);
strncpy(parameters->infile, infilename, sizeof(infilename));
/*Set output file*/