diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2014-10-21 20:08:12 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2014-10-21 20:08:12 (GMT) |
commit | 869ff34828e20e3ec318384d7b0dbf91b6b2d24d (patch) | |
tree | 7c70c0fd96db5ca9576f3d8dfbc352875a03b5da /qtools/qcstring.h | |
parent | 963d7c52de53ace46869e2954fe18f50e28e336b (diff) | |
download | Doxygen-869ff34828e20e3ec318384d7b0dbf91b6b2d24d.zip Doxygen-869ff34828e20e3ec318384d7b0dbf91b6b2d24d.tar.gz Doxygen-869ff34828e20e3ec318384d7b0dbf91b6b2d24d.tar.bz2 |
Added clearer range checks for string class to help compiler
Diffstat (limited to 'qtools/qcstring.h')
-rw-r--r-- | qtools/qcstring.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/qtools/qcstring.h b/qtools/qcstring.h index 5c3a0de..8acd9ff 100644 --- a/qtools/qcstring.h +++ b/qtools/qcstring.h @@ -431,7 +431,7 @@ public: StringRep(int size) { u.s.isShort = size<=SHORT_STR_CAPACITY; - if (u.s.isShort) // init short string + if (size<=SHORT_STR_CAPACITY) // init short string { if (size>0) { @@ -453,8 +453,8 @@ public: if (str) { int len = strlen(str); - u.s.isShort = len<=SHORT_STR_MAX_LEN; - if (u.s.isShort) + u.s.isShort = len<SHORT_STR_CAPACITY; + if (len<SHORT_STR_CAPACITY) { u.s.len = len; memcpy(u.s.str,str,len+1); @@ -527,7 +527,7 @@ public: { int len = strlen(str); u.s.isShort = len<=SHORT_STR_MAX_LEN; - if (u.s.isShort) + if (len<SHORT_STR_CAPACITY) { u.s.len = len; memcpy(u.s.str,str,len+1); |