Permalink
Browse files

Added clearer range checks for string class to help compiler

  • Loading branch information...
Dimitri van Heesch
Dimitri van Heesch committed Oct 21, 2014
1 parent 963d7c5 commit 869ff34828e20e3ec318384d7b0dbf91b6b2d24d
Showing with 4 additions and 4 deletions.
  1. +4 −4 qtools/qcstring.h
@@ -431,7 +431,7 @@ class QCString
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 @@ class QCString
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 @@ class QCString
{
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);

0 comments on commit 869ff34

Please sign in to comment.