diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-07-06 09:23:09 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-07-06 09:23:09 (GMT) |
| commit | b294401d2f8ccdb83c4f030d41ecab1e4eac11d4 (patch) | |
| tree | b1ac03bf9f3d05e5b9cc99794ede4e2521ef08e6 /generic/tclStringRep.h | |
| parent | d1f3e49057fa7688586babd4b53652f22e479ff6 (diff) | |
| parent | 841ec05ecc0bb62728af6c92deba9d2a5721d5c6 (diff) | |
| download | tcl-b294401d2f8ccdb83c4f030d41ecab1e4eac11d4.zip tcl-b294401d2f8ccdb83c4f030d41ecab1e4eac11d4.tar.gz tcl-b294401d2f8ccdb83c4f030d41ecab1e4eac11d4.tar.bz2 | |
merge novem
Diffstat (limited to 'generic/tclStringRep.h')
| -rw-r--r-- | generic/tclStringRep.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/generic/tclStringRep.h b/generic/tclStringRep.h index a11f25a..66d4578 100644 --- a/generic/tclStringRep.h +++ b/generic/tclStringRep.h @@ -47,15 +47,15 @@ */ typedef struct { - int numChars; /* The number of chars in the string. -1 means - * this value has not been calculated. >= 0 + size_t numChars; /* The number of chars in the string. (size_t)-1 means + * this value has not been calculated. Any other * means that there is a valid Unicode rep, or * that the number of UTF bytes == the number * of chars. */ - int allocated; /* The amount of space actually allocated for + size_t allocated; /* The amount of space actually allocated for * the UTF string (minus 1 byte for the * termination char). */ - int maxChars; /* Max number of chars that can fit in the + size_t 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 \ - (((size_t)UINT_MAX - sizeof(String))/sizeof(Tcl_UniChar)) + ((UINT_MAX - sizeof(String))/sizeof(Tcl_UniChar)) #define STRING_SIZE(numChars) \ (sizeof(String) + ((numChars) * sizeof(Tcl_UniChar))) #define stringCheckLimits(numChars) \ - do { \ - if ((size_t)(numChars) > STRING_MAXCHARS) { \ - Tcl_Panic("max length for a Tcl unicode value (%d chars) exceeded", \ - (int)STRING_MAXCHARS); \ - } \ + do { \ + if ((size_t)(numChars) > STRING_MAXCHARS) { \ + Tcl_Panic("max length for a Tcl unicode value (%" TCL_LL_MODIFIER "d chars) exceeded", \ + (Tcl_WideInt)STRING_MAXCHARS); \ + } \ } while (0) #define stringAttemptAlloc(numChars) \ - (String *) attemptckalloc(STRING_SIZE(numChars) ) + (String *) attemptckalloc(STRING_SIZE(numChars)) #define stringAlloc(numChars) \ - (String *) ckalloc(STRING_SIZE(numChars) ) + (String *) ckalloc(STRING_SIZE(numChars)) #define stringRealloc(ptr, numChars) \ - (String *) ckrealloc((ptr), STRING_SIZE(numChars) ) + (String *) ckrealloc((ptr), STRING_SIZE(numChars)) #define stringAttemptRealloc(ptr, numChars) \ - (String *) attemptckrealloc((ptr), STRING_SIZE(numChars) ) + (String *) attemptckrealloc((ptr), STRING_SIZE(numChars)) #define GET_STRING(objPtr) \ ((String *) (objPtr)->internalRep.twoPtrValue.ptr1) #define SET_STRING(objPtr, stringPtr) \ |
