diff options
author | Mikhail Teterin <mi@FreeBSD.org> | 2009-03-25 16:42:59 +0000 |
---|---|---|
committer | Mikhail Teterin <mi@FreeBSD.org> | 2009-03-25 16:42:59 +0000 |
commit | 50e2e280a9283c4834e10d5bcbea7a72d3d60c2a (patch) | |
tree | af7781733a23377265d882cece4d294eaa0cee33 /devel/icu | |
parent | 208b451f015054eef703d52f14ca9eeee1c87fde (diff) | |
download | ports-50e2e280a9283c4834e10d5bcbea7a72d3d60c2a.tar.gz ports-50e2e280a9283c4834e10d5bcbea7a72d3d60c2a.zip |
Notes
Diffstat (limited to 'devel/icu')
-rw-r--r-- | devel/icu/Makefile | 5 | ||||
-rw-r--r-- | devel/icu/files/patch-format | 210 |
2 files changed, 212 insertions, 3 deletions
diff --git a/devel/icu/Makefile b/devel/icu/Makefile index 2a4fd5892604..f535e7cde35e 100644 --- a/devel/icu/Makefile +++ b/devel/icu/Makefile @@ -7,10 +7,9 @@ PORTNAME= icu PORTVERSION= 3.8.1 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= devel -MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} -MASTER_SITE_SUBDIR=${PORTNAME} +MASTER_SITES= SF DISTNAME= icu4c-${PORTVERSION:S/./_/g} EXTRACT_SUFX= -src.tgz diff --git a/devel/icu/files/patch-format b/devel/icu/files/patch-format new file mode 100644 index 000000000000..817d4fb1733b --- /dev/null +++ b/devel/icu/files/patch-format @@ -0,0 +1,210 @@ +Fix self-test(s) breaking, when build happens on days with other than +24-hours (such as when daylight saving time kicks in). See: + + http://www.freebsd.org/cgi/query-pr.cgi?pr=128521 + http://www.icu-project.org/trac/ticket/6018 + +Index: /icu/trunk/source/i18n/calendar.cpp +=================================================================== +--- i18n/calendar.cpp (revision 22978) ++++ i18n/calendar.cpp (revision 23166) +@@ -1,5 +1,5 @@ + /* + ******************************************************************************* +-* Copyright (C) 1997-2007, International Business Machines Corporation and * ++* Copyright (C) 1997-2008, International Business Machines Corporation and * + * others. All Rights Reserved. * + ******************************************************************************* +@@ -74,6 +74,12 @@ + + #if defined( U_DEBUG_CALSVC ) || defined (U_DEBUG_CAL) ++ ++/** ++ * fldName was removed as a duplicate implementation. ++ * use udbg_ services instead, ++ * which depend on include files and library from ../tools/ctestfw ++ */ ++#include "unicode/udbgutil.h" + #include <stdio.h> +- + + /** +@@ -83,12 +89,8 @@ + * @internal + */ +-#error fldName() has been removed. Please use udbg_ucal_fieldName() from libctestfw instead. The following code might work. +- +-static const char* fldName(UCalendarDateFields f) { +- const char *udbg_ucal_fieldName(int32_t fld); +- return udbg_ucal_fieldName((int32_t)f); +-} +- +- ++ ++const char* fldName(UCalendarDateFields f) { ++ return udbg_enumName(UDBG_UCalendarDateFields, (int32_t)f); ++} + + #if UCAL_DEBUG_DUMP +Index: /icu/trunk/source/i18n/reldtfmt.cpp +=================================================================== +--- i18n/reldtfmt.cpp (revision 22561) ++++ i18n/reldtfmt.cpp (revision 23166) +@@ -1,5 +1,5 @@ + /* + ******************************************************************************* +-* Copyright (C) 2007, International Business Machines Corporation and * ++* Copyright (C) 2007-2008, International Business Machines Corporation and * + * others. All Rights Reserved. * + ******************************************************************************* +@@ -304,8 +304,13 @@ + return 0; + } +- // TODO: Cache the nowCal to avoid heap allocs? ++ // TODO: Cache the nowCal to avoid heap allocs? Would be difficult, don't know the calendar type + Calendar *nowCal = cal.clone(); + nowCal->setTime(Calendar::getNow(), status); +- int32_t dayDiff = nowCal->fieldDifference(cal.getTime(status), Calendar::DATE, status); ++ ++ // For the day difference, we are interested in the difference in the (modified) julian day number ++ // which is midnight to midnight. Using fieldDifference() is NOT correct here, because ++ // 6pm Jan 4th to 10am Jan 5th should be considered "tomorrow". ++ int32_t dayDiff = cal.get(UCAL_JULIAN_DAY, status) - nowCal->get(UCAL_JULIAN_DAY, status); ++ + delete nowCal; + return dayDiff; +Index: /icu/trunk/source/test/intltest/dadrfmt.cpp +=================================================================== +--- test/intltest/dadrfmt.cpp (revision 22493) ++++ test/intltest/dadrfmt.cpp (revision 23166) +@@ -1,5 +1,5 @@ + /******************************************************************** + * COPYRIGHT: +- * Copyright (c) 1997-2007, International Business Machines Corporation and ++ * Copyright (c) 1997-2008, International Business Machines Corporation and + * others. All Rights Reserved. + ********************************************************************/ +@@ -94,4 +94,5 @@ + UnicodeString kMILLIS("MILLIS="); // TODO: static + UnicodeString kRELATIVE_MILLIS("RELATIVE_MILLIS="); // TODO: static ++ UnicodeString kRELATIVE_ADD("RELATIVE_ADD:"); // TODO: static + + UErrorCode status = U_ZERO_ERROR; +@@ -170,5 +171,10 @@ + } + } +- ++ ++ Calendar *cal = Calendar::createInstance(loc, status); ++ if(U_FAILURE(status)) { ++ errln("case %d: could not create calendar from %s", n, calLoc); ++ } ++ + // parse 'date' + if(date.startsWith(kMILLIS)) { +@@ -180,4 +186,28 @@ + useDate = TRUE; + fromDate = udbg_stoi(millis) + now; ++ } else if(date.startsWith(kRELATIVE_ADD)) { ++ UnicodeString add = UnicodeString(date, kRELATIVE_ADD.length()); // "add" is a string indicating which fields to add ++ if(fromSet.parseFrom(add, status)<0 || U_FAILURE(status)) { ++ errln("case %d: could not parse date as RELATIVE_ADD calendar fields: %s", n, u_errorName(status)); ++ continue; ++ } ++ logln("Parsing ..\n"); ++ useDate=TRUE; ++ cal->clear(); ++ cal->setTime(now, status); ++ for (int q=0; q<UCAL_FIELD_COUNT; q++) { ++ if (fromSet.isSet((UCalendarDateFields)q)) { ++ int32_t oldv = cal->get((UCalendarDateFields)q, status); ++ cal->add((UCalendarDateFields)q, ++ fromSet.get((UCalendarDateFields)q), status); ++ int32_t newv = cal->get((UCalendarDateFields)q, status); ++ logln("adding %d to %s ..went from %d to %d\n", fromSet.get((UCalendarDateFields)q), udbg_enumName(UDBG_UCalendarDateFields, q), oldv, newv); ++ } ++ } ++ fromDate = cal->getTime(status); ++ if(U_FAILURE(status)) { ++ errln("case %d: could not apply date as RELATIVE_ADD calendar fields: %s", n, u_errorName(status)); ++ continue; ++ } + } else if(fromSet.parseFrom(date, status)<0 || U_FAILURE(status)) { + errln("case %d: could not parse date as calendar fields: %s", n, u_errorName(status)); +@@ -185,8 +215,4 @@ + } + +- Calendar *cal = Calendar::createInstance(loc, status); +- if(U_FAILURE(status)) { +- errln("case %d: could not create calendar from %s", n, calLoc); +- } + // now, do it. + if (fmt) { +Index: /icu/trunk/source/test/testdata/format.txt +=================================================================== +--- test/testdata/format.txt (revision 22885) ++++ test/testdata/format.txt (revision 23166) +@@ -1,3 +1,3 @@ +-// Copyright (c) 2007 International Business Machines ++// Copyright (c) 2007-2008 International Business Machines + // Corporation and others. All Rights Reserved. + format:table(nofallback) { +@@ -23,5 +23,8 @@ + // locale: locale including calendar type + // spec: either 'PATTERN=y mm h' etc, or 'DATE=SHORT,TIME=LONG' +- // date: either 'MILLIS=####' where #### is an unsigned long (millis), or a calendar spec ERA=0,YEAR=1, etc.. applied to the calendar type specified by the locale ++ // date: either 'MILLIS=####' where #### is millis, ++ // or a calendar spec ERA=0,YEAR=1, etc.. applied to the calendar type specified by the locale ++ // or RELATIVE_MILLIS=### where ### is a signed value which is added to the current millis ++ // or RELATIVE_ADD:DATE=1 which means that the field "DATE" will be added by +1 relative to current time + // str: the expected unicode string + Cases { +@@ -61,5 +64,5 @@ + "en_US@calendar=gregorian", + "DATE=RELATIVE_SHORT", +- "RELATIVE_MILLIS=86410000", // one day from now ++ "RELATIVE_ADD:DATE=1", // one day from now + "Tomorrow" + }, +@@ -67,5 +70,5 @@ + "en_US@calendar=gregorian", + "DATE=RELATIVE_SHORT", +- "RELATIVE_MILLIS=0", // one day before now ++ "RELATIVE_MILLIS=0", // today + "Today" + }, +@@ -73,5 +76,5 @@ + "en_US@calendar=gregorian", + "DATE=RELATIVE_SHORT", +- "RELATIVE_MILLIS=-86410000", // one day before now ++ "RELATIVE_ADD:DATE=-1", // one day before now + "Yesterday" + }, +@@ -79,5 +82,5 @@ + "mt_MT@calendar=gregorian", + "DATE=RELATIVE_SHORT", +- "RELATIVE_MILLIS=86410000", // one day from now ++ "RELATIVE_ADD:DATE=1", // one day from now + "Għada" + }, +@@ -85,5 +88,5 @@ + "mt_MT@calendar=gregorian", + "DATE=RELATIVE_SHORT", +- "RELATIVE_MILLIS=0", // one day before now ++ "RELATIVE_MILLIS=0", // today + "Illum" + }, +@@ -91,5 +94,5 @@ + "mt_MT@calendar=gregorian", + "DATE=RELATIVE_SHORT", +- "RELATIVE_MILLIS=-86410000", // one day before now ++ "RELATIVE_ADD:DATE=-1", // one day before now + "Lbieraħ" + }, +@@ -97,5 +100,5 @@ + "ru", + "DATE=RELATIVE_SHORT", +- "RELATIVE_MILLIS=-172810000", // 2 days ago ++ "RELATIVE_ADD:DATE=-2", // 2 days ago + "Позавчера" + }, |