Commit graph

56 commits

Author SHA1 Message Date
Markus Scherer
b6dcc95d3c ICU-21833 remove redundant void parameter lists
See #2351
2023-03-02 09:31:57 -08:00
Fredrik Roubert
2e0d30cfcf ICU-21833 Replace NULL with nullptr in all C++ code. 2023-02-03 20:20:38 +01:00
Andy Heninger
2fef6b937f ICU-21763 UVector cleanup, remove old funcs.
Remove the functions UVector::addElementX() and UVector::ensureCapacityX() that
were temporarily added to aid in the cleaning up of UVector's out-of-memory
error handling.
2022-02-06 22:07:50 -08:00
Andy Heninger
46861a5c78 ICU-21662 UVector Error Handling in Regex
Clean up some oversights from commit 0ec329c. This was triggered by fuzz testing finding
a memory leak with the original commit, see https://oss-fuzz.com/testcase-detail/4656781834452992

I was unable to replicate the fuzzing failure, but reviewing the nearby code showed
some likely problems.

In this commit,
- Fix UStack::pop() to not delete the popped element when a deleter function is present.
  This was a bug, but because there were no stacks with deleters, was not causing trouble.

- Change RegexCompile::compileSet() to delete the set if it cannot be added to the internal
  vector of sets. I suspect this is the cause of the fuzzing leak - 0ec329c changed the
  behavior of UVector in the presence of errors.

- Changed RegexCompile::fSetStack to use an object deleter function. This fixes the
  leak checking at the points new elements are pushed onto this stack.
2021-09-14 19:24:23 -07:00
Andy Heninger
0ec329c6e1 ICU-21662 Improve UVector error handling.
This is the next installment of UVector error handling cleanup. It includes:

- Revise UStack to follow the conventions of UVector, to leave the stack
  unmodified when there is an incoming error code. And, for stacks with a
  deleter function, to delete the incoming object if it cannot be
  succesfully pushed.

 - Review all useage of UStack in ICU; adjust call sites as needed.

 - Review all uses of UVector::addElementX() in the implementation of
   - Regular Expressions
   - Break Iteration
   - toolutil/xmlparser

   changing to the updated functions, and adjusting call sites as needed.
2021-09-08 17:24:52 -07:00
Peter Varga
1986dcd0d8 ICU-21734 Add missing overrides 2021-09-07 17:42:14 -07:00
Andy Heninger
081cf77330 ICU-21662 Improve UVector error handling.
- Add updated versions of UVector::addElement() and ensureCapacity() that respect
  incoming errors.
  Follow on to c26aebe, which renamed the original versions.

- Add UVector::adoptElement() as a replacement for addElement() when the vector
  has a deleter function set, meaning that it adopts ownership of its elements.

  The intent is to make the behavior clearer at the call sites when looking
  at unfamiliar code.

- Make all functions with an incoming failure, as indicated by a UErrorCode parameter,
  leave the vector unchanged.

- Change all functions that store object pointers into the vector such that,
  when the store cannot be completed for any reason _and_ the vector has a deleter function,
  then the incoming object is deleted.

  This change can simplify the error handling code around calls to the affected functions
  (addElement() and insertElementAt(), in particular)

- Add index bounds checking on functions where it was possible - that is, on functions
  with both U_ErrorCode and index parameters.

- Changed to more modern C++ idioms in some parts of the UVector implementation.

- Review & update as required all uses of the UVector functions
  setElementAt(), insertElementAt(), setSize(), sortedInsert()
  these being the functions with changed behavior on error conditions
  (aside from addElement()).

This PR will be followed by more, switching call sites in various ICU services
from UVector::addElementX() (old behavior on errors)
to   UVector::addElement()  (new behavior on errors)
2021-09-02 19:15:36 -07:00
Fredrik Roubert
633438f8da ICU-20973 Change all equality operator return types from UBool to bool. 2021-08-17 00:35:00 +02:00
Andy Heninger
c26aebe802 ICU-21662 Rename UVector::addElement().
This is the first step towards improving the error handling and out-of-memory
behavior of UVector::addElement(). A followup PR will add back a new addElement()
with corrected error handling, then additional followups will switch call sites
from the original (renamed) function to the new addElement().

