summaryrefslogtreecommitdiff
path: root/qmake/tools/qglobal.cpp
authorllornkcor <llornkcor>2003-07-10 02:40:10 (UTC)
committer llornkcor <llornkcor>2003-07-10 02:40:10 (UTC)
commit155d68c1e7d7dc0fed2534ac43d6d77ce2781f55 (patch) (unidiff)
treee6edaa5a7040fe6c224c3943d1094dcf02e4f74c /qmake/tools/qglobal.cpp
parent86703e8a5527ef114facd02c005b6b3a7e62e263 (diff)
downloadopie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.zip
opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.tar.gz
opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.tar.bz2
update qmake to 1.05a
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 )
140 if ( be16 != be32 ) { // strange machine! 140 if ( be16 != be32 ) { // strange machine!
141#if defined(QT_CHECK_RANGE) 141#if defined(QT_CHECK_RANGE)
142 qFatal( "qSysInfo: Inconsistent system byte order" ); 142 qFatal( "qSysInfo: Inconsistent system byte order" );
143#endif 143#endif
144 return FALSE; 144 return FALSE;
145 } 145 }
146 146
147 *bigEndian = si_bigEndian = be32; 147 *bigEndian = si_bigEndian = be32;
148 si_alreadyDone = TRUE; 148 si_alreadyDone = TRUE;
149 return TRUE; 149 return TRUE;
150} 150}
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
156int 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}
172Qt::MacintoshVersion qt_macver = (Qt::MacintoshVersion)qMacVersion();
173#elif defined(Q_OS_WIN32) || defined(Q_OS_CYGWIN)
153bool qt_winunicode; 174bool qt_winunicode;
154 175
155#include "qt_windows.h" 176#include "qt_windows.h"
156 177
157int qWinVersion() 178int qWinVersion()
158{ 179{
159#ifndef VER_PLATFORM_WIN32s 180#ifndef VER_PLATFORM_WIN32s
160 #define VER_PLATFORM_WIN32s 0 181 #define VER_PLATFORM_WIN32s 0
161#endif 182#endif
162#ifndef VER_PLATFORM_WIN32_WINDOWS 183#ifndef VER_PLATFORM_WIN32_WINDOWS
163#define VER_PLATFORM_WIN32_WINDOWS 1 184#define VER_PLATFORM_WIN32_WINDOWS 1
164#endif 185#endif
@@ -312,41 +333,53 @@ Qt::WindowsVersion qt_winver = (Qt::WindowsVersion)qWinVersion();
312 to crashes on certain platforms due to the platforms printf implementation. 333 to crashes on certain platforms due to the platforms printf implementation.
313 334
314 \sa qDebug(), qWarning(), qInstallMsgHandler(), 335 \sa qDebug(), qWarning(), qInstallMsgHandler(),
315 \link debug.html Debugging\endlink 336 \link debug.html Debugging\endlink
316*/ 337*/
317 338
318 339
319 static QtMsgHandler handler = 0; // pointer to debug handler 340 static QtMsgHandler handler = 0; // pointer to debug handler
320 static const int QT_BUFFER_LENGTH = 8196;// internal buffer length 341 static const int QT_BUFFER_LENGTH = 8196;// internal buffer length
321 342
322 343
323#ifdef Q_OS_MAC 344#ifdef Q_OS_MAC
324const unsigned char * p_str(const char * c, int len=-1) 345QString 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
357unsigned char * p_str(const char * c, int len=-1)
325{ 358{
326 const int maxlen = 255; 359 const int maxlen = 255;
327 if(len == -1) 360 if(len == -1)
328 len = qstrlen(c); 361 len = qstrlen(c);
329 if(len > maxlen) { 362 if(len > maxlen) {
330 qWarning( "p_str len must never exceed %d", maxlen ); 363 qWarning( "p_str len must never exceed %d", maxlen );
331 len = maxlen; 364 len = maxlen;
332 } 365 }
333 unsigned char *ret = (unsigned char*)malloc(len+2); 366 unsigned char *ret = (unsigned char*)malloc(len+2);
334 *ret=len; 367 *ret=len;
335 memcpy(((char *)ret)+1,c,len); 368 memcpy(((char *)ret)+1,c,len);
336 *(ret+len+1) = '\0'; 369 *(ret+len+1) = '\0';
337 return ret; 370 return ret;
338} 371}
339 372
340const unsigned char * p_str(const QString &s) 373unsigned char * p_str(const QString &s)
341{ 374{
342 return p_str(s, s.length()); 375 return p_str(s, s.length());
343} 376}
344 377
345QCString p2qstring(const unsigned char *c) { 378QCString p2qstring(const unsigned char *c) {
346 char *arr = (char *)malloc(c[0] + 1); 379 char *arr = (char *)malloc(c[0] + 1);
347 memcpy(arr, c+1, c[0]); 380 memcpy(arr, c+1, c[0]);
348 arr[c[0]] = '\0'; 381 arr[c[0]] = '\0';
349 QCString ret = arr; 382 QCString ret = arr;
350 delete arr; 383 delete arr;
351 return ret; 384 return ret;
352} 385}
@@ -632,36 +665,36 @@ void qSystemWarning( const char* msg, int code )
632 ASSERT: "b == 0" in div.cpp (9) 665 ASSERT: "b == 0" in div.cpp (9)
633 \endcode 666 \endcode
634 667
635 \sa qWarning(), \link debug.html Debugging\endlink 668 \sa qWarning(), \link debug.html Debugging\endlink
636*/ 669*/
637 670
638 671
639/*! 672/*!
640 \fn void Q_CHECK_PTR( void *p ) 673 \fn void Q_CHECK_PTR( void *p )
641 674
642 \relates QApplication 675 \relates QApplication
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
647 This is really a macro defined in \c qglobal.h. 680 This is really a macro defined in \c qglobal.h.
648 681
649 Example: 682 Example:
650 \code 683 \code
651 int *a; 684 int *a;
652 685
653 Q_CHECK_PTR( a = new int[80] ); // WRONG! 686 Q_CHECK_PTR( a = new int[80] ); // WRONG!
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 );
657 \endcode 690 \endcode
658 691
659 \sa qFatal(), \link debug.html Debugging\endlink 692 \sa qFatal(), \link debug.html Debugging\endlink
660*/ 693*/
661 694
662 695
663// 696//
664// The Q_CHECK_PTR macro calls this function to check if an allocation went ok. 697// The Q_CHECK_PTR macro calls this function to check if an allocation went ok.
665// 698//
666#if (QT_VERSION-0 >= 0x040000) 699#if (QT_VERSION-0 >= 0x040000)
667#if defined(Q_CC_GNU) 700#if defined(Q_CC_GNU)