src/platform_windows.h
author Volker Birk <vb@pep.foundation>
Thu, 01 Sep 2016 17:55:03 +0200
branchkeysync
changeset 1111 3c46dc58096d
parent 1001 42e0841b71f0
child 1226 a4e082c43cdd
permissions -rw-r--r--
merging
vb@0
     1
#pragma once
vb@0
     2
vb@0
     3
// Windows platform specifica
vb@0
     4
vb@24
     5
#pragma warning(disable : 4996)
vb@0
     6
vb@948
     7
#include <Rpc.h>
vb@125
     8
#include <string.h>
vb@130
     9
#include <io.h>
vb@219
    10
#include <basetsd.h>
vb@125
    11
vb@0
    12
#ifdef __cplusplus
vb@0
    13
extern "C" {
vb@0
    14
#endif
vb@0
    15
vb@219
    16
#define ssize_t SSIZE_T
vb@86
    17
#define RTLD_LAZY 1
vb@130
    18
#define mode_t int
vb@86
    19
vb@0
    20
void *dlopen(const char *filename, int flag);
vb@0
    21
int dlclose(void *handle);
vb@0
    22
void *dlsym(void *handle, const char *symbol);
vb@132
    23
int mkstemp(char *templ);
vb@0
    24
vb@86
    25
#ifndef strdup
vb@113
    26
#define strdup(A) _strdup((A))
vb@86
    27
#endif
vb@86
    28
#ifndef snprintf
Dean@971
    29
#if _MSC_VER<1900 // Includes undefined case. This is a check for VS 2015, which throws an error.
vb@89
    30
#define snprintf(...) _snprintf(__VA_ARGS__)
vb@86
    31
#endif
Dean@971
    32
#endif
vb@82
    33
#ifndef strtok_r
vb@82
    34
#define strtok_r(A, B, C) strtok_s((A), (B), (C))
vb@82
    35
#endif
vb@85
    36
#ifndef strncasecmp
vb@85
    37
#define strncasecmp(A, B, C) _strnicmp((A), (B), (C))
vb@85
    38
#endif
vb@784
    39
#ifndef strcasecmp
vb@785
    40
#define strcasecmp(A, B) _stricmp((A), (B))
vb@784
    41
#endif
vb@113
    42
#ifndef gmtime_r
vb@113
    43
#define gmtime_r(A, B) gmtime_s((B), (A))
vb@132
    44
#endif
vb@132
    45
#ifndef ftruncate
vb@132
    46
#define ftruncate(A, B) _chsize((A), (B))
vb@130
    47
#endif
vb@130
    48
#ifndef ftello
vb@130
    49
#define ftello(A) ((off_t) _ftelli64(A))
vb@113
    50
#endif
vb@113
    51
vb@82
    52
char *strndup(const char *s1, size_t n);
vb@282
    53
char *stpcpy(char *dst, const char *src);
vb@80
    54
krista@918
    55
size_t strlcpy(char* dst, const	char* src, size_t size);
krista@918
    56
size_t strlcat(char* dst, const	char* src, size_t size);
krista@918
    57
vb@0
    58
const char *windoze_local_db(void);
vb@0
    59
const char *windoze_system_db(void);
vb@0
    60
const char *gpg_conf(void);
vb@0
    61
vb@54
    62
long random(void);
vb@54
    63
vb@948
    64
// on Windoze, uuid_t needs pointer semantics
vb@948
    65
typedef UUID *uuid_t;
vb@948
    66
#define _UUID_STRING_T
vb@948
    67
typedef char uuid_string_t[37];
vb@948
    68
vb@948
    69
void uuid_generate_random(uuid_t out);
vb@948
    70
int uuid_parse(char *in, uuid_t uu);
vb@948
    71
void uuid_unparse_upper(uuid_t uu, uuid_string_t out);
vb@948
    72
vb@125
    73
#ifndef inline
vb@130
    74
#define inline __inline
vb@125
    75
#endif
vb@125
    76
vb@0
    77
#ifdef __cplusplus
vb@0
    78
}
vb@0
    79
#endif