From 2a4800d452b976ee277a962f0e54b5c1bfcebfdd Mon Sep 17 00:00:00 2001 From: Sunggyu Choi Date: Tue, 16 Jan 2018 13:41:18 +0900 Subject: [PATCH] Add new i18n custom error Change-Id: I114c02de73b63075a39511c84de374a96f45f71b Signed-off-by: Sunggyu Choi --- include/private/tizen_error_private.h | 59 +++++++++++++++++++++++++++++++++++ packaging/capi-base-common.spec | 2 +- src/tizen_error.c | 8 ++--- 3 files changed, 64 insertions(+), 5 deletions(-) diff --git a/include/private/tizen_error_private.h b/include/private/tizen_error_private.h index 9dde376..d795aa1 100644 --- a/include/private/tizen_error_private.h +++ b/include/private/tizen_error_private.h @@ -369,6 +369,65 @@ static err_info err_list[] = { ERR_ENTRY("I18N_ERROR_STD3_ASCII_RULES", TIZEN_ERROR_UTILITY_ICU | 0x1E, "Argument does not satisfy STD3 rules"), ERR_ENTRY("I18N_ERROR_UNASSIGNED", TIZEN_ERROR_UTILITY_ICU | 0x1F, "Unassigned code points are found"), ERR_ENTRY("I18N_WARNING_SORT_KEY_TOO_SHORT", TIZEN_ERROR_UTILITY_ICU | 0x20, "Number of levels requested in getBound is higher than the number of levels in the sort key"), + ERR_ENTRY("I18N_ERROR_BAD_VARIABLE_DEFINITION", TIZEN_ERROR_UTILITY_ICU | 0x1000, "Missing \'$\' or duplicate variable name"), + ERR_ENTRY("I18N_ERROR_MALFORMED_RULE", TIZEN_ERROR_UTILITY_ICU | 0x1001, "Elements of a rule are misplaced"), + ERR_ENTRY("I18N_ERROR_MALFORMED_UNICODE_ESCAPE", TIZEN_ERROR_UTILITY_ICU | 0x1002, "A Unicode escape pattern is invalid"), + ERR_ENTRY("I18N_ERROR_MALFORMED_VARIABLE_DEFINITION", TIZEN_ERROR_UTILITY_ICU | 0x1003, "A variable definition is invalid"), + ERR_ENTRY("I18N_ERROR_MALFORMED_VARIABLE_REFERENCE", TIZEN_ERROR_UTILITY_ICU | 0x1004, "A variable reference is invalid"), + ERR_ENTRY("I18N_ERROR_MISPLACED_ANCHOR_START", TIZEN_ERROR_UTILITY_ICU | 0x1005, "A start anchor appears at an illegal position"), + ERR_ENTRY("I18N_ERROR_MISPLACED_CURSOR_OFFSET", TIZEN_ERROR_UTILITY_ICU | 0x1006, "A cursor offset occurs at an illegal position"), + ERR_ENTRY("I18N_ERROR_MISPLACED_QUANTIFIER", TIZEN_ERROR_UTILITY_ICU | 0x1007, "A quantifier appears after a segment close delimiter"), + ERR_ENTRY("I18N_ERROR_MISSING_OPERATOR", TIZEN_ERROR_UTILITY_ICU | 0x1008, "A rule contains no operator"), + ERR_ENTRY("I18N_ERROR_MULTIPLE_ANTE_CONTEXTS", TIZEN_ERROR_UTILITY_ICU | 0x1009, "More than one ante context"), + ERR_ENTRY("I18N_ERROR_MULTIPLE_CURSORS", TIZEN_ERROR_UTILITY_ICU | 0x100A, "More than one cursor"), + ERR_ENTRY("I18N_ERROR_MULTIPLE_POST_CONTEXTS", TIZEN_ERROR_UTILITY_ICU | 0x100B, "More than one post context"), + ERR_ENTRY("I18N_ERROR_TRAILING_BACKSLASH", TIZEN_ERROR_UTILITY_ICU | 0x100C, "A dangling backslash"), + ERR_ENTRY("I18N_ERROR_UNDEFINED_SEGMENT_REFERENCE", TIZEN_ERROR_UTILITY_ICU | 0x100D, "A segment reference does not correspond to a defined segment"), + ERR_ENTRY("I18N_ERROR_UNDEFINED_VARIABLE", TIZEN_ERROR_UTILITY_ICU | 0x100E, "A variable reference does not correspond to a defined variable"), + ERR_ENTRY("I18N_ERROR_UNQUOTED_SPECIAL", TIZEN_ERROR_UTILITY_ICU | 0x100F, "A special character was not quoted or escaped"), + ERR_ENTRY("I18N_ERROR_UNTERMINATED_QUOTE", TIZEN_ERROR_UTILITY_ICU | 0x1010, "A closing single quote is missing"), + ERR_ENTRY("I18N_ERROR_RULE_MASK", TIZEN_ERROR_UTILITY_ICU | 0x1011, "A rule is hidden by an earlier more general rule"), + ERR_ENTRY("I18N_ERROR_MISPLACED_COMPOUND_FILTER", TIZEN_ERROR_UTILITY_ICU | 0x1012, "A compound filter is in an invalid location"), + ERR_ENTRY("I18N_ERROR_MULTIPLE_COMPOUND_FILTERS", TIZEN_ERROR_UTILITY_ICU | 0x1013, "More than one compound filter"), + ERR_ENTRY("I18N_ERROR_INVALID_RBT_SYNTAX", TIZEN_ERROR_UTILITY_ICU | 0x1014, "More than one compound filter"), + ERR_ENTRY("I18N_ERROR_MALFORMED_PRAGMA", TIZEN_ERROR_UTILITY_ICU | 0x1015, "A \'use\' pragma is invalid"), + ERR_ENTRY("I18N_ERROR_UNCLOSED_SEGMENT", TIZEN_ERROR_UTILITY_ICU | 0x1016, "A closing \')\' is missing"), + ERR_ENTRY("I18N_ERROR_VARIABLE_RANGE_EXHAUSTED", TIZEN_ERROR_UTILITY_ICU | 0x1017, "Too many stand-ins generated for the given variable range"), + ERR_ENTRY("I18N_ERROR_VARIABLE_RANGE_OVERLAP", TIZEN_ERROR_UTILITY_ICU | 0x1018, "The variable range overlaps characters used in rules"), + ERR_ENTRY("I18N_ERROR_ILLEGAL_CHARACTER", TIZEN_ERROR_UTILITY_ICU | 0x1019, "A special character is outside its allowed context"), + ERR_ENTRY("I18N_ERROR_INTERNAL_TRANSLITERATOR", TIZEN_ERROR_UTILITY_ICU | 0x101A, "Internal transliterator system error"), + ERR_ENTRY("I18N_ERROR_INVALID_ID", TIZEN_ERROR_UTILITY_ICU | 0x101B, "A \"::id\" rule specifies an unknown transliterator"), + ERR_ENTRY("I18N_ERROR_INVALID_FUNCTION", TIZEN_ERROR_UTILITY_ICU | 0x101C, "A \"&fn()\" rule specifies an unknown transliterator"), + ERR_ENTRY("I18N_ERROR_UNEXPECTED_TOKEN", TIZEN_ERROR_UTILITY_ICU | 0x2000, "Syntax error in format pattern"), + ERR_ENTRY("I18N_ERROR_MULTIPLE_DECIMAL_SEPARATORS", TIZEN_ERROR_UTILITY_ICU | 0x2001, "More than one decimal separator in number pattern"), + ERR_ENTRY("I18N_ERROR_MULTIPLE_EXPONENTIAL_SYMBOLS", TIZEN_ERROR_UTILITY_ICU | 0x2002, "More than one exponent symbol in number pattern"), + ERR_ENTRY("I18N_ERROR_MALFORMED_EXPONENTIAL_PATTERN", TIZEN_ERROR_UTILITY_ICU | 0x2003, "Grouping symbol in exponent pattern"), + ERR_ENTRY("I18N_ERROR_MULTIPLE_PERCENT_SYMBOLS", TIZEN_ERROR_UTILITY_ICU | 0x2004, "More than one percent symbol in number pattern"), + ERR_ENTRY("I18N_ERROR_MULTIPLE_PERMILL_SYMBOLS", TIZEN_ERROR_UTILITY_ICU | 0x2005, "More than one permill symbol in number pattern"), + ERR_ENTRY("I18N_ERROR_MULTIPLE_PAD_SPECIFIERS", TIZEN_ERROR_UTILITY_ICU | 0x2006, "More than one pad symbol in number pattern"), + ERR_ENTRY("I18N_ERROR_PATTERN_SYNTAX", TIZEN_ERROR_UTILITY_ICU | 0x2007, "Syntax error in format pattern"), + ERR_ENTRY("I18N_ERROR_ILLEGAL_PAD_POSITION", TIZEN_ERROR_UTILITY_ICU | 0x2008, "Pad symbol misplaced in number pattern"), + ERR_ENTRY("I18N_ERROR_UNMATCHED_BRACES", TIZEN_ERROR_UTILITY_ICU | 0x2009, "Braces do not match in message pattern"), + ERR_ENTRY("I18N_ERROR_ARGUMENT_TYPE_MISMATCH", TIZEN_ERROR_UTILITY_ICU | 0x200A, "Argument name and argument index mismatch in format functions"), + ERR_ENTRY("I18N_ERROR_DUPLICATE_KEYWORD", TIZEN_ERROR_UTILITY_ICU | 0x200B, "Duplicate keyword in PluralFormat"), + ERR_ENTRY("I18N_ERROR_UNDEFINED_KEYWORD", TIZEN_ERROR_UTILITY_ICU | 0x200C, "Undefined Plural keyword"), + ERR_ENTRY("I18N_ERROR_DEFAULT_KEYWORD_MISSING", TIZEN_ERROR_UTILITY_ICU | 0x200D, "Missing DEFAULT rule in plural rules"), + ERR_ENTRY("I18N_ERROR_DECIMAL_NUMBER_SYNTAX", TIZEN_ERROR_UTILITY_ICU | 0x200E, "Decimal number syntax error"), + ERR_ENTRY("I18N_ERROR_INEXACT_FORMAT", TIZEN_ERROR_UTILITY_ICU | 0x200F, "Cannot format a number exactly and rounding mode is unnecessary"), + ERR_ENTRY("I18N_ERROR_UBRK_INTERNAL", TIZEN_ERROR_UTILITY_ICU | 0x3001, "An internal ICU error (bug) was detected"), + ERR_ENTRY("I18N_ERROR_UBRK_HEX_DIGITS_EXPECTED", TIZEN_ERROR_UTILITY_ICU | 0x3002, "Hex digits expected as part of a escaped char in a rule"), + ERR_ENTRY("I18N_ERROR_UBRK_SEMICOLON_EXPECTED", TIZEN_ERROR_UTILITY_ICU | 0x3003, "Missing \';\' at the end of a RBBI rule"), + ERR_ENTRY("I18N_ERROR_UBRK_RULE_SYNTAX", TIZEN_ERROR_UTILITY_ICU | 0x3004, "Syntax error in RBBI rule"), + ERR_ENTRY("I18N_ERROR_UBRK_UNCLOSED_SET", TIZEN_ERROR_UTILITY_ICU | 0x3004, "UnicodeSet witing an RBBI rule missing a closing \']\'"), + ERR_ENTRY("I18N_ERROR_UBRK_ASSIGN_ERROR", TIZEN_ERROR_UTILITY_ICU | 0x3005, "Syntax error in RBBI rule assignment statement"), + ERR_ENTRY("I18N_ERROR_UBRK_VARIABLE_REDEFINITION", TIZEN_ERROR_UTILITY_ICU | 0x3006, "RBBI rule $Variable redefined"), + ERR_ENTRY("I18N_ERROR_UBRK_MISMATCHED_PAREN", TIZEN_ERROR_UTILITY_ICU | 0x3007, "Mis-matched parentheses in an RBBI rule"), + ERR_ENTRY("I18N_ERROR_UBRK_NEW_LINE_IN_QUOTED_STRING", TIZEN_ERROR_UTILITY_ICU | 0x3008, "Missing closing quote in an RBBI rule"), + ERR_ENTRY("I18N_ERROR_UBRK_UNDEFINED_VARIABLE", TIZEN_ERROR_UTILITY_ICU | 0x3009, "Use of an undefined $Variable in an RBBI rule"), + ERR_ENTRY("I18N_ERROR_UBRK_INIT", TIZEN_ERROR_UTILITY_ICU | 0x300A, "Initialization failure. Probable missing ICU Data"), + ERR_ENTRY("I18N_ERROR_UBRK_RULE_EMPTY_SET", TIZEN_ERROR_UTILITY_ICU | 0x300B, "Rule contains an empty Unicode Set"), + ERR_ENTRY("I18N_ERROR_UBRK_UNRECOGNIZED_OPTION", TIZEN_ERROR_UTILITY_ICU | 0x300C, "Option in RBBI rules not recognized"), + ERR_ENTRY("I18N_ERROR_UBRK_MALFORMED_RULE_TAG", TIZEN_ERROR_UTILITY_ICU | 0x300D, "The {nnn} tag on a rule is malformed"), ERR_ENTRY("CONTACTS_ERROR_DB_LOCKED", TIZEN_ERROR_CONTACTS | 0x81, "Database table locked or file locked"), ERR_ENTRY("CONTACTS_ERROR_DB", TIZEN_ERROR_CONTACTS | 0x9F, "Unknown DB error"), ERR_ENTRY("CONTACTS_ERROR_IPC_NOT_AVALIABLE", TIZEN_ERROR_CONTACTS | 0xB1, "IPC server is not available"), diff --git a/packaging/capi-base-common.spec b/packaging/capi-base-common.spec index f7ebe90..2d86bdf 100644 --- a/packaging/capi-base-common.spec +++ b/packaging/capi-base-common.spec @@ -1,6 +1,6 @@ Name: capi-base-common Summary: Common header files of Tizen Native API -Version: 0.4.19 +Version: 0.4.20 Release: 1 Group: Base License: Apache-2.0 diff --git a/src/tizen_error.c b/src/tizen_error.c index ec0db35..c31e6e4 100644 --- a/src/tizen_error.c +++ b/src/tizen_error.c @@ -57,20 +57,20 @@ char *get_error_message(int err_code) if (err_code == 0) { - strncpy(msg, "Successful", strlen("Successful")); + strncpy(msg, "Successful", sizeof(msg)); } else if (err_code >= TIZEN_ERROR_OWNER_DEAD && err_code < 0) { if ((~err_code + 1) == -ENOSYS) - strncpy(msg, "Invalid operation", strlen("Invalid operation")); + strncpy(msg, "Invalid operation", sizeof(msg)); else strerror_r(~err_code + 1, msg, sizeof(msg)); } else if (err_code >= TIZEN_ERROR_MIN_PLATFORM_ERROR && err_code < TIZEN_ERROR_END_OF_COLLECTION) { tmp = _get_error_message(err_code); if (tmp != NULL) - strncpy(msg, tmp, strlen(tmp)); + strncpy(msg, tmp, sizeof(msg)); } else if (err_code >= TIZEN_ERROR_MIN_PLATFORM_MODULE && err_code < -0x009F0000) { tmp = _get_error_message(err_code); if (tmp != NULL) - strncpy(msg, tmp, strlen(tmp)); + strncpy(msg, tmp, sizeof(msg)); } else {; } return msg; -- 2.7.4