generic: replace socklen_t/kde_socklen_t with QT_SOCKLEN_T

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2016-04-22 13:19:18 +00:00
parent 656489f1d7
commit 9c5e63ef16
8 changed files with 17 additions and 16 deletions

View file

@ -6,8 +6,6 @@
/****************************/ /****************************/
#define kde_socklen_t socklen_t
#define KDELIBSUFF "${KDELIBSUFF}" #define KDELIBSUFF "${KDELIBSUFF}"
/****************************/ /****************************/

View file

@ -29,7 +29,8 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include "klocale.h" #include <qplatformdefs.h>
#include <klocale.h>
static inline int kSocket(int af, int socketype, int proto) static inline int kSocket(int af, int socketype, int proto)
{ {
@ -71,7 +72,7 @@ static inline int kAccept(int fd)
{ {
int ret; int ret;
sockaddr sa; sockaddr sa;
socklen_t len = sizeof(sa); QT_SOCKLEN_T len = sizeof(sa);
do { do {
ret = ::accept(fd, &sa, &len); ret = ::accept(fd, &sa, &len);
} while (ret == -1 && errno == EINTR); } while (ret == -1 && errno == EINTR);

View file

@ -941,7 +941,7 @@ static void findport(unsigned short port, char *serv, size_t servlen, int flags)
qsnprintf(serv, servlen, "%u", ntohs(port)); qsnprintf(serv, servlen, "%u", ntohs(port));
} }
int getnameinfo(const struct sockaddr *sa, kde_socklen_t salen, int getnameinfo(const struct sockaddr *sa, QT_SOCKLEN_T salen,
char *host, size_t hostlen, char *serv, size_t servlen, char *host, size_t hostlen, char *serv, size_t servlen,
int flags) int flags)
{ {

View file

@ -290,7 +290,7 @@ namespace KDE
extern KDECORE_EXPORT void freeaddrinfo(struct addrinfo* ai); extern KDECORE_EXPORT void freeaddrinfo(struct addrinfo* ai);
/** \internal */ /** \internal */
extern KDECORE_EXPORT int getnameinfo(const struct sockaddr *sa, extern KDECORE_EXPORT int getnameinfo(const struct sockaddr *sa,
kde_socklen_t salen, QT_SOCKLEN_T salen,
char *host, size_t hostlen, char *host, size_t hostlen,
char *serv, size_t servlen, char *serv, size_t servlen,
int flags); int flags);

View file

@ -25,8 +25,8 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/un.h> #include <sys/un.h>
#include <sys/stat.h>
#include <qplatformdefs.h>
#include <QtCore/qglobal.h> #include <QtCore/qglobal.h>
#include <QtCore/QFile> #include <QtCore/QFile>
#include <QtCore/QRegExp> #include <QtCore/QRegExp>
@ -49,7 +49,7 @@ public:
}; };
#ifndef SUN_LEN #ifndef SUN_LEN
#define SUN_LEN(ptr) ((socklen_t) (((struct sockaddr_un *) 0)->sun_path) \ #define SUN_LEN(ptr) ((QT_SOCKLEN_T) (((struct sockaddr_un *) 0)->sun_path) \
+ strlen ((ptr)->sun_path)) + strlen ((ptr)->sun_path))
#endif #endif
@ -156,7 +156,7 @@ int KDEsuClient::connect()
# endif # endif
#else #else
struct ucred cred; struct ucred cred;
socklen_t siz = sizeof(cred); QT_SOCKLEN_T siz = sizeof(cred);
// Security: if socket exists, we must own it // Security: if socket exists, we must own it
if (getsockopt(d->sockfd, SOL_SOCKET, SO_PEERCRED, &cred, &siz) == 0) if (getsockopt(d->sockfd, SOL_SOCKET, SO_PEERCRED, &cred, &siz) == 0)
@ -415,8 +415,8 @@ bool KDEsuClient::isServerSGID()
if (d->daemon.isEmpty()) if (d->daemon.isEmpty())
return false; return false;
KDE_struct_stat sbuf; QT_STATBUF sbuf;
if (KDE::stat(d->daemon, &sbuf) < 0) if (QT_STAT(QFile::encodeName(d->daemon), &sbuf) < 0)
{ {
kWarning(kdesuDebugArea()) << "stat():" << perror; kWarning(kdesuDebugArea()) << "stat():" << perror;
return false; return false;

View file

@ -46,6 +46,7 @@
#endif #endif
#include <errno.h> #include <errno.h>
#include <qplatformdefs.h>
#include <qwindowdefs.h> #include <qwindowdefs.h>
#include <kglobal.h> #include <kglobal.h>
#include <kcomponentdata.h> #include <kcomponentdata.h>
@ -639,7 +640,7 @@ static int read_socket(int sock, char *buffer, int len)
static int openSocket() static int openSocket()
{ {
kde_socklen_t socklen; QT_SOCKLEN_T socklen;
int s; int s;
struct sockaddr_un server; struct sockaddr_un server;
#define MAX_SOCK_FILE 255 #define MAX_SOCK_FILE 255

View file

@ -46,10 +46,11 @@
#include <unistd.h> #include <unistd.h>
#include <locale.h> #include <locale.h>
#include <qplatformdefs.h>
#include <QtCore/QLibrary> #include <QtCore/QLibrary>
#include <QtCore/QString> #include <QtCore/QString>
#include <QtCore/QFile> #include <QtCore/QFile>
#include <QtCore/qdatetime.h> #include <QtCore/QDateTime>
#include <QtCore/QFileInfo> #include <QtCore/QFileInfo>
#include <QtCore/QRegExp> #include <QtCore/QRegExp>
#include <QtGui/QFont> #include <QtGui/QFont>
@ -775,7 +776,7 @@ static void init_signals()
static void init_kdeinit_socket() static void init_kdeinit_socket()
{ {
struct sockaddr_un sa; struct sockaddr_un sa;
kde_socklen_t socklen; QT_SOCKLEN_T socklen;
long options; long options;
const QByteArray home_dir = qgetenv("HOME"); const QByteArray home_dir = qgetenv("HOME");
int max_tries = 10; int max_tries = 10;
@ -1283,7 +1284,7 @@ static void handle_requests(pid_t waitForPid)
if (d.wrapper >= 0 && FD_ISSET(d.wrapper, &rd_set)) if (d.wrapper >= 0 && FD_ISSET(d.wrapper, &rd_set))
{ {
struct sockaddr_un client; struct sockaddr_un client;
kde_socklen_t sClient = sizeof(client); QT_SOCKLEN_T sClient = sizeof(client);
int sock = accept(d.wrapper, (struct sockaddr *)&client, &sClient); int sock = accept(d.wrapper, (struct sockaddr *)&client, &sClient);
if (sock >= 0) if (sock >= 0)
{ {

View file

@ -130,7 +130,7 @@ static int read_socket(int sock, char *buffer, int len)
static int openSocket() static int openSocket()
{ {
kde_socklen_t socklen; socklen_t socklen;
int s; int s;
struct sockaddr_un server; struct sockaddr_un server;
#define MAX_SOCK_FILE 255 #define MAX_SOCK_FILE 255