1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/omx-plugin/include/froyo/utils/Errors.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,87 @@ 1.4 +/* 1.5 + * Copyright (C) 2007 The Android Open Source Project 1.6 + * 1.7 + * Licensed under the Apache License, Version 2.0 (the "License"); 1.8 + * you may not use this file except in compliance with the License. 1.9 + * You may obtain a copy of the License at 1.10 + * 1.11 + * http://www.apache.org/licenses/LICENSE-2.0 1.12 + * 1.13 + * Unless required by applicable law or agreed to in writing, software 1.14 + * distributed under the License is distributed on an "AS IS" BASIS, 1.15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1.16 + * See the License for the specific language governing permissions and 1.17 + * limitations under the License. 1.18 + */ 1.19 + 1.20 +#ifndef ANDROID_ERRORS_H 1.21 +#define ANDROID_ERRORS_H 1.22 + 1.23 +#include <sys/types.h> 1.24 +#include <errno.h> 1.25 + 1.26 +namespace android { 1.27 + 1.28 +// use this type to return error codes 1.29 +#ifdef HAVE_MS_C_RUNTIME 1.30 +typedef int status_t; 1.31 +#else 1.32 +typedef int32_t status_t; 1.33 +#endif 1.34 + 1.35 +/* the MS C runtime lacks a few error codes */ 1.36 + 1.37 +/* 1.38 + * Error codes. 1.39 + * All error codes are negative values. 1.40 + */ 1.41 + 1.42 +// Win32 #defines NO_ERROR as well. It has the same value, so there's no 1.43 +// real conflict, though it's a bit awkward. 1.44 +#ifdef _WIN32 1.45 +# undef NO_ERROR 1.46 +#endif 1.47 + 1.48 +enum { 1.49 + OK = 0, // Everything's swell. 1.50 + NO_ERROR = 0, // No errors. 1.51 + 1.52 + UNKNOWN_ERROR = 0x80000000, 1.53 + 1.54 + NO_MEMORY = -ENOMEM, 1.55 + INVALID_OPERATION = -ENOSYS, 1.56 + BAD_VALUE = -EINVAL, 1.57 + BAD_TYPE = 0x80000001, 1.58 + NAME_NOT_FOUND = -ENOENT, 1.59 + PERMISSION_DENIED = -EPERM, 1.60 + NO_INIT = -ENODEV, 1.61 + ALREADY_EXISTS = -EEXIST, 1.62 + DEAD_OBJECT = -EPIPE, 1.63 + FAILED_TRANSACTION = 0x80000002, 1.64 + JPARKS_BROKE_IT = -EPIPE, 1.65 +#if !defined(HAVE_MS_C_RUNTIME) 1.66 + BAD_INDEX = -EOVERFLOW, 1.67 + NOT_ENOUGH_DATA = -ENODATA, 1.68 + WOULD_BLOCK = -EWOULDBLOCK, 1.69 + TIMED_OUT = -ETIMEDOUT, 1.70 + UNKNOWN_TRANSACTION = -EBADMSG, 1.71 +#else 1.72 + BAD_INDEX = -E2BIG, 1.73 + NOT_ENOUGH_DATA = 0x80000003, 1.74 + WOULD_BLOCK = 0x80000004, 1.75 + TIMED_OUT = 0x80000005, 1.76 + UNKNOWN_TRANSACTION = 0x80000006, 1.77 +#endif 1.78 +}; 1.79 + 1.80 +// Restore define; enumeration is in "android" namespace, so the value defined 1.81 +// there won't work for Win32 code in a different namespace. 1.82 +#ifdef _WIN32 1.83 +# define NO_ERROR 0L 1.84 +#endif 1.85 + 1.86 +}; // namespace android 1.87 + 1.88 +// --------------------------------------------------------------------------- 1.89 + 1.90 +#endif // ANDROID_ERRORS_H