Replaced WIN32 macro by _WIN32

This commit is contained in:
Thomas Bernard 2012-01-21 14:38:38 +01:00
parent 86c20047ee
commit 35e25ab375
13 changed files with 73 additions and 70 deletions

View File

@ -1,6 +1,9 @@
$Id: Changelog.txt,v 1.157 2012/01/07 10:13:24 nanard Exp $
$Id: Changelog.txt,v 1.160 2012/01/21 13:30:31 nanard Exp $
miniUPnP client Changelog.
2012/01/21:
Replace WIN32 macro by _WIN32
2012/01/19:
Fixes in java wrappers thanks to Alexey Kuznetsov :
https://github.com/axet/miniupnp/tree/fix-javatest/miniupnpc

View File

@ -1,7 +1,7 @@
/* $Id: connecthostport.c,v 1.5 2011/04/09 08:49:50 nanard Exp $ */
/* $Id: connecthostport.c,v 1.6 2012/01/21 13:30:31 nanard Exp $ */
/* Project : miniupnp
* Author : Thomas Bernard
* Copyright (c) 2010-2011 Thomas Bernard
* Copyright (c) 2010-2012 Thomas Bernard
* This software is subject to the conditions detailed in the
* LICENCE file provided in this distribution. */
@ -13,7 +13,7 @@
#include <string.h>
#include <stdio.h>
#ifdef WIN32
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#include <io.h>
@ -21,7 +21,7 @@
#define snprintf _snprintf
#define herror
#define socklen_t int
#else /* #ifdef WIN32 */
#else /* #ifdef _WIN32 */
#include <unistd.h>
#include <sys/param.h>
#include <errno.h>
@ -34,10 +34,10 @@
#include <sys/types.h>
#include <sys/socket.h>
#endif /* #ifndef USE_GETHOSTBYNAME */
#endif /* #else WIN32 */
#endif /* #else _WIN32 */
/* definition of PRINT_SOCKET_ERROR */
#ifdef WIN32
#ifdef _WIN32
#define PRINT_SOCKET_ERROR(x) printf("Socket error: %s, %d\n", x, WSAGetLastError());
#else
#define PRINT_SOCKET_ERROR(x) perror(x)
@ -160,7 +160,7 @@ int connecthostport(const char * host, unsigned short port)
n = getaddrinfo(tmp_host, port_str, &hints, &ai);
if(n != 0)
{
#ifdef WIN32
#ifdef _WIN32
fprintf(stderr, "getaddrinfo() error : %d\n", n);
#else
fprintf(stderr, "getaddrinfo() error : %s\n", gai_strerror(n));

View File

@ -1,7 +1,7 @@
#ifndef __DECLSPEC_H__
#define __DECLSPEC_H__
#if defined(WIN32) && !defined(STATICLIB)
#if defined(_WIN32) && !defined(STATICLIB)
#ifdef MINIUPNP_EXPORTS
#define LIBSPEC __declspec(dllexport)
#else

View File

@ -1,7 +1,7 @@
/* $Id: minisoap.c,v 1.21 2011/03/22 19:15:35 nanard Exp $ */
/* $Id: minisoap.c,v 1.22 2012/01/21 13:30:31 nanard Exp $ */
/* Project : miniupnp
* Author : Thomas Bernard
* Copyright (c) 2005-2009 Thomas Bernard
* Copyright (c) 2005-2012 Thomas Bernard
* This software is subject to the conditions detailed in the
* LICENCE file provided in this distribution.
*
@ -9,7 +9,7 @@
*/
#include <stdio.h>
#include <string.h>
#ifdef WIN32
#ifdef _WIN32
#include <io.h>
#include <winsock2.h>
#define snprintf _snprintf
@ -24,7 +24,7 @@
/* only for malloc */
#include <stdlib.h>
#ifdef WIN32
#ifdef _WIN32
#define PRINT_SOCKET_ERROR(x) printf("Socket error: %s, %d\n", x, WSAGetLastError());
#else
#define PRINT_SOCKET_ERROR(x) perror(x)
@ -57,7 +57,7 @@ httpWrite(int fd, const char * body, int bodysize,
/* disable send on the socket */
/* draytek routers dont seems to like that... */
#if 0
#ifdef WIN32
#ifdef _WIN32
if(shutdown(fd, SD_SEND)<0) {
#else
if(shutdown(fd, SHUT_WR)<0) { /*SD_SEND*/

View File

@ -1,7 +1,8 @@
/* $Id: minissdpc.c,v 1.14 2010/11/25 09:57:25 nanard Exp $ */
/* $Id: minissdpc.c,v 1.15 2012/01/21 13:30:31 nanard Exp $ */
/* Project : miniupnp
* Web : http://miniupnp.free.fr/
* Author : Thomas BERNARD
* copyright (c) 2005-2009 Thomas Bernard
* copyright (c) 2005-2012 Thomas Bernard
* This software is subjet to the conditions detailed in the
* provided LICENCE file. */
/*#include <syslog.h>*/
@ -10,8 +11,8 @@
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#if defined(WIN32) || defined(__amigaos__) || defined(__amigaos4__)
#ifdef WIN32
#if defined(_WIN32) || defined(__amigaos__) || defined(__amigaos4__)
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#include <io.h>

View File

@ -1,7 +1,8 @@
/* $Id: miniupnpc.c,v 1.100 2012/01/12 09:54:34 nanard Exp $ */
/* $Id: miniupnpc.c,v 1.101 2012/01/21 13:30:31 nanard Exp $ */
/* Project : miniupnp
* Web : http://miniupnp.free.fr/
* Author : Thomas BERNARD
* copyright (c) 2005-2011 Thomas Bernard
* copyright (c) 2005-2012 Thomas Bernard
* This software is subjet to the conditions detailed in the
* provided LICENSE file. */
#define __EXTENSIONS__ 1
@ -23,7 +24,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef WIN32
#ifdef _WIN32
/* Win32 Specific includes and defines */
#include <winsock2.h>
#include <ws2tcpip.h>
@ -38,7 +39,7 @@
#endif /* defined(_MSC_VER) && (_MSC_VER >= 1400) */
#endif /* #ifndef strncasecmp */
#define MAXHOSTNAMELEN 64
#else /* #ifdef WIN32 */
#else /* #ifdef _WIN32 */
/* Standard POSIX includes */
#include <unistd.h>
#if defined(__amigaos__) && !defined(__amigaos4__)
@ -60,7 +61,7 @@
#include <strings.h>
#include <errno.h>
#define closesocket close
#endif /* #else WIN32 */
#endif /* #else _WIN32 */
#ifdef MINIUPNPC_SET_SOCKET_TIMEOUT
#include <sys/time.h>
#endif
@ -78,7 +79,7 @@
#include "connecthostport.h"
#include "receivedata.h"
#ifdef WIN32
#ifdef _WIN32
#define PRINT_SOCKET_ERROR(x) printf("Socket error: %s, %d\n", x, WSAGetLastError());
#else
#define PRINT_SOCKET_ERROR(x) perror(x)
@ -357,14 +358,14 @@ upnpDiscover(int delay, const char * multicastif,
int rv;
struct addrinfo hints, *servinfo, *p;
#endif
#ifdef WIN32
#ifdef _WIN32
MIB_IPFORWARDROW ip_forward;
#endif
int linklocal = 1;
if(error)
*error = UPNPDISCOVER_UNKNOWN_ERROR;
#if !defined(WIN32) && !defined(__amigaos__) && !defined(__amigaos4__)
#if !defined(_WIN32) && !defined(__amigaos__) && !defined(__amigaos4__)
/* first try to get infos from minissdpd ! */
if(!minissdpdsock)
minissdpdsock = "/var/run/minissdpd.sock";
@ -382,7 +383,7 @@ upnpDiscover(int delay, const char * multicastif,
deviceIndex = 0;
#endif
/* fallback to direct discovery */
#ifdef WIN32
#ifdef _WIN32
sudp = socket(ipv6 ? PF_INET6 : PF_INET, SOCK_DGRAM, IPPROTO_UDP);
#else
sudp = socket(ipv6 ? PF_INET6 : PF_INET, SOCK_DGRAM, 0);
@ -409,7 +410,7 @@ upnpDiscover(int delay, const char * multicastif,
p->sin_port = htons(PORT);
p->sin_addr.s_addr = INADDR_ANY;
}
#ifdef WIN32
#ifdef _WIN32
/* This code could help us to use the right Network interface for
* SSDP multicast traffic */
/* Get IP associated with the index given in the ip_forward struct
@ -469,7 +470,7 @@ upnpDiscover(int delay, const char * multicastif,
}
#endif
#ifdef WIN32
#ifdef _WIN32
if (setsockopt(sudp, SOL_SOCKET, SO_REUSEADDR, (const char *)&opt, sizeof (opt)) < 0)
#else
if (setsockopt(sudp, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof (opt)) < 0)
@ -484,7 +485,7 @@ upnpDiscover(int delay, const char * multicastif,
if(multicastif)
{
if(ipv6) {
#if !defined(WIN32)
#if !defined(_WIN32)
/* according to MSDN, if_nametoindex() is supported since
* MS Windows Vista and MS Windows Server 2008.
* http://msdn.microsoft.com/en-us/library/bb408409%28v=vs.85%29.aspx */
@ -594,7 +595,7 @@ upnpDiscover(int delay, const char * multicastif,
XSTR(PORT), &hints, &servinfo)) != 0) {
if(error)
*error = UPNPDISCOVER_SOCKET_ERROR;
#ifdef WIN32
#ifdef _WIN32
fprintf(stderr, "getaddrinfo() failed: %d\n", rv);
#else
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv));

View File

@ -1,8 +1,8 @@
/* $Id: miniupnpcmodule.c,v 1.18 2011/04/10 11:21:23 nanard Exp $*/
/* $Id: miniupnpcmodule.c,v 1.19 2012/01/21 13:30:32 nanard Exp $*/
/* Project : miniupnp
* Author : Thomas BERNARD
* website : http://miniupnp.tuxfamily.org/
* copyright (c) 2007-2009 Thomas Bernard
* copyright (c) 2007-2012 Thomas Bernard
* This software is subjet to the conditions detailed in the
* provided LICENCE file. */
#include <Python.h>
@ -472,7 +472,7 @@ static PyTypeObject UPnPType = {
0, /* tp_dictoffset */
0,/*(initproc)UPnP_init,*/ /* tp_init */
0, /* tp_alloc */
#ifndef WIN32
#ifndef _WIN32
PyType_GenericNew,/*UPnP_new,*/ /* tp_new */
#else
0,
@ -492,7 +492,7 @@ initminiupnpc(void)
{
PyObject* m;
#ifdef WIN32
#ifdef _WIN32
UPnPType.tp_new = PyType_GenericNew;
#endif
if (PyType_Ready(&UPnPType) < 0)

View File

@ -1,7 +1,8 @@
/* $Id: miniwget.c,v 1.53 2012/01/20 22:07:06 nanard Exp $ */
/* $Id: miniwget.c,v 1.54 2012/01/21 13:30:32 nanard Exp $ */
/* Project : miniupnp
* Website : http://miniupnp.free.fr/
* Author : Thomas Bernard
* Copyright (c) 2005-2011 Thomas Bernard
* Copyright (c) 2005-2012 Thomas Bernard
* This software is subject to the conditions detailed in the
* LICENCE file provided in this distribution. */
@ -9,7 +10,7 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#ifdef WIN32
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#include <io.h>
@ -24,7 +25,7 @@
#define strncasecmp memicmp
#endif /* defined(_MSC_VER) && (_MSC_VER >= 1400) */
#endif /* #ifndef strncasecmp */
#else /* #ifdef WIN32 */
#else /* #ifdef _WIN32 */
#include <unistd.h>
#include <sys/param.h>
#if defined(__amigaos__) && !defined(__amigaos4__)
@ -40,7 +41,7 @@
/* defining MINIUPNPC_IGNORE_EINTR enable the ignore of interruptions
* during the connect() call */
#define MINIUPNPC_IGNORE_EINTR
#endif /* #else WIN32 */
#endif /* #else _WIN32 */
#if defined(__sun) || defined(sun)
#define MIN(x,y) (((x)<(y))?(x):(y))
#endif
@ -344,7 +345,7 @@ miniwget3(const char * url, const char * host,
NULL, 0,
NI_NUMERICHOST | NI_NUMERICSERV);
if(n != 0) {
#ifdef WIN32
#ifdef _WIN32
fprintf(stderr, "getnameinfo() failed : %d\n", n);
#else
fprintf(stderr, "getnameinfo() failed : %s\n", gai_strerror(n));
@ -508,7 +509,7 @@ void * miniwget_getaddr(const char * url, int * size, char * addr, int addrlen)
{
unsigned short port;
char * path;
/* protocol://host:port/chemin */
/* protocol://host:port/path */
char hostname[MAXHOSTNAMELEN+1];
*size = 0;
if(addr)

View File

@ -1,7 +1,7 @@
/* $Id: portlistingparse.h,v 1.4 2011/02/15 23:03:56 nanard Exp $ */
/* $Id: portlistingparse.h,v 1.5 2012/01/21 13:30:33 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2011 Thomas Bernard
* (c) 2011-2012 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
#ifndef __PORTLISTINGPARSE_H__
@ -11,7 +11,7 @@
/* for the definition of UNSIGNED_INTEGER */
#include "miniupnpctypes.h"
#if defined(NO_SYS_QUEUE_H) || defined(WIN32) || defined(__HAIKU__)
#if defined(NO_SYS_QUEUE_H) || defined(_WIN32) || defined(__HAIKU__)
#include "bsdqueue.h"
#else
#include <sys/queue.h>

View File

@ -1,12 +1,13 @@
/* $Id: receivedata.c,v 1.1 2011/04/11 08:21:47 nanard Exp $ */
/* $Id: receivedata.c,v 1.2 2012/01/21 13:30:33 nanard Exp $ */
/* Project : miniupnp
* Website : http://miniupnp.free.fr/
* Author : Thomas Bernard
* Copyright (c) 2011 Thomas Bernard
* Copyright (c) 2011-2012 Thomas Bernard
* This software is subject to the conditions detailed in the
* LICENCE file provided in this distribution. */
#include <stdio.h>
#ifdef WIN32
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#else
@ -24,7 +25,7 @@
#define MINIUPNPC_IGNORE_EINTR
#endif
#ifdef WIN32
#ifdef _WIN32
#define PRINT_SOCKET_ERROR(x) printf("Socket error: %s, %d\n", x, WSAGetLastError());
#else
#define PRINT_SOCKET_ERROR(x) perror(x)
@ -36,7 +37,7 @@ int
receivedata(int socket, char * data, int length, int timeout)
{
int n;
#if !defined(WIN32) && !defined(__amigaos__) && !defined(__amigaos4__)
#if !defined(_WIN32) && !defined(__amigaos__) && !defined(__amigaos4__)
/* using poll */
struct pollfd fds[1]; /* for the poll */
#ifdef MINIUPNPC_IGNORE_EINTR
@ -55,8 +56,8 @@ receivedata(int socket, char * data, int length, int timeout)
/* timeout */
return 0;
}
#else /* !defined(WIN32) && !defined(__amigaos__) && !defined(__amigaos4__) */
/* using select under WIN32 and amigaos */
#else /* !defined(_WIN32) && !defined(__amigaos__) && !defined(__amigaos4__) */
/* using select under _WIN32 and amigaos */
fd_set socketSet;
TIMEVAL timeval;
FD_ZERO(&socketSet);

View File

@ -1,7 +1,11 @@
/* $Id: testminixml.c,v 1.6 2006/11/19 22:32:35 nanard Exp $
/* $Id: testminixml.c,v 1.7 2012/01/21 13:30:33 nanard Exp $
* MiniUPnP project
* Website : http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* Author : Thomas Bernard.
* Copyright (c) 2005-2012 Thomas Bernard
*
* testminixml.c
* test program for the "minixml" functions.
* Author : Thomas Bernard.
*/
#include <stdlib.h>
#include <stdio.h>
@ -9,14 +13,6 @@
#include "minixml.h"
#include "igd_desc_parse.h"
#ifdef WIN32
#define NO_BZERO
#endif
#ifdef NO_BZERO
#define bzero(p, n) memset(p, 0, n)
#endif
/* ---------------------------------------------------------------------- */
void printeltname1(void * d, const char * name, int l)
{
@ -47,7 +43,7 @@ void burptest(const char * buffer, int bufsize)
struct IGDdatas data;
struct xmlparser parser;
/*objet IGDdatas */
bzero(&data, sizeof(struct IGDdatas));
memset(&data, 0, sizeof(struct IGDdatas));
/* objet xmlparser */
parser.xmlstart = buffer;
parser.xmlsize = bufsize;

View File

@ -1,7 +1,7 @@
/* $Id: upnpc.c,v 1.90 2012/01/07 10:13:26 nanard Exp $ */
/* $Id: upnpc.c,v 1.91 2012/01/21 13:30:33 nanard Exp $ */
/* Project : miniupnp
* Author : Thomas Bernard
* Copyright (c) 2005-2011 Thomas Bernard
* Copyright (c) 2005-2012 Thomas Bernard
* This software is subject to the conditions detailed in the
* LICENCE file provided in this distribution. */
@ -9,7 +9,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
#ifdef WIN32
#ifdef _WIN32
#include <winsock2.h>
#define snprintf _snprintf
#endif
@ -466,7 +466,7 @@ int main(int argc, char ** argv)
int error = 0;
int ipv6 = 0;
#ifdef WIN32
#ifdef _WIN32
WSADATA wsaData;
int nResult = WSAStartup(MAKEWORD(2,2), &wsaData);
if(nResult != NO_ERROR)

View File

@ -1,14 +1,14 @@
/* $Id: upnpreplyparse.h,v 1.11 2011/02/07 16:17:06 nanard Exp $ */
/* $Id: upnpreplyparse.h,v 1.12 2012/01/21 13:30:33 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2011 Thomas Bernard
* (c) 2006-2012 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
#ifndef __UPNPREPLYPARSE_H__
#define __UPNPREPLYPARSE_H__
#if defined(NO_SYS_QUEUE_H) || defined(WIN32) || defined(__HAIKU__)
#if defined(NO_SYS_QUEUE_H) || defined(_WIN32) || defined(__HAIKU__)
#include "bsdqueue.h"
#else
#include <sys/queue.h>