View | Details | Raw Unified | Return to bug 141324 | Differences between
and this patch

Collapse All | Expand All

(-)icu/Makefile (-8 / +16 lines)
Lines 6-13 Link Here
6
#
6
#
7
7
8
PORTNAME=	icu
8
PORTNAME=	icu
9
PORTVERSION=	3.8.1
9
PORTVERSION=	4.2.1
10
PORTREVISION=	2
11
CATEGORIES=	devel
10
CATEGORIES=	devel
12
MASTER_SITES=	SF/${PORTNAME}/ICU4C/${PORTVERSION}
11
MASTER_SITES=	SF/${PORTNAME}/ICU4C/${PORTVERSION}
13
DISTNAME=	icu4c-${PORTVERSION:S/./_/g}
12
DISTNAME=	icu4c-${PORTVERSION:S/./_/g}
Lines 25-34 Link Here
25
24
26
GNU_CONFIGURE=		yes
25
GNU_CONFIGURE=		yes
27
CONFIGURE_SCRIPT=	runConfigureICU
26
CONFIGURE_SCRIPT=	runConfigureICU
28
CONFIGURE_ARGS+=	${OPSYS}
27
CONFIGURE_ARGS+=	${OPSYS} \
29
CONFIGURE_ARGS+=	--enable-shared
28
			--enable-shared \
30
CONFIGURE_ARGS+=	--enable-static
29
			--enable-static \
31
CONFIGURE_ARGS+=	--enable-samples=no
30
			--enable-samples=no
32
31
33
USE_GMAKE=		yes
32
USE_GMAKE=		yes
34
33
Lines 51-56 Link Here
51
PLIST_SUB+=	ICUMAJOR=${ICUMAJOR} ICUMINOR=1
50
PLIST_SUB+=	ICUMAJOR=${ICUMAJOR} ICUMINOR=1
52
PLIST_SUB+=	ICUVER=${PORTVERSION}
51
PLIST_SUB+=	ICUVER=${PORTVERSION}
53
52
53
post-install:
54
	# Installing man-pages, which the vendor forgets to do...
55
	${INSTALL_MAN} ${WRKSRC}/config/icu-config.1	\
56
		${MAN1:N*config*:S|^|${WRKSRC}/*/*/|}	\
57
		${MAN1PREFIX}/man/man1
