]> granicus.if.org Git - icu/commitdiff
ICU-20100 Change the name of the TimeZone::getDisplayName daylight parameter.
authorJeff Genovy <Jeff.Genovy@microsoft.com>
Fri, 18 Jan 2019 19:45:44 +0000 (11:45 -0800)
committerJeff Genovy <29107334+jefgen@users.noreply.github.com>
Wed, 13 Feb 2019 18:55:43 +0000 (10:55 -0800)
The TimeZone::getDisplayName "daylight" parameter conflicts with an existing macro in the CRT "time.h" header.

icu4c/source/i18n/timezone.cpp
icu4c/source/i18n/unicode/timezone.h

index 162e2dac12eff54cae0393289a0cea6f782e382d..aa5e7dadf0ae31037b24e370327b9734d2cf7c8c 100644 (file)
@@ -1182,9 +1182,9 @@ TimeZone::getDisplayName(const Locale& locale, UnicodeString& result) const
 }
 
 UnicodeString&
-TimeZone::getDisplayName(UBool daylight, EDisplayType style, UnicodeString& result)  const
+TimeZone::getDisplayName(UBool inDaylight, EDisplayType style, UnicodeString& result)  const
 {
-    return getDisplayName(daylight,style, Locale::getDefault(), result);
+    return getDisplayName(inDaylight,style, Locale::getDefault(), result);
 }
 //--------------------------------------
 int32_t
@@ -1196,7 +1196,7 @@ TimeZone::getDSTSavings()const {
 }
 //---------------------------------------
 UnicodeString&
-TimeZone::getDisplayName(UBool daylight, EDisplayType style, const Locale& locale, UnicodeString& result) const
+TimeZone::getDisplayName(UBool inDaylight, EDisplayType style, const Locale& locale, UnicodeString& result) const
 {
     UErrorCode status = U_ZERO_ERROR;
     UDate date = Calendar::getNow();
@@ -1226,8 +1226,8 @@ TimeZone::getDisplayName(UBool daylight, EDisplayType style, const Locale& local
         // Generic format many use Localized GMT as the final fallback.
         // When Localized GMT format is used, the result might not be
         // appropriate for the requested daylight value.
-        if ((daylight && timeType == UTZFMT_TIME_TYPE_STANDARD) || (!daylight && timeType == UTZFMT_TIME_TYPE_DAYLIGHT)) {
-            offset = daylight ? getRawOffset() + getDSTSavings() : getRawOffset();
+        if ((inDaylight && timeType == UTZFMT_TIME_TYPE_STANDARD) || (!inDaylight && timeType == UTZFMT_TIME_TYPE_DAYLIGHT)) {
+            offset = inDaylight ? getRawOffset() + getDSTSavings() : getRawOffset();
             if (style == SHORT_GENERIC) {
                 tzfmt->formatOffsetShortLocalizedGMT(offset, result, status);
             } else {
@@ -1240,7 +1240,7 @@ TimeZone::getDisplayName(UBool daylight, EDisplayType style, const Locale& local
             result.remove();
             return result;
         }
-        offset = daylight && useDaylightTime() ? getRawOffset() + getDSTSavings() : getRawOffset();
+        offset = inDaylight && useDaylightTime() ? getRawOffset() + getDSTSavings() : getRawOffset();
         switch (style) {
         case LONG_GMT:
             tzfmt->formatOffsetLocalizedGMT(offset, result, status);
@@ -1257,11 +1257,11 @@ TimeZone::getDisplayName(UBool daylight, EDisplayType style, const Locale& local
         UTimeZoneNameType nameType = UTZNM_UNKNOWN;
         switch (style) {
         case LONG:
-            nameType = daylight ? UTZNM_LONG_DAYLIGHT : UTZNM_LONG_STANDARD;
+            nameType = inDaylight ? UTZNM_LONG_DAYLIGHT : UTZNM_LONG_STANDARD;
             break;
         case SHORT:
         case SHORT_COMMONLY_USED:
-            nameType = daylight ? UTZNM_SHORT_DAYLIGHT : UTZNM_SHORT_STANDARD;
+            nameType = inDaylight ? UTZNM_SHORT_DAYLIGHT : UTZNM_SHORT_STANDARD;
             break;
         default:
             UPRV_UNREACHABLE;
@@ -1276,7 +1276,7 @@ TimeZone::getDisplayName(UBool daylight, EDisplayType style, const Locale& local
         if (result.isEmpty()) {
             // Fallback to localized GMT
             LocalPointer<TimeZoneFormat> tzfmt(TimeZoneFormat::createInstance(locale, status));
-            offset = daylight && useDaylightTime() ? getRawOffset() + getDSTSavings() : getRawOffset();
+            offset = inDaylight && useDaylightTime() ? getRawOffset() + getDSTSavings() : getRawOffset();
             if (style == LONG) {
                 tzfmt->formatOffsetLocalizedGMT(offset, result, status);
             } else {
index 064703e1587397aa8c11314884dbb2d93b39e2e9..bc15bbf5fc4d5635a552281efb0c56a512954fd3 100644 (file)
@@ -657,13 +657,13 @@ public:
      * If the display name is not available for the locale,
      * then this method returns a string in the localized GMT offset format
      * such as <code>GMT[+-]HH:mm</code>.
-     * @param daylight if true, return the daylight savings name.
+     * @param inDaylight if true, return the daylight savings name.
      * @param style
      * @param result the human-readable name of this time zone in the default locale.
      * @return       A reference to 'result'.
      * @stable ICU 2.0
      */
-    UnicodeString& getDisplayName(UBool daylight, EDisplayType style, UnicodeString& result) const;
+    UnicodeString& getDisplayName(UBool inDaylight, EDisplayType style, UnicodeString& result) const;
 
     /**
      * Returns a name of this time zone suitable for presentation to the user
@@ -671,7 +671,7 @@ public:
      * If the display name is not available for the locale,
      * then this method returns a string in the localized GMT offset format
      * such as <code>GMT[+-]HH:mm</code>.
-     * @param daylight if true, return the daylight savings name.
+     * @param inDaylight if true, return the daylight savings name.
      * @param style
      * @param locale the locale in which to supply the display name.
      * @param result the human-readable name of this time zone in the given locale
@@ -679,7 +679,7 @@ public:
      * @return       A refence to 'result'.
      * @stable ICU 2.0
      */
-    UnicodeString& getDisplayName(UBool daylight, EDisplayType style, const Locale& locale, UnicodeString& result) const;
+    UnicodeString& getDisplayName(UBool inDaylight, EDisplayType style, const Locale& locale, UnicodeString& result) const;
     
     /**
      * Queries if this time zone uses daylight savings time.