Fixed JP3D codec file format analyzer. Thanks to Kristóf Ralovich for this patch.
This commit is contained in:
parent
1027d05064
commit
2d9e64c278
|
@ -196,14 +196,15 @@ int get_file_format(char *filename) {
|
||||||
int i;
|
int i;
|
||||||
static const char *extension[] = {"pgx", "bin", "j3d", "jp3d", "j2k", "img"};
|
static const char *extension[] = {"pgx", "bin", "j3d", "jp3d", "j2k", "img"};
|
||||||
static const int format[] = { PGX_DFMT, BIN_DFMT, J3D_CFMT, J3D_CFMT, J2K_CFMT, IMG_DFMT};
|
static const int format[] = { PGX_DFMT, BIN_DFMT, J3D_CFMT, J3D_CFMT, J2K_CFMT, IMG_DFMT};
|
||||||
char * ext = strrchr(filename, '.') + 1;
|
char * ext = strrchr(filename, '.');
|
||||||
|
if(ext) {
|
||||||
|
ext++;
|
||||||
for(i = 0; i < sizeof(format) / sizeof(format[0]); i++) {
|
for(i = 0; i < sizeof(format) / sizeof(format[0]); i++) {
|
||||||
if(strnicmp(ext, extension[i], 3) == 0) {
|
if(strnicmp(ext, extension[i], 3) == 0) {
|
||||||
return format[i];
|
return format[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
|
@ -215,8 +215,9 @@ int get_file_format(char *filename) {
|
||||||
int i;
|
int i;
|
||||||
static const char *extension[] = {"pgx", "bin", "img", "j3d", "jp3d", "j2k"};
|
static const char *extension[] = {"pgx", "bin", "img", "j3d", "jp3d", "j2k"};
|
||||||
static const int format[] = { PGX_DFMT, BIN_DFMT, IMG_DFMT, J3D_CFMT, J3D_CFMT, J2K_CFMT};
|
static const int format[] = { PGX_DFMT, BIN_DFMT, IMG_DFMT, J3D_CFMT, J3D_CFMT, J2K_CFMT};
|
||||||
char * ext = strrchr(filename, '.') + 1;
|
char * ext = strrchr(filename, '.');
|
||||||
if (ext) {
|
if (ext) {
|
||||||
|
ext++;
|
||||||
for(i = 0; i < sizeof(format)/sizeof(*format); i++) {
|
for(i = 0; i < sizeof(format)/sizeof(*format); i++) {
|
||||||
if(strnicmp(ext, extension[i], 3) == 0) {
|
if(strnicmp(ext, extension[i], 3) == 0) {
|
||||||
return format[i];
|
return format[i];
|
||||||
|
|
Loading…
Reference in New Issue