diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2014-02-04 16:02:06 -0800 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2014-07-31 18:51:40 +0200 |
commit | 7f9398fd4d23469c77c6a53eac0819f92dfc3928 (patch) | |
tree | a4199487316639bda5b49b981cc99e21b6aeb9ab /src/corelib/tools/qbytearray.cpp | |
parent | 571f52920bce5e62e9d4ae67dc605839c81c4136 (diff) |
Add ascii_isspace to replace the locale-dependent isspace(3)
Change-Id: Icee42515179e6f3ddefe0692af69e90054449618
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/corelib/tools/qbytearray.cpp')
-rw-r--r-- | src/corelib/tools/qbytearray.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index d57eeaf188..10fc3dea2d 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -3113,7 +3113,7 @@ QDataStream &operator>>(QDataStream &in, QByteArray &ba) replaced with a single space. Whitespace means any character for which the standard C++ - isspace() function returns \c true. This includes the ASCII + isspace() function returns \c true in the C locale. This includes the ASCII characters '\\t', '\\n', '\\v', '\\f', '\\r', and ' '. Example: @@ -3131,9 +3131,9 @@ QByteArray QByteArray::simplified() const int outc=0; char *to = result.d->data(); for (;;) { - while (from!=fromend && isspace(uchar(*from))) + while (from!=fromend && ascii_isspace(uchar(*from))) from++; - while (from!=fromend && !isspace(uchar(*from))) + while (from!=fromend && !ascii_isspace(uchar(*from))) to[outc++] = *from++; if (from!=fromend) to[outc++] = ' '; @@ -3151,7 +3151,7 @@ QByteArray QByteArray::simplified() const and the end. Whitespace means any character for which the standard C++ - isspace() function returns \c true. This includes the ASCII + isspace() function returns \c true in the C locale. This includes the ASCII characters '\\t', '\\n', '\\v', '\\f', '\\r', and ' '. Example: @@ -3166,14 +3166,14 @@ QByteArray QByteArray::trimmed() const if (d->size == 0) return *this; const char *s = d->data(); - if (!isspace(uchar(*s)) && !isspace(uchar(s[d->size-1]))) + if (!ascii_isspace(uchar(*s)) && !ascii_isspace(uchar(s[d->size-1]))) return *this; int start = 0; int end = d->size - 1; - while (start<=end && isspace(uchar(s[start]))) // skip white space from start + while (start<=end && ascii_isspace(uchar(s[start]))) // skip white space from start start++; if (start <= end) { // only white space - while (end && isspace(uchar(s[end]))) // skip white space from end + while (end && ascii_isspace(uchar(s[end]))) // skip white space from end end--; } int l = end - start + 1; |