From 869ff34828e20e3ec318384d7b0dbf91b6b2d24d Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Tue, 21 Oct 2014 22:08:12 +0200 Subject: Added clearer range checks for string class to help compiler --- qtools/qcstring.h | 8 ++++---- 1 file 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