diff options
-rw-r--r-- | generic/tkListbox.c | 6 | ||||
-rw-r--r-- | generic/tkMessage.c | 2 | ||||
-rw-r--r-- | generic/tkOption.c | 4 | ||||
-rw-r--r-- | generic/tkText.c | 4 | ||||
-rw-r--r-- | generic/tkTextBTree.c | 6 | ||||
-rw-r--r-- | generic/tkTextIndex.c | 2 | ||||
-rw-r--r-- | generic/tkTextTag.c | 5 | ||||
-rw-r--r-- | generic/tkVisual.c | 9 | ||||
-rw-r--r-- | generic/tkWindow.c | 6 | ||||
-rw-r--r-- | macosx/tkMacOSXBitmap.c | 2 |
10 files changed, 23 insertions, 23 deletions
diff --git a/generic/tkListbox.c b/generic/tkListbox.c index 6cbf224..0fe8e43 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -3166,14 +3166,14 @@ ListboxFetchSelection( * Copy the requested portion of the selection to the buffer. */ - count = length - offset; - if (count <= 0) { + if (length <= (size_t)offset) { count = 0; } else { + count = length - offset; if (count > maxBytes) { count = maxBytes; } - memcpy(buffer, Tcl_DStringValue(&selection) + offset, (size_t) count); + memcpy(buffer, Tcl_DStringValue(&selection) + offset, count); } buffer[count] = '\0'; Tcl_DStringFree(&selection); diff --git a/generic/tkMessage.c b/generic/tkMessage.c index 74b62b1..d6853e5 100644 --- a/generic/tkMessage.c +++ b/generic/tkMessage.c @@ -242,7 +242,7 @@ Tk_MessageObjCmd( optionTable = Tk_CreateOptionTable(interp, optionSpecs); msgPtr = ckalloc(sizeof(Message)); - memset(msgPtr, 0, (size_t) sizeof(Message)); + memset(msgPtr, 0, sizeof(Message)); /* * Set values for those fields that don't take a 0 or NULL value. diff --git a/generic/tkOption.c b/generic/tkOption.c index 6c09150..cebb86a 100644 --- a/generic/tkOption.c +++ b/generic/tkOption.c @@ -260,7 +260,7 @@ Tk_AddOption( register const char *p; const char *field; int count, firstField; - ptrdiff_t length; + size_t length; #define TMP_SIZE 100 char tmp[TMP_SIZE+1]; ThreadSpecificData *tsdPtr = @@ -311,7 +311,7 @@ Tk_AddOption( if (length > TMP_SIZE) { length = TMP_SIZE; } - strncpy(tmp, field, (size_t) length); + strncpy(tmp, field, length); tmp[length] = 0; newEl.nameUid = Tk_GetUid(tmp); if (isupper(UCHAR(*field))) { diff --git a/generic/tkText.c b/generic/tkText.c index 1585e27..11f44f1 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -1155,14 +1155,14 @@ TextWidgetObjCmd( objc++; } useIdx = ckalloc(objc); - memset(useIdx, 0, (size_t) objc); + memset(useIdx, 0, objc); /* * Do a decreasing order sort so that we delete the end ranges * first to maintain index consistency. */ - qsort(indices, (size_t) objc / 2, + qsort(indices, objc / 2, 2 * sizeof(TkTextIndex), TextIndexSortProc); lastStart = NULL; diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c index 81e31dc..23aef2d 100644 --- a/generic/tkTextBTree.c +++ b/generic/tkTextBTree.c @@ -1021,7 +1021,7 @@ TkBTreeInsertChars( * this line). */ register TkTextSegment *segPtr; TkTextLine *newLinePtr; - int chunkSize; /* # characters in current chunk. */ + size_t chunkSize; /* # characters in current chunk. */ register const char *eol; /* Pointer to character just after last one in * current chunk. */ int changeToLineCount; /* Counts change to total number of lines in @@ -1070,7 +1070,7 @@ TkBTreeInsertChars( curPtr->nextPtr = segPtr; } segPtr->size = chunkSize; - memcpy(segPtr->body.chars, string, (size_t) chunkSize); + memcpy(segPtr->body.chars, string, chunkSize); segPtr->body.chars[chunkSize] = 0; if (eol[-1] != '\n') { @@ -4563,7 +4563,7 @@ CharSplitProc( newPtr1->typePtr = &tkTextCharType; newPtr1->nextPtr = newPtr2; newPtr1->size = index; - memcpy(newPtr1->body.chars, segPtr->body.chars, (size_t) index); + memcpy(newPtr1->body.chars, segPtr->body.chars, index); newPtr1->body.chars[index] = 0; newPtr2->typePtr = &tkTextCharType; newPtr2->nextPtr = segPtr->nextPtr; diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index 0ee7347..bfef403 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -923,7 +923,7 @@ GetIndex( } if ((string[0] == 'e') && (strncmp(string, "end", - (size_t) (endOfBase-Tcl_DStringValue(©))) == 0)) { + endOfBase-Tcl_DStringValue(©)) == 0)) { /* * Base position is end of text. */ diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c index d8ffb5a..d76f770 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -1563,7 +1563,8 @@ TkTextPickCurrent( TkTextTag **copyArrayPtr = NULL; /* Initialization needed to prevent compiler * warning. */ - int numOldTags, numNewTags, i, j, size, nearby; + int numOldTags, numNewTags, i, j, nearby; + size_t size; XEvent event; /* @@ -1656,7 +1657,7 @@ TkTextPickCurrent( if (numNewTags > 0) { size = numNewTags * sizeof(TkTextTag *); copyArrayPtr = ckalloc(size); - memcpy(copyArrayPtr, newArrayPtr, (size_t) size); + memcpy(copyArrayPtr, newArrayPtr, size); for (i = 0; i < textPtr->numCurTags; i++) { for (j = 0; j < numNewTags; j++) { if (textPtr->curTagArrayPtr[i] == copyArrayPtr[j]) { diff --git a/generic/tkVisual.c b/generic/tkVisual.c index 6f6816d..427e946 100644 --- a/generic/tkVisual.c +++ b/generic/tkVisual.c @@ -21,9 +21,9 @@ typedef struct VisualDictionary { const char *name; /* Textual name of class. */ - int minLength; /* Minimum # characters that must be specified + unsigned short minLength; /* Minimum # characters that must be specified * for an unambiguous match. */ - int class; /* X symbol for class. */ + short class; /* X symbol for class. */ } VisualDictionary; static const VisualDictionary visualNames[] = { {"best", 1, 0}, @@ -99,7 +99,7 @@ Tk_GetVisual( XVisualInfo template, *visInfoList, *bestPtr; long mask; Visual *visual; - ptrdiff_t length; + size_t length; int c, numVisuals, prio, bestPrio, i; const char *p; const VisualDictionary *dictPtr; @@ -195,8 +195,7 @@ Tk_GetVisual( template.class = -1; for (dictPtr = visualNames; dictPtr->name != NULL; dictPtr++) { if ((dictPtr->name[0] == c) && (length >= dictPtr->minLength) - && (strncmp(string, dictPtr->name, - (size_t) length) == 0)) { + && (strncmp(string, dictPtr->name, length) == 0)) { template.class = dictPtr->class; break; } diff --git a/generic/tkWindow.c b/generic/tkWindow.c index bc57165..d36313b 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -1136,7 +1136,7 @@ Tk_CreateWindowFromPath( char fixedSpace[FIXED_SPACE+1]; char *p; Tk_Window parent; - int numChars; + size_t numChars; /* * Strip the parent's name out of pathName (it's everything up to the last @@ -1153,7 +1153,7 @@ Tk_CreateWindowFromPath( Tcl_SetErrorCode(interp, "TK", "VALUE", "WINDOW_PATH", NULL); return NULL; } - numChars = (int) (p-pathName); + numChars = p-pathName; if (numChars > FIXED_SPACE) { p = ckalloc(numChars + 1); } else { @@ -1163,7 +1163,7 @@ Tk_CreateWindowFromPath( *p = '.'; p[1] = '\0'; } else { - strncpy(p, pathName, (size_t) numChars); + strncpy(p, pathName, numChars); p[numChars] = '\0'; } diff --git a/macosx/tkMacOSXBitmap.c b/macosx/tkMacOSXBitmap.c index 1a20bd5..cf46202 100644 --- a/macosx/tkMacOSXBitmap.c +++ b/macosx/tkMacOSXBitmap.c @@ -210,7 +210,7 @@ OSTypeFromString(const char *s, OSType *t) { Tcl_UtfToExternalDString(encoding, s, -1, &ds); if (Tcl_DStringLength(&ds) <= 4) { char string[4] = {}; - memcpy(string, Tcl_DStringValue(&ds), (size_t) Tcl_DStringLength(&ds)); + memcpy(string, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); *t = (OSType) string[0] << 24 | (OSType) string[1] << 16 | (OSType) string[2] << 8 | (OSType) string[3]; result = TCL_OK; |