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 typedef unsigned int BOOL; 48 49 #ifndef TRUE 50 #define TRUE 1L 51 #endif 52 53 #ifndef FALSE 54 #define FALSE 0L 55 #endif 56 57 #ifndef NULL 58 #ifdef __cplusplus 59 #define NULL 0L 60 #else 61 #define NULL ((void*)0) 62 #endif 63 #endif 64 65 #define OHOS_SUCCESS 0 66 #define OHOS_FAILURE (-1) 67 68 #ifndef ARRAY_SIZE 69 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 70 #endif 71 72 #ifdef __cplusplus 73 #if __cplusplus 74 } 75 #endif 76 #endif /* __cplusplus */ 77 78 #endif /* OHOS_TYPES_H */ 79