58
	${INSTALL_MAN} ${MAN8:S,^,${WRKSRC}/tools/*/,}	\
59
		${MAN8PREFIX}/man/man8
60
54
.include <bsd.port.pre.mk>
61
.include <bsd.port.pre.mk>
55
62
56
.if ${CC:T} == "cc"
63
.if ${CC:T} == "cc"
Lines 59-65 Link Here
59
.if ${CXX:T} == "c++"
66
.if ${CXX:T} == "c++"
60
CXXFLAGS:=	${CXXFLAGS:N-funroll-loops:N-O*:N-*strict-aliasing} -O2 -fno-strict-aliasing
67
CXXFLAGS:=	${CXXFLAGS:N-funroll-loops:N-O*:N-*strict-aliasing} -O2 -fno-strict-aliasing
61
.endif
68
.endif
62
CONFIGURE_ENV+=	CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}"
69
CONFIGURE_ENV+=	CFLAGS+="${CFLAGS}" \
70
		CXXFLAGS+="${CXXFLAGS}"
63
71
64
.if defined(WITHOUT_THREADS)
72
.if defined(WITHOUT_THREADS)
65
CONFIGURE_ARGS+=	--enable-threads=no
73
CONFIGURE_ARGS+=	--enable-threads=no
Lines 78-83 Link Here
78
	    ./${.TARGET}
86
	    ./${.TARGET}
79
.endif
87
.endif
80
88
81
post-build test: iotest cintltst intltest
89
post-build test regression-test: iotest cintltst intltest
82
90
83
.include <bsd.port.post.mk>
91
.include <bsd.port.post.mk>
(-)icu/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
MD5 (icu4c-3_8_1-src.tgz) = a827dbc9d909febd4ec39b90386868ba
1
MD5 (icu4c-4_2_1-src.tgz) = e3738abd0d3ce1870dc1fd1f22bba5b1
2
SHA256 (icu4c-3_8_1-src.tgz) = 16dda09dff3f770e629313a4c50a82fee88baf87d89a3bb2a28806be07766cee
2
SHA256 (icu4c-4_2_1-src.tgz) = 814de31e1413df945cdd34939b424c4cf7a94d1c481f2d44c99c8ca52b288063
3
SIZE (icu4c-3_8_1-src.tgz) = 10998841
3
SIZE (icu4c-4_2_1-src.tgz) = 13161131
(-)icu/files/patch-CVE-2007-4770 (-304 lines)
Lines 1-304 Link Here
1
Index: /icu/branches/maint/maint-3-8/source/i18n/regexcmp.cpp
2
===================================================================
3
--- i18n/regexcmp.cpp (revision 21805)
4
+++ i18n/regexcmp.cpp (revision 23292)
5
@@ -3,5 +3,5 @@
6
 //  file:  regexcmp.cpp
7
 //
8
-//  Copyright (C) 2002-2007 International Business Machines Corporation and others.
9
+//  Copyright (C) 2002-2008 International Business Machines Corporation and others.
10
 //  All Rights Reserved.
11
 //
12
@@ -1187,12 +1187,15 @@
13
             //  we fill the operand with the capture group number.  At the end
14
             //  of compilation, it will be changed to the variable's location.
15
-            U_ASSERT(groupNum > 0);
16
-            int32_t  op;
17
-            if (fModeFlags & UREGEX_CASE_INSENSITIVE) {
18
-                op = URX_BUILD(URX_BACKREF_I, groupNum);
19
+            if (groupNum < 1) { 
20
+                error(U_REGEX_INVALID_BACK_REF);
21
             } else {
22
-                op = URX_BUILD(URX_BACKREF, groupNum);
23
-            }
24
-            fRXPat->fCompiledPat->addElement(op, *fStatus);
25
+                int32_t  op;
26
+                if (fModeFlags & UREGEX_CASE_INSENSITIVE) {
27
+                    op = URX_BUILD(URX_BACKREF_I, groupNum);
28
+                } else {
29
+                    op = URX_BUILD(URX_BACKREF, groupNum);
30
+                }
31
+                fRXPat->fCompiledPat->addElement(op, *fStatus);
32
+            }
33
         }
34
         break;
35
Index: /icu/branches/maint/maint-3-8/source/i18n/rematch.cpp
36
===================================================================
37
--- i18n/rematch.cpp (revision 21973)
38
+++ i18n/rematch.cpp (revision 23292)
39
@@ -1,5 +1,5 @@
40
 /*
41
 **************************************************************************
42
-*   Copyright (C) 2002-2007 International Business Machines Corporation  *
43
+*   Copyright (C) 2002-2008 International Business Machines Corporation  *
44
 *   and others. All rights reserved.                                     *
45
 **************************************************************************
46
@@ -30,4 +30,13 @@
47
 
48
 U_NAMESPACE_BEGIN
49
+
50
+// Limit the size of the back track stack, to avoid system failures caused
51
+//   by heap exhaustion.  Units are in 32 bit words, not bytes.
52
+// This value puts ICU's limits higher than most other regexp implementations,
53
+//  which use recursion rather than the heap, and take more storage per
54
+//  backtrack point.
55
+// This constant is _temporary_.  Proper API to control the value will added.
56
+//
57
+static const int32_t BACKTRACK_STACK_CAPACITY = 8000000;
58
 
59
 //-----------------------------------------------------------------------------
60
@@ -54,6 +63,7 @@
61
     if (fStack == NULL || fData == NULL) {
62
         fDeferredStatus = U_MEMORY_ALLOCATION_ERROR;
63
-    }
64
-        
65
+    } else {
66
+        fStack->setMaxCapacity(BACKTRACK_STACK_CAPACITY);
67
+    }
68
     reset(RegexStaticSets::gStaticSets->fEmptyString);
69
 }
70
@@ -79,4 +89,6 @@
71
     if (fStack == NULL || fData == NULL) {
72
         status = U_MEMORY_ALLOCATION_ERROR;
73
+    } else {
74
+        fStack->setMaxCapacity(BACKTRACK_STACK_CAPACITY);
75
     }
76
     reset(input);
77
@@ -103,4 +115,6 @@
78
     if (fStack == NULL || fData == NULL) {
79
         status = U_MEMORY_ALLOCATION_ERROR;
80
+    } else {
81
+        fStack->setMaxCapacity(BACKTRACK_STACK_CAPACITY);
82
     }
83
     reset(RegexStaticSets::gStaticSets->fEmptyString);
84
@@ -1015,4 +1029,12 @@
85
     // push storage for a new frame. 
86
     int32_t *newFP = fStack->reserveBlock(frameSize, status);
87
+    if (newFP == NULL) {
88
+        // Heap allocation error on attempted stack expansion.
89
+        // We need to return a writable stack frame, so just return the
90
+        //    previous frame.  The match operation will stop quickly
91
+        //    becuase of the error status, after which the frame will never
92
+        //    be looked at again.
93
+        return fp;
94
+    }
95
     fp = (REStackFrame *)(newFP - frameSize);  // in case of realloc of stack.
96
     
97
@@ -1030,6 +1052,6 @@
98
     return (REStackFrame *)newFP;
99
 }
100
-    
101
-            
102
+
103
+
104
 //--------------------------------------------------------------------------------
105
 //
106
@@ -2262,4 +2284,5 @@
107
 
108
         if (U_FAILURE(status)) {
109
+            isMatch = FALSE;
110
             break;
111
         }
112
Index: /icu/branches/maint/maint-3-8/source/test/intltest/regextst.h
113
===================================================================
114
--- test/intltest/regextst.h (revision 22001)
115
+++ test/intltest/regextst.h (revision 23292)
116
@@ -1,5 +1,5 @@
117
 /********************************************************************
118
  * COPYRIGHT: 
119
- * Copyright (c) 2002-2007, International Business Machines Corporation and
120
+ * Copyright (c) 2002-2008, International Business Machines Corporation and
121
  * others. All Rights Reserved.
122
  ********************************************************************/
123
@@ -31,4 +31,5 @@
124
     virtual void Errors();
125
     virtual void PerlTests();
126
+    virtual void Bug6149();
127
 
128
     // The following functions are internal to the regexp tests.
129
Index: /icu/branches/maint/maint-3-8/source/test/intltest/regextst.cpp
130
===================================================================
131
--- test/intltest/regextst.cpp (revision 22057)
132
+++ test/intltest/regextst.cpp (revision 23292)
133
@@ -1,5 +1,5 @@
134
 /********************************************************************
135
  * COPYRIGHT:
136
- * Copyright (c) 2002-2007, International Business Machines Corporation and
137
+ * Copyright (c) 2002-2008, International Business Machines Corporation and
138
  * others. All Rights Reserved.
139
  ********************************************************************/
140
@@ -67,4 +67,8 @@
141
             if (exec) PerlTests();
142
             break;
143
+        case 7: name = "Bug 6149";
144
+            if (exec) Bug6149();
145
+            break;
146
+            
147
 
148
 
149
@@ -1640,4 +1644,10 @@
150
     // Ticket 5389
151
     REGEX_ERR("*c", 1, 1, U_REGEX_RULE_SYNTAX);
152
+    
153
+    // Invalid Back Reference \0
154
+    //    For ICU 3.8 and earlier
155
+    //    For ICU versions newer than 3.8, \0 introduces an octal escape.
156
+    //
157
+    REGEX_ERR("(ab)\\0", 1, 6, U_REGEX_INVALID_BACK_REF);
158
 
159
 }
