diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2005-08-10 22:02:21 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2005-08-10 22:02:21 (GMT) |
commit | c8d989f48e69bfff4d7cb7214f8f4539e303fd7c (patch) | |
tree | 9d4e60b064aa3377d392ff30035da3ba8ba121ae /generic/tkCanvText.c | |
parent | aac661624dd68998883977d90169ef67424e6b7e (diff) | |
download | tk-c8d989f48e69bfff4d7cb7214f8f4539e303fd7c.zip tk-c8d989f48e69bfff4d7cb7214f8f4539e303fd7c.tar.gz tk-c8d989f48e69bfff4d7cb7214f8f4539e303fd7c.tar.bz2 |
Getting more systematic about style
Also start removing _ANSI_ARGS_; the core's required ANSI C for a while now
Also fix [Bug 1252702]; size_t doesn't mix with Tcl_GetStringFromObj
Diffstat (limited to 'generic/tkCanvText.c')
-rw-r--r-- | generic/tkCanvText.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index 5122fff..8cd3a4e 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCanvText.c,v 1.17 2004/06/08 20:25:04 mdejong Exp $ + * RCS: @(#) $Id: tkCanvText.c,v 1.18 2005/08/10 22:02:22 dkf Exp $ */ #include <stdio.h> @@ -1247,28 +1247,28 @@ GetTextIndex(interp, canvas, itemPtr, obj, indexPtr) * index. */ { TextItem *textPtr = (TextItem *) itemPtr; - size_t length; + int length; int c; TkCanvas *canvasPtr = (TkCanvas *) canvas; Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr; - char *string = Tcl_GetStringFromObj(obj, (int *) &length); + char *string = Tcl_GetStringFromObj(obj, &length); c = string[0]; - length = strlen(string); - if ((c == 'e') && (strncmp(string, "end", length) == 0)) { + if ((c == 'e') && (strncmp(string, "end", (unsigned) length) == 0)) { *indexPtr = textPtr->numChars; - } else if ((c == 'i') && (strncmp(string, "insert", length) == 0)) { + } else if ((c == 'i') + && (strncmp(string, "insert", (unsigned) length) == 0)) { *indexPtr = textPtr->insertPos; - } else if ((c == 's') && (strncmp(string, "sel.first", length) == 0) - && (length >= 5)) { + } else if ((c == 's') && (length >= 5) + && (strncmp(string, "sel.first", (unsigned) length) == 0)) { if (textInfoPtr->selItemPtr != itemPtr) { Tcl_SetResult(interp, "selection isn't in item", TCL_STATIC); return TCL_ERROR; } *indexPtr = textInfoPtr->selectFirst; - } else if ((c == 's') && (strncmp(string, "sel.last", length) == 0) - && (length >= 5)) { + } else if ((c == 's') && (length >= 5) + && (strncmp(string, "sel.last", (unsigned) length) == 0)) { if (textInfoPtr->selItemPtr != itemPtr) { Tcl_SetResult(interp, "selection isn't in item", TCL_STATIC); return TCL_ERROR; |