diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-03-22 19:48:53 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-03-22 19:48:53 (GMT) |
commit | 7b333ba9056bfea7a16de7fa67405a0a9279de14 (patch) | |
tree | 0a4370cc83711c52b6ac35ebedf49d6d33afbb86 /generic | |
parent | c7490479ef6383a35d74084f897dc50928a83a97 (diff) | |
download | tcl-7b333ba9056bfea7a16de7fa67405a0a9279de14.zip tcl-7b333ba9056bfea7a16de7fa67405a0a9279de14.tar.gz tcl-7b333ba9056bfea7a16de7fa67405a0a9279de14.tar.bz2 |
Fix [0e8fd6c6d5]: (unsigned)STRING_SIZE(STRING_MAXCHARS) is 0 (and optimize STRING_SIZE a little bit)
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclStringRep.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/generic/tclStringRep.h b/generic/tclStringRep.h index c0adc10..dc33f4b 100644 --- a/generic/tclStringRep.h +++ b/generic/tclStringRep.h @@ -65,9 +65,9 @@ typedef struct String { } String; #define STRING_MAXCHARS \ - (int)(((size_t)UINT_MAX - 1 - TclOffset(String, unicode))/sizeof(Tcl_UniChar)) + (int)(((size_t)UINT_MAX - TclOffset(String, unicode))/sizeof(Tcl_UniChar) - 1) #define STRING_SIZE(numChars) \ - (TclOffset(String, unicode) + (((numChars) + 1U) * sizeof(Tcl_UniChar))) + (TclOffset(String, unicode) + sizeof(Tcl_UniChar) + ((numChars) * sizeof(Tcl_UniChar))) #define stringCheckLimits(numChars) \ do { \ if ((numChars) < 0 || (numChars) > STRING_MAXCHARS) { \ |