160
@@ -2123,4 +2133,24 @@
161
 
162
 
163
+//--------------------------------------------------------------
164
+//
165
+//  Bug6149   Verify limits to heap expansion for backtrack stack.
166
+//             Use this pattern,
167
+//                 "(a?){1,}"
168
+//             The zero-length match will repeat forever.
169
+//                (That this goes into a loop is another bug)
170
+//
171
+//---------------------------------------------------------------
172
+void RegexTest::Bug6149() {
173
+    UnicodeString pattern("(a?){1,}");
174
+    UnicodeString s("xyz");
175
+    uint32_t flags = 0;
176
+    UErrorCode status = U_ZERO_ERROR;
177
+    
178
+    RegexMatcher  matcher(pattern, s, flags, status);
179
+    UBool result = false;
180
+    REGEX_ASSERT_FAIL(result=matcher.matches(status), U_BUFFER_OVERFLOW_ERROR);
181
+    REGEX_ASSERT(result == FALSE);
182
+ }
183
 
184
 #endif  /* !UCONFIG_NO_REGULAR_EXPRESSIONS  */
185
Index: /icu/branches/maint/maint-3-8/source/common/uvectr32.cpp
186
===================================================================
187
--- common/uvectr32.cpp (revision 12958)
188
+++ common/uvectr32.cpp (revision 23292)
189
@@ -1,5 +1,5 @@
190
 /*
191
 ******************************************************************************
192
-* Copyright (C) 1999-2003, International Business Machines Corporation and   *
193
+* Copyright (C) 1999-2008, International Business Machines Corporation and   *
194
 * others. All Rights Reserved.                                               *
195
 ******************************************************************************
196
@@ -27,4 +27,5 @@
197
     count(0),
198
     capacity(0),
199
+    maxCapacity(0),
200
     elements(NULL)
201
 {
202
@@ -35,4 +36,5 @@
203
     count(0),
204
     capacity(0),
205
+    maxCapacity(0),
206
     elements(0)
207
 {
208
@@ -46,4 +48,7 @@
209
     if (initialCapacity < 1) {
210
         initialCapacity = DEFUALT_CAPACITY;
211
+    }
212
+    if (maxCapacity>0 && maxCapacity<initialCapacity) {
213
+        initialCapacity = maxCapacity;
214
     }
215
     elements = (int32_t *)uprv_malloc(sizeof(int32_t)*initialCapacity);
216
@@ -190,19 +195,33 @@
217
     if (capacity >= minimumCapacity) {
218
         return TRUE;
219
-    } else {
220
-        int32_t newCap = capacity * 2;
221
-        if (newCap < minimumCapacity) {
222
-            newCap = minimumCapacity;
223
-        }
224
-        int32_t* newElems = (int32_t *)uprv_malloc(sizeof(int32_t)*newCap);
225
-        if (newElems == 0) {
226
-            status = U_MEMORY_ALLOCATION_ERROR;
227
-            return FALSE;
228
-        }
229
-        uprv_memcpy(newElems, elements, sizeof(elements[0]) * count);
230
-        uprv_free(elements);
231
-        elements = newElems;
232
-        capacity = newCap;
233
-        return TRUE;
234
+    }
235
+    if (maxCapacity>0 && minimumCapacity>maxCapacity) {
236
+        status = U_BUFFER_OVERFLOW_ERROR;
237
+        return FALSE;
238
+    }
239
+    int32_t newCap = capacity * 2;
240
+    if (newCap < minimumCapacity) {
241
+        newCap = minimumCapacity;
242
+    }
243
+    if (maxCapacity > 0 && newCap > maxCapacity) {
244
+        newCap = maxCapacity;
245
+    }
246
+    int32_t* newElems = (int32_t *)uprv_malloc(sizeof(int32_t)*newCap);
247
+    if (newElems == 0) {
248
+        status = U_MEMORY_ALLOCATION_ERROR;
249
+        return FALSE;
250
+    }
251
+    uprv_memcpy(newElems, elements, sizeof(elements[0]) * count);
252
+    uprv_free(elements);
253
+    elements = newElems;
254
+    capacity = newCap;
255
+    return TRUE;
256
+}
257
+
258
+void UVector32::setMaxCapacity(int32_t limit) {
259
+    U_ASSERT(limit >= 0);
260
+    maxCapacity = limit;
261
+    if (maxCapacity < 0) {
262
+        maxCapacity = 0;
263
     }
264
 }
265
Index: /icu/branches/maint/maint-3-8/source/common/uvectr32.h
266
===================================================================
267
--- common/uvectr32.h (revision 19000)
268
+++ common/uvectr32.h (revision 23292)
269
@@ -1,5 +1,5 @@
270
 /*
271
 **********************************************************************
272
-*   Copyright (C) 1999-2006, International Business Machines
273
+*   Copyright (C) 1999-2008, International Business Machines
274
 *   Corporation and others.  All Rights Reserved.
275
 **********************************************************************
276
@@ -62,4 +62,6 @@
277
 
278
     int32_t   capacity;
279
+    
280
+    int32_t   maxCapacity;   // Limit beyond which capacity is not permitted to grow.
281
 
282
     int32_t*  elements;
283
@@ -161,4 +163,12 @@
284
      */
285
     int32_t *getBuffer() const;
286
+
287
+    /**
288
+     * Set the maximum allowed buffer capacity for this vector/stack.
289
+     * Default with no limit set is unlimited, go until malloc() fails.
290
+     * A Limit of zero means unlimited capacity.
291
+     * Units are vector elements (32 bits each), not bytes.
292
+     */
293
+    void setMaxCapacity(int32_t limit);
294
 
