fix MSVC build
This commit is contained in:
committed by
Dmitry Podgorny
parent
bf5bf96e95
commit
58613ea7f3
@@ -25,7 +25,7 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "sasl.h"
|
#include "sasl.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _MSC_VER
|
||||||
#define strcasecmp stricmp
|
#define strcasecmp stricmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -21,12 +21,10 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#ifndef _WIN32
|
|
||||||
#include <stdint.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include "strophe.h"
|
#include "strophe.h"
|
||||||
|
#include "ostypes.h"
|
||||||
#include "sock.h"
|
#include "sock.h"
|
||||||
#include "tls.h"
|
#include "tls.h"
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
|
|||||||
@@ -23,14 +23,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
#include <stdint.h>
|
|
||||||
#else
|
|
||||||
#include "ostypes.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "strophe.h"
|
#include "strophe.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "ostypes.h"
|
||||||
|
|
||||||
/** Fire off all stanza handlers that match.
|
/** Fire off all stanza handlers that match.
|
||||||
* This function is called internally by the event loop whenever stanzas
|
* This function is called internally by the event loop whenever stanzas
|
||||||
|
|||||||
@@ -11,15 +11,8 @@
|
|||||||
#ifndef MD5_H
|
#ifndef MD5_H
|
||||||
#define MD5_H
|
#define MD5_H
|
||||||
|
|
||||||
/* we use the uint32_t type from stdint.h
|
|
||||||
* if it is not available, add a typedef here:
|
|
||||||
*/
|
|
||||||
/* make sure the stdint.h types are available */
|
/* make sure the stdint.h types are available */
|
||||||
#if defined(_MSC_VER) /* Microsoft Visual C++ */
|
#include "ostypes.h"
|
||||||
typedef unsigned int uint32_t;
|
|
||||||
#else
|
|
||||||
#include <stdint.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct MD5Context {
|
struct MD5Context {
|
||||||
uint32_t buf[4];
|
uint32_t buf[4];
|
||||||
|
|||||||
@@ -20,8 +20,18 @@
|
|||||||
#ifndef __LIBSTROPHE_OSTYPES_H__
|
#ifndef __LIBSTROPHE_OSTYPES_H__
|
||||||
#define __LIBSTROPHE_OSTYPES_H__
|
#define __LIBSTROPHE_OSTYPES_H__
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined (_MSC_VER) && _MSC_VER < 1600
|
||||||
|
typedef signed char int8_t;
|
||||||
|
typedef short int int16_t;
|
||||||
|
typedef int int32_t;
|
||||||
|
typedef __int64 int64_t;
|
||||||
|
|
||||||
|
typedef unsigned char uint8_t;
|
||||||
|
typedef unsigned short int uint16_t;
|
||||||
|
typedef unsigned int uint32_t;
|
||||||
typedef unsigned __int64 uint64_t;
|
typedef unsigned __int64 uint64_t;
|
||||||
|
#else
|
||||||
|
#include <stdint.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __LIBSTROPHE_OSTYPES_H__ */
|
#endif /* __LIBSTROPHE_OSTYPES_H__ */
|
||||||
|
|||||||
16
src/sasl.c
16
src/sasl.c
@@ -21,24 +21,14 @@
|
|||||||
|
|
||||||
#include "strophe.h"
|
#include "strophe.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "ostypes.h"
|
||||||
#include "sasl.h"
|
#include "sasl.h"
|
||||||
#include "md5.h"
|
#include "md5.h"
|
||||||
#include "sha1.h"
|
#include "sha1.h"
|
||||||
#include "scram.h"
|
#include "scram.h"
|
||||||
|
|
||||||
/* make sure the stdint.h types are available */
|
#ifdef _WIN32
|
||||||
#if defined(_MSC_VER) /* Microsoft Visual C++ */
|
#define strtok_r strtok_s
|
||||||
typedef signed char int8_t;
|
|
||||||
typedef short int int16_t;
|
|
||||||
typedef int int32_t;
|
|
||||||
typedef __int64 int64_t;
|
|
||||||
|
|
||||||
typedef unsigned char uint8_t;
|
|
||||||
typedef unsigned short int uint16_t;
|
|
||||||
typedef unsigned int uint32_t;
|
|
||||||
/* no uint64_t */
|
|
||||||
#else
|
|
||||||
#include <stdint.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,10 +20,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdint.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "sha1.h"
|
#include "sha1.h"
|
||||||
|
#include "ostypes.h"
|
||||||
|
|
||||||
#include "scram.h"
|
#include "scram.h"
|
||||||
|
|
||||||
@@ -36,8 +36,8 @@
|
|||||||
static const uint8_t ipad = 0x36;
|
static const uint8_t ipad = 0x36;
|
||||||
static const uint8_t opad = 0x5C;
|
static const uint8_t opad = 0x5C;
|
||||||
|
|
||||||
static inline void SHA1(const uint8_t* data, size_t len,
|
static void SHA1(const uint8_t* data, size_t len,
|
||||||
uint8_t digest[SHA1_DIGEST_SIZE])
|
uint8_t digest[SHA1_DIGEST_SIZE])
|
||||||
{
|
{
|
||||||
SHA1_CTX ctx;
|
SHA1_CTX ctx;
|
||||||
SHA1_Init(&ctx);
|
SHA1_Init(&ctx);
|
||||||
|
|||||||
@@ -19,7 +19,8 @@
|
|||||||
#ifndef __LIBSTROPHE_SCRAM_H__
|
#ifndef __LIBSTROPHE_SCRAM_H__
|
||||||
#define __LIBSTROPHE_SCRAM_H__
|
#define __LIBSTROPHE_SCRAM_H__
|
||||||
|
|
||||||
#include <stdint.h>
|
/* make sure the stdint.h types are available */
|
||||||
|
#include "ostypes.h"
|
||||||
|
|
||||||
#include "sha1.h"
|
#include "sha1.h"
|
||||||
|
|
||||||
|
|||||||
14
src/sha1.c
14
src/sha1.c
@@ -86,19 +86,7 @@ A million repetitions of "a"
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/* make sure the stdint.h types are available */
|
/* make sure the stdint.h types are available */
|
||||||
#if defined(_MSC_VER) /* Microsoft Visual C++ */
|
#include "ostypes.h"
|
||||||
typedef signed char int8_t;
|
|
||||||
typedef short int int16_t;
|
|
||||||
typedef int int32_t;
|
|
||||||
typedef __int64 int64_t;
|
|
||||||
|
|
||||||
typedef unsigned char uint8_t;
|
|
||||||
typedef unsigned short int uint16_t;
|
|
||||||
typedef unsigned int uint32_t;
|
|
||||||
/* no uint64_t */
|
|
||||||
#else
|
|
||||||
#include <stdint.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "sha1.h"
|
#include "sha1.h"
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,9 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* make sure the stdint.h types are available */
|
||||||
|
#include "ostypes.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t state[5];
|
uint32_t state[5];
|
||||||
uint32_t count[2];
|
uint32_t count[2];
|
||||||
|
|||||||
@@ -24,11 +24,11 @@
|
|||||||
#else
|
#else
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <stdint.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "strophe.h"
|
#include "strophe.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "ostypes.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
/** implement our own strdup that uses the ctx allocator */
|
/** implement our own strdup that uses the ctx allocator */
|
||||||
|
|||||||
@@ -19,11 +19,7 @@
|
|||||||
#ifndef __LIBSTROPHE_UTIL_H__
|
#ifndef __LIBSTROPHE_UTIL_H__
|
||||||
#define __LIBSTROPHE_UTIL_H__
|
#define __LIBSTROPHE_UTIL_H__
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
#include <stdint.h>
|
|
||||||
#else
|
|
||||||
#include "ostypes.h"
|
#include "ostypes.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
/* timing functions */
|
/* timing functions */
|
||||||
uint64_t time_stamp(void);
|
uint64_t time_stamp(void);
|
||||||
|
|||||||
Reference in New Issue
Block a user