slirp: some additional minor changes

This commit is contained in:
Frode Solheim 2015-09-05 01:47:40 +02:00
parent 024508e7ae
commit ed47c81f8c
4 changed files with 12 additions and 21 deletions

View File

@ -1,10 +0,0 @@
#include <stdint.h>
typedef uint8_t u_int8_t;
typedef uint16_t u_int16_t;
typedef uint32_t u_int32_t;
typedef uint64_t u_int64_t;
typedef u_int8_t uint8;
typedef u_int16_t uint16;
typedef u_int32_t uint32;

View File

@ -72,7 +72,7 @@ int cksum(struct mbuf *m, int len)
/*
* Force to even boundary.
*/
if ((1 & (long) w) && (mlen > 0)) {
if ((1 & (uintptr_t) w) && (mlen > 0)) {
REDUCE;
sum <<= 8;
s_util.c[0] = *(u_int8_t *)w;

View File

@ -9,10 +9,6 @@ int inet_aton(const char *cp, struct in_addr *ia);
#include <arpa/inet.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
int slirp_init(void);
void slirp_cleanup(void);
@ -34,8 +30,4 @@ int slirp_add_exec(int do_pty, const char *args, int addr_low_byte,
extern char slirp_hostname[33];
#ifdef __cplusplus
}
#endif
#endif

View File

@ -12,7 +12,16 @@
#include "slirp_config.h"
#ifdef _WIN32
# include <inttypes.h>
# include <stdint.h>
typedef uint8_t u_int8_t;
typedef uint16_t u_int16_t;
typedef uint32_t u_int32_t;
typedef uint64_t u_int64_t;
typedef u_int8_t uint8;
typedef u_int16_t uint16;
typedef u_int32_t uint32;
#ifdef _MSC_VER
#define container_of(address, type, field) ((type *)( \
@ -364,7 +373,7 @@ struct tcpcb *tcp_drop(struct tcpcb *tp, int err);
#define MAX_MRU 16384
#endif
#ifndef _WIN32
#ifndef _MSC_VER
#define min(x,y) ((x) < (y) ? (x) : (y))
#define max(x,y) ((x) > (y) ? (x) : (y))
#endif