From b65bb93e6711a3543228928e6793c49481df54d6 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 24 Jun 2011 03:17:00 +0000 Subject: [PATCH] Fix build issues with Visual C++ (implemented macro version of snprintf + re-ordered headers to ensure that winsock is included ahead of windows.h) git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4527 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- vncviewer/CConn.cxx | 6 ++++++ vncviewer/DesktopWindow.cxx | 6 +++--- vncviewer/DesktopWindow.h | 6 +++--- vncviewer/OptionsDialog.cxx | 8 ++++---- vncviewer/Viewport.cxx | 10 +++++++--- vncviewer/vncviewer.cxx | 6 +++++- vncviewer/win32.h | 5 +++++ 7 files changed, 33 insertions(+), 14 deletions(-) diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx index 5ae26f0b..8d233f05 100644 --- a/vncviewer/CConn.cxx +++ b/vncviewer/CConn.cxx @@ -18,7 +18,9 @@ */ #include +#ifndef _WIN32 #include +#endif #include #include @@ -37,6 +39,10 @@ #include "i18n.h" #include "parameters.h" +#ifdef WIN32 +#include "win32.h" +#endif + using namespace rdr; using namespace rfb; using namespace std; diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx index 456e372f..859d2b63 100644 --- a/vncviewer/DesktopWindow.cxx +++ b/vncviewer/DesktopWindow.cxx @@ -21,9 +21,6 @@ #include #include -#include -#include - #include #include "DesktopWindow.h" @@ -31,6 +28,9 @@ #include "i18n.h" #include "parameters.h" +#include +#include + #ifdef WIN32 #include "win32.h" #endif diff --git a/vncviewer/DesktopWindow.h b/vncviewer/DesktopWindow.h index 08483066..a190b700 100644 --- a/vncviewer/DesktopWindow.h +++ b/vncviewer/DesktopWindow.h @@ -22,13 +22,13 @@ #include -#include -#include - #include #include "Viewport.h" +#include +#include + class CConn; class DesktopWindow : public Fl_Window { diff --git a/vncviewer/OptionsDialog.cxx b/vncviewer/OptionsDialog.cxx index abe6a89d..d3928b50 100644 --- a/vncviewer/OptionsDialog.cxx +++ b/vncviewer/OptionsDialog.cxx @@ -20,10 +20,6 @@ #include -#include -#include -#include - #include #include @@ -38,6 +34,10 @@ #include "i18n.h" #include "parameters.h" +#include +#include +#include + using namespace std; using namespace rdr; using namespace rfb; diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx index 8d57e9bd..80b48545 100644 --- a/vncviewer/Viewport.cxx +++ b/vncviewer/Viewport.cxx @@ -21,9 +21,6 @@ #include #include -#include -#include - #include #include @@ -46,6 +43,13 @@ #include "parameters.h" #include "keysym2ucs.h" +#include +#include + +#ifdef WIN32 +#include "win32.h" +#endif + using namespace rfb; using namespace rdr; diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx index b9e8ab56..41d3796c 100644 --- a/vncviewer/vncviewer.cxx +++ b/vncviewer/vncviewer.cxx @@ -1,6 +1,6 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. * Copyright 2011 Pierre Ossman for Cendio AB - * Copyright (C) 2011 D. R. Commander + * Copyright (C) 2011 D. R. Commander. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -53,6 +53,10 @@ #include "ServerDialog.h" #include "UserDialog.h" +#ifdef WIN32 +#include "win32.h" +#endif + rfb::LogWriter vlog("main"); using namespace network; diff --git a/vncviewer/win32.h b/vncviewer/win32.h index 0cc1c113..35be77b5 100644 --- a/vncviewer/win32.h +++ b/vncviewer/win32.h @@ -1,5 +1,6 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. * Copyright 2011 Pierre Ossman for Cendio AB + * Copyright (C) 2011 D. R. Commander. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +21,10 @@ #ifndef __VNCVIEWER_WIN32_H__ #define __VNCVIEWER_WIN32_H__ +#ifdef _MSC_VER +#define snprintf(str, n, format, ...) _snprintf_s(str, n, _TRUNCATE, format, __VA_ARGS__) +#endif + extern "C" { int win32_enable_lowlevel_keyboard(HWND hwnd); -- 2.39.5