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 | 8027c838cc92d6350e069b635a1fa53d231eb203 (patch) | |
tree | e5e161c5e4f4b4e2d46f95e3c615a4a5b1eb27bc /generic/tkImgPNG.c | |
parent | faf078a2709835cbdb9c68f697d7d376e83e2e1c (diff) | |
download | tk-8027c838cc92d6350e069b635a1fa53d231eb203.zip tk-8027c838cc92d6350e069b635a1fa53d231eb203.tar.gz tk-8027c838cc92d6350e069b635a1fa53d231eb203.tar.bz2 |
Fix [c0cc9fd153]: PNG parser does not support uppercase format string (using -format)
Diffstat (limited to 'generic/tkImgPNG.c')
-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) { |