diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-10-31 09:35:23 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-10-31 09:35:23 (GMT) |
commit | cbb12f8e904ca926c14cba9d41e99aa6f48c8e90 (patch) | |
tree | e5e161c5e4f4b4e2d46f95e3c615a4a5b1eb27bc | |
parent | 3f70347b4b061f2da308565d2a850d5f0fdf8dcf (diff) | |
download | tk-cbb12f8e904ca926c14cba9d41e99aa6f48c8e90.zip tk-cbb12f8e904ca926c14cba9d41e99aa6f48c8e90.tar.gz tk-cbb12f8e904ca926c14cba9d41e99aa6f48c8e90.tar.bz2 |
Fix [c0cc9fd153]: PNG parser does not support uppercase format string (using -format)
-rw-r--r-- | generic/tkImgPNG.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/generic/tkImgPNG.c b/generic/tkImgPNG.c index f639694..8a740d2 100644 --- a/generic/tkImgPNG.c +++ b/generic/tkImgPNG.c @@ -2283,10 +2283,10 @@ ParseFormat( Tcl_Obj **objv = NULL; int objc = 0; static const char *const fmtOptions[] = { - "png", "-alpha", NULL + "-alpha", NULL }; enum fmtOptions { - OPT_PNG, OPT_ALPHA + OPT_ALPHA }; /* @@ -2299,33 +2299,30 @@ ParseFormat( } for (; objc>0 ; objc--, objv++) { - int optIndex; - - if (Tcl_GetIndexFromObjStruct(interp, objv[0], fmtOptions, - sizeof(char *), "option", 0, &optIndex) == TCL_ERROR) { - return TCL_ERROR; - } + int optIndex; /* * Ignore the "png" part of the format specification. */ - if (OPT_PNG == optIndex) { + if (!strcasecmp(Tcl_GetString(objv[0]), "png")) { continue; } - if (objc < 2) { + if (Tcl_GetIndexFromObjStruct(interp, objv[0], fmtOptions, + sizeof(char *), "option", 0, &optIndex) == TCL_ERROR) { + return TCL_ERROR; + } + + if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "value"); return TCL_ERROR; - } + } objc--; objv++; switch ((enum fmtOptions) optIndex) { - case OPT_PNG: - break; - case OPT_ALPHA: if (Tcl_GetDoubleFromObj(interp, objv[0], &pngPtr->alpha) == TCL_ERROR) { |