static const int format[] = { PGX_DFMT, PXM_DFMT, PXM_DFMT, PXM_DFMT, BMP_DFMT, J2K_CFMT, JP2_CFMT, JPT_CFMT };
char * ext = strrchr(filename, '.') + 1;
if(ext) {
- for(i = 0; i < sizeof(format); i++) {
+ for(i = 0; i < sizeof(format)/sizeof(*format); i++) {
if(strnicmp(ext, extension[i], 3) == 0) {
return format[i];
}
/* parse the command line */
while (1) {
- int c = getopt(argc, argv, "i:o:r:q:f:t:n:c:b:x:p:s:d:h:P:S:E:M:R:T:C:I");
+ int c = getopt(argc, argv, "i:o:r:q:f:t:n:c:b:x:p:s:d:hP:S:E:M:R:T:C:I");
if (c == -1)
break;
switch (c) {
"!! Unrecognized format for infile : %s [accept only *.j2k, *.jp2, *.jpc or *.jpt] !!\n\n",
infile);
return 1;
- break;
}
strncpy(parameters->infile, infile, MAX_PATH);
}
default:
fprintf(stderr, "Unknown output format image %s [only *.pnm, *.pgm, *.ppm, *.pgx or *.bmp]!! \n", outfile);
return 1;
- break;
}
strncpy(parameters->outfile, outfile, MAX_PATH);
}
/* ----------------------------------------------------- */
case 'h': /* display an help description */
- {
decode_help_display();
return 1;
- }
- break;
/* ----------------------------------------------------- */
default:
fprintf(stderr, "ERROR -> j2k_to_image : Unknown input image format\n");
return 1;
- break;
}
/* free the memory containing the code-stream */