295
     /**
296
@@ -222,5 +232,7 @@
297
 
298
 inline int32_t *UVector32::reserveBlock(int32_t size, UErrorCode &status) {
299
-    ensureCapacity(count+size, status);
300
+    if (ensureCapacity(count+size, status) == FALSE) {
301
+        return NULL;
302
+    }
303
     int32_t  *rp = elements+count;
304
     count += size;
(-)icu/files/patch-Makefile.in (+10 lines)
Line 0 Link Here
1
--- Makefile.in	2009-07-01 21:51:26.000000000 +0300
2
+++ Makefile.in	2009-12-09 13:25:16.000000000 +0200
3
@@ -130,7 +130,6 @@
4
 	@$(MKINSTALLDIRS) $(DESTDIR)$(sbindir)
5
 	$(INSTALL_DATA) @platform_make_fragment@ $(DESTDIR)$(pkgdatadir)/config/@platform_make_fragment_name@
6
 	$(INSTALL_SCRIPT) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(pkgdatadir)/mkinstalldirs
7
-	$(INSTALL_SCRIPT) $(top_srcdir)/install-sh $(DESTDIR)$(pkgdatadir)/install-sh
8
 	$(INSTALL_DATA) $(top_srcdir)/../license.html $(DESTDIR)$(pkgdatadir)/license.html
9
 	$(INSTALL_SCRIPT) $(top_builddir)/config/icu-config $(DESTDIR)$(bindir)/icu-config
10
 	$(INSTALL_DATA) $(top_builddir)/config/Makefile.inc $(DESTDIR)$(pkglibdir)/Makefile.inc
(-)icu/files/patch-cc-flags (-27 lines)
Lines 1-27 Link Here
1
--- runConfigureICU	Fri Jan 16 17:26:40 2004
2
+++ runConfigureICU	Mon Nov 15 11:05:50 2004
3
@@ -289,7 +289,7 @@
4
     *BSD)
5
-        THE_OS="BSD"
6
+        THE_OS="$platform"
7
-        THE_COMP="the GNU C++"
8
-        CC=gcc; export CC
9
-        CXX=g++; export CXX
10
+        CC=${CC:=cc}; export CC
11
+        CXX=${CXX:=c++}; export CXX
12
+        THE_COMP="`$CC -v | fgrep -i ver`" # works with icc and gcc at least
13
         ;;
14
     QNX)
15
@@ -358,12 +358,4 @@
16
 if test $release -eq 1
17
 then
18
-    if test "$RELEASE_CFLAGS" = ""
19
-    then
20
-        case $CC in
21
-            gcc|*/gcc|*-gcc-*|*/*-gcc-*)
22
-                RELEASE_CFLAGS=-O3
23
-                ;;
24
-        esac
25
-    fi
26
     if test "$RELEASE_CFLAGS" != ""
27
     then
(-)icu/files/patch-format (-210 lines)
Lines 1-210 Link Here
1
Fix self-test(s) breaking, when build happens on days with other than
2
24-hours (such as when daylight saving time kicks in). See:
3
4
	http://www.freebsd.org/cgi/query-pr.cgi?pr=128521
5
	http://www.icu-project.org/trac/ticket/6018
6
7
Index: /icu/trunk/source/i18n/calendar.cpp
8
===================================================================
9
--- i18n/calendar.cpp (revision 22978)
10
+++ i18n/calendar.cpp (revision 23166)
11
@@ -1,5 +1,5 @@
12
 /*
13
 *******************************************************************************
14
-* Copyright (C) 1997-2007, International Business Machines Corporation and    *
15
+* Copyright (C) 1997-2008, International Business Machines Corporation and    *
16
 * others. All Rights Reserved.                                                *
17
 *******************************************************************************
18
@@ -74,6 +74,12 @@
19
 
20
 #if defined( U_DEBUG_CALSVC ) || defined (U_DEBUG_CAL)
21
+
22
+/** 
23
+ * fldName was removed as a duplicate implementation. 
24
+ * use  udbg_ services instead, 
25
+ * which depend on include files and library from ../tools/ctestfw
26
+ */
27
+#include "unicode/udbgutil.h"
28
 #include <stdio.h>
29
-
30
 
31
 /**
32
@@ -83,12 +89,8 @@
33
 * @internal
34
 */
35
-#error fldName() has been removed. Please use udbg_ucal_fieldName()  from libctestfw instead. The following code might work.
36
-
37
-static const char* fldName(UCalendarDateFields f) {
38
-	const char *udbg_ucal_fieldName(int32_t fld);
39
-	return udbg_ucal_fieldName((int32_t)f);
40
-}
41
-
42
-
43
+
44
+const char* fldName(UCalendarDateFields f) {
45
+	return udbg_enumName(UDBG_UCalendarDateFields, (int32_t)f);
46
+}
47
 
48
 #if UCAL_DEBUG_DUMP
