Skip to content
This repository has been archived by the owner on Apr 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5 from janbar/2.0.10
Browse files Browse the repository at this point in the history
Sync with API 1.9.6
  • Loading branch information
hudokkow committed Mar 31, 2015
2 parents 59d0ddf + f2ad530 commit ef9cf41
Show file tree
Hide file tree
Showing 16 changed files with 93 additions and 97 deletions.
4 changes: 2 additions & 2 deletions lib/cppmyth/CMakeLists.txt
Expand Up @@ -110,7 +110,7 @@ file (GLOB SRC_FILES
file (GLOB HDR_FILES
src/proto/*.h src/*.h)

if (MSVC)
if (WIN32)
file (GLOB PLATFORM_SRC_FILES
src/private/platform/windows/*.cpp)
endif ()
Expand All @@ -121,7 +121,7 @@ set (CPPMYTH_SOURCES
###############################################################################
# add targets
set (cppmyth_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
if (MSVC)
if (WIN32)
list (APPEND cppmyth_LIBRARIES ws2_32)
else ()
list (APPEND cppmyth_LIBRARIES m)
Expand Down
8 changes: 4 additions & 4 deletions lib/cppmyth/src/mythtypes.cpp
Expand Up @@ -97,7 +97,7 @@ typedef struct
const char *sVal;
} protoref_t;

int __tValFromString(protoref_t *map, unsigned sz, unsigned proto, const std::string& sVal, int unk)
static int __tValFromString(protoref_t *map, unsigned sz, unsigned proto, const std::string& sVal, int unk)
{
for (unsigned i = 0; i < sz; ++i)
{
Expand All @@ -107,7 +107,7 @@ int __tValFromString(protoref_t *map, unsigned sz, unsigned proto, const std::st
return unk;
}

int __tValFromNum(protoref_t *map, unsigned sz, unsigned proto, int iVal, int unk)
static int __tValFromNum(protoref_t *map, unsigned sz, unsigned proto, int iVal, int unk)
{
for (unsigned i = 0; i < sz; ++i)
{
Expand All @@ -117,7 +117,7 @@ int __tValFromNum(protoref_t *map, unsigned sz, unsigned proto, int iVal, int un
return unk;
}

const char *__tValToString(protoref_t *map, unsigned sz, unsigned proto, int tVal, const char *unk)
static const char *__tValToString(protoref_t *map, unsigned sz, unsigned proto, int tVal, const char *unk)
{
for (unsigned i = 0; i < sz; ++i)
{
Expand All @@ -127,7 +127,7 @@ const char *__tValToString(protoref_t *map, unsigned sz, unsigned proto, int tVa
return unk;
}

int __tValToNum(protoref_t *map, unsigned sz, unsigned proto, int tVal, int unk)
static int __tValToNum(protoref_t *map, unsigned sz, unsigned proto, int tVal, int unk)
{
for (unsigned i = 0; i < sz; ++i)
{
Expand Down
12 changes: 6 additions & 6 deletions lib/cppmyth/src/private/mythsocket.cpp
Expand Up @@ -26,7 +26,7 @@
#include <cstdio>
#include <cstring>

#if defined _MSC_VER
#ifdef __WINDOWS__
#include <Ws2tcpip.h>
#define SHUT_RDWR SD_BOTH
#define SHUT_WR SD_SEND
Expand All @@ -42,7 +42,7 @@ typedef int socklen_t;
#include <arpa/inet.h>
#define closesocket(a) close(a)
#define LASTERROR errno
#endif /* _MSC_VER */
#endif /* __WINDOWS__ */

#include <signal.h>

Expand Down Expand Up @@ -74,7 +74,7 @@ TcpSocket::~TcpSocket()

static int __connectAddr(struct addrinfo *addr, tcp_socket_t *s, int rcvbuf)
{
#ifndef _MSC_VER
#ifndef __WINDOWS__
void (*old_sighandler)(int);
int old_alarm;
#endif
Expand Down Expand Up @@ -103,7 +103,7 @@ static int __connectAddr(struct addrinfo *addr, tcp_socket_t *s, int rcvbuf)
if (getsockopt(*s, SOL_SOCKET, SO_RCVBUF, (char *)&opt_rcvbuf, &size))
DBG(MYTH_DBG_WARN, "%s: could not get rcvbuf from socket (%d)\n", __FUNCTION__, LASTERROR);

#ifndef _MSC_VER
#ifndef __WINDOWS__
old_sighandler = signal(SIGALRM, __sigHandler);
old_alarm = alarm(5);
#endif
Expand All @@ -113,14 +113,14 @@ static int __connectAddr(struct addrinfo *addr, tcp_socket_t *s, int rcvbuf)
err = LASTERROR;
DBG(MYTH_DBG_ERROR, "%s: failed to connect (%d)\n", __FUNCTION__, err);
closesocket(*s);
#ifndef _MSC_VER
#ifndef __WINDOWS__
signal(SIGALRM, old_sighandler);
alarm(old_alarm);
#endif
return err;
}
my_socket = INVALID_SOCKET_VALUE;
#ifndef _MSC_VER
#ifndef __WINDOWS__
signal(SIGALRM, old_sighandler);
alarm(old_alarm);
#endif
Expand Down
23 changes: 7 additions & 16 deletions lib/cppmyth/src/private/platform/posix/os-types.h
Expand Up @@ -32,14 +32,10 @@
* http://www.pulse-eight.net/
*/

#define _FILE_OFFSET_BITS 64
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <sys/time.h>
#if !defined(__APPLE__) && !defined(__FreeBSD__)
#include <sys/prctl.h>
#endif
#include <pthread.h>
#include <poll.h>
#include <semaphore.h>
Expand All @@ -51,9 +47,6 @@
#endif
#include <inttypes.h>

#define LIBTYPE
#define DECLSPEC

typedef int socket_t;
typedef socket_t tcp_socket_t;
#define INVALID_SOCKET_VALUE (-1)
Expand All @@ -64,14 +57,14 @@ typedef long LONG;
typedef LONG HRESULT;

#define _FILE_OFFSET_BITS 64
#define FILE_BEGIN 0
#define FILE_CURRENT 1
#define FILE_END 2
#define FILE_BEGIN SEEK_SET
#define FILE_CURRENT SEEK_CUR
#define FILE_END SEEK_END

// Success codes
#define S_OK 0L
#define S_FALSE 1L
#define FAILED(Status) ((HRESULT)(Status)<0)
#define S_OK 0L
#define S_FALSE 1L
#define FAILED(hr) (((HRESULT)(hr)) < 0)
#define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0)

// Error codes
Expand Down Expand Up @@ -100,9 +93,7 @@ typedef LONG HRESULT;
typedef fpos_t fpos64_t;
#define __stat64 stat
#define stat64 stat
#if defined(TARGET_DARWIN_IOS)
#define statfs64 statfs
#endif
#define statfs64 statfs
#define fstat64 fstat
#elif defined(__FreeBSD__)
#include <stdio.h> // for fpos_t
Expand Down
4 changes: 2 additions & 2 deletions lib/cppmyth/src/private/platform/threads/mutex.h
Expand Up @@ -53,8 +53,8 @@ namespace PLATFORM
inline ~PreventCopy(void) {}

private:
inline PreventCopy(const PreventCopy &c) { *this = c; }
inline PreventCopy &operator=(const PreventCopy &c){ *this = c; return *this; }
inline PreventCopy(const PreventCopy &c) { (void)c; }
inline PreventCopy &operator=(const PreventCopy &c) { (void)c; return *this; }
};

template <typename _Predicate>
Expand Down
2 changes: 1 addition & 1 deletion lib/cppmyth/src/private/platform/util/timeutils.h
Expand Up @@ -75,7 +75,7 @@ namespace PLATFORM
#endif
}

