1 /* 2 * Copyright (c) 2020 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef OHOS_TYPES_H 16 #define OHOS_TYPES_H 17 18 #ifdef __cplusplus 19 #if __cplusplus 20 extern "C"{ 21 #endif 22 #endif /* __cplusplus */ 23 24 /* 25 * Defintion of basic data types. 26 * The data types are applicable to both the application and kernel. 27 */ 28 typedef unsigned char uint8; 29 typedef unsigned short uint16; 30 typedef unsigned int uint32; 31 typedef signed char int8; 32 typedef short int16; 33 typedef int int32; 34 35 #ifndef _M_IX86 36 typedef unsigned long long uint64; 37 typedef long long int64; 38 #else 39 typedef unsigned __int64 uint64; 40 typedef __int64 int64; 41 #endif 42 43 typedef int boolean; 44 45 typedef void *pHandle; 46 47 #ifndef DEFINED_BOOL 48 typedef unsigned int BOOL; 49 #define DEFINED_BOOL 50 #endif 51 52 #ifndef TRUE 53 #define TRUE 1L 54 #endif 55 56 #ifndef FALSE 57 #define FALSE 0L 58 #endif 59 60 #ifndef NULL 61 #ifdef __cplusplus 62 #define NULL 0L 63 #else 64 #define NULL ((void*)0) 65 #endif 66 #endif 67 68 #define OHOS_SUCCESS 0 69 #define OHOS_FAILURE (-1) 70 71 #ifndef ARRAY_SIZE 72 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 73 #endif 74 75 #ifdef __cplusplus 76 #if __cplusplus 77 } 78 #endif 79 #endif /* __cplusplus */ 80 81 #endif /* OHOS_TYPES_H */ 82