diff options
| author | Francois-Olivier Devaux <fodevaux@users.noreply.github.com> | 2010-04-08 17:34:40 +0000 |
|---|---|---|
| committer | Francois-Olivier Devaux <fodevaux@users.noreply.github.com> | 2010-04-08 17:34:40 +0000 |
| commit | 2d9e64c2782a712eb8676db9370a9d165d9ed71b (patch) | |
| tree | c3f3768ce5391fb264c4715dcf636f792e4634a5 /codec | |
| parent | 1027d050641bc1367b8ed5b3b81b437eec5240e2 (diff) | |
Fixed JP3D codec file format analyzer. Thanks to Kristóf Ralovich for this patch.
Diffstat (limited to 'codec')
| -rwxr-xr-x | codec/jp3d_to_volume.c | 13 | ||||
| -rwxr-xr-x | codec/volume_to_jp3d.c | 3 |
2 files changed, 9 insertions, 7 deletions
diff --git a/codec/jp3d_to_volume.c b/codec/jp3d_to_volume.c index 4086b20d..a5614d71 100755 --- a/codec/jp3d_to_volume.c +++ b/codec/jp3d_to_volume.c @@ -196,14 +196,15 @@ int get_file_format(char *filename) { int i;
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};
- char * ext = strrchr(filename, '.') + 1;
- for(i = 0; i < sizeof(format) / sizeof(format[0]); i++) {
- if(strnicmp(ext, extension[i], 3) == 0) {
- return format[i];
+ char * ext = strrchr(filename, '.');
+ if(ext) {
+ ext++;
+ for(i = 0; i < sizeof(format) / sizeof(format[0]); i++) {
+ if(strnicmp(ext, extension[i], 3) == 0) {
+ return format[i];
+ }
}
}
-
- return -1;
}
/* -------------------------------------------------------------------------- */
diff --git a/codec/volume_to_jp3d.c b/codec/volume_to_jp3d.c index 84f01e83..da4ca25c 100755 --- a/codec/volume_to_jp3d.c +++ b/codec/volume_to_jp3d.c @@ -215,8 +215,9 @@ int get_file_format(char *filename) { int i;
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};
- char * ext = strrchr(filename, '.') + 1;
+ char * ext = strrchr(filename, '.');
if (ext) {
+ ext++;
for(i = 0; i < sizeof(format)/sizeof(*format); i++) {
if(strnicmp(ext, extension[i], 3) == 0) {
return format[i];
|
