summaryrefslogtreecommitdiffstats
path: root/qtools
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2013-01-20 13:31:30 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2013-01-20 13:31:30 (GMT)
commitdcd4714c4413348d02eb7224dafee5d06be43dfb (patch)
tree3872f0367bbee22883a702d1d2f799c9a9c2e8ac /qtools
parent775ab3be95c02dd805aadc73ffbe3c18877c12a4 (diff)
downloadDoxygen-dcd4714c4413348d02eb7224dafee5d06be43dfb.zip
Doxygen-dcd4714c4413348d02eb7224dafee5d06be43dfb.tar.gz
Doxygen-dcd4714c4413348d02eb7224dafee5d06be43dfb.tar.bz2
Release-1.8.3.1
Diffstat (limited to 'qtools')
-rw-r--r--qtools/qcstring.h24
-rw-r--r--qtools/qdir_unix.cpp12
-rw-r--r--qtools/qfiledefs_p.h7
-rw-r--r--qtools/qgarray.cpp2
-rw-r--r--qtools/qgcache.cpp12
-rw-r--r--qtools/qgcache.h2
-rw-r--r--qtools/qgdict.cpp6
-rw-r--r--qtools/qgdict.h10
-rw-r--r--qtools/qiodevice.cpp2
-rw-r--r--qtools/qtextstream.cpp2
10 files changed, 49 insertions, 30 deletions
diff --git a/qtools/qcstring.h b/qtools/qcstring.h
index bbe8700..08f6e82 100644
--- a/qtools/qcstring.h
+++ b/qtools/qcstring.h
@@ -46,6 +46,10 @@
#include <stdlib.h>
#include <string.h>
+#if !defined(_OS_WIN32_)
+#include <stdint.h>
+#endif
+
#if defined(_OS_SUN_) && defined(_CC_GNU_)
#include <strings.h>
#endif
@@ -98,25 +102,26 @@ Q_EXPORT inline char *cstrcpy( char *dst, const char *src )
Q_EXPORT inline char *qstrcpy( char *dst, const char *src )
{ return src ? strcpy(dst, src) : 0; }
-Q_EXPORT char *qstrncpy( char *dst, const char *src, uint len );
+Q_EXPORT char * qstrncpy(char *src,const char *dst, uint len);
Q_EXPORT inline int cstrcmp( const char *str1, const char *str2 )
{ return strcmp(str1,str2); }
Q_EXPORT inline int qstrcmp( const char *str1, const char *str2 )
-{ return (str1 && str2) ? strcmp(str1,str2) : (int)((long)str2 - (long)str1); }
+{ return (str1 && str2) ? strcmp(str1,str2) : (int)((intptr_t)str2 - (intptr_t)str1); }
Q_EXPORT inline int cstrncmp( const char *str1, const char *str2, uint len )
{ return strncmp(str1,str2,len); }
Q_EXPORT inline int qstrncmp( const char *str1, const char *str2, uint len )
{ return (str1 && str2) ? strncmp(str1,str2,len) :
- (int)((long)str2 - (long)str1); }
+ (int)((intptr_t)str2 - (intptr_t)str1); }
-Q_EXPORT int qstricmp( const char *, const char * );
+Q_EXPORT int qstricmp( const char *str1, const char *str2 );
-Q_EXPORT int qstrnicmp( const char *, const char *, uint len );
+Q_EXPORT int qstrnicmp( const char *str1, const char *str2, uint len );
+#if 0
// ### TODO for 3.0: these and the cstr* functions should be used if
// !defined(QT_CLEAN_NAMESPACE)
// We want to keep source compatibility for 2.x
@@ -143,6 +148,7 @@ Q_EXPORT int qstrnicmp( const char *, const char *, uint len );
#define strnicmp qstrnicmp
#endif
+#endif
// qChecksum: Internet checksum
@@ -274,24 +280,28 @@ inline void QCString::duplicate( const QCString &s )
{
if (!s.isEmpty())
{
- uint l = strlen(s.data());
+ uint l = (uint)strlen(s.data());
m_data = (char *)malloc(l+1);
if (m_data) memcpy(m_data,s.data(),l+1);
}
else
+ {
m_data=0;
+ }
}
inline void QCString::duplicate( const char *str)
{
if (str && str[0]!='\0')
{
- uint l = strlen(str);
+ uint l = (uint)strlen(str);
m_data = (char *)malloc(l+1);
if (m_data) memcpy(m_data,str,l+1);
}
else
+ {
m_data=0;
+ }
}
inline QCString &QCString::duplicate( const char *str, int)
diff --git a/qtools/qdir_unix.cpp b/qtools/qdir_unix.cpp
index e845043..2257265 100644
--- a/qtools/qdir_unix.cpp
+++ b/qtools/qdir_unix.cpp
@@ -82,12 +82,14 @@ QString QDir::canonicalPath() const
char cur[PATH_MAX];
char tmp[PATH_MAX];
- (void)GETCWD( cur, PATH_MAX );
- if ( CHDIR(QFile::encodeName(dPath)) >= 0 ) {
- (void)GETCWD( tmp, PATH_MAX );
- r = QFile::decodeName(tmp);
+ if (GETCWD( cur, PATH_MAX )) {
+ if ( CHDIR(QFile::encodeName(dPath)) >= 0 ) {
+ if (GETCWD( tmp, PATH_MAX )) {
+ r = QFile::decodeName(tmp);
+ }
+ (void)CHDIR( cur );
+ }
}
- (void)CHDIR( cur );
slashify( r );
return r;
diff --git a/qtools/qfiledefs_p.h b/qtools/qfiledefs_p.h
index 5105c45..5a7cfe2 100644
--- a/qtools/qfiledefs_p.h
+++ b/qtools/qfiledefs_p.h
@@ -190,10 +190,17 @@
#else // all other systems
+#ifdef __MINGW32__
+# define STATBUF struct _stat
+# define STATBUF4TSTAT struct _stat
+# define STAT _stat
+# define FSTAT _fstat
+#else
# define STATBUF struct stat
# define STATBUF4TSTAT struct stat
# define STAT ::stat
# define FSTAT ::fstat
+#endif
# define STAT_REG S_IFREG
# define STAT_DIR S_IFDIR
# define STAT_MASK S_IFMT
diff --git a/qtools/qgarray.cpp b/qtools/qgarray.cpp
index efc9de0..df31363 100644
--- a/qtools/qgarray.cpp
+++ b/qtools/qgarray.cpp
@@ -635,7 +635,7 @@ extern "C" {
static int cmp_arr( const void *n1, const void *n2 )
{
return ( n1 && n2 ) ? memcmp( n1, n2, cmp_item_size )
- : (int)((long)n1 - (long)n2);
+ : (int)((intptr_t)n1 - (intptr_t)n2);
// Qt 3.0: Add a virtual compareItems() method and call that instead
}
diff --git a/qtools/qgcache.cpp b/qtools/qgcache.cpp
index e5dd8de..511c867 100644
--- a/qtools/qgcache.cpp
+++ b/qtools/qgcache.cpp
@@ -216,7 +216,7 @@ public:
bool remove_ascii( QCacheItem *item )
{ return QGDict::remove_ascii((const char *)item->key,item); }
bool remove_int( QCacheItem *item )
- { return QGDict::remove_int((long)item->key,item);}
+ { return QGDict::remove_int((intptr_t)item->key,item);}
void statistics() { QGDict::statistics(); }
};
@@ -406,7 +406,7 @@ bool QGCache::insert_other( const char *key, QCollection::Item data,
if ( keytype == AsciiKey )
dict->insert_ascii( key, ci );
else
- dict->insert_int( (long)key, ci );
+ dict->insert_int( (intptr_t)key, ci );
tCost += cost;
return TRUE;
}
@@ -469,7 +469,7 @@ QCollection::Item QGCache::take_other( const char *key )
if ( keytype == AsciiKey )
ci = dict->take_ascii( key );
else
- ci = dict->take_int( (long)key );
+ ci = dict->take_int( (intptr_t)key );
Item d;
if ( ci ) {
d = ci->data;
@@ -549,7 +549,7 @@ QCollection::Item QGCache::find_string( const QString &key, bool ref ) const
QCollection::Item QGCache::find_other( const char *key, bool ref ) const
{
QCacheItem *ci = keytype == AsciiKey ? dict->find_ascii(key)
- : dict->find_int((long)key);
+ : dict->find_int((intptr_t)key);
#if defined(DEBUG)
lruList->finds++;
#endif
@@ -816,10 +816,10 @@ const char *QGCacheIterator::getKeyAscii() const
Returns the key of the current item, as a long.
*/
-long QGCacheIterator::getKeyInt() const
+intptr_t QGCacheIterator::getKeyInt() const
{
QCacheItem *item = it->current();
- return item ? (long)item->key : 0;
+ return item ? (intptr_t)item->key : 0;
}
/*!
diff --git a/qtools/qgcache.h b/qtools/qgcache.h
index 2f35c41..a71f6d3 100644
--- a/qtools/qgcache.h
+++ b/qtools/qgcache.h
@@ -114,7 +114,7 @@ protected:
QCollection::Item get() const;
QString getKeyString() const;
const char *getKeyAscii() const;
- long getKeyInt() const;
+ intptr_t getKeyInt() const;
QCollection::Item operator()();
QCollection::Item operator++();
diff --git a/qtools/qgdict.cpp b/qtools/qgdict.cpp
index e51b9c1..534a93c 100644
--- a/qtools/qgdict.cpp
+++ b/qtools/qgdict.cpp
@@ -466,7 +466,7 @@ QCollection::Item QGDict::look_int( long key, QCollection::Item d, int op )
QCollection::Item QGDict::look_ptr( void *key, QCollection::Item d, int op )
{
QPtrBucket *n;
- int index = (int)((ulong)key % vlen); // simple hash
+ int index = (int)((uintptr_t)key % vlen); // simple hash
if ( op == op_find ) { // find
for ( n=(QPtrBucket*)vec[index]; n;
n=(QPtrBucket*)n->getNext() ) {
@@ -681,7 +681,7 @@ QPtrBucket *QGDict::unlink_ptr( void *key, QCollection::Item d )
return 0;
QPtrBucket *n;
QPtrBucket *prev = 0;
- int index = (int)((ulong)key % vlen);
+ int index = (int)((uintptr_t)key % vlen);
for ( n=(QPtrBucket *)vec[index]; n; n=(QPtrBucket *)n->getNext() ) {
bool found = (n->getKey() == key);
if ( found && d )
@@ -1012,7 +1012,7 @@ QDataStream &QGDict::read( QDataStream &s )
// but hey, serializing pointers? can it be done
// at all, ever?
if ( k )
- look_ptr( (void *)k, d, op_insert );
+ look_ptr( (void *)(uintptr_t)k, d, op_insert );
}
break;
}
diff --git a/qtools/qgdict.h b/qtools/qgdict.h
index 6243364..a5c8aa0 100644
--- a/qtools/qgdict.h
+++ b/qtools/qgdict.h
@@ -83,11 +83,11 @@ private:
class QIntBucket : public QBaseBucket
{
public:
- QIntBucket( long k, QCollection::Item d, QBaseBucket *n )
+ QIntBucket( intptr_t k, QCollection::Item d, QBaseBucket *n )
: QBaseBucket(d,n), key(k) {}
- long getKey() const { return key; }
+ intptr_t getKey() const { return key; }
private:
- long key;
+ intptr_t key;
};
class QPtrBucket : public QBaseBucket
@@ -178,7 +178,7 @@ public:
QCollection::Item get() const;
QString getKeyString() const;
const char *getKeyAscii() const;
- long getKeyInt() const;
+ intptr_t getKeyInt() const;
void *getKeyPtr() const;
QCollection::Item operator()();
@@ -208,7 +208,7 @@ inline const char *QGDictIterator::getKeyAscii() const
return curNode ? ((QAsciiBucket*)curNode)->getKey() : 0;
}
-inline long QGDictIterator::getKeyInt() const
+inline intptr_t QGDictIterator::getKeyInt() const
{
return curNode ? ((QIntBucket*)curNode)->getKey() : 0;
}
diff --git a/qtools/qiodevice.cpp b/qtools/qiodevice.cpp
index 43b2787..b52475c 100644
--- a/qtools/qiodevice.cpp
+++ b/qtools/qiodevice.cpp
@@ -593,7 +593,7 @@ int QIODevice::readLine( char *data, uint maxlen )
break;
}
*p++ = '\0';
- return (int)((long)p - (long)data);
+ return (int)((intptr_t)p - (intptr_t)data);
}
diff --git a/qtools/qtextstream.cpp b/qtools/qtextstream.cpp
index 21b455e..bae072d 100644
--- a/qtools/qtextstream.cpp
+++ b/qtools/qtextstream.cpp
@@ -1894,7 +1894,7 @@ QTextStream &QTextStream::operator<<( void *ptr )
setf( hex, basefield );
setf( showbase );
unsetf( uppercase );
- output_int( I_LONG | I_UNSIGNED, (ulong)ptr, FALSE );
+ output_int( I_LONG | I_UNSIGNED, (uintptr_t)ptr, FALSE );
flags( f );
return *this;
}