media/omx-plugin/include/ics/utils/Errors.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /*
michael@0 2 * Copyright (C) 2007 The Android Open Source Project
michael@0 3 *
michael@0 4 * Licensed under the Apache License, Version 2.0 (the "License");
michael@0 5 * you may not use this file except in compliance with the License.
michael@0 6 * You may obtain a copy of the License at
michael@0 7 *
michael@0 8 * http://www.apache.org/licenses/LICENSE-2.0
michael@0 9 *
michael@0 10 * Unless required by applicable law or agreed to in writing, software
michael@0 11 * distributed under the License is distributed on an "AS IS" BASIS,
michael@0 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
michael@0 13 * See the License for the specific language governing permissions and
michael@0 14 * limitations under the License.
michael@0 15 */
michael@0 16
michael@0 17 #ifndef ANDROID_ERRORS_H
michael@0 18 #define ANDROID_ERRORS_H
michael@0 19
michael@0 20 #include <sys/types.h>
michael@0 21 #include <errno.h>
michael@0 22
michael@0 23 namespace android {
michael@0 24
michael@0 25 // use this type to return error codes
michael@0 26 #ifdef HAVE_MS_C_RUNTIME
michael@0 27 typedef int status_t;
michael@0 28 #else
michael@0 29 typedef int32_t status_t;
michael@0 30 #endif
michael@0 31
michael@0 32 /* the MS C runtime lacks a few error codes */
michael@0 33
michael@0 34 /*
michael@0 35 * Error codes.
michael@0 36 * All error codes are negative values.
michael@0 37 */
michael@0 38
michael@0 39 // Win32 #defines NO_ERROR as well. It has the same value, so there's no
michael@0 40 // real conflict, though it's a bit awkward.
michael@0 41 #ifdef _WIN32
michael@0 42 # undef NO_ERROR
michael@0 43 #endif
michael@0 44
michael@0 45 enum {
michael@0 46 OK = 0, // Everything's swell.
michael@0 47 NO_ERROR = 0, // No errors.
michael@0 48
michael@0 49 UNKNOWN_ERROR = 0x80000000,
michael@0 50
michael@0 51 NO_MEMORY = -ENOMEM,
michael@0 52 INVALID_OPERATION = -ENOSYS,
michael@0 53 BAD_VALUE = -EINVAL,
michael@0 54 BAD_TYPE = 0x80000001,
michael@0 55 NAME_NOT_FOUND = -ENOENT,
michael@0 56 PERMISSION_DENIED = -EPERM,
michael@0 57 NO_INIT = -ENODEV,
michael@0 58 ALREADY_EXISTS = -EEXIST,
michael@0 59 DEAD_OBJECT = -EPIPE,
michael@0 60 FAILED_TRANSACTION = 0x80000002,
michael@0 61 JPARKS_BROKE_IT = -EPIPE,
michael@0 62 #if !defined(HAVE_MS_C_RUNTIME)
michael@0 63 BAD_INDEX = -EOVERFLOW,
michael@0 64 NOT_ENOUGH_DATA = -ENODATA,
michael@0 65 WOULD_BLOCK = -EWOULDBLOCK,
michael@0 66 TIMED_OUT = -ETIMEDOUT,
michael@0 67 UNKNOWN_TRANSACTION = -EBADMSG,
michael@0 68 #else
michael@0 69 BAD_INDEX = -E2BIG,
michael@0 70 NOT_ENOUGH_DATA = 0x80000003,
michael@0 71 WOULD_BLOCK = 0x80000004,
michael@0 72 TIMED_OUT = 0x80000005,
michael@0 73 UNKNOWN_TRANSACTION = 0x80000006,
michael@0 74 #endif
michael@0 75 FDS_NOT_ALLOWED = 0x80000007,
michael@0 76 };
michael@0 77
michael@0 78 // Restore define; enumeration is in "android" namespace, so the value defined
michael@0 79 // there won't work for Win32 code in a different namespace.
michael@0 80 #ifdef _WIN32
michael@0 81 # define NO_ERROR 0L
michael@0 82 #endif
michael@0 83
michael@0 84 }; // namespace android
michael@0 85
michael@0 86 // ---------------------------------------------------------------------------
michael@0 87
michael@0 88 #endif // ANDROID_ERRORS_H

mercurial