template <class T>
template <typename T>
inline T GetTimeSec()
{
return (T)GetTimeMs() / (T)1000.0;
Expand Down
8 changes: 2 additions & 6 deletions lib/cppmyth/src/private/platform/windows/inttypes.h
Expand Up @@ -29,17 +29,13 @@
//
///////////////////////////////////////////////////////////////////////////////

#ifndef _MSC_VER // [
#ifndef __WINDOWS__ // [
#error "Use this header only with Microsoft Visual C++ compilers!"
#endif // _MSC_VER ]
#endif // __WINDOWS__ ]

#ifndef _MSC_INTTYPES_H_ // [
#define _MSC_INTTYPES_H_

#if _MSC_VER > 1000
#pragma once
#endif

#include "stdint.h"

// 7.8 Format conversion of integer types
Expand Down
76 changes: 35 additions & 41 deletions lib/cppmyth/src/private/platform/windows/os-types.h
Expand Up @@ -36,35 +36,17 @@
#define __WINDOWS__
#endif

#ifndef _WINSOCKAPI_
#define _WINSOCKAPI_
#endif

#define WIN32_LEAN_AND_MEAN // Enable LEAN_AND_MEAN support
#define NOMINMAX // don't define min() and max() to prevent a clash with std::min() and std::max
#include <windows.h>
#include <wchar.h>
/* Enable LEAN_AND_MEAN support */
#define WIN32_LEAN_AND_MEAN

/* String to 64-bit int */
#if (_MSC_VER < 1800)
#define atoll(S) _atoi64(S)
/* Don't define min() and max() to prevent a clash with std::min() and std::max */
#ifndef NOMINMAX
#define NOMINMAX
#endif

/* Platform dependent path separator */
#ifndef PATH_SEPARATOR_CHAR
#define PATH_SEPARATOR_CHAR '\\'
#define PATH_SEPARATOR_STRING "\\"
#endif

/* Handling of 2-byte Windows wchar strings */
#define WcsLen wcslen
#define WcsToMbs wcstombs
typedef wchar_t Wchar_t; /* sizeof(wchar_t) = 2 bytes on Windows */

#pragma warning(disable:4005) // Disable "warning C4005: '_WINSOCKAPI_' : macro redefinition"
#include <winsock2.h>
#pragma warning(default:4005)

#include <windows.h>
#include <wchar.h>
#include <time.h>
#include <sys/timeb.h>
#include <io.h>
Expand All @@ -78,11 +60,25 @@ typedef wchar_t Wchar_t; /* sizeof(wchar_t) = 2 bytes on Windows */
#endif
#include "inttypes.h"

/* prevent inclusion of wingdi.h */
#define NOGDI

typedef SOCKET tcp_socket_t;
#define INVALID_SOCKET_VALUE INVALID_SOCKET
typedef HANDLE serial_socket_t;
#define INVALID_SERIAL_SOCKET_VALUE INVALID_HANDLE_VALUE

/* Platform dependent path separator */
#ifndef PATH_SEPARATOR_CHAR
#define PATH_SEPARATOR_CHAR '\\'
#define PATH_SEPARATOR_STRING "\\"
#endif

/* Handling of 2-byte Windows wchar strings */
#define WcsLen wcslen
#define WcsToMbs wcstombs
typedef wchar_t Wchar_t; /* sizeof(wchar_t) = 2 bytes on Windows */

#ifndef _SSIZE_T_DEFINED
#ifdef _WIN64
typedef __int64 ssize_t;
Expand All @@ -95,12 +91,26 @@ typedef _W64 int ssize_t;
#define usleep(t) Sleep((DWORD)(t)/1000)
#define sleep(t) Sleep((DWORD)(t)*1000)

/* Microsoft Visual C++ compilers */
#if defined(_MSC_VER)

struct timezone
{
int tz_minuteswest;
int tz_dsttime;
};

/* String to 64-bit int */
#if (_MSC_VER < 1800)
#define atoll(S) _atoi64(S)
#endif

/* Prevent deprecation warnings */
#define snprintf _snprintf
#define strnicmp _strnicmp

#endif /* _MSC_VER */

#define gettimeofday __gettimeofday
__inline int gettimeofday(struct timeval *pcur_time, struct timezone *tz)
{
Expand All @@ -120,19 +130,3 @@ __inline int gettimeofday(struct timeval *pcur_time, struct timezone *tz)
}
return 0;
}

