Fixed Issue #20: Compiling with gcc > 4.3 failes

This commit is contained in:
syed.amer@gilani.eu 2009-03-29 12:50:33 +00:00
parent 3580a29fd8
commit b3cf31bd7c
19 changed files with 40 additions and 18 deletions

View File

@ -19,6 +19,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#include <cstdlib>
// //
// CArchDaemonUnix // CArchDaemonUnix
@ -37,6 +38,8 @@ CArchDaemonUnix::~CArchDaemonUnix()
int int
CArchDaemonUnix::daemonize(const char* name, DaemonFunc func) CArchDaemonUnix::daemonize(const char* name, DaemonFunc func)
{ {
int dummy;
// fork so shell thinks we're done and so we're not a process // fork so shell thinks we're done and so we're not a process
// group leader // group leader
switch (fork()) { switch (fork()) {
@ -57,7 +60,7 @@ CArchDaemonUnix::daemonize(const char* name, DaemonFunc func)
setsid(); setsid();
// chdir to root so we don't keep mounted filesystems points busy // chdir to root so we don't keep mounted filesystems points busy
chdir("/"); dummy = chdir("/");
// mask off permissions for any but owner // mask off permissions for any but owner
umask(077); umask(077);
@ -71,7 +74,7 @@ CArchDaemonUnix::daemonize(const char* name, DaemonFunc func)
// of standard I/O safely goes in the bit bucket. // of standard I/O safely goes in the bit bucket.
open("/dev/null", O_RDONLY); open("/dev/null", O_RDONLY);
open("/dev/null", O_RDWR); open("/dev/null", O_RDWR);
dup(1); dummy = dup(1);
// invoke function // invoke function
return func(1, &name); return func(1, &name);

View File

@ -316,8 +316,10 @@ CArchNetworkBSD::pollSocket(CPollEntry pe[], int num, double timeout)
if (n > 0 && unblockPipe != NULL && (pfd[num].revents & POLLIN) != 0) { if (n > 0 && unblockPipe != NULL && (pfd[num].revents & POLLIN) != 0) {
// the unblock event was signalled. flush the pipe. // the unblock event was signalled. flush the pipe.
char dummy[100]; char dummy[100];
int ignore;
do { do {
read(unblockPipe[0], dummy, sizeof(dummy)); ignore = read(unblockPipe[0], dummy, sizeof(dummy));
} while (errno != EAGAIN); } while (errno != EAGAIN);
// don't count this unblock pipe in return value // don't count this unblock pipe in return value
@ -489,7 +491,9 @@ CArchNetworkBSD::unblockPollSocket(CArchThread thread)
const int* unblockPipe = getUnblockPipeForThread(thread); const int* unblockPipe = getUnblockPipeForThread(thread);
if (unblockPipe != NULL) { if (unblockPipe != NULL) {
char dummy = 0; char dummy = 0;
write(unblockPipe[1], &dummy, 1); int ignore;
ignore = write(unblockPipe[1], &dummy, 1);
} }
} }

View File

@ -17,8 +17,9 @@
#include "common.h" #include "common.h"
#include "CArch.h" #include "CArch.h"
#include <limits.h> #include <climits>
#include <string.h> #include <cstring>
#include <cstdlib>
#if HAVE_LOCALE_H #if HAVE_LOCALE_H
# include <locale.h> # include <locale.h>
#endif #endif
@ -26,7 +27,7 @@
# include <wchar.h> # include <wchar.h>
#elif __APPLE__ #elif __APPLE__
// wtf? Darwin puts mbtowc() et al. in stdlib // wtf? Darwin puts mbtowc() et al. in stdlib
# include <stdlib.h> # include <cstdlib>
#else #else
// platform apparently has no wchar_t support. provide dummy // platform apparently has no wchar_t support. provide dummy
// implementations. hopefully at least the C++ compiler has // implementations. hopefully at least the C++ compiler has

View File

@ -13,7 +13,7 @@
*/ */
#include "XArchUnix.h" #include "XArchUnix.h"
#include <string.h> #include <cstring>
// //
// XArchEvalUnix // XArchEvalUnix

View File

@ -19,6 +19,7 @@
#include <cctype> #include <cctype>
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
#include <cstring>
#include <algorithm> #include <algorithm>
// //

View File

@ -14,7 +14,7 @@
#include "CUnicode.h" #include "CUnicode.h"
#include "CArch.h" #include "CArch.h"
#include <string.h> #include <cstring>
// //
// local utility functions // local utility functions

View File

@ -26,6 +26,8 @@
#include "CLog.h" #include "CLog.h"
#include "IEventQueue.h" #include "IEventQueue.h"
#include "TMethodEventJob.h" #include "TMethodEventJob.h"
#include <cstring>
#include <cstdlib>
// //
// CClient // CClient

View File

@ -24,6 +24,7 @@
#include "TMethodEventJob.h" #include "TMethodEventJob.h"
#include "XBase.h" #include "XBase.h"
#include <memory> #include <memory>
#include <cstring>
// //
// CServerProxy // CServerProxy

View File

@ -23,7 +23,9 @@
#include "IEventJob.h" #include "IEventJob.h"
#include "CArch.h" #include "CArch.h"
#include "XArch.h" #include "XArch.h"
#include <string.h> #include <cstring>
#include <cstdlib>
#include <memory>
// //
// CTCPSocket // CTCPSocket

View File

@ -27,6 +27,7 @@
#include "IEventQueue.h" #include "IEventQueue.h"
#include "TMethodEventJob.h" #include "TMethodEventJob.h"
#include <cstring> #include <cstring>
#include <cstdlib>
#if X_DISPLAY_MISSING #if X_DISPLAY_MISSING
# error X11 is required to build synergy # error X11 is required to build synergy
#else #else

View File

@ -17,6 +17,8 @@
#include "CLog.h" #include "CLog.h"
#include "IEventQueue.h" #include "IEventQueue.h"
#include "TMethodEventJob.h" #include "TMethodEventJob.h"
#include <cstring>
#include <memory>
// //
// CClientProxy1_3 // CClientProxy1_3

View File

@ -19,7 +19,7 @@
#include "XSocket.h" #include "XSocket.h"
#include "stdistream.h" #include "stdistream.h"
#include "stdostream.h" #include "stdostream.h"
#include <stdlib.h> #include <cstdlib>
// //
// CConfig // CConfig

View File

@ -19,8 +19,8 @@
#include "CEventQueue.h" #include "CEventQueue.h"
#include "CLog.h" #include "CLog.h"
#include "TMethodEventJob.h" #include "TMethodEventJob.h"
#include <stdlib.h> #include <cstdlib>
#include <string.h> #include <cstring>
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Input Filter Condition Classes // Input Filter Condition Classes

View File

@ -28,7 +28,8 @@
#include "CLog.h" #include "CLog.h"
#include "TMethodEventJob.h" #include "TMethodEventJob.h"
#include "CArch.h" #include "CArch.h"
#include <string.h> #include <cstring>
#include <cstdlib>
// //
// CServer // CServer

View File

@ -16,8 +16,8 @@
#include "KeyTypes.h" #include "KeyTypes.h"
#include "CLog.h" #include "CLog.h"
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <cctype>
#include <stdlib.h> #include <cstdlib>
CKeyMap::CNameToKeyMap* CKeyMap::s_nameToKeyMap = NULL; CKeyMap::CNameToKeyMap* CKeyMap::s_nameToKeyMap = NULL;
CKeyMap::CNameToModifierMap* CKeyMap::s_nameToModifierMap = NULL; CKeyMap::CNameToModifierMap* CKeyMap::s_nameToModifierMap = NULL;

View File

@ -15,7 +15,7 @@
#include "CKeyState.h" #include "CKeyState.h"
#include "IEventQueue.h" #include "IEventQueue.h"
#include "CLog.h" #include "CLog.h"
#include <string.h> #include <cstring>
#include <algorithm> #include <algorithm>
static const KeyButton kButtonMask = (KeyButton)(IKeyState::kNumButtons - 1); static const KeyButton kButtonMask = (KeyButton)(IKeyState::kNumButtons - 1);

View File

@ -16,6 +16,8 @@
#include "IEventQueue.h" #include "IEventQueue.h"
#include "CLock.h" #include "CLock.h"
#include "TMethodEventJob.h" #include "TMethodEventJob.h"
#include <cstring>
#include <memory>
// //
// CPacketStreamFilter // CPacketStreamFilter

View File

@ -13,7 +13,8 @@
*/ */
#include "IKeyState.h" #include "IKeyState.h"
#include <string.h> #include <cstring>
#include <cstdlib>
// //
// IKeyState // IKeyState

View File

@ -13,6 +13,7 @@
*/ */
#include "IPrimaryScreen.h" #include "IPrimaryScreen.h"
#include <cstdlib>
// //
// IPrimaryScreen // IPrimaryScreen