This commit includes no logic or behavior changes; it only renames the existing functions.
2021-07-28 15:36:50 -07:00
Markus Scherer
a18df7ba28 ICU-21267 stop using FALSE & TRUE macros in most library-internal headers 2020-09-10 13:55:46 -07:00
Jerome Gaillard
4b8edfa999 ICU-20356 Fix compilation warnings 'dllimport' attribute ignored
Methods implementead as 'inline' but not declared 'inline' cause clang++
to throw compilation warnings on Windows. This adds 'inline' to the
relevant method declarations.
2019-02-21 12:18:22 -08:00
Andy Heninger
242e02c388 ICU-12764 icu4c utf-8 source files, update Copyright notices.
X-SVN-Rev: 39583
2017-01-20 00:20:31 +00:00
Michael Ow
61607c2773 ICU-12564 Update copyright notice in trunk
X-SVN-Rev: 38848
2016-06-15 18:58:17 +00:00
Yoshito Umaoka
00ca13e126 ICU-12564 Reverted r38761 and r38762, because we want to prepend the Unicode copyright for existing source files, instead of replacing copyright comments.
X-SVN-Rev: 38776
2016-05-31 21:45:07 +00:00
Michael Ow
c9f199a30f ICU-12564 Update copyright notice in ICU4C
X-SVN-Rev: 38761
2016-05-26 22:32:17 +00:00
kazède king
f713c0687c ICU-11872 new time formatting pattern chars b/B
Merging from the branch.

X-SVN-Rev: 38370
2016-02-25 19:51:53 +00:00
Markus Scherer
f5cd9984c6 ICU-9880 add ImmutableIndex, replace Chinese hacks and support zhuyin, handle index characters with multiple primary weights, lazy-create rarely-used objects, bug fixes, port other improvements from Java
X-SVN-Rev: 33245
2013-02-15 22:11:33 +00:00
Markus Scherer
744d1f3a19 ICU-8617 move UHashTok into lower-level uelement.h (new) and rename to UElement to share with UVector
X-SVN-Rev: 30272
2011-07-04 23:51:56 +00:00
Andy Heninger
7b7f48eef8 ICU-7530 Alphabetic index, move from branch to trunk.
X-SVN-Rev: 29482
2011-02-25 22:21:30 +00:00
Andy Heninger
9715eae02c ICU-4790 spoof impl merged to trunk.
X-SVN-Rev: 25534
2009-03-09 23:40:15 +00:00
George Rhoten
1725c5899a ICU-6076 Fix some allocation issues.
X-SVN-Rev: 23087
2007-12-14 10:17:12 +00:00
George Rhoten
5b9b0f3d01 ICU-5357 Fix misspelling
X-SVN-Rev: 20434
2006-09-28 21:27:09 +00:00
George Rhoten
6d97fc4c9f ICU-5008 Undraft some API
X-SVN-Rev: 19000
2006-01-18 03:52:04 +00:00
George Rhoten
f31614d5bc ICU-4092 Add documentation that was found to be helpful while testing.
X-SVN-Rev: 16972
2004-12-20 23:22:34 +00:00
George Rhoten
254eea3c6e ICU-4072 Explicitly use U_EXPORT2 to specify calling convention of static C++ code.
X-SVN-Rev: 16182
2004-08-24 17:21:14 +00:00
Eric Mader
14fbb48bf9 ICU-3770 Updated copyright notices for ICU 3.0
X-SVN-Rev: 15385
2004-05-18 22:01:41 +00:00
George Rhoten
232ee12872 ICU-3500 Fix compiler warnings about multiple virtual destructors and/or not inlining compiler generated destructors.
X-SVN-Rev: 14896
2004-04-07 05:20:22 +00:00
George Rhoten
4d18bb2b4f ICU-3221 Fix the AIX linker warning about multiple definitions of virtual functions.
X-SVN-Rev: 12958
2003-08-27 01:01:42 +00:00
Vladimir Weinstein
c9475e02ae ICU-2959 Updated copyright notices
X-SVN-Rev: 12246
2003-06-03 06:44:40 +00:00
George Rhoten
cf258a7833 ICU-2699 Fix some compiler warnings
X-SVN-Rev: 12177
2003-05-29 22:21:22 +00:00
Vladimir Weinstein
f346c4d8f2 ICU-2268 fixed UTokenAssigner bug in UVector
X-SVN-Rev: 9816
2002-08-29 22:12:49 +00:00
George Rhoten
aa41d27d93 ICU-1947 Better usage for U_EXPORT2 and U_CALLCONV
X-SVN-Rev: 9296
2002-07-23 23:12:03 +00:00
Andy Heninger
e32993b2d8 ICU-45 RBBI, getRuleStatus() works after previous().
More Tests.
Private includes removed from public header
Break rule tag status added to word break rules.

