summaryrefslogtreecommitdiffstats
path: root/src/corelib
Commit message (Collapse)AuthorAgeFilesLines
* Mark QAtomic* implicit cast and other operators as deprecatedBradley T. Hughes2011-10-281-0/+13
| | | | | | | | | | | | Add Q_DECL_DEPRECATED to all methods that are pending removal once http://codereview.qt-project.org/#change,6243 is merged. This is necessary to give people time to react to the source incompatible change. Change-Id: Ia72f184d630d593f96dd1d95ad6cd0d3bd5d811c Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace implicit QAtomic* casts with explicit load()/store()Bradley T. Hughes2011-10-2718-56/+55
| | | | | Change-Id: Ia7ef1a8e01001f203e409c710c977d6f4686342e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix compiler warnings.Friedemann Kleint2011-10-273-4/+4
| | | | | | | | - Fix gcc 4.6.X warnings about assigned but unused variables - Remove trailing ';' from inline functions (Clang) Change-Id: I8670afd6b149748a740f22c65de137762e9f18e1 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Use load() instead of implicit cast when using QueuedConnectionBradley T. Hughes2011-10-271-12/+15
| | | | | | | | | | | queued_activate() sets the argumentTypes atomic pointer on first use, which mixes a load, memory initialization, test-and-set-ordered, and another load. The explicit memory ordering is necessary to ensure that the memory stores happen in program order. Change-Id: Id1f8641f9cd081ce81aa8e830692f7af8261e84b Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Move the implementation of normalizeTypeInternal()Bradley T. Hughes2011-10-274-152/+211
| | | | | | | | | | | | | | | | | | | | | This function is only used in src/tools/moc/moc.cpp and src/corelib/kernel/qmetaobject.cpp. We don't need to include the static, non-inline declaration and definition every time qmetaobject_p.h is included. This also silences the related warning from clang: ../../../include/QtCore/5.0.0/QtCore/private/../../../../../src/corelib/kernel/qmetaobject_p.h:171:19: error: function 'normalizeTypeInternal' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration] static QByteArray normalizeTypeInternal(const char *t, const char *e, ... ^ Change-Id: I6dfb2cb4d9d82a2ae7795f91169aa62f9a5f2c2f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Add QDataStream operators to QMargins, so it can be streamedSteven Ceuppens2011-10-272-0/+49
| | | | | | | | | | * QDataStream format documented * Added Unit test for QDataStream operators * Updated Unit test Change-Id: Idbcfcb0b927e6369e8d31b57693c7aa0d1a154e7 Reviewed-by: Olivier Goffart <ogoffart@kde.org>
* Use load() when constructing QSimpleCodec's reverse mapBradley T. Hughes2011-10-271-7/+10
| | | | | | | | | | The implicit casting results in unnecessary volatile loads. The test-and-set-ordered doesn't need full ordering, test-and-set-release is enough to ensure that the memory initialization done by buildReverseMap() and test-and-set happen in program order. Change-Id: I168b504271aeba050d6b8396becbdeb3ef938213 Reviewed-by: Olivier Goffart <ogoffart@kde.org>
* Unix (non-Glib) event dispatcher: round sleep to millisecond boundary.Thiago Macieira2011-10-271-1/+15
| | | | | | | | | | | | If we have two timers running in an application with the same timeout and started almost at the same time by the code, they would trigger two sleeps, the second of which very short (under a millisecond). This causes us to match the Glib and Windows event loops, which round all timers to millisecond anyway. Change-Id: I7eb531e02dadf75925c01192b0f33ef3641ae1ea Reviewed-by: Olivier Goffart <ogoffart@kde.org>
* replace 'const QChar &' with 'QChar ' for QChar and QStringRitt Konstantin2011-10-265-50/+50
| | | | | | | | Merge-request: 69 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Change-Id: I61f5a54b783252029fcad95677958fa6a2130d01 Reviewed-by: Olivier Goffart <ogoffart@kde.org>
* Revert "Use memmove in QListData::append(int) as regions overlap."Oswald Buddenhagen2011-10-261-1/+1
| | | | | | | | | | We have proven that the regions cannot overlap. The root problem must be somewhere else. This reverts commit d96b7b809e614dd416709acec768529457120b9f. Change-Id: I3446487f2a1a5bd322379b8adb788c26ff3e08e2 Reviewed-by: Thiago Macieira (Intel) <thiago.macieira@intel.com>
* Silence warning from clangBradley T. Hughes2011-10-251-2/+2
| | | | | | | | | | | | | | | ../../corelib/tools/qlocale_mac.mm:78:13: warning: '&&' within '||' [-Wlogical-op-parentheses] ...&& !qt_splitLocaleName(QString::fromLocal8Bit(result), lang, script, cntry)... ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../corelib/tools/qlocale_mac.mm:78:13: note: place parentheses around the '&&' expression to silence this warning && !qt_splitLocaleName(QString::fromLocal8Bit(result), ... ^ Change-Id: I64f745e7dfa64f28f264667372ed64f9e34ca3b7 Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Thiago Macieira (Intel) <thiago.macieira@intel.com>
* Compile with clangBradley T. Hughes2011-10-241-5/+6
| | | | | | | | | | | | | | | | | | Clang does not accept this syntax, see http://llvm.org/bugs/show_bug.cgi?id=8875 The work around is to not use the typedef name. NS() around the template parameters is necessary to match the real types (and not the QMetaType::Type enumerators), otherwise we get the following: kernel/qmetatype.cpp:1647:72: error: template argument for template type parameter must be a type ...NS(QVariantMap)* >(where)->NS(QVariantMap)::~QMap<QString, ... ^~~~~~~ Change-Id: I3afa0cbbe4ef7ad899cfa9eafb3bcc10bedc20b3 Reviewed-by: Wolf-Michael Bolle <wolf-michael.bolle@nokia.com> Reviewed-by: Thiago Macieira (Intel) <thiago.macieira@intel.com>
* QIODevice - disallow setTextMode when not openShane Kearns2011-10-241-0/+6
| | | | | | | | | | | Calling setTextMode() before open() would make the device appear to be already open and cause later errors. Added a qWarning and documentation update to prevent this API misuse Task-number: QTBUG-20905 Change-Id: I2e06cd8e79f4afcf27417ac0eae6ebef980a17aa Reviewed-by: Thiago Macieira (Intel) <thiago.macieira@intel.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* corelib: Remove Q_WS-macros.Friedemann Kleint2011-10-2424-250/+44
| | | | | | | | | | | | | | | | | | | | Q_WS_QPA is the only active code path after merging refactor, other Q_WS-macros are no longer used. Enable compilation without -qpa. - Remove Q_OS_MSDOS, Q_OS_OS2 - Remove Q_WS_QWS - Remove/replace definitions/conditionals of Q_WS_XX - Remove qpa branches from profiles - Replace Q_WS_MAC by Q_OS_MAC - Replace Q_WS_MAC && !Q_WS_QPA by Q_OS_MAC && !QT_NO_CORESERVICES - Similarly in profiles: mac:contains(QT_CONFIG, coreservices) - Replace Q_FS_FAT by Q_OS_WIN Change-Id: Icce5a6c55b052c8f72b3b979ddf31a4f388ea9c9 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Rename storageLocation() to writableLocation().David Faure2011-10-235-13/+13
| | | | | Change-Id: I8f6522a70950f78ddd6141360d36d104bd697e28 Reviewed-by: Thiago Macieira (Intel) <thiago.macieira@intel.com>
* Add QStandardPaths::RuntimeLocation, for sockets ($XDG_RUNTIME_DIR)David Faure2011-10-235-7/+42
| | | | | Change-Id: I19c36a04a9deae49ffc20fdec6a2a7eb05155cb4 Reviewed-by: Thiago Macieira (Intel) <thiago.macieira@intel.com>
* Add QStandardPaths::findExecutable.David Faure2011-10-233-14/+92
| | | | | Change-Id: If30a83622e2ac5af48e47a38b8f70fce73044d74 Reviewed-by: Thiago Macieira (Intel) <thiago.macieira@intel.com>
* QStandardPaths: add Config and GenericData, add methodsDavid Faure2011-10-235-74/+297
| | | | | | | New methods: standardLocations, locate, locateAll. Change-Id: I60bc90f8df53727a72c4b1839ea4d1d88a204e29 Reviewed-by: Thiago Macieira (Intel) <thiago.macieira@intel.com>
* Move path information from QDesktopServices (gui) to QStandardPaths (core)David Faure2011-10-236-0/+688
| | | | | Change-Id: Ic596c21894d83b4dab0c3f5b1aed916ddd590f2f Reviewed-by: Thiago Macieira (Intel) <thiago.macieira@intel.com>
* Fix two typos: docu for "deprecated since" and Q_DEPR... -> QT_DEPR...David Faure2011-10-221-1/+1
| | | | | | | | Shows that there should be an automated build with QT_DISABLE_DEPRECATED_BEFORE set to 0, too... Change-Id: If154786ea26bcbfab41efcd7001c222cc258a8af Reviewed-by: Olivier Goffart <ogoffart@kde.org>
* Compile with clangBradley T. Hughes2011-10-221-2/+2
| | | | | | | | | | When using methods from a template base class, the lookup needs to be qualified. See http://clang.llvm.org/compatibility.html#dep_lookup_bases Change-Id: I5b7cd71e0d45414ac0eff97fe9ba5d3ccd5bd9e6 Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Thiago Macieira (Intel) <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart <ogoffart@kde.org>
* Add Q_DECL_CONSTEXPR to a QChar, QLatin1Char and QLatin1String constructorsThiago Macieira2011-10-222-26/+19
| | | | | | | | These types now technically are trivially-constructible and standard-layout in C++0x. Change-Id: I455bd905fd6e237a1dff517b86dcbe59d571266f Reviewed-by: Olivier Goffart <ogoffart@kde.org>
* Off-by-one error in assert condition...João Abecasis2011-10-211-1/+1
| | | | | | | | | | | While this was safe, it was also over-zealous, disallowing the path from ending with the placeholder... Incidentally, the default. Laughed-at-by: w00t_ (cherry picked from commit 7b693627ee2a17718cb6d8bee5e3deb5a97b307f) Change-Id: I61a1511bca5cafe2edde20ef38c23154200dfcab Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Leftovers from 401722ef9e6fe79bd41f9d5f79668f5c4997c8e6João Abecasis2011-10-211-14/+0
| | | | | | | | | | | This no longer necessary template specialization went unnoticed inside the Windows/Symbian #ifdef. It breaks compilation on those platforms, now that qstringbuilder.h is not included and QConcatenable is unknown to the compiler. (cherry picked from commit 9e656ce0f7bda4bca4ae55a7aefe1617bc2805ac) Change-Id: Ie7145c25bca01b808fa6a3fd99e34baa8375d304 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Fix QTemporaryFile regressions and new found issuesJoão Abecasis2011-10-211-50/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | With this change, the file template is always processed in original QString format. Trying to generate native paths before adding a missing placeholder mask could change the meaning of templates, such as "." and "..", which are now tested to mean "..XXXXXX" and "...XXXXXX", respectively. After ensuring the template includes a placeholder mask, the path is converted to a native *absolute* file path and the mask is sought for again. On Windows, native paths were already absolute. On Symbian, we'd need at least a clean path, as "." and ",," are not natively understood. There is a requirement that the placeholder mask /XXXXXX+/ makes it through this conversion unaltered, which relaxes prior requirements on *nix platforms. On Windows and Symbian the conversion is under Qt's control and not user-configurable. Reviewed-by: Shane Kearns (cherry picked from commit 401722ef9e6fe79bd41f9d5f79668f5c4997c8e6) Conflicts: tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp Change-Id: Iac823881c865adf0931dc4f429c6c1ef135eeb56 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Use "native paths" on POSIX platforms as wellJoão Abecasis2011-10-211-27/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | And don't rely solely on "local8Bit" conversions. QFile defines an API for overriding how encoding conversions are done for filenames. In generating unique names, QTemporaryFile ignored that API and hardcoded the use of local 8-bit, implicitly assuming that that was appropriate. With this change, we switch that assumption to one where user supplied encoding function keeps the byte value of 'X' and '/', also assuming that encoded 'X' takes up a single-byte (i.e., the byte sequence for "XXXXXX" remains unchanged). There was also, and there still is an assumption in name generation that byte values for ASCII alpha-numeric characters are valid in the "native" encoding. In practice this change is compatible with UTF-8, Latin-1 and other ISO/IEC 8859 encodings. At any rate, it's very likely that only UTF-8 is relevant here. Reviewed-by: Denis Dzyubenko (cherry picked from commit 0de701d01cb221464eed773fd3751aff73fe4d60) Change-Id: I9ee0fe8e3cad48694d5ec9a2bedd5412cfc0d172 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Cleanup #includesJoão Abecasis2011-10-211-2/+0
| | | | | | | | These are already required and included by qfsfileengine_p.h. (cherry picked from commit a153d50eea2dea0925695a90af2c12f1887a9020) Change-Id: I9efb635373239f6e6778eb4a3ee85c396cfeeeb5 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Atomic implementation of create file and obtain handle for Win/SymbianJoão Abecasis2011-10-211-49/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Besides generating a unique name, createFileFromTemplate now also acquires a file handle on all platforms. The file engine's native handle is passed by reference and modified in place. This fixes a long standing security issue on Windows. On Windows and Symbian platforms we directly use the "native" file path when processing the template and generating the unique name. Since the native encoding is known, conversions at this point are safe. Errors other than "file exists" are propagated to Q(Temporary)File, and result in a failure in open(). The changes also unify error handling and should give consistent behaviour across all platforms. Worthy of note, there's a change in behaviour on Windows and Symbian: fileNames returned by QTemporaryFile on Windows and Symbian are always absolute after open has been called. This has to do with how QFileSystemEntry::nativeFilePath works on these platforms. (Test was updated to reflect change in behaviour.) Reviewed-by: Gareth Stockwell Reviewed-by: Shane Kearns (cherry picked from commit ff9b69838ec146aeb43d4af8a03043f9c5f0454d) Conflicts: tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp Change-Id: Ibc9affb321ea4f4b193efc1f7336c9770b43d8df Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Minimize encoding conversions when generating unique file nameJoão Abecasis2011-10-211-15/+54
| | | | | | | | | | | | | | | | With minor adjustments, createFileFromTemplate is made to work directly on (UTF-16) QString data, which is already in the native encoding for Windows and Symbian. This is possible because the function only fills out the placeholder sub-string, without touching adjacent characters. This eliminates unnecessary conversions on those platforms. Reviewed-by: Gareth Stockwell Reviewed-by: Shane Kearns (cherry picked from commit 9a76587363a2f37312326286e08cce502f7fe27e) Change-Id: I8732b88ece5e2befb2da2e717758954c9aa7e5b0 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Use QStringBuilder when copying template for modificationJoão Abecasis2011-10-211-15/+47
| | | | | | | | | | | | | | | | | This avoids modifying the original string in the case where a placeholder marker is not found. By marking the variable const we further avoid checks on the reference count and detaches, also allowing us to safely reuse it later in the function. The new approach also fixes an issue where suffix wasn't empty, but the toLocal8Bit conversion would be. This resulted in a buffer overflow inside createFileFromTemplate. Reviewed-by: Shane Kearns (cherry picked from commit d71d3b1ce31ffc585258330d825ff8ea535254ef) Change-Id: I6cb3fbc6c653d8a881426fddbc433826365d4816 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Make Symbian follow Windows code in temporary path generationJoão Abecasis2011-10-211-8/+5
| | | | | | | | | | | | | | | | | On the one hand, we stop using OpenC here. On the other, we no longer use an atomic create and obtain file handle API -- just as we don't on Windows yet. This is a stepping stone to removing back and forth conversions of path names when generating unique names and also towards the use of native APIs for creating and obtaining a file handle atomically. Reviewed-by: Gareth Stockwell Reviewed-by: Shane Kearns (cherry picked from commit 63bb67d3107b03f399cddf4c9cca9c7eb347b62d) Change-Id: I97b3b6179dff053807acc8d4469fdf57f57f68a6 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Encapsulate pointer manipulations to createFileTemplate functionJoão Abecasis2011-10-211-15/+18
| | | | | | | | | , where we actually control how we use the pointers. Reduce some code duplication in #ifdefs. (cherry picked from commit d69788728ccd843e3d4a372680185fdf5e711c86) Change-Id: I50aafbcac520837f9dc751e85f59a482a2f5225f Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Expand QT_TR_NOOP("str") to "str", not ("str").Jan-Arve Saether2011-10-211-4/+4
| | | | | | | | | | | | | | This enables us to write code like : QStringLiteral(QT_TR_NOOP("Press")) or just: QT_UNICODE_LITERAL(QT_TR_NOOP("Press")) It also makes it consistent with the QT_TRANSLATE_NOOP3, QT_TRANSLATE_NOOP3_UTF8 and QT_TRID_NOOP macros, as they don't surround the string literals with parenthesis. Change-Id: I67c30bcd88609f897bd22afb44266affa4dcfc8f Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
* ret is an "internal" path, no need to re-process itJoão Abecasis2011-10-201-1/+1
| | | | | | | | | Where "internal" means that it uses Qt's separator '/', regardless of the native one. (cherry picked from commit d4aa1777389f41da60a862a8c371d13839938d43) Change-Id: Ic23ba0b360020b2e910b1256b38522db5c57f49b Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* We prefer capitalized drive letters, make it so soonerJoão Abecasis2011-10-201-2/+3
| | | | | | | | Reviewed-by: Prasanth Ullattil (cherry picked from commit 13899108ed57548d3c4f40e595481f8ee76e4fcf) Change-Id: I70132c19af34715c92718f9b06e4f2dfba28d255 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Avoid spurious detaching in QDir::to/fromNativeSeparatorsJoão Abecasis2011-10-201-10/+28
| | | | | | | | | | | | | | | | The new code avoids non-const detaching operations until needed and uses a pointer into the "raw" QChar data from then on, thus skipping unneeded checks on the reference count for further detaching. These functions are used all the time by the file system classes so this small optimization won't hurt. In particular, it will help users who already use '/' when passing paths into Qt. Reviewed-by: Peter Hartmann (cherry picked from commit 773a6df46243831dee7559f90e33d7eff3c5c71e) Change-Id: I27787e787b544a63c9ea1e4138bd548500104dff Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Move the non-atomic and implicit functions from QBasicAtomicXXXThiago Macieira2011-10-202-84/+65
| | | | | | | | | Now, users of QBasicAtomicInt and QBasicAtomicPointer must be sure to use .load() and .store() to access the values. Change-Id: I6b48ed175618baf387dd38d821bd50e6e93c082e Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Use fromLocal8Bit for reversing toLocal8BitJoão Abecasis2011-10-201-1/+1
| | | | | | | | | path is converted to 8-bit encoding using toLocal8Bit in QTemporaryFileEngine::open. The reverse operation should be used here. (cherry picked from commit 023976f9dd48a3deb947905d32d5fc0692da7318) Change-Id: Idb4c1ca3415300367c46a09d68df640e17b7bfdc Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Don't convert template's path separators againJoão Abecasis2011-10-201-1/+1
| | | | | | | (cherry picked from commit 19880c1bdf75455b645fb8d5ee12bcb6e37e5aff) Change-Id: Iec201da5c09d76711d994bc1da6d15a70a66b0c8 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Changed if/if/else/if/eleven chain to switchJoão Abecasis2011-10-201-15/+22
| | | | | | | | | | | Inlined isdigit in switch statement. Removed unused #includes. Documented unreachable segment with code (Q_ASSERT). Reviewed-by: Denis Dzyubenko (cherry picked from commit 3596db6c9bb8db42476d0c7b52fa2043dc67135b) Change-Id: I98c33801fd8794e95ba8fc0b5c4efe9b1910682b Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Modulus of negative dividends is undefined or negativeJoão Abecasis2011-10-201-1/+1
| | | | | | | | | | | | ... depending on who you ask. Since it is possible for applicationPid to return negative values this means we would introduce garbage ['()*+,-./] in the generated filenames. Reviewed-by: Denis Dzyubenko (cherry picked from commit cb7cb1d3884ae8a032f3ad2ed3a6d8e3ffc06206) Change-Id: Ie4f74b961397f97508ea67a0c835e45773d1cc0e Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Update keyToValue and keysToValue in QMetaEnumLiang Qi2011-10-192-10/+34
| | | | | | | | | | Add a ok return value for whether found or not. Task-number: QTBUG-21672 Reviewed-by: Olivier Goffart Change-Id: Ic0ea7455dccf1ac91705bcc1479444eb4091ded3 Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Liang Qi <liang.qi@nokia.com>
* Introduce Q_STATIC_ASSERTJędrzej Nowacki2011-10-191-0/+9
| | | | | | | | | Example of message of failed assert (gcc 4.6, file tst_qglobal.cpp:300): tst_qglobal.cpp:300:92: error: invalid application of ‘sizeof’ to incomplete type ‘QStaticAssertFailure<false>’ Change-Id: Ic1798094f718eaad388d754034115aafbbb6bd5e Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Metatype: Silence MSVC warnings about unused variables.Friedemann Kleint2011-10-191-6/+6
| | | | | | | Turn around if's. Change-Id: Ica6f7f54098a567816ce3918f6fe5d8d2c072e01 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Fix "may be used uninitialized" compiler warning.Morten Sorvig2011-10-191-1/+1
| | | | | Change-Id: I96e9dbf0f3df527785e03661b9c25bd2d214cd44 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Provide API for "placement new" construction of meta-typesKent Hansen2011-10-192-8/+508
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By making it possible to specify the place in memory where a type should be constructed, any meta-type can be allocated on the stack, for example. In the QML/JS QObject binding, this makes it possible to call slots and access properties from JavaScript without having to perform any mallocs (e.g. due to QVariant creation) in the C++ <--> JS value conversion, in the best case. In addition to QMetaType::construct() and QMetaType::destruct(), this change introduces QMetaType::typeSize(), which returns the size of a type in bytes. This can be used to prepare a suitable buffer for constructing a type using construct(). Benchmarks indicate that in-place construction is 2-5x faster than normal construction for core and GUI types on linux-g++. Note that there is already a QMetaType::construct() function in Qt 4, which has been renamed to QMetaType::create() in Qt 5. In order to avoid existing usages of construct() in user code to call the Qt 5 construct() (when they really meant to call create()), the third argument ("copy") of construct() is made mandatory. Hence, calls to QMetaType::construct() written for Qt 4 will cause a compile error when compiled with Qt 5, and the user must adapt his code. Task-number: QTBUG-12574 Change-Id: I836f06f6ee1c1c3edbd199a03424c78c942bdd3e Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Remove Sensors and Location related macros/defines from qglobal.h.alex2011-10-191-26/+0
| | | | | | | | | This reduces interdependencies between QtCore and other modules. Individual modules handle this by themselves. Change-Id: I82cb96326b8ccb0b6acb88d899ed811f80f47ec1 Reviewed-by: Lincoln Ramsay <lincoln.ramsay@nokia.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* make fromWCharArray() and toWCharArray() inlinedKonstantin Ritt2011-10-182-27/+25
| | | | | | | | | because we may have the size of wchar_t varying, we need to know which is the correct encoding: UTF-16 or UCS-4 Merge-request: 49 Change-Id: Ib5a1e7dea51d0cd8394e686634a36aae984fa072 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Remove stale documentation.Casper van Donderen2011-10-186-75/+0
| | | | | Change-Id: I85139e0334b648bee0d18129cef9387dcc6c3222 Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com>
* Less friends is good, at least for C++ code :)Lars Knoll2011-10-172-3/+0
| | | | | Change-Id: Ia46359ee80eb30b8e16a02b7d5376cc9610fac84 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>