From dd845e95204f61cede6108950126ce7e15c06684 Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Thu, 3 Jan 2008 10:07:47 +0000 Subject: [PATCH] ICU-5955 Mark data const X-SVN-Rev: 23158 --- icu4c/source/common/rbbi.cpp | 4 ++-- icu4c/source/common/util.cpp | 21 +++++++++------------ icu4c/source/i18n/dtptngen.cpp | 12 ++++-------- icu4c/source/i18n/regexcmp.cpp | 4 ++-- icu4c/source/i18n/ucol.cpp | 8 ++++---- 5 files changed, 21 insertions(+), 28 deletions(-) diff --git a/icu4c/source/common/rbbi.cpp b/icu4c/source/common/rbbi.cpp index 41d242fff9c..06dc2c570a6 100644 --- a/icu4c/source/common/rbbi.cpp +++ b/icu4c/source/common/rbbi.cpp @@ -1,6 +1,6 @@ /* *************************************************************************** -* Copyright (C) 1999-2007 International Business Machines Corporation * +* Copyright (C) 1999-2008 International Business Machines Corporation * * and others. All rights reserved. * *************************************************************************** */ @@ -321,7 +321,7 @@ void RuleBasedBreakIterator::setText(UText *ut, UErrorCode &status) { // we can come to signaling a failure. // (GetText() is obsolete, this failure is sort of OK) if (fDCharIter == NULL) { - static UChar c = 0; + static const UChar c = 0; fDCharIter = new UCharCharacterIterator(&c, 0); } diff --git a/icu4c/source/common/util.cpp b/icu4c/source/common/util.cpp index 6b74ffe5b16..8a69a0ebc5f 100644 --- a/icu4c/source/common/util.cpp +++ b/icu4c/source/common/util.cpp @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (c) 2001-2007, International Business Machines +* Copyright (c) 2001-2008, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * Date Name Description @@ -62,9 +62,6 @@ UnicodeString& ICU_Utility::appendNumber(UnicodeString& result, int32_t n, return result; } -static const UChar HEX[16] = {48,49,50,51,52,53,54,55, // 0-7 - 56,57,65,66,67,68,69,70}; // 8-9 A-F - /** * Return true if the character is NOT printable ASCII. */ @@ -83,17 +80,17 @@ UBool ICU_Utility::escapeUnprintable(UnicodeString& result, UChar32 c) { result.append(BACKSLASH); if (c & ~0xFFFF) { result.append(UPPER_U); - result.append(HEX[0xF&(c>>28)]); - result.append(HEX[0xF&(c>>24)]); - result.append(HEX[0xF&(c>>20)]); - result.append(HEX[0xF&(c>>16)]); + result.append(DIGITS[0xF&(c>>28)]); + result.append(DIGITS[0xF&(c>>24)]); + result.append(DIGITS[0xF&(c>>20)]); + result.append(DIGITS[0xF&(c>>16)]); } else { result.append(LOWER_U); } - result.append(HEX[0xF&(c>>12)]); - result.append(HEX[0xF&(c>>8)]); - result.append(HEX[0xF&(c>>4)]); - result.append(HEX[0xF&c]); + result.append(DIGITS[0xF&(c>>12)]); + result.append(DIGITS[0xF&(c>>8)]); + result.append(DIGITS[0xF&(c>>4)]); + result.append(DIGITS[0xF&c]); return TRUE; } return FALSE; diff --git a/icu4c/source/i18n/dtptngen.cpp b/icu4c/source/i18n/dtptngen.cpp index cd06c29400a..88c21f5b17e 100644 --- a/icu4c/source/i18n/dtptngen.cpp +++ b/icu4c/source/i18n/dtptngen.cpp @@ -1,6 +1,6 @@ /* ******************************************************************************* -* Copyright (C) 2008, International Business Machines Corporation and +* Copyright (C) 2007-2008, International Business Machines Corporation and * others. All Rights Reserved. ******************************************************************************* * @@ -35,10 +35,6 @@ #include "dtptngen_impl.h" -#if defined U_DEBUG_DTPTN -#include -#endif - #define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0])) U_NAMESPACE_BEGIN @@ -105,17 +101,17 @@ static const dtTypeElem dtTypes[] = { {0, UDATPG_FIELD_COUNT, 0, 0, 0} , // last row of dtTypes[] }; -static const char* CLDR_FIELD_APPEND[] = { +static const char* const CLDR_FIELD_APPEND[] = { "Era", "Year", "Quarter", "Month", "Week", "*", "Day-Of-Week", "Day", "*", "*", "*", "Hour", "Minute", "Second", "*", "Timezone" }; -static const char* CLDR_FIELD_NAME[] = { +static const char* const CLDR_FIELD_NAME[] = { "era", "year", "quarter", "month", "week", "*", "weekday", "day", "*", "*", "dayperiod", "hour", "minute", "second", "*", "zone" }; -static const char* Resource_Fields[] = { +static const char* const Resource_Fields[] = { "day", "dayperiod", "era", "hour", "minute", "month", "second", "week", "weekday", "year", "zone", "quarter" }; diff --git a/icu4c/source/i18n/regexcmp.cpp b/icu4c/source/i18n/regexcmp.cpp index adf1ce067b5..33d40750a11 100644 --- a/icu4c/source/i18n/regexcmp.cpp +++ b/icu4c/source/i18n/regexcmp.cpp @@ -2,7 +2,7 @@ // // file: regexcmp.cpp // -// Copyright (C) 2002-2007 International Business Machines Corporation and others. +// Copyright (C) 2002-2008 International Business Machines Corporation and others. // All Rights Reserved. // // This file contains the ICU regular expression compiler, which is responsible @@ -4022,7 +4022,7 @@ UnicodeSet *RegexCompile::createSetForProperty(const UnicodeString &propName, UB // TODO: Redo to remove dependency on code page conversion of (char *) strings. // #define IDENTIFIER_IGNORABLE "[\\u0000-\\u0008\\u000e-\\u001b\\u007f-\\u009f\\p{Cf}]" - static const char *javaProps[][2] = { + static const char * const javaProps[][2] = { {"javaDefined", "\\P{Cn}"}, {"javaDigit", "\\p{Nd}"}, {"javaIdentifierIgnorable", IDENTIFIER_IGNORABLE}, diff --git a/icu4c/source/i18n/ucol.cpp b/icu4c/source/i18n/ucol.cpp index 09582433641..1f79581f4da 100644 --- a/icu4c/source/i18n/ucol.cpp +++ b/icu4c/source/i18n/ucol.cpp @@ -1,6 +1,6 @@ /* ******************************************************************************* -* Copyright (C) 1996-2007, International Business Machines +* Copyright (C) 1996-2008, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************* * file name: ucol.cpp @@ -72,9 +72,9 @@ static const uint16_t *fcdTrieIndex=NULL; // implicit generation and supressing sort key compression // they should regularly be in the UCA, but if one // is running without UCA, it could be a problem -static int32_t maxRegularPrimary = 0xA0; -static int32_t minImplicitPrimary = 0xE0; -static int32_t maxImplicitPrimary = 0xE4; +static const int32_t maxRegularPrimary = 0xA0; +static const int32_t minImplicitPrimary = 0xE0; +static const int32_t maxImplicitPrimary = 0xE4; U_CDECL_BEGIN static UBool U_CALLCONV