From d68ebc949ff65561393bce4e9c6357623a402cf9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 20 Jan 2013 11:40:02 +0000 Subject: eliminate use of deprecated Tcl_SaveResult API --- generic/tkImgPNG.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/generic/tkImgPNG.c b/generic/tkImgPNG.c index b159c45..267b1d9 100644 --- a/generic/tkImgPNG.c +++ b/generic/tkImgPNG.c @@ -334,9 +334,11 @@ InitPNGImage( if (Tcl_ZlibStreamInit(NULL, dir, TCL_ZLIB_FORMAT_ZLIB, TCL_ZLIB_COMPRESS_DEFAULT, NULL, &pngPtr->stream) != TCL_OK) { - Tcl_SetObjResult(interp, Tcl_NewStringObj( - "zlib initialization failed", -1)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "ZLIB_INIT", NULL); + if (interp) { + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "zlib initialization failed", -1)); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "ZLIB_INIT", NULL); + } if (objPtr) { Tcl_DecrRefCount(objPtr); } @@ -2667,11 +2669,8 @@ FileMatchPNG( { PNGImage png; int match = 0; - Tcl_SavedResult sya; - - Tcl_SaveResult(interp, &sya); - InitPNGImage(interp, &png, chan, NULL, TCL_ZLIB_STREAM_INFLATE); + InitPNGImage(NULL, &png, chan, NULL, TCL_ZLIB_STREAM_INFLATE); if (ReadIHDR(interp, &png) == TCL_OK) { *widthPtr = png.block.width; @@ -2680,7 +2679,6 @@ FileMatchPNG( } CleanupPNGImage(&png); - Tcl_RestoreResult(interp, &sya); return match; } @@ -2759,10 +2757,8 @@ StringMatchPNG( { PNGImage png; int match = 0; - Tcl_SavedResult sya; - Tcl_SaveResult(interp, &sya); - InitPNGImage(interp, &png, NULL, pObjData, TCL_ZLIB_STREAM_INFLATE); + InitPNGImage(NULL, &png, NULL, pObjData, TCL_ZLIB_STREAM_INFLATE); png.strDataBuf = Tcl_GetByteArrayFromObj(pObjData, &png.strDataLen); @@ -2773,7 +2769,6 @@ StringMatchPNG( } CleanupPNGImage(&png); - Tcl_RestoreResult(interp, &sya); return match; } -- cgit v0.12