Minor fixes for Win32 build. It now builds, but doesn't link.

This commit is contained in:
Jack Moffitt
2005-06-14 22:35:15 +00:00
parent d07094c090
commit e6fa890d3d
8 changed files with 49 additions and 8 deletions

View File

@@ -21,6 +21,10 @@
#include "common.h"
#include "util.h"
#ifdef _WIN32
#define vsnprintf _vsnprintf
#endif
/** version **/
/* 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)
{
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)
{
return ctx->mem->realloc(p, size);
@@ -86,7 +90,7 @@ void *xmpp_realloc(const xmpp_ctx_t * const ctx, void *p,
/* 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 char * const area,
const char * const fmt,

View File

@@ -16,7 +16,9 @@
#include <stdlib.h>
#include <string.h>
#ifndef _WIN32
#include <sys/select.h>
#endif
#include "strophe.h"
#include "common.h"

View File

@@ -15,7 +15,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef _WIN32
#include <stdint.h>
#else
#include "ostypes.h"
#endif
#include "strophe.h"
#include "common.h"

22
src/ostypes.h Normal file
View 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__ */

View File

@@ -18,6 +18,7 @@
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#define snprintf _snprintf
#else
#include <errno.h>

View File

@@ -20,6 +20,7 @@
#ifndef _WIN32
typedef int sock_t;
#else
#include <winsock2.h>
typedef SOCKET sock_t;
#endif

View File

@@ -19,6 +19,10 @@
#include "common.h"
#include "hash.h"
#ifdef _WIN32
#define inline __inline
#endif
/* allocate an initialize a blank stanza */
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);
if (!iter) { printf("DEBUG HERE\n"); goto copy_error; }
while ((key = hash_iter_next(iter))) {
val = xmpp_strdup(stanza->ctx,
val = xmpp_strdup(stanza->ctx,
(char *)hash_get(stanza->attributes, key));
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
* written if the buffer was large enough
/* always returns number of bytes written or that would have been
* written if the buffer was large enough
* return values < 0 indicate some error occured,
* 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
* 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)
{
int i;
@@ -311,7 +315,7 @@ void xmpp_stanza_set_attributes(xmpp_stanza_t *stanza,
if (stanza->attributes != NULL)
hash_release(stanza->attributes);
stanza->attributes = hash_new(stanza->ctx, 8, xmpp_free);
if (!stanza->attributes) return;

View File

@@ -17,6 +17,8 @@
#ifndef _WIN32
#include <stdint.h>
#else
#include "ostypes.h"
#endif
/* timing functions */