android status t,Android Native代码中的status_t定义

21#include 22

23namespace android {

24

25// use this type to return error codes

26#ifdef _WIN32

27typedef int status_t;

28#else

29typedef int32_t status_t;

30#endif

31

32/* the MS C runtime lacks a few error codes */

33

34/*

35 * Error codes.

36 * All error codes are negative values.

37 */

38

39// Win32 #defines NO_ERROR as well. It has the same value, so there's no

40// real conflict, though it's a bit awkward.

41#ifdef _WIN32

42# undef NO_ERROR

43#endif

44

45enum {

46 OK = 0, // Everything's swell.

47 NO_ERROR = 0, // No errors.

48

49 UNKNOWN_ERROR = (-2147483647-1), // INT32_MIN value

50

51 NO_MEMORY = -ENOMEM,

52 INVALID_OPERATION = -ENOSYS,

53 BAD_VALUE = -EINVAL,

54 BAD_TYPE = (UNKNOWN_ERROR + 1),

55 NAME_NOT_FOUND = -ENOENT,

56 PERMISSION_DENIED = -EPERM,

57 NO_INIT = -ENODEV,

58 ALREADY_EXISTS = -EEXIST,

59 DEAD_OBJECT = -EPIPE,

60 FAILED_TRANSACTION = (UNKNOWN_ERROR + 2),

61#if !defined(_WIN32)

62 BAD_INDEX = -EOVERFLOW,

63 NOT_ENOUGH_DATA = -ENODATA,

64 WOULD_BLOCK = -EWOULDBLOCK,

65 TIMED_OUT = -ETIMEDOUT,

66 UNKNOWN_TRANSACTION = -EBADMSG,

67#else

68 BAD_INDEX = -E2BIG,

69 NOT_ENOUGH_DATA = (UNKNOWN_ERROR + 3),

70 WOULD_BLOCK = (UNKNOWN_ERROR + 4),

71 TIMED_OUT = (UNKNOWN_ERROR + 5),

72 UNKNOWN_TRANSACTION = (UNKNOWN_ERROR + 6),

73#endif

74 FDS_NOT_ALLOWED = (UNKNOWN_ERROR + 7),

75 UNEXPECTED_NULL = (UNKNOWN_ERROR + 8),

76};

77

78// Restore define; enumeration is in "android" namespace, so the value defined

79// there won't work for Win32 code in a different namespace.

80#ifdef _WIN32

81# define NO_ERROR 0L

82#endif

83

84}; // namespace android

85

86// ---------------------------------------------------------------------------

87

88#endif // ANDROID_ERRORS_H

89

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值