49
Index: /icu/trunk/source/i18n/reldtfmt.cpp
50
===================================================================
51
--- i18n/reldtfmt.cpp (revision 22561)
52
+++ i18n/reldtfmt.cpp (revision 23166)
53
@@ -1,5 +1,5 @@
54
 /*
55
 *******************************************************************************
56
-* Copyright (C) 2007, International Business Machines Corporation and    *
57
+* Copyright (C) 2007-2008, International Business Machines Corporation and    *
58
 * others. All Rights Reserved.                                                *
59
 *******************************************************************************
60
@@ -304,8 +304,13 @@
61
         return 0;
62
     }
63
-    // TODO: Cache the nowCal to avoid heap allocs?
64
+    // TODO: Cache the nowCal to avoid heap allocs? Would be difficult, don't know the calendar type
65
     Calendar *nowCal = cal.clone();
66
     nowCal->setTime(Calendar::getNow(), status);
67
-    int32_t dayDiff = nowCal->fieldDifference(cal.getTime(status), Calendar::DATE, status);
68
+
69
+    // For the day difference, we are interested in the difference in the (modified) julian day number
70
+    // which is midnight to midnight.  Using fieldDifference() is NOT correct here, because 
71
+    // 6pm Jan 4th  to 10am Jan 5th should be considered "tomorrow".
72
+    int32_t dayDiff = cal.get(UCAL_JULIAN_DAY, status) - nowCal->get(UCAL_JULIAN_DAY, status);
73
+
74
     delete nowCal;
75
     return dayDiff;
76
Index: /icu/trunk/source/test/intltest/dadrfmt.cpp
77
===================================================================
78
--- test/intltest/dadrfmt.cpp (revision 22493)
79
+++ test/intltest/dadrfmt.cpp (revision 23166)
80
@@ -1,5 +1,5 @@
81
 /********************************************************************
82
  * COPYRIGHT: 
83
- * Copyright (c) 1997-2007, International Business Machines Corporation and
84
+ * Copyright (c) 1997-2008, International Business Machines Corporation and
85
  * others. All Rights Reserved.
86
  ********************************************************************/
87
@@ -94,4 +94,5 @@
88
     UnicodeString kMILLIS("MILLIS="); // TODO: static
89
     UnicodeString kRELATIVE_MILLIS("RELATIVE_MILLIS="); // TODO: static
90
+    UnicodeString kRELATIVE_ADD("RELATIVE_ADD:"); // TODO: static
91
     
92
     UErrorCode status = U_ZERO_ERROR;
93
@@ -170,5 +171,10 @@
94
             }
95
         }
96
-        
97
+
98
+        Calendar *cal = Calendar::createInstance(loc, status);
99
+        if(U_FAILURE(status)) {
100
+            errln("case %d: could not create calendar from %s", n, calLoc);
101
+        }
102
+
103
         // parse 'date'
104
         if(date.startsWith(kMILLIS)) {
105
@@ -180,4 +186,28 @@
106
             useDate = TRUE;
107
             fromDate = udbg_stoi(millis) + now;
108
+        } else if(date.startsWith(kRELATIVE_ADD)) {
109
+            UnicodeString add = UnicodeString(date, kRELATIVE_ADD.length());  // "add" is a string indicating which fields to add
110
+            if(fromSet.parseFrom(add, status)<0 || U_FAILURE(status)) {
111
+                errln("case %d: could not parse date as RELATIVE_ADD calendar fields: %s", n, u_errorName(status));
112
+                continue;
113
+            }
114
+            logln("Parsing ..\n");
115
+            useDate=TRUE;
116
+            cal->clear();
117
+            cal->setTime(now, status);
118
+            for (int q=0; q<UCAL_FIELD_COUNT; q++) {
119
+                if (fromSet.isSet((UCalendarDateFields)q)) {
120
+                    int32_t oldv = cal->get((UCalendarDateFields)q, status);
121
+                    cal->add((UCalendarDateFields)q,
122
+                                fromSet.get((UCalendarDateFields)q), status);
123
+                    int32_t newv = cal->get((UCalendarDateFields)q, status);
124
+                    logln("adding %d to %s ..went from %d to %d\n", fromSet.get((UCalendarDateFields)q), udbg_enumName(UDBG_UCalendarDateFields, q), oldv, newv);
125
+                }
126
+            }
127
+            fromDate = cal->getTime(status);
128
+            if(U_FAILURE(status)) {
129
+                errln("case %d: could not apply date as RELATIVE_ADD calendar fields: %s", n, u_errorName(status));
130
+                continue;
131
+            }
132
         } else if(fromSet.parseFrom(date, status)<0 || U_FAILURE(status)) {
133
             errln("case %d: could not parse date as calendar fields: %s", n, u_errorName(status));
134
@@ -185,8 +215,4 @@
135
         }
136
         
137
-        Calendar *cal = Calendar::createInstance(loc, status);
138
-        if(U_FAILURE(status)) {
139
-            errln("case %d: could not create calendar from %s", n, calLoc);
140
-        }
141
         // now, do it.
142
         if (fmt) {
143
Index: /icu/trunk/source/test/testdata/format.txt
144
===================================================================
145
--- test/testdata/format.txt (revision 22885)
146
+++ test/testdata/format.txt (revision 23166)
147
@@ -1,3 +1,3 @@
148
-// Copyright (c) 2007 International Business Machines
149
+// Copyright (c) 2007-2008 International Business Machines
150
 // Corporation and others. All Rights Reserved.
151
 format:table(nofallback) {
152
@@ -23,5 +23,8 @@
153
             // locale: locale including calendar type
154
             // spec:   either 'PATTERN=y mm h' etc, or 'DATE=SHORT,TIME=LONG'
155
-            // 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
156
+            // date:   either 'MILLIS=####' where #### is millis,
157
+            //        or a calendar spec ERA=0,YEAR=1, etc.. applied to the calendar type specified by the locale
158
+            //        or RELATIVE_MILLIS=### where ### is a signed value which is added to the current millis
159
+            //        or RELATIVE_ADD:DATE=1  which means that the field "DATE" will be added by +1 relative to current time
160
             // str:   the expected unicode string
161
             Cases { 
162
@@ -61,5 +64,5 @@
163
                     "en_US@calendar=gregorian",         
164
                     "DATE=RELATIVE_SHORT",
165
-                    "RELATIVE_MILLIS=86410000", // one day from now
166
+                    "RELATIVE_ADD:DATE=1", // one day from now
167
                     "Tomorrow"
168
                },
169
@@ -67,5 +70,5 @@
170
                     "en_US@calendar=gregorian",         
171
                     "DATE=RELATIVE_SHORT",
172
-                    "RELATIVE_MILLIS=0", // one day before now
173
+                    "RELATIVE_MILLIS=0", // today
174
                     "Today"
175
                },
176
@@ -73,5 +76,5 @@
177
                     "en_US@calendar=gregorian",         
178
                     "DATE=RELATIVE_SHORT",
179
-                    "RELATIVE_MILLIS=-86410000", // one day before now
180
+                    "RELATIVE_ADD:DATE=-1", // one day before now
181
                     "Yesterday"
182
                },
