Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | some more int -> size_t changes |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
af0c7cac75e785ca92c44fd60ff1a589 |
User & Date: | jan.nijtmans 2013-02-01 15:49:33 |
Context
2013-02-01
| ||
16:07 | eliminate unnecessary Tcl_ConvertToType call check-in: 1a2f18b1 user: jan.nijtmans tags: trunk | |
15:49 | some more int -> size_t changes check-in: af0c7cac user: jan.nijtmans tags: trunk | |
14:37 | typo check-in: ad17ee85 user: jan.nijtmans tags: trunk | |
Changes
Changes to generic/tkCanvLine.c.
︙ | ︙ | |||
1739 1740 1741 1742 1743 1744 1745 | Tk_Item *itemPtr, /* Item for which the index is being * specified. */ Tcl_Obj *obj, /* Specification of a particular coord in * itemPtr's line. */ int *indexPtr) /* Where to store converted index. */ { LineItem *linePtr = (LineItem *) itemPtr; | < | | | 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 | Tk_Item *itemPtr, /* Item for which the index is being * specified. */ Tcl_Obj *obj, /* Specification of a particular coord in * itemPtr's line. */ int *indexPtr) /* Where to store converted index. */ { LineItem *linePtr = (LineItem *) itemPtr; const char *string = Tcl_GetString(obj); if (string[0] == 'e') { if (strncmp(string, "end", obj->length) == 0) { *indexPtr = 2*linePtr->numPoints; } else { goto badIndex; } } else if (string[0] == '@') { int i; double x, y, bestDist, dist, *coordPtr; |
︙ | ︙ |
Changes to generic/tkCanvPoly.c.
︙ | ︙ | |||
1669 1670 1671 1672 1673 1674 1675 | Tk_Item *itemPtr, /* Item for which the index is being * specified. */ Tcl_Obj *obj, /* Specification of a particular coord in * itemPtr's line. */ int *indexPtr) /* Where to store converted index. */ { PolygonItem *polyPtr = (PolygonItem *) itemPtr; | < | | | 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 | Tk_Item *itemPtr, /* Item for which the index is being * specified. */ Tcl_Obj *obj, /* Specification of a particular coord in * itemPtr's line. */ int *indexPtr) /* Where to store converted index. */ { PolygonItem *polyPtr = (PolygonItem *) itemPtr; const char *string = Tcl_GetString(obj); if (string[0] == 'e') { if (strncmp(string, "end", obj->length) != 0) { goto badIndex; } *indexPtr = 2*(polyPtr->numPoints - polyPtr->autoClosed); } else if (string[0] == '@') { int i; double x, y, bestDist, dist, *coordPtr; char *end; |
︙ | ︙ |
Changes to generic/tkCanvas.c.
︙ | ︙ | |||
1238 1239 1240 1241 1242 1243 1244 | case CANV_CREATE: { Tk_ItemType *typePtr; Tk_ItemType *matchPtr = NULL; Tk_Item *itemPtr; int isNew = 0; Tcl_HashEntry *entryPtr; const char *arg; | | | > | | 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 | case CANV_CREATE: { Tk_ItemType *typePtr; Tk_ItemType *matchPtr = NULL; Tk_Item *itemPtr; int isNew = 0; Tcl_HashEntry *entryPtr; const char *arg; size_t length; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "type coords ?arg ...?"); result = TCL_ERROR; goto done; } arg = Tcl_GetString(objv[2]); length = objv[2]->length; c = arg[0]; /* * Lock because the list of types is a global resource that could be * updated by another thread. That's fairly unlikely, but not * impossible. */ Tcl_MutexLock(&typeListMutex); for (typePtr = typeList; typePtr != NULL; typePtr = typePtr->nextPtr){ if ((c == typePtr->name[0]) && (!strncmp(arg, typePtr->name, length))) { if (matchPtr != NULL) { Tcl_MutexUnlock(&typeListMutex); goto badType; } matchPtr = typePtr; } } |
︙ | ︙ |
Changes to generic/tkCmds.c.
︙ | ︙ | |||
448 449 450 451 452 453 454 | p = winPtr->tagPtr[i]; if (*p == '.') { /* * Names starting with "." are malloced rather than Uids, so they * have to be freed. */ | | | 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | p = winPtr->tagPtr[i]; if (*p == '.') { /* * Names starting with "." are malloced rather than Uids, so they * have to be freed. */ ckfree((char *)p); } } ckfree(winPtr->tagPtr); winPtr->numTags = 0; winPtr->tagPtr = NULL; } |
︙ | ︙ |
Changes to generic/tkOldConfig.c.
︙ | ︙ | |||
714 715 716 717 718 719 720 | } if (argv[4] == NULL) { argv[4] = ""; } result = Tcl_Merge(5, argv); if (freeProc != NULL) { if ((freeProc == TCL_DYNAMIC) || (freeProc == (Tcl_FreeProc *) free)) { | | | 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 | } if (argv[4] == NULL) { argv[4] = ""; } result = Tcl_Merge(5, argv); if (freeProc != NULL) { if ((freeProc == TCL_DYNAMIC) || (freeProc == (Tcl_FreeProc *) free)) { ckfree((char *) argv[4]); } else { freeProc((char *) argv[4]); } } return result; } |
︙ | ︙ |
Changes to generic/tkPack.c.
︙ | ︙ | |||
1097 1098 1099 1100 1101 1102 1103 | int objc, /* Number of elements in objv. */ Tcl_Obj *const objv[]) /* Array of lists, each containing 2 elements: * window name and side against which to * pack. */ { register Packer *packPtr; Tk_Window tkwin, ancestor, parent; | < | 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 | int objc, /* Number of elements in objv. */ Tcl_Obj *const objv[]) /* Array of lists, each containing 2 elements: * window name and side against which to * pack. */ { register Packer *packPtr; Tk_Window tkwin, ancestor, parent; Tcl_Obj **options; int index, optionCount, c; /* * Iterate over all of the window specifiers, each consisting of two * arguments. The first argument contains the window name and the * additional arguments contain options such as "top" or "padx 20". |
︙ | ︙ | |||
1166 1167 1168 1169 1170 1171 1172 | packPtr->padX = packPtr->padY = 0; packPtr->padLeft = packPtr->padTop = 0; packPtr->iPadX = packPtr->iPadY = 0; packPtr->flags &= ~(FILLX|FILLY|EXPAND); packPtr->flags |= OLD_STYLE; for (index = 0 ; index < optionCount; index++) { Tcl_Obj *curOptPtr = options[index]; | | > | | | | | | 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 | packPtr->padX = packPtr->padY = 0; packPtr->padLeft = packPtr->padTop = 0; packPtr->iPadX = packPtr->iPadY = 0; packPtr->flags &= ~(FILLX|FILLY|EXPAND); packPtr->flags |= OLD_STYLE; for (index = 0 ; index < optionCount; index++) { Tcl_Obj *curOptPtr = options[index]; const char *curOpt = Tcl_GetString(curOptPtr); size_t length = curOptPtr->length; c = curOpt[0]; if ((c == 't') && (strncmp(curOpt, "top", length)) == 0) { packPtr->side = TOP; } else if ((c == 'b') && (strncmp(curOpt, "bottom", length)) == 0) { packPtr->side = BOTTOM; } else if ((c == 'l') && (strncmp(curOpt, "left", length)) == 0) { packPtr->side = LEFT; } else if ((c == 'r') && (strncmp(curOpt, "right", length)) == 0) { packPtr->side = RIGHT; } else if ((c == 'e') && (strncmp(curOpt, "expand", length)) == 0) { packPtr->flags |= EXPAND; } else if ((c == 'f') && (strcmp(curOpt, "fill")) == 0) { packPtr->flags |= FILLX|FILLY; } else if ((length == 5) && (strcmp(curOpt, "fillx")) == 0) { packPtr->flags |= FILLX; } else if ((length == 5) && (strcmp(curOpt, "filly")) == 0) { |
︙ | ︙ |
Changes to generic/tkTest.c.
︙ | ︙ | |||
1977 1978 1979 1980 1981 1982 1983 | Tk_Window tkwin, Tcl_Obj **value, char *recordPtr, int internalOffset, char *saveInternalPtr, int flags) { | | | | | | | | 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 | Tk_Window tkwin, Tcl_Obj **value, char *recordPtr, int internalOffset, char *saveInternalPtr, int flags) { int objEmpty; char *newStr, *string, *internalPtr; objEmpty = 0; if (internalOffset >= 0) { internalPtr = recordPtr + internalOffset; } else { internalPtr = NULL; } /* * See if the object is empty. */ if (value == NULL) { objEmpty = 1; CLANG_ASSERT(value); } else if ((*value)->bytes != NULL) { objEmpty = ((*value)->length == 0); } else { (void)Tcl_GetString(*value); objEmpty = ((*value)->length == 0); } if ((flags & TK_OPTION_NULL_OK) && objEmpty) { *value = NULL; } else { string = Tcl_GetString(*value); Tcl_UtfToUpper(string); if (strcmp(string, "BAD") == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj("expected good value, got \"BAD\"", -1)); return TCL_ERROR; } } if (internalPtr != NULL) { if (*value != NULL) { string = Tcl_GetString(*value); newStr = ckalloc((*value)->length + 1); strcpy(newStr, string); } else { newStr = NULL; } *((char **) saveInternalPtr) = *((char **) internalPtr); *((char **) internalPtr) = newStr; } |
︙ | ︙ |
Changes to generic/tkText.c.
︙ | ︙ | |||
855 856 857 858 859 860 861 | if (indexToPtr == NULL) { result = TCL_ERROR; goto done; } for (i = 2; i < objc-2; i++) { int value, length; | | > | 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 | if (indexToPtr == NULL) { result = TCL_ERROR; goto done; } for (i = 2; i < objc-2; i++) { int value, length; const char *option = Tcl_GetString(objv[i]); char c; length = objv[i]->length; if (length < 2 || option[0] != '-') { goto badOption; } c = option[1]; if (c == 'c' && !strncmp("-chars", option, (unsigned) length)) { value = CountIndices(textPtr, indexFromPtr, indexToPtr, COUNT_CHARS); |
︙ | ︙ | |||
1256 1257 1258 1259 1260 1261 1262 | /* * Simple, restrictive argument parsing. The only options are -- and * -displaychars (or any unique prefix). */ i = 2; if (objc > 3) { | | > | > | 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 | /* * Simple, restrictive argument parsing. The only options are -- and * -displaychars (or any unique prefix). */ i = 2; if (objc > 3) { name = Tcl_GetString(objv[i]); length = objv[i]->length; if (length > 1 && name[0] == '-') { if (strncmp("-displaychars", name, (unsigned) length) == 0) { i++; visible = 1; name = Tcl_GetString(objv[i]); length = objv[i]->length; } if ((i < objc-1) && (length == 2) && !strcmp("--", name)) { i++; } } } |
︙ | ︙ | |||
2548 2549 2550 2551 2552 2553 2554 | int viewUpdate) /* Update the view if set. */ { int lineIndex, length; TkText *tPtr; int *lineAndByteIndex; int resetViewCount; int pixels[2*PIXEL_CLIENTS]; | < | > | 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 | int viewUpdate) /* Update the view if set. */ { int lineIndex, length; TkText *tPtr; int *lineAndByteIndex; int resetViewCount; int pixels[2*PIXEL_CLIENTS]; const char *string = Tcl_GetString(stringPtr); length = stringPtr->length; if (sharedTextPtr == NULL) { sharedTextPtr = textPtr->sharedTextPtr; } /* * Don't allow insertions on the last (dummy) line of the text. This is * the only place in this function where the indexPtr is modified. |
︙ | ︙ | |||
4089 4090 4091 4092 4093 4094 4095 | if (searchSpecPtr->exact && searchSpecPtr->noCase) { Tcl_SetObjLength(theLine, Tcl_UtfToLower(Tcl_GetString(theLine))); } if (lenPtr != NULL) { if (searchSpecPtr->exact) { | | > | 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 | if (searchSpecPtr->exact && searchSpecPtr->noCase) { Tcl_SetObjLength(theLine, Tcl_UtfToLower(Tcl_GetString(theLine))); } if (lenPtr != NULL) { if (searchSpecPtr->exact) { (void)Tcl_GetString(theLine); *lenPtr = theLine->length; } else { *lenPtr = Tcl_GetCharLength(theLine); } } return linePtr; } |
︙ | ︙ | |||
4615 4616 4617 4618 4619 4620 4621 | } else { int length; const char *str; if (TkTextGetObjIndex(interp, textPtr, objv[arg], &index2) != TCL_OK) { return TCL_ERROR; } | | > | 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 | } else { int length; const char *str; if (TkTextGetObjIndex(interp, textPtr, objv[arg], &index2) != TCL_OK) { return TCL_ERROR; } str = Tcl_GetString(objv[arg]); length = objv[arg]->length; if (strncmp(str, "end", (unsigned) length) == 0) { atEnd = 1; } } if (TkTextIndexCmp(&index1, &index2) >= 0) { return TCL_OK; } |
︙ | ︙ | |||
5537 5538 5539 5540 5541 5542 5543 | /* * We only need to set the matchLength once for exact searches, and we * do it here. It is also used below as the actual pattern length, so * it has dual purpose. */ | | > | 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 | /* * We only need to set the matchLength once for exact searches, and we * do it here. It is also used below as the actual pattern length, so * it has dual purpose. */ pattern = Tcl_GetString(patObj); matchLength = patObj->length; nl = strchr(pattern, '\n'); /* * If there is no newline, or it is the very end of the string, then * we don't need any special treatment, since single-line matching * will work fine. */ |
︙ | ︙ | |||
6605 6606 6607 6608 6609 6610 6611 | *---------------------------------------------------------------------- */ static int ObjectIsEmpty( Tcl_Obj *objPtr) /* Object to test. May be NULL. */ { | < < | | | 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 | *---------------------------------------------------------------------- */ static int ObjectIsEmpty( Tcl_Obj *objPtr) /* Object to test. May be NULL. */ { if (objPtr == NULL) { return 1; } if (objPtr->bytes != NULL) { return (objPtr->length == 0); } (void)Tcl_GetString(objPtr); return (objPtr->length == 0); } /* *---------------------------------------------------------------------- * * TkpTesttextCmd -- * |
︙ | ︙ |
Changes to generic/tkUtil.c.
︙ | ︙ | |||
725 726 727 728 729 730 731 | int objc, /* # arguments for command. */ Tcl_Obj *const objv[], /* Arguments for command. */ double *dblPtr, /* Filled in with argument "moveto" option, if * any. */ int *intPtr) /* Filled in with number of pages or lines to * scroll, if any. */ { | < | > | 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 | int objc, /* # arguments for command. */ Tcl_Obj *const objv[], /* Arguments for command. */ double *dblPtr, /* Filled in with argument "moveto" option, if * any. */ int *intPtr) /* Filled in with number of pages or lines to * scroll, if any. */ { const char *arg = Tcl_GetString(objv[2]); size_t length = objv[2]->length; #define ArgPfxEq(str) \ ((arg[0] == str[0]) && !strncmp(arg, str, (unsigned)length)) if (ArgPfxEq("moveto")) { if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "moveto fraction"); |
︙ | ︙ | |||
749 750 751 752 753 754 755 | Tcl_WrongNumArgs(interp, 2, objv, "scroll number units|pages"); return TK_SCROLL_ERROR; } if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) { return TK_SCROLL_ERROR; } | | > | 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 | Tcl_WrongNumArgs(interp, 2, objv, "scroll number units|pages"); return TK_SCROLL_ERROR; } if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) { return TK_SCROLL_ERROR; } arg = Tcl_GetString(objv[4]); length = objv[4]->length; if (ArgPfxEq("pages")) { return TK_SCROLL_PAGES; } else if (ArgPfxEq("units")) { return TK_SCROLL_UNITS; } Tcl_SetObjResult(interp, Tcl_ObjPrintf( |
︙ | ︙ |
Changes to win/tkWinWm.c.
︙ | ︙ | |||
2812 2813 2814 2815 2816 2817 2818 | wrongNumArgs: Tcl_WrongNumArgs(interp, 1, objv, "option window ?arg ...?"); return TCL_ERROR; } argv1 = Tcl_GetString(objv[1]); length = objv[1]->length; | | | 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 | wrongNumArgs: Tcl_WrongNumArgs(interp, 1, objv, "option window ?arg ...?"); return TCL_ERROR; } argv1 = Tcl_GetString(objv[1]); length = objv[1]->length; if ((argv1[0] == 't') && !strncmp(argv1, "tracing", length) && (length >= 3)) { int wmTracing; if ((objc != 2) && (objc != 3)) { Tcl_WrongNumArgs(interp, 2, objv, "?boolean?"); return TCL_ERROR; } |
︙ | ︙ |