summaryrefslogtreecommitdiffstats
path: root/mkspecs/common
diff options
context:
space:
mode:
authorJoão Abecasis <joao@trolltech.com>2010-01-15 17:05:06 (GMT)
committerJoão Abecasis <joao@trolltech.com>2010-01-22 16:50:19 (GMT)
commit0f8519368e2cfdaddb49cea60096fd03df69fd62 (patch)
treedd9b46cd1f5930de4c26554adc35da37272ec1f1 /mkspecs/common
parent784946b8ea8b932924a831504387661d66170ca0 (diff)
downloadQt-0f8519368e2cfdaddb49cea60096fd03df69fd62.zip
Qt-0f8519368e2cfdaddb49cea60096fd03df69fd62.tar.gz
Qt-0f8519368e2cfdaddb49cea60096fd03df69fd62.tar.bz2
Refactor common POSIX support out of individual qplatformdefs.h
POSIX header incorporates previously refactored X/Open LFS extensions. Reviewed-by: Thiago Macieira
Diffstat (limited to 'mkspecs/common')
-rw-r--r--mkspecs/common/posix/qplatformdefs.h (renamed from mkspecs/common/xopen-lfs/qplatformdefs.h)75
-rw-r--r--mkspecs/common/symbian/qplatformdefs.h39
2 files changed, 68 insertions, 46 deletions
diff --git a/mkspecs/common/xopen-lfs/qplatformdefs.h b/mkspecs/common/posix/qplatformdefs.h
index 2599d62..fe50de2 100644
--- a/mkspecs/common/xopen-lfs/qplatformdefs.h
+++ b/mkspecs/common/posix/qplatformdefs.h
@@ -39,13 +39,18 @@
**
****************************************************************************/
-#ifndef Q_XOPEN_LFS_QPLATFORMDEFS_H
-#define Q_XOPEN_LFS_QPLATFORMDEFS_H
+#ifndef Q_POSIX_QPLATFORMDEFS_H
+#define Q_POSIX_QPLATFORMDEFS_H
-#ifdef QT_LARGEFILE_SUPPORT
+#include <signal.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+
+#if defined(QT_USE_XOPEN_LFS_EXTENSIONS) && defined(QT_LARGEFILE_SUPPORT)
#define QT_STATBUF struct stat64
-#define QT_STATBUF4TSTAT struct stat64
#define QT_FPOS_T fpos64_t
#define QT_OFF_T off64_t
@@ -53,11 +58,13 @@
#define QT_LSTAT ::lstat64
#define QT_TRUNCATE ::truncate64
+// File I/O
#define QT_OPEN ::open64
#define QT_LSEEK ::lseek64
#define QT_FSTAT ::fstat64
#define QT_FTRUNCATE ::ftruncate64
+// Standard C89
#define QT_FOPEN ::fopen64
#define QT_FSEEK ::fseeko64
#define QT_FTELL ::ftello64
@@ -66,32 +73,72 @@
#define QT_MMAP ::mmap64
-#else // !QT_LARGEFILE_SUPPORT
+#else // !defined(QT_USE_XOPEN_LFS_EXTENSIONS) || !defined(QT_LARGEFILE_SUPPORT)
+
+#include "../c89/qplatformdefs.h"
#define QT_STATBUF struct stat
-#define QT_STATBUF4TSTAT struct stat
-#define QT_FPOS_T fpos_t
-#define QT_OFF_T long
#define QT_STAT ::stat
#define QT_LSTAT ::lstat
#define QT_TRUNCATE ::truncate
+// File I/O
#define QT_OPEN ::open
#define QT_LSEEK ::lseek
#define QT_FSTAT ::fstat
#define QT_FTRUNCATE ::ftruncate
-#define QT_FOPEN ::fopen
-#define QT_FSEEK ::fseek
-#define QT_FTELL ::ftell
-#define QT_FGETPOS ::fgetpos
-#define QT_FSETPOS ::fsetpos
+// Posix extensions to C89
+#if !defined(QT_USE_XOPEN_LFS_EXTENSIONS) && !defined(QT_NO_USE_FSEEKO)
+#undef QT_OFF_T
+#undef QT_FSEEK
+#undef QT_FTELL
+
+#define QT_OFF_T off_t
+
+#define QT_FSEEK ::fseeko
+#define QT_FTELL ::ftello
+#endif
#define QT_MMAP ::mmap
-#endif // QT_LARGEFILE_SUPPORT
+#endif // !defined (QT_USE_XOPEN_LFS_EXTENSIONS) || !defined(QT_LARGEFILE_SUPPORT)
+
+#define QT_STAT_MASK S_IFMT
+#define QT_STAT_REG S_IFREG
+#define QT_STAT_DIR S_IFDIR
+#define QT_STAT_LNK S_IFLNK
+
+#define QT_ACCESS ::access
+#define QT_GETCWD ::getcwd
+#define QT_CHDIR ::chdir
+#define QT_MKDIR ::mkdir
+#define QT_RMDIR ::rmdir
+
+// File I/O
+#define QT_CLOSE ::close
+#define QT_READ ::read
+#define QT_WRITE ::write
#define QT_OPEN_LARGEFILE O_LARGEFILE
+#define QT_OPEN_RDONLY O_RDONLY
+#define QT_OPEN_WRONLY O_WRONLY
+#define QT_OPEN_RDWR O_RDWR
+#define QT_OPEN_CREAT O_CREAT
+#define QT_OPEN_TRUNC O_TRUNC
+#define QT_OPEN_APPEND O_APPEND
+
+// Posix extensions to C89
+#define QT_FILENO fileno
+
+#define QT_SOCKLEN_T socklen_t
+
+#define QT_SOCKET_CONNECT ::connect
+#define QT_SOCKET_BIND ::bind
+
+#define QT_SIGNAL_RETTYPE void
+#define QT_SIGNAL_ARGS int
+#define QT_SIGNAL_IGNORE SIG_IGN
#endif // include guard
diff --git a/mkspecs/common/symbian/qplatformdefs.h b/mkspecs/common/symbian/qplatformdefs.h
index 4d95fae..38a1314 100644
--- a/mkspecs/common/symbian/qplatformdefs.h
+++ b/mkspecs/common/symbian/qplatformdefs.h
@@ -84,48 +84,23 @@
#endif
#include <arpa/inet.h>
-#include "../xopen-lfs/qplatformdefs.h"
+#define QT_USE_XOPEN_LFS_EXTENSIONS
+#include "../posix/qplatformdefs.h"
#undef QT_OPEN_LARGEFILE
-#define QT_OPEN_LARGEFILE 0
-
-#define QT_STAT_REG S_IFREG
-#define QT_STAT_DIR S_IFDIR
-#define QT_STAT_MASK S_IFMT
-#define QT_STAT_LNK S_IFLNK
-#define QT_SOCKET_CONNECT ::connect
-#define QT_SOCKET_BIND ::bind
-#define QT_FILENO fileno
-#define QT_CLOSE ::close
-#define QT_READ ::read
-#define QT_WRITE ::write
-#define QT_ACCESS ::access
-#define QT_GETCWD ::getcwd
-#define QT_CHDIR ::chdir
-#define QT_MKDIR ::mkdir
-#define QT_RMDIR ::rmdir
-#define QT_OPEN_RDONLY O_RDONLY
-#define QT_OPEN_WRONLY O_WRONLY
-#define QT_OPEN_RDWR O_RDWR
-#define QT_OPEN_CREAT O_CREAT
-#define QT_OPEN_TRUNC O_TRUNC
-#define QT_OPEN_APPEND O_APPEND
-
-#define QT_SIGNAL_RETTYPE void
-#define QT_SIGNAL_ARGS int
-#define QT_SIGNAL_IGNORE SIG_IGN
+#undef QT_SOCKLEN_T
+
+#define QT_OPEN_LARGEFILE 0
#if (defined(__GLIBC__) && (__GLIBC__ >= 2)) || defined(Q_OS_SYMBIAN)
-#define QT_SOCKLEN_T socklen_t
+#define QT_SOCKLEN_T socklen_t
#else
-#define QT_SOCKLEN_T int
+#define QT_SOCKLEN_T int
#endif
-
#if defined(__ISO_C_VISIBLE) && (__ISO_C_VISIBLE >= 1999)
#define QT_SNPRINTF ::snprintf
#define QT_VSNPRINTF ::vsnprintf
#endif
-
#endif // QPLATFORMDEFS_H