183
@@ -79,5 +82,5 @@
184
                     "mt_MT@calendar=gregorian",         
185
                     "DATE=RELATIVE_SHORT",
186
-                    "RELATIVE_MILLIS=86410000", // one day from now
187
+                    "RELATIVE_ADD:DATE=1", // one day from now
188
                     "Għada"
189
                },
190
@@ -85,5 +88,5 @@
191
                     "mt_MT@calendar=gregorian",         
192
                     "DATE=RELATIVE_SHORT",
193
-                    "RELATIVE_MILLIS=0", // one day before now
194
+                    "RELATIVE_MILLIS=0", // today
195
                     "Illum"
196
                },
197
@@ -91,5 +94,5 @@
198
                     "mt_MT@calendar=gregorian",         
199
                     "DATE=RELATIVE_SHORT",
200
-                    "RELATIVE_MILLIS=-86410000", // one day before now
201
+                    "RELATIVE_ADD:DATE=-1", // one day before now
202
                     "Lbieraħ"
203
                },
204
@@ -97,5 +100,5 @@
205
                     "ru",
206
                     "DATE=RELATIVE_SHORT",
207
-                    "RELATIVE_MILLIS=-172810000", // 2 days ago
208
+                    "RELATIVE_ADD:DATE=-2", // 2 days ago
209
                     "Позавчера"
210
                },
(-)icu/files/patch-install (-8 lines)
Lines 1-8 Link Here
1
--- Makefile.in	2007-12-12 13:58:06.000000000 -0500
2
+++ Makefile.in	2008-01-28 15:20:56.000000000 -0500
3
@@ -126,5 +126,4 @@
4
 	$(INSTALL_DATA) @platform_make_fragment@ $(DESTDIR)$(pkgdatadir)/config/@platform_make_fragment_name@
5
 	$(INSTALL_SCRIPT) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(pkgdatadir)/mkinstalldirs
6
-	$(INSTALL_SCRIPT) $(top_srcdir)/install-sh $(DESTDIR)$(pkgdatadir)/install-sh
7
 	$(INSTALL_DATA) $(top_srcdir)/../license.html $(DESTDIR)$(pkgdatadir)/license.html
8
 	$(INSTALL_SCRIPT) $(top_builddir)/config/icu-config $(DESTDIR)$(bindir)/icu-config
(-)icu/files/patch-putil (-9 lines)
Lines 1-9 Link Here
1
--- common/putil.c	2007-12-12 13:57:26.000000000 -0500
2
+++ common/putil.c	2008-01-28 13:04:02.000000000 -0500
3
@@ -577,5 +577,5 @@
4
 /* These platforms are likely to use Olson timezone IDs. */
5
 #define CHECK_LOCALTIME_LINK 1
6
-#if defined(U_LINUX)
7
+#if defined(U_LINUX) || defined(U_BSD)
8
 #define TZDEFAULT       "/etc/localtime"
9
 #define TZZONEINFO      "/usr/share/zoneinfo/"
(-)icu/files/patch-regexcmp.cpp (+32 lines)
Line 0 Link Here
1
--- i18n/regexcmp.cpp	2009-07-01 21:50:10.000000000 +0300
2
+++ i18n/regexcmp.cpp	2009-12-09 13:32:52.000000000 +0200
3
@@ -1264,17 +1264,19 @@
4
             // Because capture groups can be forward-referenced by back-references,
5
             //  we fill the operand with the capture group number.  At the end
6
             //  of compilation, it will be changed to the variable's location.
7
-            U_ASSERT(groupNum > 0);
8
-            int32_t  op;
9
-            if (fModeFlags & UREGEX_CASE_INSENSITIVE) {
10
-                op = URX_BUILD(URX_BACKREF_I, groupNum);
11
-            } else {
12
-                op = URX_BUILD(URX_BACKREF, groupNum);
13
+            if (groupNum < 1) { 
14
+                error(U_REGEX_INVALID_BACK_REF);
15
+             } else {
16
+                int32_t  op;
17
+                if (fModeFlags & UREGEX_CASE_INSENSITIVE) {
18
+                    op = URX_BUILD(URX_BACKREF_I, groupNum);
19
+                } else {
20
+                    op = URX_BUILD(URX_BACKREF, groupNum);
21
+                }
22
+                fRXPat->fCompiledPat->addElement(op, *fStatus);
23
             }
24
-            fRXPat->fCompiledPat->addElement(op, *fStatus);
25
-        }
26
-        break;
27
-
28
+         }
29
+         break;
30
 
31
     case doPossessivePlus:
32
         // Possessive ++ quantifier.
(-)icu/files/patch-runConfigureICU (+32 lines)
Line 0 Link Here
1
--- runConfigureICU	2009-07-01 21:51:26.000000000 +0300
2
+++ runConfigureICU	2009-12-09 13:27:11.000000000 +0200
3
@@ -254,10 +254,10 @@
4
         RELEASE_CXXFLAGS='-O2'
5
         ;;
6
     *BSD)
7
-        THE_OS="BSD"
8
-        THE_COMP="the GNU C++"
9
-        CC=gcc; export CC
10
-        CXX=g++; export CXX
11
+        THE_OS="$platform"
12
+        CC=${CC:=cc}; export CC
13
+        CXX=${CXX:=c++}; export CXX
14
+        THE_COMP="`$CC -v | fgrep -i ver`" # works with icc and gcc at least
15
         ;;
