From 12c00d26b35bb8d0e08a37c3ab6843ad6884efe5 Mon Sep 17 00:00:00 2001 From: "patthoyts@users.sourceforge.net" Date: Sat, 17 Nov 2007 23:07:45 +0000 Subject: Tidy up some variable types. --- ChangeLog | 4 ++++ generic/tkArgv.c | 6 +++--- generic/tkBind.c | 6 +++--- generic/tkClipboard.c | 8 ++++---- generic/tkEntry.c | 8 +++++--- generic/tkOption.c | 5 +++-- generic/tkScale.c | 4 ++-- generic/tkScrollbar.c | 4 ++-- generic/tkTextImage.c | 4 ++-- generic/tkVisual.c | 5 +++-- generic/tkWindow.c | 4 ++-- 11 files changed, 33 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9b7fe68..8cc54d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2007-11-17 Pat Thoyts + * generic/(tkArgv.c, tkBind.c, tkCipboard.c, tkEntry.c, tkOption.c, + tkScale.c, tkScrollbar.c, tkTextImage.c, tkVisual.c, tkWindow.c): + Tidy up some variable types. + * generic/tkFont.c: Only check for -displayof if there are * test/font.test: sufficient arguments. This permits checking strings like -d. diff --git a/generic/tkArgv.c b/generic/tkArgv.c index 15f032a..ed7b2cd 100644 --- a/generic/tkArgv.c +++ b/generic/tkArgv.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkArgv.c,v 1.9 2007/10/15 07:24:48 das Exp $ + * RCS: @(#) $Id: tkArgv.c,v 1.10 2007/11/17 23:07:45 patthoyts Exp $ */ #include "tkInt.h" @@ -337,7 +337,7 @@ PrintUsage( * for default options. */ { register Tk_ArgvInfo *infoPtr; - int width, i, numSpaces; + size_t width, i, numSpaces; #define NUM_SPACES 20 static char spaces[] = " "; char tmp[TCL_DOUBLE_SPACE]; @@ -351,7 +351,7 @@ PrintUsage( for (i = 0; i < 2; i++) { for (infoPtr = i ? defaultTable : argTable; infoPtr->type != TK_ARGV_END; infoPtr++) { - int length; + size_t length; if (infoPtr->key == NULL) { continue; } diff --git a/generic/tkBind.c b/generic/tkBind.c index d834f0e..542b6b3 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkBind.c,v 1.43 2007/09/07 00:34:51 dgp Exp $ + * RCS: @(#) $Id: tkBind.c,v 1.44 2007/11/17 23:07:45 patthoyts Exp $ */ #include "tkInt.h" @@ -1002,7 +1002,7 @@ Tk_CreateBinding( oldStr = (char *) psPtr->clientData; if ((append != 0) && (oldStr != NULL)) { - int length; + size_t length; length = strlen(oldStr) + strlen(command) + 2; newStr = (char *) ckalloc((unsigned) length); @@ -3935,7 +3935,7 @@ GetVirtualEventUid( char *virtString) { Tk_Uid uid; - int length; + size_t length; length = strlen(virtString); diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c index 0caae15..9dda480 100644 --- a/generic/tkClipboard.c +++ b/generic/tkClipboard.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkClipboard.c,v 1.16 2007/09/07 00:34:52 dgp Exp $ + * RCS: @(#) $Id: tkClipboard.c,v 1.17 2007/11/17 23:07:45 patthoyts Exp $ */ #include "tkInt.h" @@ -61,7 +61,7 @@ ClipboardHandler( TkClipboardTarget *targetPtr = (TkClipboardTarget*) clientData; TkClipboardBuffer *cbPtr; char *srcPtr, *destPtr; - int count = 0; + size_t count = 0; int scanned = 0; size_t length, freeCount; @@ -104,7 +104,7 @@ ClipboardHandler( srcPtr = cbPtr->buffer; length = cbPtr->length; } - return count; + return (int)count; } /* @@ -150,7 +150,7 @@ ClipboardAppHandler( length = maxBytes; } strncpy(buffer, p, length); - return length; + return (int)length; } /* diff --git a/generic/tkEntry.c b/generic/tkEntry.c index ae0500c..30b525b 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkEntry.c,v 1.45 2007/05/24 14:46:24 dkf Exp $ + * RCS: @(#) $Id: tkEntry.c,v 1.46 2007/11/17 23:07:45 patthoyts Exp $ */ #include "tkInt.h" @@ -2008,7 +2008,9 @@ InsertChars( char *value) /* New characters to add (NULL-terminated * string). */ { - int byteIndex, byteCount, oldChars, charsAdded, newByteCount; + ptrdiff_t byteIndex; + size_t byteCount, newByteCount; + int oldChars, charsAdded; CONST char *string; char *newStr; @@ -2021,7 +2023,7 @@ InsertChars( newByteCount = entryPtr->numBytes + byteCount + 1; newStr = (char *) ckalloc((unsigned) newByteCount); - memcpy(newStr, string, (size_t) byteIndex); + memcpy(newStr, string, byteIndex); strcpy(newStr + byteIndex, value); strcpy(newStr + byteIndex + byteCount, string + byteIndex); diff --git a/generic/tkOption.c b/generic/tkOption.c index 254443b..4bb74c8 100644 --- a/generic/tkOption.c +++ b/generic/tkOption.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkOption.c,v 1.22 2007/09/07 00:34:53 dgp Exp $ + * RCS: @(#) $Id: tkOption.c,v 1.23 2007/11/17 23:07:46 patthoyts Exp $ */ #include "tkInt.h" @@ -261,7 +261,8 @@ Tk_AddOption( Element newEl; register CONST char *p; CONST char *field; - int count, firstField, length; + int count, firstField; + ptrdiff_t length; #define TMP_SIZE 100 char tmp[TMP_SIZE+1]; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) diff --git a/generic/tkScale.c b/generic/tkScale.c index 42b88b5..07b4406 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -16,7 +16,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkScale.c,v 1.26 2007/09/07 00:34:53 dgp Exp $ + * RCS: @(#) $Id: tkScale.c,v 1.27 2007/11/17 23:07:46 patthoyts Exp $ */ #include "default.h" @@ -636,7 +636,7 @@ ConfigureScale( ComputeFormat(scalePtr); - scalePtr->labelLength = scalePtr->label ? strlen(scalePtr->label) : 0; + scalePtr->labelLength = scalePtr->label ? (int)strlen(scalePtr->label) : 0; Tk_SetBackgroundFromBorder(scalePtr->tkwin, scalePtr->bgBorder); diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c index 932b6dd..99947cc 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkScrollbar.c,v 1.10 2007/09/08 16:01:20 dkf Exp $ + * RCS: @(#) $Id: tkScrollbar.c,v 1.11 2007/11/17 23:07:46 patthoyts Exp $ */ #include "tkInt.h" @@ -542,7 +542,7 @@ ConfigureScrollbar( */ if (scrollPtr->command != NULL) { - scrollPtr->commandSize = strlen(scrollPtr->command); + scrollPtr->commandSize = (int)strlen(scrollPtr->command); } else { scrollPtr->commandSize = 0; } diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c index 5f08da7..d65abc1 100644 --- a/generic/tkTextImage.c +++ b/generic/tkTextImage.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: tkTextImage.c,v 1.20 2007/09/07 00:34:54 dgp Exp $ + * RCS: @(#) $Id: tkTextImage.c,v 1.21 2007/11/17 23:07:46 patthoyts Exp $ */ #include "tkPort.h" @@ -328,7 +328,7 @@ EmbImageConfigure( char *name; int count = 0; /* The counter for picking a unique name */ int conflict = 0; /* True if we have a name conflict */ - unsigned int len; /* length of image name */ + size_t len; /* length of image name */ if (Tk_SetOptions(textPtr->interp, (char*)&eiPtr->body.ei, eiPtr->body.ei.optionTable, diff --git a/generic/tkVisual.c b/generic/tkVisual.c index 7c79ea2..d34b548 100644 --- a/generic/tkVisual.c +++ b/generic/tkVisual.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkVisual.c,v 1.8 2007/09/07 00:34:54 dgp Exp $ + * RCS: @(#) $Id: tkVisual.c,v 1.9 2007/11/17 23:07:46 patthoyts Exp $ */ #include "tkInt.h" @@ -101,7 +101,8 @@ Tk_GetVisual( XVisualInfo template, *visInfoList, *bestPtr; long mask; Visual *visual; - int length, c, numVisuals, prio, bestPrio, i; + ptrdiff_t length; + int c, numVisuals, prio, bestPrio, i; CONST char *p; VisualDictionary *dictPtr; TkColormap *cmapPtr; diff --git a/generic/tkWindow.c b/generic/tkWindow.c index c2e12f8..872a30b 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWindow.c,v 1.87 2007/10/24 00:16:43 patthoyts Exp $ + * RCS: @(#) $Id: tkWindow.c,v 1.88 2007/11/17 23:07:46 patthoyts Exp $ */ #include "tkInt.h" @@ -744,7 +744,7 @@ NameWindow( char *pathName; int isNew; Tcl_HashEntry *hPtr; - int length1, length2; + size_t length1, length2; /* * Setup all the stuff except name right away, then do the name stuff -- cgit v0.12