Couchbase C Client  3.3.14
Asynchronous C Client for Couchbase
sysdefs.h
1/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * Copyright 2010-2020 Couchbase, Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
21#ifndef LCB_SYSDEFS_H
22#define LCB_SYSDEFS_H
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28#ifdef _WIN32
29#include <stddef.h>
30#include <winsock2.h>
31#include <basetsd.h>
32
33/* TODO: consider using pstdint.h from http://www.azillionmonkeys.com/qed/pstdint.h */
34typedef __int16 int16_t;
35typedef __int32 int32_t;
36typedef __int64 int64_t;
37typedef unsigned __int8 uint8_t;
38typedef unsigned __int16 uint16_t;
39typedef unsigned __int32 uint32_t;
40typedef unsigned __int64 uint64_t;
41
42typedef __int64 lcb_int64_t;
43typedef __int32 lcb_int32_t;
44typedef SIZE_T lcb_size_t;
45typedef SSIZE_T lcb_ssize_t;
46typedef unsigned __int8 lcb_uint8_t;
47typedef unsigned __int16 lcb_vbucket_t;
48typedef unsigned __int16 lcb_uint16_t;
49typedef unsigned __int32 lcb_uint32_t;
50typedef unsigned __int64 lcb_uint64_t;
51
53typedef unsigned __int32 lcb_time_t;
54#else
55#include <sys/types.h>
56#include <stdint.h>
57#include <time.h>
58
59#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
60#include <stddef.h>
61#endif
62
63typedef int64_t lcb_int64_t;
64typedef int32_t lcb_int32_t;
65typedef size_t lcb_size_t;
66typedef ssize_t lcb_ssize_t;
67typedef uint16_t lcb_vbucket_t;
68typedef uint8_t lcb_uint8_t;
69typedef uint16_t lcb_uint16_t;
70typedef uint32_t lcb_uint32_t;
71typedef uint64_t lcb_uint64_t;
72typedef time_t lcb_time_t;
73#endif
74
75typedef lcb_int64_t lcb_S64;
76typedef lcb_uint64_t lcb_U64;
77typedef lcb_uint32_t lcb_U32;
78typedef lcb_int32_t lcb_S32;
79typedef lcb_uint16_t lcb_U16;
80typedef lcb_uint8_t lcb_U8;
81typedef lcb_size_t lcb_SIZE;
82typedef lcb_ssize_t lcb_SSIZE;
83typedef lcb_time_t lcb_SECS;
85#ifdef __GNUC__
86#define LCB_DEPRECATED(X) X __attribute__((deprecated))
87#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
88#define LCB_DEPRECATED2(X, reason) X __attribute__((deprecated(reason)))
89#else
90#define LCB_DEPRECATED2(X, reason) LCB_DEPRECATED(X)
91#endif
92#elif defined(_MSC_VER)
93#define LCB_DEPRECATED(X) __declspec(deprecated) X
94#define LCB_DEPRECATED2(X, reason) __declspec(deprecated(reason)) X
95#else
96#define LCB_DEPRECATED(X) X
97#define LCB_DEPRECATED2(X, reason)
98#endif
99
100#ifdef __cplusplus
101}
102#endif
103
104#endif /* LCB_SYSDEFS_H */