# HG changeset patch # User Matti Hamalainen # Date 1400260119 -10800 # Node ID 0177d4a66d48b3951fc6c940c0743b0b55b0ac2f # Parent a6452b575c63de22a77c92568ebd31f21c1cdd26 Split dmGetFormatByExt() to dmGetC64FormatByExt(). diff -r a6452b575c63 -r 0177d4a66d48 tools/gfxconv.c --- a/tools/gfxconv.c Fri May 16 20:07:38 2014 +0300 +++ b/tools/gfxconv.c Fri May 16 20:08:39 2014 +0300 @@ -247,6 +247,29 @@ } +BOOL dmGetC64FormatByExt(const char *fext, int *format, int *subformat) +{ + int i; + if (fext == NULL) + return FALSE; + + for (i = 0; i < ndmC64ImageFormats; i++) + { + const DMC64ImageFormat *fmt = &dmC64ImageFormats[i]; + if (fmt->fext != NULL && + strcasecmp(fext, fmt->fext) == 0) + { + *format = FFMT_BITMAP; + *subformat = i; + return TRUE; + } + } + + return FALSE; +} + + + BOOL dmGetFormatByExt(const char *fext, int *format, int *subformat) { int i; @@ -265,18 +288,6 @@ } } - for (i = 0; i < ndmC64ImageFormats; i++) - { - const DMC64ImageFormat *fmt = &dmC64ImageFormats[i]; - if (fmt->fext != NULL && - strcasecmp(fext, fmt->fext) == 0) - { - *format = FFMT_BITMAP; - *subformat = i; - return TRUE; - } - } - return FALSE; } @@ -528,7 +539,8 @@ break; case 5: - if (!dmGetFormatByExt(optArg, &optOutFormat, &optOutSubFormat)) + if (!dmGetFormatByExt(optArg, &optOutFormat, &optOutSubFormat) && + !dmGetC64FormatByExt(optArg, &optOutFormat, &optOutSubFormat)) { dmError("Invalid output format '%s'.\n", optArg); return FALSE; @@ -1522,7 +1534,8 @@ dmMsg(4, "Trying to determine file format by extension.\n"); if (dext) { - dmGetFormatByExt(dext + 1, &optInFormat, &optInSubFormat); + if (!dmGetFormatByExt(dext + 1, &optInFormat, &optInSubFormat)) + dmGetC64FormatByExt(dext + 1, &optInFormat, &optInSubFormat); } }