Silence warning by Apple Clang 4.2 about adding an integer to a string

It gives a good suggestion on what to do and even shows us how to do
it.

doc.cpp:2681:34: error: adding 'int' to a string does not append to the string [-Werror,-Wstring-plus-int]
            result += "        " + (column % tabSize);
                      ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
doc.cpp:2681:34: note: use array indexing to silence this warning
            result += "        " + (column % tabSize);
                                 ^
                      &          [                   ]

Change-Id: Idd2157ab04cd2a3e37a1336bb5e8926ddc14823a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
This commit is contained in:
Thiago Macieira 2013-03-21 14:26:48 -07:00 committed by The Qt Project
parent fff8b698ab
commit 470f92167f

View File

@ -2678,7 +2678,7 @@ QString DocParser::untabifyEtc(const QString& str)
if (c == QLatin1Char('\r')) if (c == QLatin1Char('\r'))
continue; continue;
if (c == QLatin1Char('\t')) { if (c == QLatin1Char('\t')) {
result += " " + (column % tabSize); result += &" "[column % tabSize];
column = ((column / tabSize) + 1) * tabSize; column = ((column / tabSize) + 1) * tabSize;
continue; continue;
} }