From 1ee7570052487671b889d7b123ba049ee41bd9e8 Mon Sep 17 00:00:00 2001 From: Ashok Bhat Date: Tue, 17 Dec 2013 11:13:05 +0000 Subject: AArch64: Use negative values in error enumeration With AArch64 the enumerations with values in the range 0x80000000 to 0x80000007 are being assigned to ssize_t typed variables which are 64-bit rather than 32-bit, and are being used in conditions where they are being checked for being negative. This is not the case when ssize_t is 64-bit, so redefine this to INT32_MIN value. Change-Id: I7a031a940a28658b3bf34bebac93dfb3ba397b05 Signed-off-by: Marcus Oakland Signed-off-by: Ashok Bhat --- include/utils/Errors.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'include/utils/Errors.h') diff --git a/include/utils/Errors.h b/include/utils/Errors.h index 0b75b19..46173db 100644 --- a/include/utils/Errors.h +++ b/include/utils/Errors.h @@ -41,23 +41,23 @@ typedef int32_t status_t; #ifdef _WIN32 # undef NO_ERROR #endif - + enum { OK = 0, // Everything's swell. NO_ERROR = 0, // No errors. - - UNKNOWN_ERROR = 0x80000000, + + UNKNOWN_ERROR = (-2147483647-1), // INT32_MIN value NO_MEMORY = -ENOMEM, INVALID_OPERATION = -ENOSYS, BAD_VALUE = -EINVAL, - BAD_TYPE = 0x80000001, + BAD_TYPE = (UNKNOWN_ERROR + 1), NAME_NOT_FOUND = -ENOENT, PERMISSION_DENIED = -EPERM, NO_INIT = -ENODEV, ALREADY_EXISTS = -EEXIST, DEAD_OBJECT = -EPIPE, - FAILED_TRANSACTION = 0x80000002, + FAILED_TRANSACTION = (UNKNOWN_ERROR + 2), JPARKS_BROKE_IT = -EPIPE, #if !defined(HAVE_MS_C_RUNTIME) BAD_INDEX = -EOVERFLOW, @@ -67,12 +67,12 @@ enum { UNKNOWN_TRANSACTION = -EBADMSG, #else BAD_INDEX = -E2BIG, - NOT_ENOUGH_DATA = 0x80000003, - WOULD_BLOCK = 0x80000004, - TIMED_OUT = 0x80000005, - UNKNOWN_TRANSACTION = 0x80000006, + NOT_ENOUGH_DATA = (UNKNOWN_ERROR + 3), + WOULD_BLOCK = (UNKNOWN_ERROR + 4), + TIMED_OUT = (UNKNOWN_ERROR + 5), + UNKNOWN_TRANSACTION = (UNKNOWN_ERROR + 6), #endif - FDS_NOT_ALLOWED = 0x80000007, + FDS_NOT_ALLOWED = (UNKNOWN_ERROR + 7), }; // Restore define; enumeration is in "android" namespace, so the value defined -- cgit v1.1