diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-08-11 21:33:05 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-08-11 21:33:05 (GMT) |
commit | 09fba835c8c9d68042f6fef960c025be7c8c3641 (patch) | |
tree | 5e38501bee08c156d14cba01ccef64012a94521b /generic/tkFont.c | |
parent | 1d1ca3a5dde2d56b10fab0dfa5f430b98760de8e (diff) | |
download | tk-09fba835c8c9d68042f6fef960c025be7c8c3641.zip tk-09fba835c8c9d68042f6fef960c025be7c8c3641.tar.gz tk-09fba835c8c9d68042f6fef960c025be7c8c3641.tar.bz2 |
More preparation for TIP #494 compatibitly. Add 2 utility functions, which can retreive big strings and ByteArrays without length overflow.
Diffstat (limited to 'generic/tkFont.c')
-rw-r--r-- | generic/tkFont.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/generic/tkFont.c b/generic/tkFont.c index 834e944..9f2fa11 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -712,7 +712,8 @@ Tk_FontObjCmd( case FONT_MEASURE: { const char *string; Tk_Font tkfont; - int length = 0, skip = 0; + size_t length = 0; + int skip = 0; if (objc > 4) { skip = TkGetDisplayOf(interp, objc - 3, objv + 3, &tkwin); @@ -729,7 +730,7 @@ Tk_FontObjCmd( if (tkfont == NULL) { return TCL_ERROR; } - string = Tcl_GetStringFromObj(objv[3 + skip], &length); + string = TkGetStringFromObj(objv[3 + skip], &length); Tcl_SetObjResult(interp, Tcl_NewIntObj( Tk_TextWidth(tkfont, string, length))); Tk_FreeFont(tkfont); @@ -3245,7 +3246,8 @@ Tk_TextLayoutToPostscript( LayoutChunk *chunkPtr = layoutPtr->chunks; int baseline = chunkPtr->y; Tcl_Obj *psObj = Tcl_NewObj(); - int i, j, len; + int i, j; + size_t len; const char *p, *glyphname; char uindex[5], c, *ps; int ch; @@ -3303,7 +3305,7 @@ Tk_TextLayoutToPostscript( sprintf(uindex, "%04X", ch); /* endianness? */ glyphname = Tcl_GetVar2(interp, "::tk::psglyphs", uindex, 0); if (glyphname) { - ps = Tcl_GetStringFromObj(psObj, &len); + ps = TkGetStringFromObj(psObj, &len); if (ps[len-1] == '(') { /* * In-place edit. Ewww! |