SF Tracker: Patches - Fedora mingw32 compilation - ID: 3138849

Details:
Hello. I trying compile libupnp-1.6.10 on the Fedora 14 MinGW
Environment and get many errors. I create patch to fix it. With this
patch i can get static library. This patch is very raw.

Submitted: Ivan Romanov (ivanromanov) - 2010-12-16 23:29:19 UTC
This commit is contained in:
Marcelo Roberto Jimenez 2010-12-18 19:29:24 -02:00
parent bb5a80c05b
commit b2a88aa70b
12 changed files with 92 additions and 157 deletions

View File

@ -2,6 +2,16 @@
Version 1.6.11
*******************************************************************************
2010-12-18 Marcelo Roberto Jimenez <mroberto(at)users.sourceforge.net>
SF Tracker: Patches
Fedora mingw32 compilation - ID: 3138849
Details:
Hello. I trying compile libupnp-1.6.10 on the Fedora 14 MinGW
Environment and get many errors. I create patch to fix it. With this
patch i can get static library. This patch is very raw.
Submitted: Ivan Romanov (ivanromanov) - 2010-12-16 23:29:19 UTC
*******************************************************************************
Version 1.6.10

1
THANKS
View File

@ -32,6 +32,7 @@ exempt of errors.
- Glen Masgai
- Hartmut Holzgraefe (hholzgra)
- Ingo Hofmann
- Ivan Romanov (ivanromanov)
- Jiri Zouhar
- John Dennis
- Jonathan Casiot (no_dice)

View File

@ -12,7 +12,7 @@
#ifdef WIN32
#include <iphlpapi.h>
#include <winsock2.h>
#include <Ws2tcpip.h>
#include <ws2tcpip.h>
#define UpnpCloseSocket closesocket
#else /* WIN32 */

View File

@ -72,6 +72,7 @@
#include "soaplib.h"
#include "ThreadPool.h"
#include "sysdep.h"
#include "UpnpStdInt.h"
#include "UpnpUniStd.h" /* for close() */
#include "uuid.h"

View File

