diff options
author | dkf <dkf@noemail.net> | 2012-06-25 12:57:50 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2012-06-25 12:57:50 (GMT) |
commit | e8ac46036adda986916bd0a0995ebb2d68213a12 (patch) | |
tree | 6f7fbc2ac8742c8c3c00c0f6ba91990ac9e00498 /generic/tclCmdAH.c | |
parent | 88d947cd9e02e984104de2f40f7a45ccf080ae05 (diff) | |
parent | fc71b38300f43f0158815e220a19e4ac039403a3 (diff) | |
download | tcl-e8ac46036adda986916bd0a0995ebb2d68213a12.zip tcl-e8ac46036adda986916bd0a0995ebb2d68213a12.tar.gz tcl-e8ac46036adda986916bd0a0995ebb2d68213a12.tar.bz2 |
[Bug 3537605]: Make [encoding dirs ? ?] report the right error message.
FossilOrigin-Name: 0d03fa5c04529c0ae61cb79cdcadb38c26b1a234
Diffstat (limited to 'generic/tclCmdAH.c')
-rw-r--r-- | generic/tclCmdAH.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 4292224..6dfc705 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -629,24 +629,26 @@ EncodingDirsObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { + Tcl_Obj *dirListObj; + if (objc > 3) { - Tcl_WrongNumArgs(interp, 1, objv, "?dirList?"); + Tcl_WrongNumArgs(interp, 2, objv, "?dirList?"); return TCL_ERROR; } - objc -= 1; - objv += 1; - if (objc == 1) { + if (objc == 2) { Tcl_SetObjResult(interp, Tcl_GetEncodingSearchPath()); return TCL_OK; } - if (Tcl_SetEncodingSearchPath(objv[1]) == TCL_ERROR) { + + dirListObj = objv[2]; + if (Tcl_SetEncodingSearchPath(dirListObj) == TCL_ERROR) { Tcl_AppendResult(interp, "expected directory list but got \"", - TclGetString(objv[1]), "\"", NULL); + TclGetString(dirListObj), "\"", NULL); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "ENCODING", "BADPATH", NULL); return TCL_ERROR; } - Tcl_SetObjResult(interp, objv[1]); + Tcl_SetObjResult(interp, dirListObj); return TCL_OK; } |