summaryrefslogtreecommitdiff
path: root/qmake/tools/qglobal.cpp
Side-by-side diff
Diffstat (limited to 'qmake/tools/qglobal.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/tools/qglobal.cpp45
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
@@ -140,25 +140,46 @@ bool qSysInfo( int *wordSize, bool *bigEndian )
if ( be16 != be32 ) { // strange machine!
#if defined(QT_CHECK_RANGE)
qFatal( "qSysInfo: Inconsistent system byte order" );
#endif
return FALSE;
}
*bigEndian = si_bigEndian = be32;
si_alreadyDone = TRUE;
return TRUE;
}
-#if defined(Q_OS_WIN32) || defined(Q_OS_CYGWIN)
+#if !defined(QWS) && defined(Q_OS_MAC)
+
+#include "qt_mac.h"
+
+int qMacVersion()
+{
+ static int macver = Qt::MV_Unknown;
+ static bool first = TRUE;
+ if(first) {
+ first = FALSE;
+ long gestalt_version;
+ if(Gestalt(gestaltSystemVersion, &gestalt_version) == noErr) {
+ if(gestalt_version >= 0x1020 && gestalt_version < 0x1030)
+ macver = Qt::MV_10_DOT_2;
+ else if(gestalt_version >= 0x1010 && gestalt_version < 0x1020)
+ macver = Qt::MV_10_DOT_1;
+ }
+ }
+ return macver;
+}
+Qt::MacintoshVersion qt_macver = (Qt::MacintoshVersion)qMacVersion();
+#elif defined(Q_OS_WIN32) || defined(Q_OS_CYGWIN)
bool qt_winunicode;
#include "qt_windows.h"
int qWinVersion()
{
#ifndef VER_PLATFORM_WIN32s
#define VER_PLATFORM_WIN32s 0
#endif
#ifndef VER_PLATFORM_WIN32_WINDOWS
#define VER_PLATFORM_WIN32_WINDOWS 1
#endif
@@ -312,41 +333,53 @@ Qt::WindowsVersion qt_winver = (Qt::WindowsVersion)qWinVersion();
to crashes on certain platforms due to the platforms printf implementation.
\sa qDebug(), qWarning(), qInstallMsgHandler(),
\link debug.html Debugging\endlink
*/
static QtMsgHandler handler = 0; // pointer to debug handler
static const int QT_BUFFER_LENGTH = 8196; // internal buffer length
#ifdef Q_OS_MAC
-const unsigned char * p_str(const char * c, int len=-1)
+QString cfstring2qstring(CFStringRef str)
+{
+ CFIndex length = CFStringGetLength(str);
+ if(const UniChar *chars = CFStringGetCharactersPtr(str))
+ return QString((QChar *)chars, length);
+ UniChar *buffer = (UniChar*)malloc(length * sizeof(UniChar));
+ CFStringGetCharacters(str, CFRangeMake(0, length), buffer);
+ QString ret((QChar *)buffer, length);
+ free(buffer);
+ return ret;
+}
+
+unsigned char * p_str(const char * c, int len=-1)
{
const int maxlen = 255;
if(len == -1)
len = qstrlen(c);
if(len > maxlen) {
qWarning( "p_str len must never exceed %d", maxlen );
len = maxlen;
}
unsigned char *ret = (unsigned char*)malloc(len+2);
*ret=len;
memcpy(((char *)ret)+1,c,len);
*(ret+len+1) = '\0';
return ret;
}
-const unsigned char * p_str(const QString &s)
+unsigned char * p_str(const QString &s)
{
return p_str(s, s.length());
}
QCString p2qstring(const unsigned char *c) {
char *arr = (char *)malloc(c[0] + 1);
memcpy(arr, c+1, c[0]);
arr[c[0]] = '\0';
QCString ret = arr;
delete arr;
return ret;
}
@@ -632,36 +665,36 @@ void qSystemWarning( const char* msg, int code )
ASSERT: "b == 0" in div.cpp (9)
\endcode
\sa qWarning(), \link debug.html Debugging\endlink
*/
/*!
\fn void Q_CHECK_PTR( void *p )
\relates QApplication
- If \a p is null, a fatal messages says that the program ran out of
- memory and exits. If \e p is not null, nothing happens.
+ If \a p is 0, a fatal messages says that the program ran out of
+ memory and exits. If \e p is not 0, nothing happens.
This is really a macro defined in \c qglobal.h.
Example:
\code
int *a;
Q_CHECK_PTR( a = new int[80] ); // WRONG!
- a = new int[80]; // Right
+ a = new (nothrow) int[80]; // Right
Q_CHECK_PTR( a );
\endcode
\sa qFatal(), \link debug.html Debugging\endlink
*/
//
// The Q_CHECK_PTR macro calls this function to check if an allocation went ok.
//
#if (QT_VERSION-0 >= 0x040000)
#if defined(Q_CC_GNU)