src/corelib/tools/qstring.cpp
branchRCL_3
changeset 5 d3bac044e0f0
parent 4 3b1da2848fc7
child 8 3f74d0d4af4c
--- a/src/corelib/tools/qstring.cpp	Fri Feb 19 23:40:16 2010 +0200
+++ b/src/corelib/tools/qstring.cpp	Fri Mar 12 15:46:37 2010 +0200
@@ -885,7 +885,7 @@
 QString QString::fromWCharArray(const wchar_t *string, int size)
 {
     if (sizeof(wchar_t) == sizeof(QChar)) {
-        return fromUtf16((ushort *)string, size);
+        return fromUtf16((const ushort *)string, size);
     } else {
         return fromUcs4((uint *)string, size);
     }
@@ -3857,6 +3857,12 @@
     If \a size is -1 (default), \a unicode must be terminated
     with a 0.
 
+    This function checks for a Byte Order Mark (BOM). If it is missing,
+    host byte order is assumed.
+
+    This function is comparatively slow.
+    Use QString(const ushort *, int) if possible.
+
     QString makes a deep copy of the Unicode data.
 
     \sa utf16(), setUtf16()
@@ -3923,6 +3929,9 @@
     If \a unicode is 0, nothing is copied, but the string is still
     resized to \a size.
 
+    Note that unlike fromUtf16(), this function does not consider BOMs and
+    possibly differing byte ordering.
+
     \sa utf16(), setUnicode()
 */
 
@@ -4669,6 +4678,8 @@
     Returns the QString as a '\\0\'-terminated array of unsigned
     shorts. The result remains valid until the string is modified.
 
+    The returned string is in host byte order.
+
     \sa unicode()
 */
 
@@ -7740,7 +7751,7 @@
         return QString();
     if (m_size && m_position == 0 && m_size == m_string->size())
         return *m_string;
-    return QString::fromUtf16(reinterpret_cast<const ushort*>(m_string->unicode() + m_position), m_size);
+    return QString(m_string->unicode() + m_position, m_size);
 }