diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-06-30 12:18:03 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-06-30 12:18:03 (GMT) |
| commit | 4139aa785c96f443c893c26e9d98fe3fa557d3ff (patch) | |
| tree | 680ac3a43054ead9661f4bfd0d71582be87482d6 /generic/tclStringRep.h | |
| parent | 99a50b95e536053fe9adf6898ab92e00956e5744 (diff) | |
| download | tcl-4139aa785c96f443c893c26e9d98fe3fa557d3ff.zip tcl-4139aa785c96f443c893c26e9d98fe3fa557d3ff.tar.gz tcl-4139aa785c96f443c893c26e9d98fe3fa557d3ff.tar.bz2 | |
Make test-cases pass again
Diffstat (limited to 'generic/tclStringRep.h')
| -rw-r--r-- | generic/tclStringRep.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/generic/tclStringRep.h b/generic/tclStringRep.h index d71eefa..a11f25a 100644 --- a/generic/tclStringRep.h +++ b/generic/tclStringRep.h @@ -47,15 +47,15 @@ */ typedef struct { - size_t numChars; /* The number of chars in the string. -1 means + int numChars; /* The number of chars in the string. -1 means * this value has not been calculated. >= 0 * means that there is a valid Unicode rep, or * that the number of UTF bytes == the number * of chars. */ - size_t allocated; /* The amount of space actually allocated for + int allocated; /* The amount of space actually allocated for * the UTF string (minus 1 byte for the * termination char). */ - size_t maxChars; /* Max number of chars that can fit in the + int maxChars; /* Max number of chars that can fit in the * space allocated for the unicode array. */ int hasUnicode; /* Boolean determining whether the string has * a Unicode representation. */ @@ -65,24 +65,24 @@ typedef struct { } String; #define STRING_MAXCHARS \ - (int)(((size_t)UINT_MAX - sizeof(String))/sizeof(Tcl_UniChar)) + (((size_t)UINT_MAX - sizeof(String))/sizeof(Tcl_UniChar)) #define STRING_SIZE(numChars) \ (sizeof(String) + ((numChars) * sizeof(Tcl_UniChar))) #define stringCheckLimits(numChars) \ - do { \ - if ((numChars) < 0 || (numChars) > STRING_MAXCHARS) { \ + do { \ + if ((size_t)(numChars) > STRING_MAXCHARS) { \ Tcl_Panic("max length for a Tcl unicode value (%d chars) exceeded", \ - STRING_MAXCHARS); \ - } \ + (int)STRING_MAXCHARS); \ + } \ } while (0) #define stringAttemptAlloc(numChars) \ - (String *) attemptckalloc((unsigned) STRING_SIZE(numChars)) + (String *) attemptckalloc(STRING_SIZE(numChars) ) #define stringAlloc(numChars) \ - (String *) ckalloc((unsigned) STRING_SIZE(numChars)) + (String *) ckalloc(STRING_SIZE(numChars) ) #define stringRealloc(ptr, numChars) \ - (String *) ckrealloc((ptr), (unsigned) STRING_SIZE(numChars)) + (String *) ckrealloc((ptr), STRING_SIZE(numChars) ) #define stringAttemptRealloc(ptr, numChars) \ - (String *) attemptckrealloc((ptr), (unsigned) STRING_SIZE(numChars)) + (String *) attemptckrealloc((ptr), STRING_SIZE(numChars) ) #define GET_STRING(objPtr) \ ((String *) (objPtr)->internalRep.twoPtrValue.ptr1) #define SET_STRING(objPtr, stringPtr) \ |
