diff options
author | dgp <dgp@users.sourceforge.net> | 2009-02-19 14:55:55 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2009-02-19 14:55:55 (GMT) |
commit | 0c058bc1950888b1d4c5744c7f4a26698ff3606b (patch) | |
tree | a81e5d2ee9eee47522db70c8ca8c021303584e23 | |
parent | 59207d524457ce50296ceb2e91eba66bc0e1f4ec (diff) | |
download | tcl-0c058bc1950888b1d4c5744c7f4a26698ff3606b.zip tcl-0c058bc1950888b1d4c5744c7f4a26698ff3606b.tar.gz tcl-0c058bc1950888b1d4c5744c7f4a26698ff3606b.tar.bz2 |
alternative solution to the signed/unsigned warnings
-rw-r--r-- | generic/tclStringObj.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index eb11b43..23f98e0 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -33,7 +33,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStringObj.c,v 1.119 2009/02/19 06:35:01 das Exp $ */ + * RCS: @(#) $Id: tclStringObj.c,v 1.120 2009/02/19 14:55:55 dgp Exp $ */ #include "tclInt.h" #include "tommath.h" @@ -115,11 +115,11 @@ typedef struct String { } String; #define STRING_MAXCHARS \ - (((size_t)UINT_MAX - sizeof(String))/sizeof(Tcl_UniChar)) + (int)(((size_t)UINT_MAX - sizeof(String))/sizeof(Tcl_UniChar)) #define STRING_SIZE(numChars) \ (sizeof(String) + ((numChars) * sizeof(Tcl_UniChar))) #define stringCheckLimits(numChars) \ - if ((numChars) < 0 || (size_t)(numChars) > STRING_MAXCHARS) { \ + if ((numChars) < 0 || (numChars) > STRING_MAXCHARS) { \ Tcl_Panic("max length for a Tcl unicode value (%d chars) exceeded", \ STRING_MAXCHARS); \ } @@ -246,7 +246,7 @@ GrowUnicodeBuffer( if (stringPtr->maxChars > 0) { /* Subsequent appends - apply the growth algorithm. */ attempt = 2 * needed; - if (attempt >= 0 && (size_t)attempt <= STRING_MAXCHARS) { + if (attempt >= 0 && attempt <= STRING_MAXCHARS) { ptr = stringAttemptRealloc(stringPtr, attempt); } if (ptr == NULL) { @@ -947,7 +947,7 @@ Tcl_AttemptSetObjLength( * Changing length of pure unicode string. */ - if ((size_t)length > STRING_MAXCHARS) { + if (length > STRING_MAXCHARS) { return 0; } if (length > stringPtr->maxChars) { |