/* Prevent deprecation warnings */
#define snprintf _snprintf
#define strnicmp _strnicmp

#if defined(_MSC_VER)
#pragma warning (push)
#endif

#define NOGDI
#if defined(_MSC_VER) /* prevent inclusion of wingdi.h */
#pragma warning (pop)
#endif

#pragma warning(disable:4189) /* disable 'defined but not used' */
#pragma warning(disable:4100) /* disable 'unreferenced formal parameter' */
4 changes: 2 additions & 2 deletions lib/cppmyth/src/proto/mythprotoplayback.cpp
Expand Up @@ -28,12 +28,12 @@
#include <limits>
#include <cstdio>

#if defined _MSC_VER
#ifdef __WINDOWS__
#include <Ws2tcpip.h>
#else
#include <sys/socket.h> // for recv
#include <sys/select.h> // for select
#endif /* _MSC_VER */
#endif /* __WINDOWS__ */

using namespace Myth;

Expand Down
4 changes: 2 additions & 2 deletions pvr.mythtv/addon.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="pvr.mythtv"
version="2.0.9"
version="2.0.10"
name="MythTV PVR Client"
provider-name="Christian Fetzer, Jean-Luc Barrière">
<requires>
<c-pluff version="0.1"/>
<import addon="xbmc.pvr" version="1.9.5"/>
<import addon="xbmc.pvr" version="1.9.6"/>
<import addon="xbmc.gui" version="5.8.0"/>
<import addon="xbmc.codec" version="1.0.1"/>
</requires>
Expand Down
3 changes: 3 additions & 0 deletions pvr.mythtv/changelog.txt
@@ -1,3 +1,6 @@
v2.0.10
- Updated to API 1.9.6

v2.0.9
- Process subscription queue in separated thread

Expand Down

0 comments on commit ef9cf41

Please sign in to comment.