@ -29,10 +29,8 @@
*
**************************************************************************/
#include "config.h"
/*!
* \file
*
@ -46,10 +44,8 @@
*
*/
#include "miniserver.h"
#include "httpreadwrite.h"
#include "ithread.h"
#include "ssdplib.h"
@ -59,7 +55,6 @@
#include "upnpapi.h"
#include "upnputil.h"
#include <assert.h>
#include <errno.h>
#include <stdio.h>
@ -67,11 +62,9 @@
#include <string.h>
#include <sys/types.h>
/*! . */
#define APPLICATION_LISTENING_PORT 49152
struct mserv_request_t {
/*! Connection handle. */
SOCKET connfd;
@ -79,7 +72,6 @@ struct mserv_request_t {
struct sockaddr_storage foreign_sockaddr;
};
/*! . */
typedef enum {
/*! . */
@ -90,11 +82,9 @@ typedef enum {
MSERV_STOPPING
} MiniServerState;
/*! . */
uint16_t miniStopSockPort;
/*!
* module vars
*/
@ -103,13 +93,11 @@ static MiniServerCallback gSoapCallback = NULL;
static MiniServerCallback gGenaCallback = NULL;
static MiniServerState gMServState = MSERV_IDLE;
void SetHTTPGetCallback(MiniServerCallback callback)
{
gGetCallback = callback;
}
#ifdef INCLUDE_DEVICE_APIS
void SetSoapCallback(MiniServerCallback callback)
{
@ -122,7 +110,6 @@ void SetGenaCallback(MiniServerCallback callback)
gGenaCallback = callback;
}
#ifdef INTERNAL_WEB_SERVER
/*!
* \brief Based on the type pf message, appropriate callback is issued.
@ -169,7 +156,6 @@ static int dispatch_request(
return 0;
}
/*!
* \brief Send Error Message.
*/
@ -186,7 +172,6 @@ static UPNP_INLINE void handle_error(
http_SendStatusResponse(info, http_error_code, major, minor);
}
/*!
* \brief Free memory assigned for handling request and unitialize socket
* functionality.
@ -201,7 +186,6 @@ static void free_handle_request_arg(
free(request);
}
/*!
* \brief Receive the request and dispatch it for handling.
*/
@ -262,7 +246,6 @@ error_handler:
"miniserver %d: COMPLETE\n", connfd);
}
/*!
* \brief Initilize the thread pool to handle a request, sets priority for the
* job and adds the job to the thread pool.
@ -456,7 +439,6 @@ static void RunMiniServer(
return;
}
/*!
* \brief Returns port to which socket, sockfd, is bound.
*
@ -488,7 +470,6 @@ static int get_port(
return 0;
}
#ifdef INTERNAL_WEB_SERVER
/*!
* \brief Creates a STREAM socket, binds to INADDR_ANY and listens for
@ -519,12 +500,12 @@ static int get_miniserver_sockets(
struct sockaddr_storage __ss_v4;
struct sockaddr_in* serverAddr4 = (struct sockaddr_in*)&__ss_v4;
SOCKET listenfd4;
unsigned short actual_port4;
uint16_t actual_port4;
#ifdef UPNP_ENABLE_IPV6
struct sockaddr_storage __ss_v6;
struct sockaddr_in6* serverAddr6 = (struct sockaddr_in6*)&__ss_v6;
SOCKET listenfd6;
unsigned short actual_port6;
uint16_t actual_port6;
#endif
int ret_code;
int reuseaddr_on = 0;
@ -635,7 +616,7 @@ static int get_miniserver_sockets(
#endif /* IPv6 */
} else {
if (listenfd4 != INVALID_SOCKET) {
unsigned short orig_listen_port4 = listen_port4;
uint16_t orig_listen_port4 = listen_port4;
do {
serverAddr4->sin_port = htons(listen_port4++);
sockError = bind(listenfd4,
@ -673,7 +654,7 @@ static int get_miniserver_sockets(
}
#ifdef UPNP_ENABLE_IPV6
if (listenfd6 != INVALID_SOCKET) {
unsigned short orig_listen_port6 = listen_port6;
uint16_t orig_listen_port6 = listen_port6;
do {
serverAddr6->sin6_port = htons(listen_port6++);
sockError = bind(listenfd6,
@ -763,7 +744,6 @@ static int get_miniserver_sockets(
}
#endif /* INTERNAL_WEB_SERVER */
/*!
* \brief Creates the miniserver STOP socket. This socket is created and
* listened on to know when it is time to stop the Miniserver.
@ -832,10 +812,10 @@ static UPNP_INLINE void InitMiniServerSockArray(MiniServerSockArray *miniSocket)
int StartMiniServer(
/*! [in,out] Port on which the server listens for incoming IPv4
* connections. */
unsigned short *listen_port4,
uint16_t *listen_port4,
/*! [in,out] Port on which the server listens for incoming IPv6
* connections. */
unsigned short *listen_port6)
uint16_t *listen_port6)
{
int ret_code;
int count;
@ -921,7 +901,6 @@ int StartMiniServer(
return UPNP_E_SUCCESS;
}
int StopMiniServer()
{
char errorBuffer[ERROR_BUFFER_LEN];
@ -960,4 +939,3 @@ int StopMiniServer()
return 0;
}

View File

@ -78,22 +78,19 @@ int http_FixStrUrl(
/*! [out] Fixed and corrected URL. */
uri_type *fixed_url);
/************************************************************************
* Function: http_Connect
/*!
* \brief Gets destination address from URL and then connects to the
* remote end.
*
* Parameters:
* IN uri_type* destination_url; URL containing destination information
* OUT uri_type *url; Fixed and corrected URL
*
* Description:
* Gets destination address from URL and then connects to the remote end
*
* Returns:
* socket descriptor on success
* UPNP_E_OUTOF_SOCKET
* UPNP_E_SOCKET_CONNECT on error
************************************************************************/
int http_Connect( IN uri_type* destination_url, OUT uri_type *url );
* \return Socket descriptor on success, or on error:
* \li \c UPNP_E_OUTOF_SOCKET
* \li \c UPNP_E_SOCKET_CONNECT
*/
SOCKET http_Connect(
/*! [in] URL containing destination information. */
uri_type *destination_url,
/*! [out] Fixed and corrected URL. */
uri_type *url);
/************************************************************************

View File

@ -1,9 +1,6 @@
#ifndef INET_PTON
#define INET_PTON
#ifdef WIN32
#ifdef IPV6_
@ -12,12 +9,10 @@
#include "unixutil.h"
#include <errno.h>
#include <stdio.h>
#include <string.h>
/*!
* \file
*
@ -30,59 +25,14 @@
*
*/
/*!
* \brief format an IPv4 address
*
* \return `dst' (as a const)
*
* \note
* \li (1) uses no statics
* \li (2) takes a u_char* not an in_addr as input
*
*/
extern const char *inet_ntop4(const u_char *src, char *dst, socklen_t size);
/*!
* \brief convert IPv6 binary address into presentation (printable) format
*/
#ifdef INET_IPV6
extern const char *inet_ntop6(const u_char *src, char *dst, socklen_t size);
#endif /* INET_IPV6 */
/*!
* \brief like inet_aton() but without all the hexadecimal and shorthand.
*
* \return 1 if `src' is a valid dotted quad, else 0.
*
* \note does not touch `dst' unless it's returning 1.
*/
extern inet_pton4(const char *src,u_char *dst);
/*!
* \brief convert presentation level address to network order binary form.
*
* \return 1 if `src' is a valid [RFC1884 2.2] address, else 0.
*
* \note
* \li (1) does not touch `dst' unless it's returning 1.
* \li (2) :: in a full address is silently ignored.
*/
#ifdef INET_IPV6
extern int inet_pton6(const char *src, u_char *dst);
#endif /* INET_IPV6 */
/*!
* \brief convert a network format address to presentation format.
*
* \return
* pointer to presentation format address (`dst'), or NULL (see errno).
*/
extern const char *inet_ntop(int af,const void *src,char *dst,socklen_t size);
extern const char *inet_ntop(int af, const void *src, char *dst,
socklen_t size);
/*!
* \brief convert from presentation format (which usually means ASCII printable)
@ -93,11 +43,8 @@ extern const char *inet_ntop(int af,const void *src,char *dst,socklen_t size);
* \li 0 if the address wasn't valid (`dst' is untouched in this case)
* \li -1 if some other error occurred (`dst' is untouched in this case, too)
*/
extern int inet_pton(int af,const char *src,void *dst);
extern int inet_pton(int af, const char *src, void *dst);
#endif /* WIN32 */
#endif /* INET_PTON */

View File

@ -1,3 +1,6 @@
#ifndef MINISERVER_H
#define MINISERVER_H
/**************************************************************************
*
* Copyright (c) 2000-2003 Intel Corporation
@ -29,22 +32,16 @@
*
**************************************************************************/
#ifndef MINISERVER_H
#define MINISERVER_H
/*!
* \file
*/
#include "sock.h"
#include "httpparser.h"
#include "UpnpStdInt.h"
extern SOCKET gMiniServerStopSock;
typedef struct MServerSockArray {
/*! IPv4 socket for listening for miniserver requests. */
SOCKET miniServerSock4;
@ -74,22 +71,19 @@ typedef struct MServerSockArray {
#endif /* INCLUDE_CLIENT_APIS */
} MiniServerSockArray;
/*! . */
typedef void (*MiniServerCallback)(
typedef void (*MiniServerCallback) (
/* ! . */
IN http_parser_t *parser,
IN http_parser_t * parser,
/* ! . */
IN http_message_t* request,
IN http_message_t * request,
/* ! . */
IN SOCKINFO *info);
IN SOCKINFO * info);
#ifdef __cplusplus
extern "C" {
#endif
/*!
* \brief Set HTTP Get Callback.
*/
@ -97,7 +91,6 @@ void SetHTTPGetCallback(
/*! [in] HTTP Callback to be invoked . */
MiniServerCallback callback);
/*!
* \brief Set SOAP Callback.
*/
@ -105,11 +98,9 @@ void SetHTTPGetCallback(
void SetSoapCallback(
/*! [in] SOAP Callback to be invoked . */
MiniServerCallback callback);
#else /* INCLUDE_DEVICE_APIS */
static UPNP_INLINE void SetSoapCallback(MiniServerCallback callback) {}
#else /* INCLUDE_DEVICE_APIS */
static UPNP_INLINE void SetSoapCallback(MiniServerCallback callback) {}
#endif /* INCLUDE_DEVICE_APIS */
/*!
* \brief Set GENA Callback.
*/
@ -117,7 +108,6 @@ void SetGenaCallback(
/*! [in] GENA Callback to be invoked. */
MiniServerCallback callback);
/*!
* \brief Initialize the sockets functionality for the Miniserver.
*
@ -136,11 +126,10 @@ void SetGenaCallback(
int StartMiniServer(
/*! [in,out] Port on which the server listens for incoming IPv4
* connections. */
unsigned short *listen_port4,
uint16_t *listen_port4,
/*! [in,out] Port on which the server listens for incoming IPv6
* connections. */
unsigned short *listen_port6);
uint16_t *listen_port6);
/*!
* \brief Stop and Shutdown the MiniServer and free socket resources.
@ -149,11 +138,8 @@ int StartMiniServer(
*/
int StopMiniServer();
#ifdef __cplusplus
} /* extern C */
} /* extern C */
#endif
#endif /* MINISERVER_H */

View File

@ -1,3 +1,6 @@
#ifndef GENLIB_NET_SOCK_H
#define GENLIB_NET_SOCK_H
/**************************************************************************
*
* Copyright (c) 2000-2003 Intel Corporation
@ -29,9 +32,6 @@
*
**************************************************************************/
#ifndef GENLIB_NET_SOCK_H
#define GENLIB_NET_SOCK_H
/*!
* \file
*/
@ -171,6 +171,4 @@ static UPNP_INLINE int sock_close(
} /* #extern "C" */
#endif
#endif /* GENLIB_NET_SOCK_H */

View File

@ -202,7 +202,7 @@ typedef int (*ParserFun)(char *, Event *);
* Returns: int
* 0 if successful else -1
***************************************************************************/
int Make_Socket_NoBlocking (int sock);
int Make_Socket_NoBlocking (SOCKET sock);
/************************************************************************
* Function : ssdp_handle_device_request

View File

@ -15,14 +15,24 @@
* SOFTWARE.
*/
/*!
* \file
*/
/* This file is WIN32 only */
#ifdef WIN32
#include "inet_pton.h"
/*!
* \brief format an IPv4 address
*
* \return `dst' (as a const)
*
* \note
* \li (1) uses no statics
* \li (2) takes a u_char* not an in_addr as input
*/
static const char *inet_ntop4(const u_char *src, char *dst, socklen_t size)
{
char tmp[sizeof ("255.255.255.255") + 1] = "\0";
@ -56,8 +66,10 @@ static const char *inet_ntop4(const u_char *src, char *dst, socklen_t size)
return strcpy(dst, tmp);
}
#ifdef INET_IPV6
/*!
* \brief convert IPv6 binary address into presentation (printable) format
*/
static const char *inet_ntop6(const u_char *src, char *dst, socklen_t size)
{
/*
@ -133,9 +145,7 @@ static const char *inet_ntop6(const u_char *src, char *dst, socklen_t size)
*tp++ = ':';
*tp++ = '\0';
/*
* Check for overflow, copy, and we're done.
*/
/* Check for overflow, copy, and we're done. */
if ((socklen_t)(tp - tmp) size) {
//__set_errno (ENOSPC);
return (NULL);
@ -144,7 +154,13 @@ static const char *inet_ntop6(const u_char *src, char *dst, socklen_t size)
}
#endif /* INET_IPV6 */
/*!
* \brief like inet_aton() but without all the hexadecimal and shorthand.
*
* \return 1 if `src' is a valid dotted quad, else 0.
*
* \note does not touch `dst' unless it's returning 1.
*/
static int inet_pton4(const char *src,u_char *dst)
{
int saw_digit, octets, ch;
@ -154,10 +170,8 @@ static int inet_pton4(const char *src,u_char *dst)
octets = 0;
*(tp = tmp) = 0;
while ((ch = *src++) != '\0') {
if (ch >= '0' && ch <= '9') {
u_int new = *tp * 10 + (ch - '0');
if (new>255)
return (0);
*tp = new;
@ -180,8 +194,16 @@ static int inet_pton4(const char *src,u_char *dst)
return 1;
}
#ifdef INET_IPV6
/*!
* \brief convert presentation level address to network order binary form.
*
* \return 1 if `src' is a valid [RFC1884 2.2] address, else 0.
*
* \note
* \li (1) does not touch `dst' unless it's returning 1.
* \li (2) :: in a full address is silently ignored.
*/
static int inet_pton6(const char *src, u_char *dst)
{
static const char xdigits[] = "0123456789abcdef";
@ -245,10 +267,8 @@ static int inet_pton6(const char *src, u_char *dst)
*tp++ = (u_char) val & 0xff;
}
if (colonp != NULL) {
/*
* Since some memmove()'s erroneously fail to handle
* overlapping regions, we'll do the shift by hand.
*/
/* Since some memmove()'s erroneously fail to handle
* overlapping regions, we'll do the shift by hand. */
const int n = tp - colonp;
int i;
@ -268,14 +288,14 @@ static int inet_pton6(const char *src, u_char *dst)
#endif /* INET_IPV6 */
const char *inet_ntop(int af,const void *src,char *dst,socklen_t size)
const char *inet_ntop(int af, const void *src, char *dst,socklen_t size)
{
switch (af) {
case AF_INET:
return (inet_ntop4(src, dst, size));
return inet_ntop4(src, dst, size);
#ifdef INET_IPV6
case AF_INET6:
return (inet_ntop6(src, dst, size));
return inet_ntop6(src, dst, size);
#endif
default:
/*__set_errno(EAFNOSUPPORT);*/
@ -284,15 +304,14 @@ const char *inet_ntop(int af,const void *src,char *dst,socklen_t size)
/* NOTREACHED */
}
int inet_pton(int af,const char *src,void *dst)
int inet_pton(int af, const char *src, void *dst)
{
switch (af) {
case AF_INET:
return (inet_pton4(src, dst));
return inet_pton4(src, dst);
#ifdef INET_IPV6
case AF_INET6:
return (inet_pton6(src, dst));
return inet_pton6(src, dst);
#endif
default:
/*__set_errno(EAFNOSUPPORT);*/
@ -301,6 +320,4 @@ int inet_pton(int af,const char *src,void *dst)
/* NOTREACHED */
}
#endif /* WIN32 */

View File

@ -76,7 +76,7 @@ void get_system_time(uuid_time_t *uuid_time)
*uuid_time = time.QuadPart;
};
void get_random_info(char seed[16])
void get_random_info(unsigned char seed[16])
{
MD5_CTX c;
typedef struct {