Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opj_compress and opj_decompress : get_next_file method uses hard-coded unix path separator #630

Closed
boxerab opened this issue Oct 12, 2015 · 3 comments

Comments

@boxerab
Copy link
Contributor

boxerab commented Oct 12, 2015

In these lines:

sprintf(infilename,"%s/%s",img_fol->imgdirpath,image_filename);

and

sprintf(outfilename,"%s/%s.%s",img_fol->imgdirpath,temp_ofname,img_fol->out_format);

use the following code to replace hard coded separator:

#ifdef _WIN32
const char* path_separator = "\\";
#else
const char* path_separator = "/";
#endif

@boxerab boxerab changed the title opj_compress : get_next_file method uses hard-coded unix path separator opj_compress and opj_decompress : get_next_file method uses hard-coded unix path separator Oct 12, 2015
@mayeut
Copy link
Collaborator

mayeut commented Oct 12, 2015

@boxerab,

I'd rather see the following:

#ifdef _WIN32
# define OPJ_PATH_SEPARATOR "\\"
#else
# define OPJ_PATH_SEPARATOR "/"
#endif

Then:

sprintf(infilename,"%s" OPJ_PATH_SEPARATOR "%s",img_fol->imgdirpath,image_filename);

And

sprintf(outfilename,"%s" OPJ_PATH_SEPARATOR "%s.%s",img_fol->imgdirpath,temp_ofname,img_fol->out_format);

In any case, doesn't Windows support forward slash separators ?

@stweil
Copy link
Contributor

stweil commented Oct 12, 2015

Yes, it does. Even old versions of MSDOS support "/".

@boxerab
Copy link
Contributor Author

boxerab commented Oct 12, 2015

@mayeut I agree. And yes, the code works fine on windows, but I find the path names are confusing when debugging under windows: a mix of forward and backward slashes. Also, this fix is already partially implemented in opj_decompress; just need to add it in a few more places. A 10 minute fix.

@boxerab boxerab closed this as completed Oct 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants