diff options
| author | kjnash <k.j.nash@usa.net> | 2022-08-31 16:19:00 (GMT) |
|---|---|---|
| committer | kjnash <k.j.nash@usa.net> | 2022-08-31 16:19:00 (GMT) |
| commit | bca70ca3acaed162e49bc7616b7da4001c7fee41 (patch) | |
| tree | e7f53f796bd576d7231fed8db0aa533ae65f59b6 /generic/tclStringRep.h | |
| parent | 7e2bd5e5052a3fa8f5ee01c05e56fadf4cdfc592 (diff) | |
| parent | 6cf74d1492b68e11b5a4cccf559ec5f69836b67b (diff) | |
| download | tcl-bca70ca3acaed162e49bc7616b7da4001c7fee41.zip tcl-bca70ca3acaed162e49bc7616b7da4001c7fee41.tar.gz tcl-bca70ca3acaed162e49bc7616b7da4001c7fee41.tar.bz2 | |
Merge 8.7
Diffstat (limited to 'generic/tclStringRep.h')
| -rw-r--r-- | generic/tclStringRep.h | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/generic/tclStringRep.h b/generic/tclStringRep.h index e01ba2d..faa2c2c 100644 --- a/generic/tclStringRep.h +++ b/generic/tclStringRep.h @@ -39,11 +39,6 @@ * Unicode reps of the String object with fewer mallocs. To optimize string * length and indexing operations, this structure also stores the number of * characters (same of UTF and Unicode!) once that value has been computed. - * - * Under normal configurations, what Tcl calls "Unicode" is actually UTF-16 - * restricted to the Basic Multilingual Plane (i.e. U+00000 to U+0FFFF). This - * can be officially modified by altering the definition of Tcl_UniChar in - * tcl.h, but do not do that unless you are sure what you're doing! */ typedef struct { @@ -59,20 +54,20 @@ typedef struct { * space allocated for the unicode array. */ int hasUnicode; /* Boolean determining whether the string has * a Unicode representation. */ - Tcl_UniChar unicode[TCLFLEXARRAY]; /* The array of Unicode chars. The actual size + unsigned short unicode[TCLFLEXARRAY]; /* The array of Unicode chars. The actual size * of this field depends on the 'maxChars' * field above. */ } String; #define STRING_MAXCHARS \ - (int)(((size_t)UINT_MAX - 1 - offsetof(String, unicode))/sizeof(Tcl_UniChar)) + (int)(((size_t)UINT_MAX - offsetof(String, unicode))/sizeof(unsigned short) - 1) #define STRING_SIZE(numChars) \ - (offsetof(String, unicode) + ((numChars + 1) * sizeof(Tcl_UniChar))) + (offsetof(String, unicode) + sizeof(unsigned short) + ((numChars) * sizeof(unsigned short))) #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); \ + STRING_MAXCHARS); \ } \ } while (0) #define stringAttemptAlloc(numChars) \ |
