summaryrefslogtreecommitdiffstats
path: root/tools/configure
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2013-10-09 12:14:01 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-13 09:29:58 +0100
commitb0afad8f0b6a3be7ab3a23e063b0201cd68ada95 (patch)
treef51e7623e623e24c859bcb889885bda078247aeb /tools/configure
parentc0b899b3df328f9957bea404f351b492ecfefe31 (diff)
Implement support for ref-qualified QString::toLatin1 & friends
This is the first step in implementing an in-place conversion of QString to QByteArray. This requires ref-qualifiers in member functions so we know that we have an rvalue QString. Converting from UTF-16 to Latin1 always requires half the memory. For conversion from UTF-16 to UTF-8, the typical string will also need the same memory or less: characters from U+0000 to U+007F consume one fewer byte; characters from U+0080 to U+07FF and from U+10000 to U+1FFFFF occupy the same space in UTF-8 and UTF-16; it's only the ones from U+0800 to U+FFFF that consume more space in the UTF-8 string. For the locale's 8-bit codec, we can't be sure and the code (currently) needs to go through QTextCodec anyway. This requires a #define set before #include'ing "qstring.h". However, since qstring.h is included by the QtCore PCH, we need an extra qmake compiler without the PCH flags to compile this .cpp. After this change, the distribution of calls in QtCore, Network, Gui, and Widgets is as follows: const & && toUtf8 31 (74%) 11 (26%) toLatin1 79 (77%) 24 (23%) toLocal8Bit 26 (16%) 138 (84%) Change-Id: Idd96f9ddb51b989bc59f6da50054dd10c953dd4f Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'tools/configure')
-rw-r--r--tools/configure/Makefile.mingw1
-rw-r--r--tools/configure/Makefile.win321
-rw-r--r--tools/configure/configure.pro1
3 files changed, 3 insertions, 0 deletions
diff --git a/tools/configure/Makefile.mingw b/tools/configure/Makefile.mingw
index 1994c9a52b..11bfbe562a 100644
--- a/tools/configure/Makefile.mingw
+++ b/tools/configure/Makefile.mingw
@@ -60,6 +60,7 @@ OBJECTS = \
qmap.o \
qregexp.o \
qstring.o \
+ qstring_compat.o \
qstringlist.o \
qvsnprintf.o \
qvariant.o \
diff --git a/tools/configure/Makefile.win32 b/tools/configure/Makefile.win32
index 17c2d1089c..272b86c2d4 100644
--- a/tools/configure/Makefile.win32
+++ b/tools/configure/Makefile.win32
@@ -58,6 +58,7 @@ OBJECTS = \
qmap.obj \
qregexp.obj \
qstring.obj \
+ qstring_compat.obj \
qstringlist.obj \
qvsnprintf.obj \
qvariant.obj \
diff --git a/tools/configure/configure.pro b/tools/configure/configure.pro
index 2163e37a58..215a137adf 100644
--- a/tools/configure/configure.pro
+++ b/tools/configure/configure.pro
@@ -119,6 +119,7 @@ SOURCES = main.cpp configureapp.cpp environment.cpp tools.cpp \
$$QT_SOURCE_TREE/src/corelib/tools/qmap.cpp \
$$QT_SOURCE_TREE/src/corelib/tools/qregexp.cpp \
$$QT_SOURCE_TREE/src/corelib/tools/qstring.cpp \
+ $$QT_SOURCE_TREE/src/corelib/tools/qstring_compat.cpp \
$$QT_SOURCE_TREE/src/corelib/tools/qstringlist.cpp \
$$QT_SOURCE_TREE/src/corelib/tools/qvsnprintf.cpp \
$$QT_SOURCE_TREE/src/corelib/kernel/qvariant.cpp \