Skip to content

Commit

Permalink
fixed GH #1425: Workaround bug in SolarisStudio 12.4 on RVO-ed objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
obiltschnig committed Nov 8, 2017
1 parent 18a70a4 commit f4530b0
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions Foundation/include/Poco/String.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ S trimLeft(const S& str)
{
typename S::const_iterator it = str.begin();
typename S::const_iterator end = str.end();

while (it != end && Ascii::isSpace(*it)) ++it;
return S(it, end);
}
Expand All @@ -46,7 +46,7 @@ S& trimLeftInPlace(S& str)
{
typename S::iterator it = str.begin();
typename S::iterator end = str.end();

while (it != end && Ascii::isSpace(*it)) ++it;
str.erase(str.begin(), it);
return str;
Expand All @@ -59,7 +59,7 @@ S trimRight(const S& str)
/// whitespace removed.
{
int pos = int(str.size()) - 1;

while (pos >= 0 && Ascii::isSpace(str[pos])) --pos;
return S(str, 0, pos + 1);
}
Expand All @@ -70,7 +70,7 @@ S& trimRightInPlace(S& str)
/// Removes all trailing whitespace in str.
{
int pos = int(str.size()) - 1;

while (pos >= 0 && Ascii::isSpace(str[pos])) --pos;
str.resize(pos + 1);

Expand All @@ -85,7 +85,7 @@ S trim(const S& str)
{
int first = 0;
int last = int(str.size()) - 1;

while (first <= last && Ascii::isSpace(str[first])) ++first;
while (last >= first && Ascii::isSpace(str[last])) --last;

Expand All @@ -99,7 +99,7 @@ S& trimInPlace(S& str)
{
int first = 0;
int last = int(str.size()) - 1;

while (first <= last && Ascii::isSpace(str[first])) ++first;
while (last >= first && Ascii::isSpace(str[last])) --last;

Expand Down Expand Up @@ -215,7 +215,7 @@ int icompare(const S& str1, const S& str2)
return 1;
++it1; ++it2;
}

if (it1 == end1)
return it2 == end2 ? 0 : -1;
else
Expand Down Expand Up @@ -300,7 +300,7 @@ int icompare(
return 1;
++it; ++ptr;
}

if (it == end)
return *ptr == 0 ? 0 : -1;
else
Expand Down Expand Up @@ -403,9 +403,9 @@ S translateInPlace(S& str, const typename S::value_type* from, const typename S:
poco_check_ptr (to);
str = translate(str, S(from), S(to));
#if defined(__SUNPRO_CC)
// Fix around the RVO bug in SunStudio 12.4
S ret(str);
return ret;
// Fix around the RVO bug in SunStudio 12.4
S ret(str);
return ret;
#else
return str;
#endif
Expand All @@ -419,7 +419,7 @@ template <class S>
S& replaceInPlace(S& str, const S& from, const S& to, typename S::size_type start = 0)
{
poco_assert (from.size() > 0);

S result;
typename S::size_type pos = 0;
result.append(str, 0, start);
Expand Down Expand Up @@ -666,7 +666,7 @@ struct i_char_traits : public std::char_traits<charT>
return Ascii::toLower(c1) < Ascii::toLower(c2);
}

static int compare(const charT* s1, const charT* s2, size_t n)
static int compare(const charT* s1, const charT* s2, std::size_t n)
{
for (int i = 0; i < n && s1 && s2; ++i, ++s1, ++s2)
{
Expand Down

0 comments on commit f4530b0

Please sign in to comment.