Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: source/tools/toolutil/udbgutil.cpp

Issue 1621843002: ICU 56 update step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@561
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/tools/toolutil/udbgutil.h ('k') | source/tools/toolutil/uoptions.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/tools/toolutil/udbgutil.cpp
diff --git a/source/tools/toolutil/udbgutil.cpp b/source/tools/toolutil/udbgutil.cpp
index efad36345f55a1d59ffa47c00441294ac59e9d08..d4f22a053c74a8d2008c5126ea055dcb6317746f 100644
--- a/source/tools/toolutil/udbgutil.cpp
+++ b/source/tools/toolutil/udbgutil.cpp
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 2007-2013, International Business Machines Corporation and
+ * Copyright (c) 2007-2015, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
@@ -17,6 +17,8 @@
To add a new enum type
(For example: UShoeSize with values USHOE_WIDE=0, USHOE_REGULAR, USHOE_NARROW, USHOE_COUNT)
+ 0. Make sure that all lines you add are protected with appropriate uconfig guards,
+ such as '#if !UCONFIG_NO_SHOES'.
1. udbgutil.h: add UDBG_UShoeSize to the UDebugEnumType enum before UDBG_ENUM_COUNT
( The subsequent steps involve this file, udbgutil.cpp )
2. Find the marker "Add new enum types above this line"
@@ -184,6 +186,7 @@ static const Field names_UColAttributeValue[] = {
#endif
+#if UCONFIG_ENABLE_PLUGINS
#include "unicode/icuplug.h"
#define LEN_UPLUG_REASON 13 /* UPLUG_REASON_ */
@@ -202,6 +205,7 @@ static const Field names_UPlugLevel[] = {
FIELD_NAME_STR( LEN_UPLUG_LEVEL, UPLUG_LEVEL_LOW ),
FIELD_NAME_STR( LEN_UPLUG_LEVEL, UPLUG_LEVEL_HIGH ),
};
+#endif
#define LEN_UDBG 5 /* "UDBG_" */
static const int32_t count_UDebugEnumType = UDBG_ENUM_COUNT;
@@ -213,8 +217,10 @@ static const Field names_UDebugEnumType[] =
FIELD_NAME_STR( LEN_UDBG, UDBG_UCalendarMonths ),
FIELD_NAME_STR( LEN_UDBG, UDBG_UDateFormatStyle ),
#endif
+#if UCONFIG_ENABLE_PLUGINS
FIELD_NAME_STR( LEN_UDBG, UDBG_UPlugReason ),
FIELD_NAME_STR( LEN_UDBG, UDBG_UPlugLevel ),
+#endif
FIELD_NAME_STR( LEN_UDBG, UDBG_UAcceptResult ),
#if !UCONFIG_NO_COLLATION
FIELD_NAME_STR( LEN_UDBG, UDBG_UColAttributeValue ),
@@ -244,8 +250,10 @@ static int32_t _udbg_enumCount(UDebugEnumType type, UBool actual) {
COUNT_CASE(UCalendarMonths)
COUNT_CASE(UDateFormatStyle)
#endif
+#if UCONFIG_ENABLE_PLUGINS
COUNT_CASE(UPlugReason)
COUNT_CASE(UPlugLevel)
+#endif
COUNT_CASE(UAcceptResult)
#if !UCONFIG_NO_COLLATION
COUNT_CASE(UColAttributeValue)
@@ -264,10 +272,12 @@ static const Field* _udbg_enumFields(UDebugEnumType type) {
FIELD_CASE(UCalendarMonths)
FIELD_CASE(UDateFormatStyle)
#endif
+#if UCONFIG_ENABLE_PLUGINS
FIELD_CASE(UPlugReason)
FIELD_CASE(UPlugLevel)
+#endif
FIELD_CASE(UAcceptResult)
- // FIELD_FAIL_CASE(UNonExistentEnum)
+ // FIELD_FAIL_CASE(UNonExistentEnum)
#if !UCONFIG_NO_COLLATION
FIELD_CASE(UColAttributeValue)
#endif
@@ -319,15 +329,17 @@ int32_t udbg_enumByName(UDebugEnumType type, const char *value) {
return -1; // type out of range
}
const Field *fields = _udbg_enumFields(type);
- for(int32_t field = 0;field<_udbg_enumCount(type, FALSE);field++) {
- if(!strcmp(value, fields[field].str + fields[field].prefix)) {
- return fields[field].num;
+ if (fields != NULL) {
+ for(int32_t field = 0;field<_udbg_enumCount(type, FALSE);field++) {
+ if(!strcmp(value, fields[field].str + fields[field].prefix)) {
+ return fields[field].num;
+ }
}
- }
- // try with the prefix
- for(int32_t field = 0;field<_udbg_enumCount(type, FALSE);field++) {
- if(!strcmp(value, fields[field].str)) {
- return fields[field].num;
+ // try with the prefix
+ for(int32_t field = 0;field<_udbg_enumCount(type, FALSE);field++) {
+ if(!strcmp(value, fields[field].str)) {
+ return fields[field].num;
+ }
}
}
// fail
« no previous file with comments | « source/tools/toolutil/udbgutil.h ('k') | source/tools/toolutil/uoptions.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698