Tk Source Code

Check-in [8363f1b5]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix [c0cc9fd153]: PNG parser does not support uppercase format string (using -format)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8363f1b57d8ab59903f6c2b27e4dabb81fa481cc
User & Date: jan.nijtmans 2013-10-31 09:35:23
References
2013-10-31
09:35 Closed ticket [c0cc9fd1]: PNG parser does not support uppercase format string (using -format) plus 7 other changes artifact: 37640d6e user: jan.nijtmans
Context
2013-10-31
21:25
Fix refcount bug in FreeFontObjProc. Could result in freeing a TkFont which was already freed. check-in: 61cefa0e user: jan.nijtmans tags: trunk
11:27
Suggested fix for [3604346]: Checkin [a7eee0499a] broke Ttk docs. Closed-Leaf check-in: 7de29bd8 user: jan.nijtmans tags: bug-3604346
09:35
Fix [c0cc9fd153]: PNG parser does not support uppercase format string (using -format) check-in: 8363f1b5 user: jan.nijtmans tags: trunk
09:27
Put extern "C" guards around all stub table struct definitions, so it is usable to be used for C++ compilers as well without the danger of modifying the calling convention. For tkDecls.h, ttkDecls.h tkIntXlibDecls.h is was no problem, because tk.h, tkTheme.h and Xlib.h already contain those guards. But not for the other *Decls.h files. check-in: 83a9d727 user: jan.nijtmans tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tkImgPNG.c.

2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316





2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
    Tcl_Interp *interp,
    Tcl_Obj *fmtObj,
    PNGImage *pngPtr)
{
    Tcl_Obj **objv = NULL;
    int objc = 0;
    static const char *const fmtOptions[] = {
	"png", "-alpha", NULL
    };
    enum fmtOptions {
	OPT_PNG, OPT_ALPHA
    };

    /*
     * Extract elements of format specification as a list.
     */

    if (fmtObj &&
	    Tcl_ListObjGetElements(interp, fmtObj, &objc, &objv) != TCL_OK) {
	return TCL_ERROR;
    }

    for (; objc>0 ; objc--, objv++) {
    	int optIndex;

        if (Tcl_GetIndexFromObjStruct(interp, objv[0], fmtOptions,
		sizeof(char *), "option", 0, &optIndex) == TCL_ERROR) {
            return TCL_ERROR;
	}

	/*
	 * Ignore the "png" part of the format specification.
	 */

	if (OPT_PNG == optIndex) {
	    continue;
	}






    	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) {
		return TCL_ERROR;
	    }

	    if ((pngPtr->alpha < 0.0) || (pngPtr->alpha > 1.0)) {







|


|












|
<
<
<
<
<





|



>
>
>
>
>
|


|





<
<
<







2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302





2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325



2326
2327
2328
2329
2330
2331
2332
    Tcl_Interp *interp,
    Tcl_Obj *fmtObj,
    PNGImage *pngPtr)
{
    Tcl_Obj **objv = NULL;
    int objc = 0;
    static const char *const fmtOptions[] = {
	"-alpha", NULL
    };
    enum fmtOptions {
	OPT_ALPHA
    };

    /*
     * Extract elements of format specification as a list.
     */

    if (fmtObj &&
	    Tcl_ListObjGetElements(interp, fmtObj, &objc, &objv) != TCL_OK) {
	return TCL_ERROR;
    }

    for (; objc>0 ; objc--, objv++) {
	int optIndex;






	/*
	 * Ignore the "png" part of the format specification.
	 */

	if (!strcasecmp(Tcl_GetString(objv[0]), "png")) {
	    continue;
	}

	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_ALPHA:
	    if (Tcl_GetDoubleFromObj(interp, objv[0],
		    &pngPtr->alpha) == TCL_ERROR) {
		return TCL_ERROR;
	    }

	    if ((pngPtr->alpha < 0.0) || (pngPtr->alpha > 1.0)) {