Minor fixes for Win32 build. It now builds, but doesn't link.
This commit is contained in:
10
src/ctx.c
10
src/ctx.c
@@ -21,6 +21,10 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define vsnprintf _vsnprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
/** version **/
|
/** version **/
|
||||||
|
|
||||||
/* TODO: update from the build system? */
|
/* TODO: update from the build system? */
|
||||||
@@ -75,10 +79,10 @@ void *xmpp_alloc(const xmpp_ctx_t * const ctx, const size_t size)
|
|||||||
|
|
||||||
void xmpp_free(const xmpp_ctx_t * const ctx, void *p)
|
void xmpp_free(const xmpp_ctx_t * const ctx, void *p)
|
||||||
{
|
{
|
||||||
return ctx->mem->free(p);
|
ctx->mem->free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *xmpp_realloc(const xmpp_ctx_t * const ctx, void *p,
|
void *xmpp_realloc(const xmpp_ctx_t * const ctx, void *p,
|
||||||
const size_t size)
|
const size_t size)
|
||||||
{
|
{
|
||||||
return ctx->mem->realloc(p, size);
|
return ctx->mem->realloc(p, size);
|
||||||
@@ -86,7 +90,7 @@ void *xmpp_realloc(const xmpp_ctx_t * const ctx, void *p,
|
|||||||
|
|
||||||
/* logger */
|
/* logger */
|
||||||
|
|
||||||
void xmpp_log(const xmpp_ctx_t * const ctx,
|
void xmpp_log(const xmpp_ctx_t * const ctx,
|
||||||
const xmpp_log_level_t level,
|
const xmpp_log_level_t level,
|
||||||
const char * const area,
|
const char * const area,
|
||||||
const char * const fmt,
|
const char * const fmt,
|
||||||
|
|||||||
@@ -16,7 +16,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "strophe.h"
|
#include "strophe.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|||||||
@@ -15,7 +15,12 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#else
|
||||||
|
#include "ostypes.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "strophe.h"
|
#include "strophe.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|||||||
22
src/ostypes.h
Normal file
22
src/ostypes.h
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/* ostypes.h
|
||||||
|
** XMPP client library -- type definitions for platforms without stdint.h
|
||||||
|
**
|
||||||
|
** Copyright (C) 2005 OGG, LCC. All rights reserved.
|
||||||
|
**
|
||||||
|
** This software is provided AS-IS with no warranty, either express
|
||||||
|
** or implied.
|
||||||
|
**
|
||||||
|
** This software is distributed under license and may not be copied,
|
||||||
|
** modified or distributed except as expressly authorized under the
|
||||||
|
** terms of the license contained in the file LICENSE.txt in this
|
||||||
|
** distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIBSTROPHE_OSTYPES_H__
|
||||||
|
#define __LIBSTROPHE_OSTYPES_H__
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
typedef unsigned __int64 uint64_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __LIBSTROPHE_OSTYPES_H__ */
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
|
#include <ws2tcpip.h>
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#else
|
#else
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
typedef int sock_t;
|
typedef int sock_t;
|
||||||
#else
|
#else
|
||||||
|
#include <winsock2.h>
|
||||||
typedef SOCKET sock_t;
|
typedef SOCKET sock_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
14
src/stanza.c
14
src/stanza.c
@@ -19,6 +19,10 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define inline __inline
|
||||||
|
#endif
|
||||||
|
|
||||||
/* allocate an initialize a blank stanza */
|
/* allocate an initialize a blank stanza */
|
||||||
xmpp_stanza_t *xmpp_stanza_new(xmpp_ctx_t *ctx)
|
xmpp_stanza_t *xmpp_stanza_new(xmpp_ctx_t *ctx)
|
||||||
{
|
{
|
||||||
@@ -82,7 +86,7 @@ xmpp_stanza_t *xmpp_stanza_copy(const xmpp_stanza_t * const stanza)
|
|||||||
iter = hash_iter_new(stanza->attributes);
|
iter = hash_iter_new(stanza->attributes);
|
||||||
if (!iter) { printf("DEBUG HERE\n"); goto copy_error; }
|
if (!iter) { printf("DEBUG HERE\n"); goto copy_error; }
|
||||||
while ((key = hash_iter_next(iter))) {
|
while ((key = hash_iter_next(iter))) {
|
||||||
val = xmpp_strdup(stanza->ctx,
|
val = xmpp_strdup(stanza->ctx,
|
||||||
(char *)hash_get(stanza->attributes, key));
|
(char *)hash_get(stanza->attributes, key));
|
||||||
if (!val) goto copy_error;
|
if (!val) goto copy_error;
|
||||||
|
|
||||||
@@ -153,8 +157,8 @@ static inline void _render_update(int *written, const int length,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* always returns number of bytes written or that would have been
|
/* always returns number of bytes written or that would have been
|
||||||
* written if the buffer was large enough
|
* written if the buffer was large enough
|
||||||
* return values < 0 indicate some error occured,
|
* return values < 0 indicate some error occured,
|
||||||
* and return values > buflen indicate buffer was not large enough
|
* and return values > buflen indicate buffer was not large enough
|
||||||
*/
|
*/
|
||||||
@@ -303,7 +307,7 @@ char *xmpp_stanza_get_name(xmpp_stanza_t * const stanza)
|
|||||||
|
|
||||||
/* convinience function to copy attributes from the xml parser
|
/* convinience function to copy attributes from the xml parser
|
||||||
* callback into a stanza. this replaces all previous attributes */
|
* callback into a stanza. this replaces all previous attributes */
|
||||||
void xmpp_stanza_set_attributes(xmpp_stanza_t *stanza,
|
void xmpp_stanza_set_attributes(xmpp_stanza_t * const stanza,
|
||||||
const char * const * const attr)
|
const char * const * const attr)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -311,7 +315,7 @@ void xmpp_stanza_set_attributes(xmpp_stanza_t *stanza,
|
|||||||
|
|
||||||
if (stanza->attributes != NULL)
|
if (stanza->attributes != NULL)
|
||||||
hash_release(stanza->attributes);
|
hash_release(stanza->attributes);
|
||||||
|
|
||||||
stanza->attributes = hash_new(stanza->ctx, 8, xmpp_free);
|
stanza->attributes = hash_new(stanza->ctx, 8, xmpp_free);
|
||||||
if (!stanza->attributes) return;
|
if (!stanza->attributes) return;
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#else
|
||||||
|
#include "ostypes.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* timing functions */
|
/* timing functions */
|
||||||
|
|||||||
Reference in New Issue
Block a user