-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathport_win.h
More file actions
171 lines (150 loc) · 5.09 KB
/
port_win.h
File metadata and controls
171 lines (150 loc) · 5.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/*
* Copyright 2008, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef NATIVE_CLIENT_SRC_INCLUDE_WIN_PORT_WIN_H_
#define NATIVE_CLIENT_SRC_INCLUDE_WIN_PORT_WIN_H_ 1
#include "native_client/src/include/nacl_base.h"
#include "native_client/src/include/nacl_macros.h"
/* TODO: eliminated this file and move its contents to portability*.h */
#if defined(_MSC_VER)
/* wchar_t and unsigned short are not always equivalent*/
#pragma warning(disable : 4255)
/* padding added after struct member */
#pragma warning(disable: 4820)
/* sign extended conversion */
#pragma warning(disable: 4826)
/* conditional expression is constant */
#pragma warning(disable : 4127)
#endif
/* TODO: limit this include to files that really need it */
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <windows.h>
/* types missing on Windows */
typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef short __int16_t;
typedef unsigned short __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;
typedef __int64 __int64_t;
typedef unsigned __int64 __uint64_t;
typedef __int8_t int8_t;
typedef __uint8_t uint8_t;
typedef __int16_t int16_t;
typedef __uint16_t uint16_t;
typedef __int32_t int32_t;
typedef __uint32_t uint32_t;
typedef __uint32_t u_int32_t;
typedef __int64_t int64_t;
typedef __uint64_t uint64_t;
typedef long off_t;
#if defined(_MSC_VER)
typedef int mode_t;
#endif
typedef long _off_t;
typedef long int __loff_t;
typedef unsigned long DWORD;
typedef long clock_t;
#ifdef _WIN64
typedef int64_t ssize_t;
#else
typedef int32_t ssize_t;
#endif /* _WIN64 */
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
/*
* These are conditionally defined because starting in VS2012 (11.0) stdint.h
* includes definitions for them.
*
* Only including range values actually used in our codebase.
*/
#if !defined(_MSC_VER) || _MSC_VER >= 1800
#include <stdint.h>
#else
# if !defined(UINT8_MAX)
# define UINT8_MAX NACL_UMAX_VAL(uint8_t)
# endif
# if !defined(INT8_MAX)
# define INT8_MAX NACL_MAX_VAL(int8_t)
# endif
# if !defined(INT8_MIN)
# define INT8_MIN NACL_MIN_VAL(int8_t)
# endif
# if !defined(UINT16_MAX)
# define UINT16_MAX NACL_UMAX_VAL(uint16_t)
# endif
# if !defined(INT16_MAX)
# define INT16_MAX NACL_MAX_VAL(int16_t)
# endif
# if !defined(INT16_MIN)
# define INT16_MIN NACL_MIN_VAL(int16_t)
# endif
# if !defined(UINT32_MAX)
# define UINT32_MAX NACL_UMAX_VAL(uint32_t)
# endif
# if !defined(INT32_MAX)
# define INT32_MAX NACL_MAX_VAL(int32_t)
# endif
# if !defined(INT32_MIN)
# define INT32_MIN NACL_MIN_VAL(int32_t)
# endif
# if !defined(UINT64_MAX)
# define UINT64_MAX NACL_UMAX_VAL(uint64_t)
# endif
# if !defined(INT64_MAX)
# define INT64_MAX NACL_MAX_VAL(int64_t)
# endif
# if !defined(INT64_MIN)
# define INT64_MIN NACL_MIN_VAL(int64_t)
# endif
#endif
#endif /* _MSC_VER >= 1800 */
EXTERN_C_BEGIN
/* arguments processing */
int ffs(int x);
int getopt(int argc, char *argv[], const char *optstring);
extern char *optarg; /* global argument pointer */
extern int optind; /* global argv index */
EXTERN_C_END
/*************************** stdio.h ********************/
#ifndef NULL
#if defined(__cplusplus)
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
/************************************************************/
/* from linux/limits.h, via sys/param.h */
#if defined(_MSC_VER)
#define PATH_MAX 4096
#endif
#endif /* NATIVE_CLIENT_SRC_INCLUDE_WIN_PORT_WIN_H_ */