summaryrefslogtreecommitdiffstats
path: root/tqtinterface/qt4/src/tools
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-07-23 17:13:36 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-07-23 17:13:36 -0500
commitd3f7a9d6f1b8f6e24fb49aaa8caeaa7623ae48b5 (patch)
treebaeeba639393f46abab749f4700a250091c3cc16 /tqtinterface/qt4/src/tools
parentd7be1694839bacae31e500ea9e36b3c13257ce28 (diff)
downloadexperimental-d3f7a9d6f1b8f6e24fb49aaa8caeaa7623ae48b5.tar.gz
experimental-d3f7a9d6f1b8f6e24fb49aaa8caeaa7623ae48b5.zip
Apply all Qt3.3.8d patches
NOTE: This will *likely* break compilation of TQt4 Please wait a few days for fixes to be committed as needed!
Diffstat (limited to 'tqtinterface/qt4/src/tools')
-rw-r--r--tqtinterface/qt4/src/tools/tqdir_unix.cpp23
-rw-r--r--tqtinterface/qt4/src/tools/tqfeatures.h10
-rw-r--r--tqtinterface/qt4/src/tools/tqfileinfo_unix.cpp36
-rw-r--r--tqtinterface/qt4/src/tools/tqglobal.h10
-rw-r--r--tqtinterface/qt4/src/tools/tqlibrary.cpp1
-rw-r--r--tqtinterface/qt4/src/tools/tqlocale.cpp15
-rw-r--r--tqtinterface/qt4/src/tools/tqmap.h1
-rw-r--r--tqtinterface/qt4/src/tools/tqstring.h2
-rw-r--r--tqtinterface/qt4/src/tools/tqvaluelist.h1
9 files changed, 88 insertions, 11 deletions
diff --git a/tqtinterface/qt4/src/tools/tqdir_unix.cpp b/tqtinterface/qt4/src/tools/tqdir_unix.cpp
index 5d69993..f96808b 100644
--- a/tqtinterface/qt4/src/tools/tqdir_unix.cpp
+++ b/tqtinterface/qt4/src/tools/tqdir_unix.cpp
@@ -74,6 +74,20 @@ TQString TQDir::homeDirPath()
TQString TQDir::canonicalPath() const
{
TQString r;
+#if defined(__GLIBC__) && !defined(PATH_MAX)
+ char *cur = ::get_current_dir_name();
+ if ( cur ) {
+ char *tmp = canonicalize_file_name( TQFile::encodeName( dPath ).data() );
+ if ( tmp ) {
+ r = TQFile::decodeName( tmp );
+ free( tmp );
+ }
+ slashify( r );
+ // always make sure we go back to the current dir
+ ::chdir( cur );
+ free( cur );
+ }
+#else
char cur[PATH_MAX+1];
if ( ::getcwd( cur, PATH_MAX ) ) {
char tmp[PATH_MAX+1];
@@ -86,6 +100,7 @@ TQString TQDir::canonicalPath() const
// always make sure we go back to the current dir
::chdir( cur );
}
+#endif /* __GLIBC__ && !PATH_MAX */
return r;
}
@@ -147,9 +162,17 @@ TQString TQDir::currentDirPath()
struct stat st;
if ( ::stat( ".", &st ) == 0 ) {
+#if defined(__GLIBC__) && !defined(PATH_MAX)
+ char *currentName = ::get_current_dir_name();
+ if ( currentName ) {
+ result = TQFile::decodeName(currentName);
+ free( currentName );
+ }
+#else
char currentName[PATH_MAX+1];
if ( ::getcwd( currentName, PATH_MAX ) )
result = TQFile::decodeName(currentName);
+#endif /* __GLIBC__ && !PATH_MAX */
#if defined(TQT_DEBUG)
if ( result.isNull() )
qWarning( "TQDir::currentDirPath: getcwd() failed" );
diff --git a/tqtinterface/qt4/src/tools/tqfeatures.h b/tqtinterface/qt4/src/tools/tqfeatures.h
index f06fe39..dfafe61 100644
--- a/tqtinterface/qt4/src/tools/tqfeatures.h
+++ b/tqtinterface/qt4/src/tools/tqfeatures.h
@@ -982,3 +982,13 @@
#define TQT_NO_WORKSPACE
#endif
+// Input method
+#if !defined(TQT_NO_IM) && (defined(TQT_NO_STRINGLIST))
+#define TQT_NO_IM
+#endif
+
+// Input method extensions
+#if !defined(TQT_NO_IM_EXTENSIONS) && (defined(TQT_NO_IM) || defined(TQT_NO_STRINGLIST))
+#define TQT_NO_IM_EXTENSIONS
+#endif
+
diff --git a/tqtinterface/qt4/src/tools/tqfileinfo_unix.cpp b/tqtinterface/qt4/src/tools/tqfileinfo_unix.cpp
index 921b9f9..3be62bf 100644
--- a/tqtinterface/qt4/src/tools/tqfileinfo_unix.cpp
+++ b/tqtinterface/qt4/src/tools/tqfileinfo_unix.cpp
@@ -48,6 +48,9 @@
#if !defined(TQWS) && defined(TQ_OS_MAC)
# include <tqt_mac.h>
#endif
+#if defined(Q_OS_HURD)
+# include <stdlib.h>
+#endif
void TQFileInfo::slashify( TQString& )
{
@@ -127,16 +130,43 @@ bool TQFileInfo::isSymLink() const
TQString TQFileInfo::readLink() const
{
+ if ( !isSymLink() )
+ return TQString();
#if defined(TQ_OS_UNIX) && !defined(TQ_OS_OS2EMX)
+#if defined(__GLIBC__) && !defined(PATH_MAX)
+ int size = 256;
+ char *s = NULL, *s2;
+
+ while (1)
+ {
+ s2 = (char *) realloc (s, size);
+ if (s2 == NULL) {
+ free( s );
+ return TQString();
+ }
+ s = s2;
+ int len = readlink ( TQFile::encodeName(fn).data(), s, size );
+ if ( len < 0 ) {
+ free( s );
+ return TQString();
+ }
+ if ( len < size ) {
+ s[len] = '\0';
+ TQString str = TQFile::decodeName(s);
+ free(s);
+ return str;
+ }
+ size *= 2;
+ }
+#else
char s[PATH_MAX+1];
- if ( !isSymLink() )
- return TQString();
int len = readlink( TQFile::encodeName(fn).data(), s, PATH_MAX );
if ( len >= 0 ) {
s[len] = '\0';
return TQFile::decodeName(s);
}
-#endif
+#endif /* __GLIBC__ && !PATH_MAX */
+#endif /* Q_OS_UNIX && !Q_OS_OS2EMX */
#if !defined(TQWS) && defined(TQ_OS_MAC)
{
FSRef fref;
diff --git a/tqtinterface/qt4/src/tools/tqglobal.h b/tqtinterface/qt4/src/tools/tqglobal.h
index 3fe0fb0..693da3f 100644
--- a/tqtinterface/qt4/src/tools/tqglobal.h
+++ b/tqtinterface/qt4/src/tools/tqglobal.h
@@ -115,7 +115,9 @@
# define TQ_OS_ULTRIX
#elif defined(sinix)
# define TQ_OS_RELIANT
-#elif defined(__linux__) || defined(__linux)
+#elif defined(__GNU__)
+# define TQ_OS_HURD
+#elif defined(__linux__) || defined(__linux) || defined(__GNU__) || defined(__GLIBC__)
# define TQ_OS_LINUX
#elif defined(__FreeBSD__) || defined(__DragonFly__)
# define TQ_OS_FREEBSD
@@ -137,8 +139,6 @@
# define TQ_OS_AIX
#elif defined(__Lynx__)
# define TQ_OS_LYNX
-#elif defined(__GNU_HURD__)
-# define TQ_OS_HURD
#elif defined(__DGUX__)
# define TQ_OS_DGUX
#elif defined(__TQNXNTO__)
@@ -318,9 +318,9 @@
TQString bloat. However, gcc 3.4 doesn't allow us to create references to
members of a packed struct. (Pointers are OK, because then you
supposedly know what you are doing.) */
-# if (defined(__arm__) || defined(__ARMEL__)) && !defined(TQT_TQMOC_CPP)
+# if (defined(__arm__) || defined(__ARMEL__)) && !defined(__ARM_EABI__) && !defined(TQT_TQMOC_CPP)
# define TQ_PACKED __attribute__ ((packed))
-# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4
+# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3
# define TQ_NO_PACKED_REFERENCE
# endif
# endif
diff --git a/tqtinterface/qt4/src/tools/tqlibrary.cpp b/tqtinterface/qt4/src/tools/tqlibrary.cpp
index 140e017..cf34295 100644
--- a/tqtinterface/qt4/src/tools/tqlibrary.cpp
+++ b/tqtinterface/qt4/src/tools/tqlibrary.cpp
@@ -429,6 +429,7 @@ TQString TQLibrary::library() const
} else {
tmpfilename = TQString( "lib%1" ).arg( filename );
}
+ if ( !filename.tqcontains(".so") )
tmpfilename += filter;
if(TQFile::exists(tmpfilename) || it == filters.end()) {
filename = tmpfilename;
diff --git a/tqtinterface/qt4/src/tools/tqlocale.cpp b/tqtinterface/qt4/src/tools/tqlocale.cpp
index 26a3230..69c8c39 100644
--- a/tqtinterface/qt4/src/tools/tqlocale.cpp
+++ b/tqtinterface/qt4/src/tools/tqlocale.cpp
@@ -125,13 +125,24 @@ static inline double nan()
#endif
// We can't rely on -NAN, since all operations on a NAN should return a NAN.
+static double be_neg_nan;
+static double le_neg_nan;
static const unsigned char be_neg_nan_bytes[] = { 0xff, 0xf8, 0, 0, 0, 0, 0, 0 };
static const unsigned char le_neg_nan_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf8, 0xff };
+static bool neg_nan_init = false;
+
static inline double negNan()
{
+ if (!neg_nan_init)
+ {
+ memcpy(&be_neg_nan,be_neg_nan_bytes,sizeof(be_neg_nan_bytes));
+ memcpy(&le_neg_nan,le_neg_nan_bytes,sizeof(le_neg_nan_bytes));
+ neg_nan_init = true;
+ }
return (ByteOrder == BigEndian ?
- *((const double *) be_neg_nan_bytes) :
- *((const double *) le_neg_nan_bytes));
+ be_neg_nan :
+ le_neg_nan);
+
}
// Sizes as defined by the ISO C99 standard - fallback
diff --git a/tqtinterface/qt4/src/tools/tqmap.h b/tqtinterface/qt4/src/tools/tqmap.h
index 029f4a3..fe36e97 100644
--- a/tqtinterface/qt4/src/tools/tqmap.h
+++ b/tqtinterface/qt4/src/tools/tqmap.h
@@ -60,6 +60,7 @@
#ifndef TQT_NO_STL
#include <iterator>
#include <map>
+#include <cstddef>
#endif
//#define TQT_CHECK_MAP_RANGE
diff --git a/tqtinterface/qt4/src/tools/tqstring.h b/tqtinterface/qt4/src/tools/tqstring.h
index b4db802..71bc563 100644
--- a/tqtinterface/qt4/src/tools/tqstring.h
+++ b/tqtinterface/qt4/src/tools/tqstring.h
@@ -754,7 +754,7 @@ public:
char latin1() const { return ucs > 0xff ? 0 : (char) ucs; }
ushort tqunicode() const { return ucs; }
#ifdef TQ_NO_PACKED_REFERENCE
- ushort &tqunicode() { return *(&ucs); }
+ ushort &tqunicode() { return *((ushort*)&ucs); }
#else
ushort &tqunicode() { return ucs; }
#endif
diff --git a/tqtinterface/qt4/src/tools/tqvaluelist.h b/tqtinterface/qt4/src/tools/tqvaluelist.h
index 67c2574..799473a 100644
--- a/tqtinterface/qt4/src/tools/tqvaluelist.h
+++ b/tqtinterface/qt4/src/tools/tqvaluelist.h
@@ -50,6 +50,7 @@
#ifndef TQT_NO_STL
#include <iterator>
#include <list>
+#include <cstddef>
#endif
//#define TQT_CHECK_VALUELIST_RANGE