src/platform_windows.h
author krista
Wed, 31 Aug 2016 17:26:59 +0200
branchkrista_local_windows
changeset 1125 89e75396c69a
parent 1122 bbd0d058f0e3
child 1126 129b561095a6
permissions -rw-r--r--
merged with default
     1 #pragma once
     2 
     3 // Windows platform specifica
     4 
     5 #pragma warning(disable : 4996)
     6 
     7 #include <string.h>
     8 #include <io.h>
     9 #include <basetsd.h>
    10 
    11 #ifdef __cplusplus
    12 extern "C" {
    13 #endif
    14 
    15 #define ssize_t SSIZE_T
    16 #define RTLD_LAZY 1
    17 #define mode_t int
    18 
    19 void *dlopen(const char *filename, int flag);
    20 int dlclose(void *handle);
    21 void *dlsym(void *handle, const char *symbol);
    22 int mkstemp(char *templ);
    23 
    24 #ifndef strdup
    25 #define strdup(A) _strdup((A))
    26 #endif
    27 #ifndef snprintf
    28 #if _MSC_VER<1900 // Includes undefined case. This is a check for VS 2015, which throws an error.
    29 #define snprintf(...) _snprintf(__VA_ARGS__)
    30 #endif
    31 #endif
    32 #ifndef strtok_r
    33 #define strtok_r(A, B, C) strtok_s((A), (B), (C))
    34 #endif
    35 #ifndef strncasecmp
    36 #define strncasecmp(A, B, C) _strnicmp((A), (B), (C))
    37 #endif
    38 #ifndef strcasecmp
    39 #define strcasecmp(A, B) _stricmp((A), (B))
    40 #endif
    41 #ifndef gmtime_r
    42 #define gmtime_r(A, B) gmtime_s((B), (A))
    43 #endif
    44 #ifndef ftruncate
    45 #define ftruncate(A, B) _chsize((A), (B))
    46 #endif
    47 #ifndef ftello
    48 #define ftello(A) ((off_t) _ftelli64(A))
    49 #endif
    50 
    51 char *strndup(const char *s1, size_t n);
    52 char *stpcpy(char *dst, const char *src);
    53 
    54 size_t strlcpy(char* dst, const	char* src, size_t size);
    55 size_t strlcat(char* dst, const	char* src, size_t size);
    56 
    57 const char *windoze_local_db(void);
    58 const char *windoze_system_db(void);
    59 const char *gpg_conf(void);
    60 
    61 long random(void);
    62 
    63 #ifndef inline
    64 #define inline __inline
    65 #endif
    66 
    67 #ifdef __cplusplus
    68 }
    69 #endif