This commit is contained in:
parent
986bbacfb2
commit
ad58580971
21
icu.changes
21
icu.changes
@ -1,3 +1,24 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Sat Sep 6 00:54:42 CEST 2008 - maw@suse.de
|
||||||
|
|
||||||
|
- Update to version 4.0:
|
||||||
|
(All of the bug numbers listed are against
|
||||||
|
http://bugs.icu-project.org/trac)
|
||||||
|
+ Update to Unicode 5.1 (#5696)
|
||||||
|
+ Locale Data: ICU uses and supports data from Common Locale Data
|
||||||
|
Repository (CLDR) 1.6, which includes many improvements in
|
||||||
|
quality and quantity of data
|
||||||
|
+ Add/removeLikelySubtags (#6124)
|
||||||
|
+ Charset converter file size improvement (#5987)
|
||||||
|
+ Date Interval Formatting (#6157) Note: Calendar type supported
|
||||||
|
by this feature is Gregorian only in this release
|
||||||
|
+ Improved Plural support
|
||||||
|
+ Additional calendars: Chinese (#4081) and Coptic/Ethiopic
|
||||||
|
(#4571)
|
||||||
|
+ Security fixes for CVE-2007-4770, CVE-2007-4771, and
|
||||||
|
CVE-2008-1036.
|
||||||
|
- Drop libicu-regex.patch, which has been upstreamed.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Apr 10 12:54:45 CEST 2008 - ro@suse.de
|
Thu Apr 10 12:54:45 CEST 2008 - ro@suse.de
|
||||||
|
|
||||||
|
42
icu.spec
42
icu.spec
@ -1,10 +1,17 @@
|
|||||||
#
|
#
|
||||||
# spec file for package icu (Version 3.8.1)
|
# spec file for package icu (Version 4.0)
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
# This file and all modifications and additions to the pristine
|
|
||||||
# package are under the same license as the package itself.
|
|
||||||
#
|
#
|
||||||
|
# All modifications and additions to the file contributed by third parties
|
||||||
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
|
# upon. The license for this file, and modifications and additions to the
|
||||||
|
# file, is the same license as for the pristine package itself (unless the
|
||||||
|
# license for the pristine package is not an Open Source License, in which
|
||||||
|
# case the license is the MIT License). An "Open Source License" is a
|
||||||
|
# license that conforms to the Open Source Definition (Version 1.9)
|
||||||
|
# published by the Open Source Initiative.
|
||||||
|
|
||||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -16,17 +23,16 @@ BuildRequires: gcc-c++
|
|||||||
License: X11/MIT
|
License: X11/MIT
|
||||||
Group: System/Libraries
|
Group: System/Libraries
|
||||||
AutoReqProv: on
|
AutoReqProv: on
|
||||||
Version: 3.8.1
|
Version: 4.0
|
||||||
Release: 12
|
Release: 2
|
||||||
Requires: libicu = %{version}
|
Requires: libicu = %{version}
|
||||||
Url: http://ibm.com/software/globalization/icu
|
Url: http://ibm.com/software/globalization/icu
|
||||||
Source0: icu4c-3_8_1-src.tar.bz2
|
Source0: icu4c-4_0-src.tar.bz2
|
||||||
Source1: icu4c-3_8-docs.tar.bz2
|
Source1: icu4c-4_0-docs.tar.bz2
|
||||||
Source3: SuSEconfig.icu
|
Source3: SuSEconfig.icu
|
||||||
# OOo-2.3.1 and above needs to access the setBreakType method, see
|
# OOo-2.3.1 and above needs to access the setBreakType method, see
|
||||||
# http://bugs.icu-project.org/trac/ticket/5498
|
# http://bugs.icu-project.org/trac/ticket/5498
|
||||||
Patch: icu4c-3_6-src-setBreakType-public.diff
|
Patch: icu4c-3_6-src-setBreakType-public.diff
|
||||||
Patch1: libicu-regex.patch
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
Summary: International Components for Unicode
|
Summary: International Components for Unicode
|
||||||
|
|
||||||
@ -128,7 +134,6 @@ Authors:
|
|||||||
%prep
|
%prep
|
||||||
%setup -q -n icu -a1
|
%setup -q -n icu -a1
|
||||||
%patch
|
%patch
|
||||||
%patch1 -p0
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
cd source
|
cd source
|
||||||
@ -136,6 +141,7 @@ rm -f config.cache
|
|||||||
%{?suse_update_config:%{suse_update_config -f }}
|
%{?suse_update_config:%{suse_update_config -f }}
|
||||||
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
|
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
|
||||||
export CXXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
|
export CXXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
|
||||||
|
export CXXFLAGS="$CXXFLAGS -DICU_DATA_DIR='/usr/share/icu/4.0/'"
|
||||||
./configure --prefix=/usr \
|
./configure --prefix=/usr \
|
||||||
--sysconfdir=/etc \
|
--sysconfdir=/etc \
|
||||||
--datadir=/usr/share \
|
--datadir=/usr/share \
|
||||||
@ -226,6 +232,24 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
/usr/share/icu/%{version}/UnicodeData.txt
|
/usr/share/icu/%{version}/UnicodeData.txt
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sat Sep 06 2008 maw@suse.de
|
||||||
|
- Update to version 4.0:
|
||||||
|
(All of the bug numbers listed are against
|
||||||
|
http://bugs.icu-project.org/trac)
|
||||||
|
+ Update to Unicode 5.1 (#5696)
|
||||||
|
+ Locale Data: ICU uses and supports data from Common Locale Data
|
||||||
|
Repository (CLDR) 1.6, which includes many improvements in
|
||||||
|
quality and quantity of data
|
||||||
|
+ Add/removeLikelySubtags (#6124)
|
||||||
|
+ Charset converter file size improvement (#5987)
|
||||||
|
+ Date Interval Formatting (#6157) Note: Calendar type supported
|
||||||
|
by this feature is Gregorian only in this release
|
||||||
|
+ Improved Plural support
|
||||||
|
+ Additional calendars: Chinese (#4081) and Coptic/Ethiopic
|
||||||
|
(#4571)
|
||||||
|
+ Security fixes for CVE-2007-4770, CVE-2007-4771, and
|
||||||
|
CVE-2008-1036.
|
||||||
|
- Drop libicu-regex.patch, which has been upstreamed.
|
||||||
* Thu Apr 10 2008 ro@suse.de
|
* Thu Apr 10 2008 ro@suse.de
|
||||||
- added baselibs.conf file to build xxbit packages
|
- added baselibs.conf file to build xxbit packages
|
||||||
for multilib support
|
for multilib support
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:12b8d0486af18fd4590329b592f2126c7608a4094339fb80f70ee573d55a0b11
|
|
||||||
size 2339992
|
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:919f4684e0924d6be941efef16a6c2b2e74e2790c6a2d6a373928000d5b97301
|
|
||||||
size 9320021
|
|
3
icu4c-4_0-docs.tar.bz2
Normal file
3
icu4c-4_0-docs.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:550c05b2469c1626f6bba1ec491eaa7ddc78730c0a12ebd4fcfe7a1749dc8ddc
|
||||||
|
size 297209
|
3
icu4c-4_0-src.tar.bz2
Normal file
3
icu4c-4_0-src.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:7d6a4cff4d83aec978eca493bdee6e028be68e4a8e990d98852d09a61b2856f1
|
||||||
|
size 9375923
|
@ -1,350 +0,0 @@
|
|||||||
Index: source/i18n/regexcmp.cpp
|
|
||||||
===================================================================
|
|
||||||
--- source/i18n/regexcmp.cpp (revision 23251)
|
|
||||||
+++ source/i18n/regexcmp.cpp (revision 23418)
|
|
||||||
@@ -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
|
|
||||||
@@ -1186,14 +1186,17 @@
|
|
||||||
// Because capture groups can be forward-referenced by back-references,
|
|
||||||
// we fill the operand with the capture group number. At the end
|
|
||||||
// of compilation, it will be changed to the variable's location.
|
|
||||||
- U_ASSERT(groupNum > 0);
|
|
||||||
- int32_t op;
|
|
||||||
- if (fModeFlags & UREGEX_CASE_INSENSITIVE) {
|
|
||||||
- op = URX_BUILD(URX_BACKREF_I, groupNum);
|
|
||||||
+ if (groupNum < 1) {
|
|
||||||
+ error(U_REGEX_INVALID_BACK_REF);
|
|
||||||
} else {
|
|
||||||
- op = URX_BUILD(URX_BACKREF, groupNum);
|
|
||||||
+ int32_t op;
|
|
||||||
+ if (fModeFlags & UREGEX_CASE_INSENSITIVE) {
|
|
||||||
+ op = URX_BUILD(URX_BACKREF_I, groupNum);
|
|
||||||
+ } else {
|
|
||||||
+ op = URX_BUILD(URX_BACKREF, groupNum);
|
|
||||||
+ }
|
|
||||||
+ fRXPat->fCompiledPat->addElement(op, *fStatus);
|
|
||||||
}
|
|
||||||
- fRXPat->fCompiledPat->addElement(op, *fStatus);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
Index: source/i18n/rematch.cpp
|
|
||||||
===================================================================
|
|
||||||
--- source/i18n/rematch.cpp (revision 23251)
|
|
||||||
+++ source/i18n/rematch.cpp (revision 23418)
|
|
||||||
@@ -1,6 +1,6 @@
|
|
||||||
/*
|
|
||||||
**************************************************************************
|
|
||||||
-* Copyright (C) 2002-2007 International Business Machines Corporation *
|
|
||||||
+* Copyright (C) 2002-2008 International Business Machines Corporation *
|
|
||||||
* and others. All rights reserved. *
|
|
||||||
**************************************************************************
|
|
||||||
*/
|
|
||||||
@@ -30,6 +30,15 @@
|
|
||||||
|
|
||||||
U_NAMESPACE_BEGIN
|
|
||||||
|
|
||||||
+// Limit the size of the back track stack, to avoid system failures caused
|
|
||||||
+// by heap exhaustion. Units are in 32 bit words, not bytes.
|
|
||||||
+// This value puts ICU's limits higher than most other regexp implementations,
|
|
||||||
+// which use recursion rather than the heap, and take more storage per
|
|
||||||
+// backtrack point.
|
|
||||||
+// This constant is _temporary_. Proper API to control the value will added.
|
|
||||||
+//
|
|
||||||
+static const int32_t BACKTRACK_STACK_CAPACITY = 8000000;
|
|
||||||
+
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Constructor and Destructor
|
|
||||||
@@ -53,8 +62,9 @@
|
|
||||||
}
|
|
||||||
if (fStack == NULL || fData == NULL) {
|
|
||||||
fDeferredStatus = U_MEMORY_ALLOCATION_ERROR;
|
|
||||||
+ } else {
|
|
||||||
+ fStack->setMaxCapacity(BACKTRACK_STACK_CAPACITY);
|
|
||||||
}
|
|
||||||
-
|
|
||||||
reset(RegexStaticSets::gStaticSets->fEmptyString);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -78,6 +88,8 @@
|
|
||||||
}
|
|
||||||
if (fStack == NULL || fData == NULL) {
|
|
||||||
status = U_MEMORY_ALLOCATION_ERROR;
|
|
||||||
+ } else {
|
|
||||||
+ fStack->setMaxCapacity(BACKTRACK_STACK_CAPACITY);
|
|
||||||
}
|
|
||||||
reset(input);
|
|
||||||
}
|
|
||||||
@@ -102,6 +114,8 @@
|
|
||||||
}
|
|
||||||
if (fStack == NULL || fData == NULL) {
|
|
||||||
status = U_MEMORY_ALLOCATION_ERROR;
|
|
||||||
+ } else {
|
|
||||||
+ fStack->setMaxCapacity(BACKTRACK_STACK_CAPACITY);
|
|
||||||
}
|
|
||||||
reset(RegexStaticSets::gStaticSets->fEmptyString);
|
|
||||||
}
|
|
||||||
@@ -1014,6 +1028,14 @@
|
|
||||||
inline REStackFrame *RegexMatcher::StateSave(REStackFrame *fp, int32_t savePatIdx, int32_t frameSize, UErrorCode &status) {
|
|
||||||
// push storage for a new frame.
|
|
||||||
int32_t *newFP = fStack->reserveBlock(frameSize, status);
|
|
||||||
+ if (newFP == NULL) {
|
|
||||||
+ // Heap allocation error on attempted stack expansion.
|
|
||||||
+ // We need to return a writable stack frame, so just return the
|
|
||||||
+ // previous frame. The match operation will stop quickly
|
|
||||||
+ // becuase of the error status, after which the frame will never
|
|
||||||
+ // be looked at again.
|
|
||||||
+ return fp;
|
|
||||||
+ }
|
|
||||||
fp = (REStackFrame *)(newFP - frameSize); // in case of realloc of stack.
|
|
||||||
|
|
||||||
// New stack frame = copy of old top frame.
|
|
||||||
@@ -1029,8 +1051,8 @@
|
|
||||||
fp->fPatIdx = savePatIdx;
|
|
||||||
return (REStackFrame *)newFP;
|
|
||||||
}
|
|
||||||
-
|
|
||||||
-
|
|
||||||
+
|
|
||||||
+
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// MatchAt This is the actual matching engine.
|
|
||||||
@@ -2261,6 +2283,7 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
if (U_FAILURE(status)) {
|
|
||||||
+ isMatch = FALSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Index: source/test/intltest/regextst.h
|
|
||||||
===================================================================
|
|
||||||
--- source/test/intltest/regextst.h (revision 23251)
|
|
||||||
+++ source/test/intltest/regextst.h (revision 23418)
|
|
||||||
@@ -1,6 +1,6 @@
|
|
||||||
/********************************************************************
|
|
||||||
* COPYRIGHT:
|
|
||||||
- * Copyright (c) 2002-2007, International Business Machines Corporation and
|
|
||||||
+ * Copyright (c) 2002-2008, International Business Machines Corporation and
|
|
||||||
* others. All Rights Reserved.
|
|
||||||
********************************************************************/
|
|
||||||
|
|
||||||
@@ -30,6 +30,7 @@
|
|
||||||
virtual void Extended();
|
|
||||||
virtual void Errors();
|
|
||||||
virtual void PerlTests();
|
|
||||||
+ virtual void Bug6149();
|
|
||||||
|
|
||||||
// The following functions are internal to the regexp tests.
|
|
||||||
virtual UBool doRegexLMTest(const char *pat, const char *text, UBool looking, UBool match, int32_t line);
|
|
||||||
Index: source/test/intltest/regextst.cpp
|
|
||||||
===================================================================
|
|
||||||
--- source/test/intltest/regextst.cpp (revision 23251)
|
|
||||||
+++ source/test/intltest/regextst.cpp (revision 23418)
|
|
||||||
@@ -1,6 +1,6 @@
|
|
||||||
/********************************************************************
|
|
||||||
* COPYRIGHT:
|
|
||||||
- * Copyright (c) 2002-2007, International Business Machines Corporation and
|
|
||||||
+ * Copyright (c) 2002-2008, International Business Machines Corporation and
|
|
||||||
* others. All Rights Reserved.
|
|
||||||
********************************************************************/
|
|
||||||
|
|
||||||
@@ -66,6 +66,10 @@
|
|
||||||
case 6: name = "PerlTests";
|
|
||||||
if (exec) PerlTests();
|
|
||||||
break;
|
|
||||||
+ case 7: name = "Bug 6149";
|
|
||||||
+ if (exec) Bug6149();
|
|
||||||
+ break;
|
|
||||||
+
|
|
||||||
|
|
||||||
|
|
||||||
default: name = "";
|
|
||||||
@@ -1639,6 +1643,12 @@
|
|
||||||
|
|
||||||
// Ticket 5389
|
|
||||||
REGEX_ERR("*c", 1, 1, U_REGEX_RULE_SYNTAX);
|
|
||||||
+
|
|
||||||
+ // Invalid Back Reference \0
|
|
||||||
+ // For ICU 3.8 and earlier
|
|
||||||
+ // For ICU versions newer than 3.8, \0 introduces an octal escape.
|
|
||||||
+ //
|
|
||||||
+ REGEX_ERR("(ab)\\0", 1, 6, U_REGEX_INVALID_BACK_REF);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -2122,6 +2132,26 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
+//--------------------------------------------------------------
|
|
||||||
+//
|
|
||||||
+// Bug6149 Verify limits to heap expansion for backtrack stack.
|
|
||||||
+// Use this pattern,
|
|
||||||
+// "(a?){1,}"
|
|
||||||
+// The zero-length match will repeat forever.
|
|
||||||
+// (That this goes into a loop is another bug)
|
|
||||||
+//
|
|
||||||
+//---------------------------------------------------------------
|
|
||||||
+void RegexTest::Bug6149() {
|
|
||||||
+ UnicodeString pattern("(a?){1,}");
|
|
||||||
+ UnicodeString s("xyz");
|
|
||||||
+ uint32_t flags = 0;
|
|
||||||
+ UErrorCode status = U_ZERO_ERROR;
|
|
||||||
+
|
|
||||||
+ RegexMatcher matcher(pattern, s, flags, status);
|
|
||||||
+ UBool result = false;
|
|
||||||
+ REGEX_ASSERT_FAIL(result=matcher.matches(status), U_BUFFER_OVERFLOW_ERROR);
|
|
||||||
+ REGEX_ASSERT(result == FALSE);
|
|
||||||
+ }
|
|
||||||
|
|
||||||
#endif /* !UCONFIG_NO_REGULAR_EXPRESSIONS */
|
|
||||||
|
|
||||||
Index: source/common/uvectr32.cpp
|
|
||||||
===================================================================
|
|
||||||
--- source/common/uvectr32.cpp (revision 23251)
|
|
||||||
+++ source/common/uvectr32.cpp (revision 23418)
|
|
||||||
@@ -1,6 +1,6 @@
|
|
||||||
/*
|
|
||||||
******************************************************************************
|
|
||||||
-* Copyright (C) 1999-2003, International Business Machines Corporation and *
|
|
||||||
+* Copyright (C) 1999-2008, International Business Machines Corporation and *
|
|
||||||
* others. All Rights Reserved. *
|
|
||||||
******************************************************************************
|
|
||||||
* Date Name Description
|
|
||||||
@@ -26,6 +26,7 @@
|
|
||||||
UVector32::UVector32(UErrorCode &status) :
|
|
||||||
count(0),
|
|
||||||
capacity(0),
|
|
||||||
+ maxCapacity(0),
|
|
||||||
elements(NULL)
|
|
||||||
{
|
|
||||||
_init(DEFUALT_CAPACITY, status);
|
|
||||||
@@ -34,6 +35,7 @@
|
|
||||||
UVector32::UVector32(int32_t initialCapacity, UErrorCode &status) :
|
|
||||||
count(0),
|
|
||||||
capacity(0),
|
|
||||||
+ maxCapacity(0),
|
|
||||||
elements(0)
|
|
||||||
{
|
|
||||||
_init(initialCapacity, status);
|
|
||||||
@@ -46,6 +48,9 @@
|
|
||||||
if (initialCapacity < 1) {
|
|
||||||
initialCapacity = DEFUALT_CAPACITY;
|
|
||||||
}
|
|
||||||
+ if (maxCapacity>0 && maxCapacity<initialCapacity) {
|
|
||||||
+ initialCapacity = maxCapacity;
|
|
||||||
+ }
|
|
||||||
elements = (int32_t *)uprv_malloc(sizeof(int32_t)*initialCapacity);
|
|
||||||
if (elements == 0) {
|
|
||||||
status = U_MEMORY_ALLOCATION_ERROR;
|
|
||||||
@@ -189,24 +194,38 @@
|
|
||||||
UBool UVector32::expandCapacity(int32_t minimumCapacity, UErrorCode &status) {
|
|
||||||
if (capacity >= minimumCapacity) {
|
|
||||||
return TRUE;
|
|
||||||
- } else {
|
|
||||||
- int32_t newCap = capacity * 2;
|
|
||||||
- if (newCap < minimumCapacity) {
|
|
||||||
- newCap = minimumCapacity;
|
|
||||||
- }
|
|
||||||
- int32_t* newElems = (int32_t *)uprv_malloc(sizeof(int32_t)*newCap);
|
|
||||||
- if (newElems == 0) {
|
|
||||||
- status = U_MEMORY_ALLOCATION_ERROR;
|
|
||||||
- return FALSE;
|
|
||||||
- }
|
|
||||||
- uprv_memcpy(newElems, elements, sizeof(elements[0]) * count);
|
|
||||||
- uprv_free(elements);
|
|
||||||
- elements = newElems;
|
|
||||||
- capacity = newCap;
|
|
||||||
- return TRUE;
|
|
||||||
}
|
|
||||||
+ if (maxCapacity>0 && minimumCapacity>maxCapacity) {
|
|
||||||
+ status = U_BUFFER_OVERFLOW_ERROR;
|
|
||||||
+ return FALSE;
|
|
||||||
+ }
|
|
||||||
+ int32_t newCap = capacity * 2;
|
|
||||||
+ if (newCap < minimumCapacity) {
|
|
||||||
+ newCap = minimumCapacity;
|
|
||||||
+ }
|
|
||||||
+ if (maxCapacity > 0 && newCap > maxCapacity) {
|
|
||||||
+ newCap = maxCapacity;
|
|
||||||
+ }
|
|
||||||
+ int32_t* newElems = (int32_t *)uprv_malloc(sizeof(int32_t)*newCap);
|
|
||||||
+ if (newElems == 0) {
|
|
||||||
+ status = U_MEMORY_ALLOCATION_ERROR;
|
|
||||||
+ return FALSE;
|
|
||||||
+ }
|
|
||||||
+ uprv_memcpy(newElems, elements, sizeof(elements[0]) * count);
|
|
||||||
+ uprv_free(elements);
|
|
||||||
+ elements = newElems;
|
|
||||||
+ capacity = newCap;
|
|
||||||
+ return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
+void UVector32::setMaxCapacity(int32_t limit) {
|
|
||||||
+ U_ASSERT(limit >= 0);
|
|
||||||
+ maxCapacity = limit;
|
|
||||||
+ if (maxCapacity < 0) {
|
|
||||||
+ maxCapacity = 0;
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/**
|
|
||||||
* Change the size of this vector as follows: If newSize is smaller,
|
|
||||||
* then truncate the array, possibly deleting held elements for i >=
|
|
||||||
Index: source/common/uvectr32.h
|
|
||||||
===================================================================
|
|
||||||
--- source/common/uvectr32.h (revision 23251)
|
|
||||||
+++ source/common/uvectr32.h (revision 23418)
|
|
||||||
@@ -1,6 +1,6 @@
|
|
||||||
/*
|
|
||||||
**********************************************************************
|
|
||||||
-* Copyright (C) 1999-2006, International Business Machines
|
|
||||||
+* Copyright (C) 1999-2008, International Business Machines
|
|
||||||
* Corporation and others. All Rights Reserved.
|
|
||||||
**********************************************************************
|
|
||||||
*/
|
|
||||||
@@ -61,6 +61,8 @@
|
|
||||||
int32_t count;
|
|
||||||
|
|
||||||
int32_t capacity;
|
|
||||||
+
|
|
||||||
+ int32_t maxCapacity; // Limit beyond which capacity is not permitted to grow.
|
|
||||||
|
|
||||||
int32_t* elements;
|
|
||||||
|
|
||||||
@@ -162,6 +164,14 @@
|
|
||||||
int32_t *getBuffer() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
+ * Set the maximum allowed buffer capacity for this vector/stack.
|
|
||||||
+ * Default with no limit set is unlimited, go until malloc() fails.
|
|
||||||
+ * A Limit of zero means unlimited capacity.
|
|
||||||
+ * Units are vector elements (32 bits each), not bytes.
|
|
||||||
+ */
|
|
||||||
+ void setMaxCapacity(int32_t limit);
|
|
||||||
+
|
|
||||||
+ /**
|
|
||||||
* ICU "poor man's RTTI", returns a UClassID for this class.
|
|
||||||
*/
|
|
||||||
static UClassID U_EXPORT2 getStaticClassID();
|
|
||||||
@@ -221,7 +231,9 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int32_t *UVector32::reserveBlock(int32_t size, UErrorCode &status) {
|
|
||||||
- ensureCapacity(count+size, status);
|
|
||||||
+ if (ensureCapacity(count+size, status) == FALSE) {
|
|
||||||
+ return NULL;
|
|
||||||
+ }
|
|
||||||
int32_t *rp = elements+count;
|
|
||||||
count += size;
|
|
||||||
return rp;
|
|
Loading…
Reference in New Issue
Block a user