-rw-r--r-- | qmake/tools/qglobal.cpp | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/qmake/tools/qglobal.cpp b/qmake/tools/qglobal.cpp index 47cd6bd..342005d 100644 --- a/qmake/tools/qglobal.cpp +++ b/qmake/tools/qglobal.cpp | |||
@@ -151,3 +151,24 @@ bool qSysInfo( int *wordSize, bool *bigEndian ) | |||
151 | 151 | ||
152 | #if defined(Q_OS_WIN32) || defined(Q_OS_CYGWIN) | 152 | #if !defined(QWS) && defined(Q_OS_MAC) |
153 | |||
154 | #include "qt_mac.h" | ||
155 | |||
156 | int qMacVersion() | ||
157 | { | ||
158 | static int macver = Qt::MV_Unknown; | ||
159 | static bool first = TRUE; | ||
160 | if(first) { | ||
161 | first = FALSE; | ||
162 | long gestalt_version; | ||
163 | if(Gestalt(gestaltSystemVersion, &gestalt_version) == noErr) { | ||
164 | if(gestalt_version >= 0x1020 && gestalt_version < 0x1030) | ||
165 | macver = Qt::MV_10_DOT_2; | ||
166 | else if(gestalt_version >= 0x1010 && gestalt_version < 0x1020) | ||
167 | macver = Qt::MV_10_DOT_1; | ||
168 | } | ||
169 | } | ||
170 | return macver; | ||
171 | } | ||
172 | Qt::MacintoshVersion qt_macver = (Qt::MacintoshVersion)qMacVersion(); | ||
173 | #elif defined(Q_OS_WIN32) || defined(Q_OS_CYGWIN) | ||
153 | bool qt_winunicode; | 174 | bool qt_winunicode; |
@@ -323,3 +344,15 @@ static const int QT_BUFFER_LENGTH = 8196; // internal buffer length | |||
323 | #ifdef Q_OS_MAC | 344 | #ifdef Q_OS_MAC |
324 | const unsigned char * p_str(const char * c, int len=-1) | 345 | QString cfstring2qstring(CFStringRef str) |
346 | { | ||
347 | CFIndex length = CFStringGetLength(str); | ||
348 | if(const UniChar *chars = CFStringGetCharactersPtr(str)) | ||
349 | return QString((QChar *)chars, length); | ||
350 | UniChar *buffer = (UniChar*)malloc(length * sizeof(UniChar)); | ||
351 | CFStringGetCharacters(str, CFRangeMake(0, length), buffer); | ||
352 | QString ret((QChar *)buffer, length); | ||
353 | free(buffer); | ||
354 | return ret; | ||
355 | } | ||
356 | |||
357 | unsigned char * p_str(const char * c, int len=-1) | ||
325 | { | 358 | { |
@@ -339,3 +372,3 @@ const unsigned char * p_str(const char * c, int len=-1) | |||
339 | 372 | ||
340 | const unsigned char * p_str(const QString &s) | 373 | unsigned char * p_str(const QString &s) |
341 | { | 374 | { |
@@ -643,4 +676,4 @@ void qSystemWarning( const char* msg, int code ) | |||
643 | 676 | ||
644 | If \a p is null, a fatal messages says that the program ran out of | 677 | If \a p is 0, a fatal messages says that the program ran out of |
645 | memory and exits. If \e p is not null, nothing happens. | 678 | memory and exits. If \e p is not 0, nothing happens. |
646 | 679 | ||
@@ -654,3 +687,3 @@ void qSystemWarning( const char* msg, int code ) | |||
654 | 687 | ||
655 | a = new int[80]; // Right | 688 | a = new (nothrow) int[80]; // Right |
656 | Q_CHECK_PTR( a ); | 689 | Q_CHECK_PTR( a ); |