diff options
author | Ritt Konstantin <ritt.ks@gmail.com> | 2011-06-09 15:34:17 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2011-06-09 15:34:17 (GMT) |
commit | 2cb398e1d901e62384bb2b388761cfd18fc8804a (patch) | |
tree | 0d69fcc6994a797766dff23227cc79dfc80cf8ce /src/corelib/global | |
parent | 292a953258cac0107b820490b09231c0f700bdbe (diff) | |
download | Qt-2cb398e1d901e62384bb2b388761cfd18fc8804a.zip Qt-2cb398e1d901e62384bb2b388761cfd18fc8804a.tar.gz Qt-2cb398e1d901e62384bb2b388761cfd18fc8804a.tar.bz2 |
move some internal helper functions from qglobal.cpp to qcore_mac*
namely:
void qt_mac_to_pascal_string(const QString &s, Str255 str, TextEncoding encoding = 0, int len = -1);
QString qt_mac_from_pascal_string(const Str255 pstr);
OSErr qt_mac_create_fsref(const QString &file, FSRef *fsref);
OSErr qt_mac_create_fsspec(const QString &file, FSSpec *spec);
remove relevant "extern" declarations all over the Qt sources
Merge-request: 2615
Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com>
Diffstat (limited to 'src/corelib/global')
-rw-r--r-- | src/corelib/global/qglobal.cpp | 55 |
1 files changed, 2 insertions, 53 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index c144871..f6eaedc 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1648,64 +1648,13 @@ static const unsigned int qt_one = 1; const int QSysInfo::ByteOrder = ((*((unsigned char *) &qt_one) == 0) ? BigEndian : LittleEndian); #endif -#if !defined(QWS) && !defined(Q_WS_QPA) && defined(Q_OS_MAC) +#if !defined(QWS) && defined(Q_OS_MAC) QT_BEGIN_INCLUDE_NAMESPACE #include "private/qcore_mac_p.h" #include "qnamespace.h" QT_END_INCLUDE_NAMESPACE -Q_CORE_EXPORT OSErr qt_mac_create_fsref(const QString &file, FSRef *fsref) -{ - return FSPathMakeRef(reinterpret_cast<const UInt8 *>(file.toUtf8().constData()), fsref, 0); -} - -// Don't use this function, it won't work in 10.5 (Leopard) and up -Q_CORE_EXPORT OSErr qt_mac_create_fsspec(const QString &file, FSSpec *spec) -{ - FSRef fsref; - OSErr ret = qt_mac_create_fsref(file, &fsref); - if (ret == noErr) - ret = FSGetCatalogInfo(&fsref, kFSCatInfoNone, 0, 0, spec, 0); - return ret; -} - -Q_CORE_EXPORT void qt_mac_to_pascal_string(QString s, Str255 str, TextEncoding encoding=0, int len=-1) -{ - if(len == -1) - len = s.length(); -#if 0 - UnicodeMapping mapping; - mapping.unicodeEncoding = CreateTextEncoding(kTextEncodingUnicodeDefault, - kTextEncodingDefaultVariant, - kUnicode16BitFormat); - mapping.otherEncoding = (encoding ? encoding : ); - mapping.mappingVersion = kUnicodeUseLatestMapping; - - UnicodeToTextInfo info; - OSStatus err = CreateUnicodeToTextInfo(&mapping, &info); - if(err != noErr) { - qDebug("Qt: internal: Unable to create pascal string '%s'::%d [%ld]", - s.left(len).latin1(), (int)encoding, err); - return; - } - const int unilen = len * 2; - const UniChar *unibuf = (UniChar *)s.unicode(); - ConvertFromUnicodeToPString(info, unilen, unibuf, str); - DisposeUnicodeToTextInfo(&info); -#else - Q_UNUSED(encoding); - CFStringGetPascalString(QCFString(s), str, 256, CFStringGetSystemEncoding()); -#endif -} - -Q_CORE_EXPORT QString qt_mac_from_pascal_string(const Str255 pstr) { - return QCFString(CFStringCreateWithPascalString(0, pstr, CFStringGetSystemEncoding())); -} -#endif //!defined(QWS) && !defined(Q_WS_QPA) && defined(Q_OS_MAC) - -#if !defined(QWS) && defined(Q_OS_MAC) - static QSysInfo::MacVersion macVersion() { #ifndef QT_NO_CORESERVICES @@ -2105,7 +2054,7 @@ static void mac_default_handler(const char *msg) { if (qt_is_gui_used) { Str255 pmsg; - qt_mac_to_pascal_string(msg, pmsg); + qt_mac_to_pascal_string(QString::fromAscii(msg), pmsg); DebugStr(pmsg); } else { fprintf(stderr, msg); |