From 1d84ebe142bb392f1d8c24f0bb90f6be02530c24 Mon Sep 17 00:00:00 2001 From: dkf Date: Mon, 30 Jul 2012 09:16:18 +0000 Subject: more reorganization of error codes: safety is common failure mode --- generic/tkCanvPs.c | 2 +- generic/tkCmds.c | 8 ++++---- generic/tkImgBmap.c | 2 +- generic/tkImgPhoto.c | 6 +++--- generic/tkOption.c | 2 +- unix/tkUnixCursor.c | 2 +- win/tkWinCursor.c | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c index b6e9a33..fb5172e 100644 --- a/generic/tkCanvPs.c +++ b/generic/tkCanvPs.c @@ -357,7 +357,7 @@ TkCanvPostscriptCmd( if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't specify -file in a safe interpreter", -1)); - Tcl_SetErrorCode(interp, "TK", "CANVAS", "PS", "SAFE", NULL); + Tcl_SetErrorCode(interp, "TK", "SAFE", "PS_FILE", NULL); result = TCL_ERROR; goto cleanup; } diff --git a/generic/tkCmds.c b/generic/tkCmds.c index 2955105..4e9494b 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -687,7 +687,7 @@ AppnameCmd( if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "appname not accessible in a safe interpreter", -1)); - Tcl_SetErrorCode(interp, "TK", "SAFE", NULL); + Tcl_SetErrorCode(interp, "TK", "SAFE", "APPLICATION", NULL); return TCL_ERROR; } @@ -812,7 +812,7 @@ ScalingCmd( if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "scaling not accessible in a safe interpreter", -1)); - Tcl_SetErrorCode(interp, "TK", "SAFE", NULL); + Tcl_SetErrorCode(interp, "TK", "SAFE", "SCALING", NULL); return TCL_ERROR; } @@ -862,7 +862,7 @@ UseinputmethodsCmd( if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "useinputmethods not accessible in a safe interpreter", -1)); - Tcl_SetErrorCode(interp, "TK", "SAFE", NULL); + Tcl_SetErrorCode(interp, "TK", "SAFE", "INPUT_METHODS", NULL); return TCL_ERROR; } @@ -959,7 +959,7 @@ InactiveCmd( Tcl_SetObjResult(interp, Tcl_NewStringObj( "resetting the user inactivity timer " "is not allowed in a safe interpreter", -1)); - Tcl_SetErrorCode(interp, "TK", "SAFE", NULL); + Tcl_SetErrorCode(interp, "TK", "SAFE", "INACTIVITY_TIMER", NULL); return TCL_ERROR; } Tk_ResetUserInactiveTime(Tk_Display(tkwin)); diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index f57db55..cdd57dd 100644 --- a/generic/tkImgBmap.c +++ b/generic/tkImgBmap.c @@ -497,7 +497,7 @@ TkGetBitmapData( Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't get bitmap data from a file in a safe interpreter", -1)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "BITMAP", "SAFE", NULL); + Tcl_SetErrorCode(interp, "TK", "SAFE", "BITMAP_FILE", NULL); return NULL; } expandedFileName = Tcl_TranslateFileName(interp, fileName, &buffer); diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 74ee564..559268a 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -1011,7 +1011,7 @@ ImgPhotoCmd( if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't get image from a file in a safe interpreter", -1)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "SAFE", NULL); + Tcl_SetErrorCode(interp, "TK", "SAFE", "PHOTO_FILE", NULL); return TCL_ERROR; } @@ -1274,7 +1274,7 @@ ImgPhotoCmd( if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't write image to a file in a safe interpreter", -1)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "SAFE", NULL); + Tcl_SetErrorCode(interp, "TK", "SAFE", "PHOTO_FILE", NULL); return TCL_ERROR; } @@ -1898,7 +1898,7 @@ ImgPhotoConfigureMaster( Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't get image from a file in a safe interpreter", -1)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "SAFE", NULL); + Tcl_SetErrorCode(interp, "TK", "SAFE", "PHOTO_FILE", NULL); goto errorExit; } diff --git a/generic/tkOption.c b/generic/tkOption.c index 24f7e39..ec9e465 100644 --- a/generic/tkOption.c +++ b/generic/tkOption.c @@ -1081,7 +1081,7 @@ ReadOptionFile( if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't read options from a file in a safe interpreter", -1)); - Tcl_SetErrorCode(interp, "TK", "OPTIONDB", "SAFE", NULL); + Tcl_SetErrorCode(interp, "TK", "SAFE", "OPTION_FILE", NULL); return TCL_ERROR; } diff --git a/unix/tkUnixCursor.c b/unix/tkUnixCursor.c index 8a19c7b..5266bde 100644 --- a/unix/tkUnixCursor.c +++ b/unix/tkUnixCursor.c @@ -313,7 +313,7 @@ TkGetCursorByName( Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't get cursor from a file in a safe interpreter", -1)); - Tcl_SetErrorCode(interp, "TK", "CURSOR", "SAFE", NULL); + Tcl_SetErrorCode(interp, "TK", "SAFE", "CURSOR_FILE", NULL); cursorPtr = NULL; goto cleanup; } diff --git a/win/tkWinCursor.c b/win/tkWinCursor.c index e7dbc65..622ba4d 100644 --- a/win/tkWinCursor.c +++ b/win/tkWinCursor.c @@ -132,7 +132,7 @@ TkGetCursorByName( if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't get cursor from a file in a safe interpreter",-1)); - Tcl_SetErrorCode(interp, "TK", "CURSOR", "SAFE", NULL); + Tcl_SetErrorCode(interp, "TK", "SAFE", "CURSOR_FILE", NULL); ckfree(argv); ckfree(cursorPtr); return NULL; -- cgit v0.12