16
     TRU64V5.1/CXX)
17
         THE_OS="OSF1"
18
@@ -302,14 +302,6 @@
19
 
20
 if test $release -eq 1
21
 then
22
-    if test "$RELEASE_CFLAGS" = ""
23
-    then
24
-        case $CC in
25
-            gcc|*/gcc|*-gcc-*|*/*-gcc-*)
26
-                RELEASE_CFLAGS=-O3
27
-                ;;
28
-        esac
29
-    fi
30
     if test "$RELEASE_CFLAGS" != ""
31
     then
32
         CFLAGS="$CFLAGS $RELEASE_CFLAGS"
(-)icu/pkg-plist (-30 / +54 lines)
Lines 1-5 Link Here
1
bin/derb
1
bin/derb
2
bin/genbrk
2
bin/genbrk
3
bin/gencfu
3
bin/gencnval
4
bin/gencnval
4
bin/genctd
5
bin/genctd
5
bin/genrb
6
bin/genrb
Lines 7-18 Link Here
7
bin/makeconv
8
bin/makeconv
8
bin/pkgdata
9
bin/pkgdata
9
bin/uconv
10
bin/uconv
10
sbin/genccode
11
sbin/gencmn
12
sbin/gensprep
13
sbin/genuca
14
sbin/icupkg
15
sbin/icuswap
16
include/layout/LEFontInstance.h
11
include/layout/LEFontInstance.h
17
include/layout/LEGlyphFilter.h
12
include/layout/LEGlyphFilter.h
18
include/layout/LEGlyphStorage.h
13
include/layout/LEGlyphStorage.h
Lines 25-40 Link Here
25
include/layout/ParagraphLayout.h
20
include/layout/ParagraphLayout.h
26
include/layout/RunArrays.h
21
include/layout/RunArrays.h
27
include/layout/loengine.h
22
include/layout/loengine.h
28
@dirrm include/layout
23
include/layout/playout.h
24
include/layout/plruns.h
29
include/unicode/basictz.h
25
include/unicode/basictz.h
26
include/unicode/bms.h
27
include/unicode/bmsearch.h
30
include/unicode/brkiter.h
28
include/unicode/brkiter.h
29
include/unicode/bytestream.h
31
include/unicode/calendar.h
30
include/unicode/calendar.h
32
include/unicode/caniter.h
31
include/unicode/caniter.h
33
include/unicode/chariter.h
32
include/unicode/chariter.h
34
include/unicode/choicfmt.h
33
include/unicode/choicfmt.h
35
include/unicode/coleitr.h
34
include/unicode/coleitr.h
36
include/unicode/coll.h
35
include/unicode/coll.h
36
include/unicode/colldata.h
37
include/unicode/curramt.h
37
include/unicode/curramt.h
38
include/unicode/currpinf.h
38
include/unicode/currunit.h
39
include/unicode/currunit.h
39
include/unicode/datefmt.h
40
include/unicode/datefmt.h
40
include/unicode/dbbi.h
41
include/unicode/dbbi.h
Lines 42-49 Link Here
42
include/unicode/decimfmt.h
43
include/unicode/decimfmt.h
43
include/unicode/docmain.h
44
include/unicode/docmain.h
44
include/unicode/dtfmtsym.h
45
include/unicode/dtfmtsym.h
46
include/unicode/dtintrv.h
47
include/unicode/dtitvfmt.h
48
include/unicode/dtitvinf.h
45
include/unicode/dtptngen.h
49
include/unicode/dtptngen.h
46
include/unicode/dtrule.h
50
include/unicode/dtrule.h
51
include/unicode/errorcode.h
47
include/unicode/fieldpos.h
52
include/unicode/fieldpos.h
48
include/unicode/fmtable.h
53
include/unicode/fmtable.h
49
include/unicode/format.h
54
include/unicode/format.h
Lines 55-63 Link Here
55
include/unicode/msgfmt.h
60
include/unicode/msgfmt.h
56
include/unicode/normlzr.h
61
include/unicode/normlzr.h
57
include/unicode/numfmt.h
62
include/unicode/numfmt.h
63
include/unicode/numsys.h
58
include/unicode/parseerr.h
64
include/unicode/parseerr.h
59
include/unicode/parsepos.h
65
include/unicode/parsepos.h
60
include/unicode/platform.h
66
include/unicode/platform.h
67
include/unicode/plurfmt.h
68
include/unicode/plurrule.h
61
include/unicode/ppalmos.h
69
include/unicode/ppalmos.h
62
include/unicode/putil.h
70
include/unicode/putil.h
63
include/unicode/pwin32.h
71
include/unicode/pwin32.h
Lines 72-82 Link Here
72
include/unicode/simpletz.h
80
include/unicode/simpletz.h
73
include/unicode/smpdtfmt.h
81
include/unicode/smpdtfmt.h
74
include/unicode/sortkey.h
82
include/unicode/sortkey.h
83
include/unicode/std_string.h
75
include/unicode/strenum.h
84
include/unicode/strenum.h
85
include/unicode/stringpiece.h
76
include/unicode/stsearch.h
86
include/unicode/stsearch.h
77
include/unicode/symtable.h
87
include/unicode/symtable.h
78
include/unicode/tblcoll.h
88
include/unicode/tblcoll.h
79
include/unicode/timezone.h
89
include/unicode/timezone.h
90
include/unicode/tmunit.h
91
include/unicode/tmutamt.h
92
include/unicode/tmutfmt.h
80
include/unicode/translit.h
93
include/unicode/translit.h
81
include/unicode/tzrule.h
94
include/unicode/tzrule.h
82
include/unicode/tztrans.h
95
include/unicode/tztrans.h
Lines 91-96 Link Here
91
include/unicode/ucnv.h
104
include/unicode/ucnv.h
92
include/unicode/ucnv_cb.h
105
include/unicode/ucnv_cb.h
93
include/unicode/ucnv_err.h
106
include/unicode/ucnv_err.h
107
include/unicode/ucnvsel.h
94
include/unicode/ucol.h
108
include/unicode/ucol.h
95
include/unicode/ucoleitr.h
109
include/unicode/ucoleitr.h
96
include/unicode/uconfig.h
110
include/unicode/uconfig.h
Lines 129-134 Link Here
129
include/unicode/uset.h
143
include/unicode/uset.h
130
include/unicode/usetiter.h
144
include/unicode/usetiter.h
131
include/unicode/ushape.h
145
include/unicode/ushape.h
146
include/unicode/uspoof.h
132
include/unicode/usprep.h
147
include/unicode/usprep.h
133
include/unicode/ustdio.h
148
include/unicode/ustdio.h
134
include/unicode/ustream.h
149
include/unicode/ustream.h
Lines 146-187 Link Here
146
include/unicode/utypes.h
161
include/unicode/utypes.h
147
include/unicode/uversion.h
162
include/unicode/uversion.h
148
include/unicode/vtzone.h
163
include/unicode/vtzone.h
149
@dirrm include/unicode
150
lib/icu/%%ICUVER%%/Makefile.inc
164
lib/icu/%%ICUVER%%/Makefile.inc
151
lib/icu/current
165
lib/icu/%%ICUVER%%/pkgdata.inc
152
lib/icu/Makefile.inc
166
lib/icu/Makefile.inc
153
lib/libsicudata.a
167
lib/icu/current
154
lib/libicudata.so.%%ICUMAJOR%%.%%ICUMINOR%%
168
lib/icu/pkgdata.inc
155
lib/libicudata.so
169
lib/libicudata.so
156
lib/libicudata.so.%%ICUMAJOR%%
170
lib/libicudata.so.%%ICUMAJOR%%
157
lib/libsicuuc.a
171
lib/libicudata.so.%%ICUMAJOR%%.%%ICUMINOR%%
158
lib/libicuuc.so.%%ICUMAJOR%%.%%ICUMINOR%%
159
lib/libicuuc.so
160
lib/libicuuc.so.%%ICUMAJOR%%
161
lib/libsicui18n.a
162
lib/libicui18n.so.%%ICUMAJOR%%.%%ICUMINOR%%
163
lib/libicui18n.so
172
lib/libicui18n.so
164
lib/libicui18n.so.%%ICUMAJOR%%
173
lib/libicui18n.so.%%ICUMAJOR%%
165
lib/libsicule.a
174
lib/libicui18n.so.%%ICUMAJOR%%.%%ICUMINOR%%
166
lib/libicule.so.%%ICUMAJOR%%.%%ICUMINOR%%
175
lib/libicuio.so
176
lib/libicuio.so.%%ICUMAJOR%%
177
lib/libicuio.so.%%ICUMAJOR%%.%%ICUMINOR%%
167
lib/libicule.so
178
lib/libicule.so
168
lib/libicule.so.%%ICUMAJOR%%
179
lib/libicule.so.%%ICUMAJOR%%
169
lib/libsiculx.a
180
lib/libicule.so.%%ICUMAJOR%%.%%ICUMINOR%%
170
lib/libiculx.so.%%ICUMAJOR%%.%%ICUMINOR%%
171
lib/libiculx.so
181
lib/libiculx.so
172
lib/libiculx.so.%%ICUMAJOR%%
182
lib/libiculx.so.%%ICUMAJOR%%
173
lib/libsicuio.a
183
lib/libiculx.so.%%ICUMAJOR%%.%%ICUMINOR%%
174
lib/libicuio.so.%%ICUMAJOR%%.%%ICUMINOR%%
175
lib/libicuio.so
176
lib/libicuio.so.%%ICUMAJOR%%
177
lib/libicutu.so.%%ICUMAJOR%%.%%ICUMINOR%%
178
lib/libicutu.so.%%ICUMAJOR%%
179
lib/libicutu.so
184
lib/libicutu.so
185
lib/libicutu.so.%%ICUMAJOR%%
186
lib/libicutu.so.%%ICUMAJOR%%.%%ICUMINOR%%
187
lib/libicuuc.so
188
lib/libicuuc.so.%%ICUMAJOR%%
189
lib/libicuuc.so.%%ICUMAJOR%%.%%ICUMINOR%%
190
lib/libsicudata.a
191
lib/libsicui18n.a
192
lib/libsicuio.a
193
lib/libsicule.a
194
lib/libsiculx.a
195
lib/libsicutu.a
196
lib/libsicuuc.a
197
sbin/genccode
198
sbin/gencmn
199
sbin/gensprep
200
sbin/genuca
201
sbin/icupkg
180
%%DATADIR%%/%%ICUVER%%/config/mh-bsd-gcc
202
%%DATADIR%%/%%ICUVER%%/config/mh-bsd-gcc
181
%%DATADIR%%/%%ICUVER%%/mkinstalldirs
182
%%DATADIR%%/%%ICUVER%%/license.html
203
%%DATADIR%%/%%ICUVER%%/license.html
204
%%DATADIR%%/%%ICUVER%%/mkinstalldirs
183
@dirrm %%DATADIR%%/%%ICUVER%%/config
205
@dirrm %%DATADIR%%/%%ICUVER%%/config
184
@dirrm %%DATADIR%%/%%ICUVER%%
206
@dirrm %%DATADIR%%/%%ICUVER%% 
185
@dirrm %%DATADIR%%
207
@dirrm %%DATADIR%%
186
@dirrm lib/icu/%%ICUVER%%
208
@dirrm lib/icu/%%ICUVER%% 
187
@dirrm lib/icu
209
@dirrm lib/icu
210
@dirrm include/unicode
211
@dirrm include/layout

Return to bug 141324