[Pkg-mpd-commits] [qmpdclient] 09/38: Fix compilation under MSVC
Andrey Rahmatullin
wrar at moszumanska.debian.org
Mon May 23 07:19:44 UTC 2016
This is an automated email from the git hooks/post-receive script.
wrar pushed a commit to branch master
in repository qmpdclient.
commit b8b42a20e2d27de3fa0c5fa9ace5f19f5bfe5873
Author: Denis Krjuchkov <denis at crazydev.net>
Date: Wed Mar 28 02:05:06 2012 +0600
Fix compilation under MSVC
---
CMakeLists.txt | 4 ++++
src/libmpdclient.c | 13 +++++++++++--
src/libmpdclient.h | 4 +++-
src/mpdsong.h | 5 +++++
src/mpdstatus.cpp | 2 +-
5 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cc821b1..dd71b9f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,6 +11,10 @@ SET (QT_USE_QTNETWORK TRUE)
SET (QT_USE_QTXMLPATTERNS TRUE)
SET (QT_USE_QTXML TRUE)
+if(WIN32)
+ SET (QT_USE_QTMAIN TRUE)
+endif()
+
if(NOT DEFINED VERSION)
find_program (GIT_CMD git)
execute_process (COMMAND "${GIT_CMD}" describe
diff --git a/src/libmpdclient.c b/src/libmpdclient.c
index 490f619..567d4bc 100644
--- a/src/libmpdclient.c
+++ b/src/libmpdclient.c
@@ -30,23 +30,32 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifdef _MSC_VER
+# define _CRT_SECURE_NO_DEPRECATE 1
+# define _CRT_NONSTDC_NO_DEPRECATE 1
+#endif
+
#include "libmpdclient.h"
#include <errno.h>
#include <ctype.h>
#include <sys/types.h>
#include <stdio.h>
-#include <sys/param.h>
#include <string.h>
-#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <limits.h>
+#ifdef _MSC_VER
+# define snprintf _snprintf
+#endif
+
#ifdef WIN32
# include <ws2tcpip.h>
# include <winsock.h>
#else
+# include <sys/param.h>
+# include <unistd.h>
# include <netinet/in.h>
# include <arpa/inet.h>
# include <sys/socket.h>
diff --git a/src/libmpdclient.h b/src/libmpdclient.h
index 111d52a..5e72ff3 100644
--- a/src/libmpdclient.h
+++ b/src/libmpdclient.h
@@ -35,9 +35,11 @@
#ifdef WIN32
# define __W32API_USE_DLLIMPORT__ 1
+# include <winsock2.h> /* for timeval */
+#else
+# include <sys/time.h>
#endif
-#include <sys/time.h>
#include <stdarg.h>
#define MPD_BUFFER_MAX_LENGTH 50000
#define MPD_ERRORSTR_MAX_LENGTH 1000
diff --git a/src/mpdsong.h b/src/mpdsong.h
index 3ab32b0..d40c9bb 100644
--- a/src/mpdsong.h
+++ b/src/mpdsong.h
@@ -26,6 +26,11 @@ class QRegExp;
struct MPDSongPrivate;
struct mpd_InfoEntity;
+// wingdi.h defines this to 0
+#ifdef ERROR
+# undef ERROR
+#endif
+
class MPDSong {
public:
enum Type { ERROR, SONG, STREAM, PLAYLIST, PLAYLISTSONG, PLAYLISTSTREAM, UNKNOWN };
diff --git a/src/mpdstatus.cpp b/src/mpdstatus.cpp
index 5a4fed8..2105964 100644
--- a/src/mpdstatus.cpp
+++ b/src/mpdstatus.cpp
@@ -73,7 +73,7 @@ MPDStatus::MPDStatus(const MPDStatus &other) : d(other.d) {}
MPDStatus::~MPDStatus() {}
-int MPDStatus::MPDStatus::volume() const {
+int MPDStatus::volume() const {
Q_ASSERT(d);
return d->volume;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mpd/qmpdclient.git
More information about the Pkg-mpd-commits
mailing list