diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-11-16 13:50:32 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-11-16 13:50:32 (GMT) |
| commit | fd3fbe8801d5ad9b3e3653e77d83149f1e8d09d6 (patch) | |
| tree | 498355f045bba404552983c2aa3b9f5b47bc87ec /generic/tclStringRep.h | |
| parent | 5534478fa10a116663a3b05f32a119bb07aa9ed2 (diff) | |
| download | tcl-fd3fbe8801d5ad9b3e3653e77d83149f1e8d09d6.zip tcl-fd3fbe8801d5ad9b3e3653e77d83149f1e8d09d6.tar.gz tcl-fd3fbe8801d5ad9b3e3653e77d83149f1e8d09d6.tar.bz2 | |
Handle Tcl_UtfAtIndex/Tcl_UniCharAtIndex for extended index range. More field fixes.
Diffstat (limited to 'generic/tclStringRep.h')
| -rw-r--r-- | generic/tclStringRep.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/generic/tclStringRep.h b/generic/tclStringRep.h index b4125c1..0ee1a14 100644 --- a/generic/tclStringRep.h +++ b/generic/tclStringRep.h @@ -48,7 +48,7 @@ typedef struct { size_t numChars; /* The number of chars in the string. (size_t)-1 means - * this value has not been calculated. >= 0 + * 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. */ @@ -65,14 +65,14 @@ typedef struct { } String; #define STRING_MAXCHARS \ - (int)(((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 ((numChars) < 0 || (numChars) > STRING_MAXCHARS) { \ - Tcl_Panic("max length for a Tcl unicode value (%d chars) exceeded", \ - (int)STRING_MAXCHARS); \ + 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) \ |
