[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: [Patch] fix compile kdecore with msvc
From: Christian Ehrlicher <Ch.Ehrlicher () gmx ! de>
Date: 2005-10-29 18:20:44
Message-ID: 4363BD7C.304 () gmx ! de
[Download RAW message or body]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
i've attached a small patch which allows me to compile and link kdecore
with msvc.
Changes:
network/kresolver.cpp
- - masked '#warning' - is gnuc-specific
network/kresolver.h
- - don't export KResolverResults to avoid compiler errors (*)
network/ksocketdevice.cpp
- - don't include ksockssocketdevice in windows to avoid linker errors
- - indentation fixes (tabulator -> spaces)
- - add kde_ioctl because ioctl isn't available in windows
network/syssocket.h
- - add kde_ioctl (**)
SConscript
- - add 'DMAKE_KDECORE_LIB' to ccflags instead cxxflags
* there is imho no need to export KResolverResults because nobody
derivates a class from KResolverResults. And if you really want to
export this class, you have to implement all functions QList<T> defines
because otherwise when someone wants to use a function you forgot to
implement he will get a linker error.
** I don't know excatly if this is the correct place, but I wouldn't put
this into win/include/msvc and win/include/mingw. The problem here is,
that ioctl is defined as ioctlsocket(int fd, int cmd, u_long* argp) and
I have to use a temporary variable to map between int and long.
I've another question regarding some header files: In win/include/ we've
some headers which are empty. Wouldn't it be better to avoid including
them instead using empty headerfiles? Shouldn't be a problem to mask
them with '#ifdef HAVE_XXX', or?
Christian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFDY718nNKwkgf+zVMRAs9YAJ4+ipupNJYM2YwBSFFj/LGEJWnZaACcCPYB
A5fl03/ntTmyPytXe6mEOYA=
=nrxd
-----END PGP SIGNATURE-----
["kdecore.patch" (text/x-diff)]
Index: network/kresolver.cpp
===================================================================
--- network/kresolver.cpp (revision 475511)
+++ network/kresolver.cpp (working copy)
@@ -60,7 +60,9 @@
#include "ksocketaddress.h"
#ifdef NEED_MUTEX
+#ifdef __GNUC__
#warning "mutex"
+#endif
QMutex getXXbyYYmutex;
#endif
Index: network/kresolver.h
===================================================================
--- network/kresolver.h (revision 475511)
+++ network/kresolver.h (working copy)
@@ -195,7 +195,7 @@
*
* @author Thiago Macieira <thiago@kde.org>
*/
-class KDECORE_EXPORT KResolverResults: public QList<KResolverEntry>
+class KResolverResults: public QList<KResolverEntry>
{
public:
/**
Index: network/ksocketdevice.cpp
===================================================================
--- network/ksocketdevice.cpp (revision 475511)
+++ network/ksocketdevice.cpp (working copy)
@@ -57,7 +57,9 @@
#include "ksocketaddress.h"
#include "ksocketbase.h"
#include "ksocketdevice.h"
+#ifndef Q_WS_WIN
#include "ksockssocketdevice.h"
+#endif
using namespace KNetwork;
@@ -256,12 +258,12 @@
if (kde_bind(m_sockfd, address.address(), address.length()) == -1)
{
if (errno == EADDRINUSE)
- setError(AddressInUse);
+ setError(AddressInUse);
else if (errno == EINVAL)
- setError(AlreadyBound);
+ setError(AlreadyBound);
else
- // assume the address is the cause
- setError(NotSupported);
+ // assume the address is the cause
+ setError(NotSupported);
return false;
}
@@ -299,21 +301,21 @@
if (kde_connect(m_sockfd, address.address(), address.length()) == -1)
{
if (errno == EISCONN)
- return true; // we're already connected
+ return true; // we're already connected
else if (errno == EALREADY || errno == EINPROGRESS)
{
setError(InProgress);
return true;
}
else if (errno == ECONNREFUSED)
- setError(ConnectionRefused);
+ setError(ConnectionRefused);
else if (errno == ENETDOWN || errno == ENETUNREACH ||
- errno == ENETRESET || errno == ECONNABORTED ||
- errno == ECONNRESET || errno == EHOSTDOWN ||
- errno == EHOSTUNREACH)
- setError(NetFailure);
+ errno == ENETRESET || errno == ECONNABORTED ||
+ errno == ECONNRESET || errno == EHOSTDOWN ||
+ errno == EHOSTUNREACH)
+ setError(NetFailure);
else
- setError(NotSupported);
+ setError(NotSupported);
return false;
}
@@ -385,7 +387,7 @@
return -1; // there's nothing to read in a closed socket
int nchars;
- if (ioctl(m_sockfd, FIONREAD, &nchars) == -1)
+ if (kde_ioctl(m_sockfd, FIONREAD, &nchars) == -1)
return -1; // error!
return nchars;
Index: network/syssocket.h
===================================================================
--- network/syssocket.h (revision 475511)
+++ network/syssocket.h (working copy)
@@ -88,6 +88,19 @@
return ::getsockname(fd, sa, len);
}
+ // ioctl
+ inline int kde_ioctl(int fd, int cmd, int* argp)
+ {
+#if defined _WIN32 || defined _WIN64
+ ulong l_argp = *argp;
+ bool bRet = ::ioctlsocket(fd, cmd, &l_argp);
+ *argp = (int) l_argp;
+ return bRet;
+#else
+ return ::ioctl(fd, cmd, argp);
+#endif
+ }
+
} // anonymous namespace
#endif
Index: SConscript
===================================================================
--- SConscript (revision 475511)
+++ SConscript (working copy)
@@ -114,7 +114,7 @@
obj.libs = 'DCOP ltdlc'
obj.iskdelib = 1
obj.includes = 'network'
-obj.cxxflags += ' -DMAKE_KDECORE_LIB ' # todo: will be generated automatically
+obj.ccflags += ' -DMAKE_KDECORE_LIB ' # todo: will be generated automatically
if env['WINDOWS']:
obj.libpaths += ' ../win '
obj.includes += ' ../win/3rdparty/zlib '
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic