From 2996ef1b03e4fac0c23ae64bb074521fc406cbef Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 5 Dec 2012 22:40:20 +0000 Subject: A demo version of "novem" in which the signature of Tcl_EvalEx is modified to have a Tcl_WideInt numBytes argument. That's the only change. --- generic/tcl.decls | 2 +- generic/tclBasic.c | 7 +++++-- generic/tclDecls.h | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index ad725f5..595cb98 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -1051,7 +1051,7 @@ declare 290 { void Tcl_DiscardResult(Tcl_SavedResult *statePtr) } declare 291 { - int Tcl_EvalEx(Tcl_Interp *interp, const char *script, int numBytes, + int Tcl_EvalEx(Tcl_Interp *interp, const char *script, Tcl_WideInt numBytes, int flags) } declare 292 { diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 7202184..ee41bde 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -4442,14 +4442,17 @@ Tcl_EvalEx( Tcl_Interp *interp, /* Interpreter in which to evaluate the * script. Also used for error reporting. */ const char *script, /* First character of script to evaluate. */ - int numBytes, /* Number of bytes in script. If < 0, the + Tcl_WideInt numBytes, /* Number of bytes in script. If < 0, the * script consists of all bytes up to the * first null character. */ int flags) /* Collection of OR-ed bits that control the * evaluation of the script. Only * TCL_EVAL_GLOBAL is currently supported. */ { - return TclEvalEx(interp, script, numBytes, flags, 1, NULL, script); + if (numBytes < -1 || numBytes > INT_MAX) { + Tcl_Panic("Crash!"); + } + return TclEvalEx(interp, script, (int)numBytes, flags, 1, NULL, script); } int diff --git a/generic/tclDecls.h b/generic/tclDecls.h index d38296d..63dbdf1 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -834,7 +834,7 @@ TCLAPI void Tcl_DeleteThreadExitHandler(Tcl_ExitProc *proc, TCLAPI void Tcl_DiscardResult(Tcl_SavedResult *statePtr); /* 291 */ TCLAPI int Tcl_EvalEx(Tcl_Interp *interp, const char *script, - int numBytes, int flags); + Tcl_WideInt numBytes, int flags); /* 292 */ TCLAPI int Tcl_EvalObjv(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], int flags); @@ -2094,7 +2094,7 @@ typedef struct TclStubs { void (*tcl_CreateThreadExitHandler) (Tcl_ExitProc *proc, ClientData clientData); /* 288 */ void (*tcl_DeleteThreadExitHandler) (Tcl_ExitProc *proc, ClientData clientData); /* 289 */ void (*tcl_DiscardResult) (Tcl_SavedResult *statePtr); /* 290 */ - int (*tcl_EvalEx) (Tcl_Interp *interp, const char *script, int numBytes, int flags); /* 291 */ + int (*tcl_EvalEx) (Tcl_Interp *interp, const char *script, Tcl_WideInt numBytes, int flags); /* 291 */ int (*tcl_EvalObjv) (Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], int flags); /* 292 */ int (*tcl_EvalObjEx) (Tcl_Interp *interp, Tcl_Obj *objPtr, int flags); /* 293 */ void (*tcl_ExitThread) (int status); /* 294 */ -- cgit v0.12