X-SVN-Rev: 9284
2002-07-22 22:02:08 +00:00
George Rhoten
4d4cde52ca ICU-1913 Fixes for iSeries.
X-SVN-Rev: 9235
2002-07-17 19:44:00 +00:00
George Rhoten
f414b9c5d2 ICU-1891 Update for z/OS regarding U_CALLCONV.
All C callbacks should all be defined the same way.

X-SVN-Rev: 9107
2002-07-12 00:23:52 +00:00
Markus Scherer
11948b52df ICU-1962 change UObject: RTTI pure virtual, remove other boilerplate for now
X-SVN-Rev: 8977
2002-06-29 00:04:16 +00:00
Markus Scherer
5a81709c73 ICU-1962 derive all ICU C++ classes from common UObject base class
X-SVN-Rev: 8953
2002-06-27 01:19:20 +00:00
Andy Heninger
32c09250b7 ICU-45 new builder for RBBI rules, initial checkin
X-SVN-Rev: 8939
2002-06-25 17:23:07 +00:00
Alan Liu
37b4739783 ICU-1749 API additions to support UnicodeSet
X-SVN-Rev: 8526
2002-04-26 06:30:37 +00:00
George Rhoten
2ab3c9cd3b ICU-214 Fix for Win64. Don't freely convert between (void *) and int32_t.
Use the int32_t functions when you are only using integers.
Also arrays of scalars need to be allocated with malloc (Needed by Lotus j1733).

X-SVN-Rev: 8289
2002-03-29 01:56:09 +00:00
George Rhoten
a2e0a0733d ICU-1096 Made changes per Ram's request.
X-SVN-Rev: 6704
2001-11-09 02:04:35 +00:00
Alan Liu
989da3cfa9 ICU-1406 make quantified segments behave like perl counterparts
X-SVN-Rev: 6499
2001-10-30 19:44:11 +00:00
Alan Liu
8a98ee7a0e ICU-1023 change UHashKey to UHashTok and use for values as well
X-SVN-Rev: 6264
2001-10-16 18:31:13 +00:00
Helena Chapman
d816eefc57 ICU-1264 added namspace support where possible.
X-SVN-Rev: 6124
2001-10-08 23:26:58 +00:00
George Rhoten
f9081a2e8e ICU-1096 Make UVector and UStack use UErrorCode for U_MEMORY_ALLOCATION_ERROR
X-SVN-Rev: 5565
2001-08-23 01:06:08 +00:00
Alan Liu
772c6a5bd5 ICU-1023 fix UVector to support int32_t elements properly
X-SVN-Rev: 5398
2001-07-31 18:10:53 +00:00
Alan Liu
c3f4cfbc85 ICU-1029 make UVector compare and delete fn pts compatible with uhash
X-SVN-Rev: 5170
2001-07-03 23:09:03 +00:00
George Rhoten
c4997713ef ICU-903 Updated the copyright notice
X-SVN-Rev: 4238
2001-03-21 20:44:20 +00:00
Helena Chapman
69ba12f77c ICU-351 Define UBool to be used in the APIs.
X-SVN-Rev: 1410
2000-05-18 22:08:39 +00:00
Alan Liu
d623133b0c ICU-161 fix copyrights
X-SVN-Rev: 905
2000-03-07 02:39:27 +00:00