Commit graph

59 commits

Author SHA1 Message Date
Frank Tang
b65650bc5f ICU-23077 Correct the internalGet call inside Calendar
See #3439
2025-03-19 16:22:43 -07:00
Frank Tang
59af52bb6f ICU-23043 Propogate error in Calendar. 2025-02-11 15:14:27 -08:00
Frank Tang
7153a3db52 ICU-23006 Fix Chinese Calendar getActualMaximize
See #3348
2025-01-28 16:34:26 -08:00
Frank Tang
4fc1b7e7f6 ICU-22991 Simplified Grego code
Use timeToFields instead of dayToFields

ICU-22991 Revert back gregoimp interface change
2025-01-24 17:13:51 -08:00
Frank Tang
9eafd8ca3e ICU-22991 Reduce Calendar object size
See #3327
2025-01-08 12:26:35 -08:00
Frank Tang
e515c84645 ICU-22991 Remove unnecessary overload in Calendar 2024-12-23 12:52:11 -08:00
Frank Tang
a7291c4e51 ICU-22962 Fix int32 overflow in Chinese Calendar 2024-12-16 18:02:05 -08:00
Frank Tang
81d047524c ICU-22991 Remove protected direct access to fStamp 2024-12-16 13:17:40 -08:00
Fredrik Roubert
0178a07a26 ICU-22793 Clang-Tidy: google-readability-casting
https://releases.llvm.org/17.0.1/tools/clang/tools/extra/docs/clang-tidy/checks/google/readability-casting.html
2024-07-04 22:32:12 +02:00
Frank Tang
6ac6fdda74 ICU-22730 propagate error avoid overflow 2024-05-16 00:27:14 -07:00
Frank Tang
0c02f8c007 ICU-22743 Change internal functions to propagate errors up. 2024-04-18 15:32:59 -07:00
Frank Tang
d83d26cc5d ICU-9972 Fix Chinese/Dangi Calendar getActualMaximum(UCAL_DAY_OF_YEAR)
Also fix ICU-12620 which is mark duplicate of ICU-9972 just now.
and fix ICU-22258.

Separate the new year and winter solstice cache since the calculated
value for these two calendar are mostly but not always the same due
to slightly different observation timeZone.

Remove the epochYear and zoneAstroCalc from the member data
and instead return them from a getStting() method with the two caches
since all four of them are constant per subclass of ChineseCalendar
and do not need to be different per object.

The known issues in the TestLimit is caused by both Calendar get/put the
value from the same cache while the calculated result depends on the
timeZone zoneAstroCalc.
2024-03-28 11:02:21 -07:00
Frank Tang
fbc1f33e7e ICU-22679 Clean up Calendar code.
1. Remove redudant implementation of default system ceuntry by using
   macro
2. Fold long if / else block if one block return.
2024-03-21 09:50:10 -07:00
Frank Tang
0b77215040 ICU-22698 Clean up CalendarAstronomer 2024-03-20 13:36:17 -07:00
Frank Tang
606623cf30 ICU-22679 Refactor ChineseCalendar
See #2898
2024-03-18 18:51:27 -07:00
Frank Tang
9a912bb51b ICU-22633 Add more Calendar overflow tests
Test set+set, set+add, set+roll, add+add, roll+roll
Fix more int32_t overflow problems.

Optimize both Java and C++ Hebrew Calendar month/year advancement by first consider
every 235 months is 19 years before iteration.
2024-03-13 15:48:25 -07:00
Frank Tang
d43d216feb ICU-22633 Test and fix int32_t overflow for Calendar set
Add test to set with INT32_MAX and INT32_MIN then call getTime()
and fix all the undefined errors.
2024-03-12 16:46:53 -07:00
Frank Tang
784056dfdb ICU-22633 Fix overflow in Chinese calendar
Fix issue found by https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=67256
2024-03-07 16:03:00 -08:00
Frank Tang
ec800e7407 ICU-22633 Return error if era is out of range 2024-02-27 10:56:28 -08:00
Frank Yung-Fong Tang
0b66fada30 ICU-22633 Fix integer overflow inside Calendar code
See #2806
2024-02-07 10:58:41 -08:00
Fredrik Roubert
c5160765d4 ICU-22639 Clone the calendar so we don't mess with the real one. 2024-01-19 08:07:22 +09:00
Frank Tang
4fcf8d22b9 ICU-22507 Fix stack overflow in ChineseCalendar::isLeapMonthBetween
Rewrite the recursive call to while loop to avoid stack overflow
when the two values have big gap.
Include tests to verify the problem in unit test.
2023-09-20 23:56:15 -07:00
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
Frank Tang
cd1b772cbf ICU-22027 Add C++ Calendar API for Temporal
API proposal
https://docs.google.com/document/d/1UYriEzzExiLhi2RD3zjTsI5UQHv1dXaFqrct7yXNdCA/edit#heading=h.x9obor85vpx9

Design Doc
https://docs.google.com/document/d/15ViyC9s0k3VEDwBmAkKxxz4IadZ6QrAIoETkdkF0cVA/

ICU-22027 Adjust API to remove the mention of M00L for now.
2023-01-17 15:08:08 -08:00
Frank Tang
b0ab1171ad ICU-10752 Spread (s|g)etRelativeYear to subclass
Remove the switch statment implementaiton in
Calendar::(g|s)etRelatedYear
and move the code into each subclass as proper OOP style.
2022-11-09 13:18:24 -08:00
Frank Tang
294b26eb7a ICU-22159 Merge inDaylightTime to Calendar
All the subclass implementation of inDaylightTime are the same
so just move to a base class implementation.
2022-10-31 08:42:51 -07:00
Fredrik Roubert
030fa1a479 ICU-21148 Consistently use standard lowercase true/false everywhere.
This is the normal standard way in C, C++ as well as Java and there's no
longer any reason for ICU to be different. The various internal macros
providing custom boolean constants can all be deleted and code as well
as documentation can be updated to use lowercase true/false everywhere.
2022-09-07 20:56:33 +02:00
Frank Yung-Fong Tang
3d89af0f72 ICU-22023 Fix Calendar::get() return out of bound value and SimpleDateTime::format assert while TimeZone is "UTC" and value is -1e-9
See #2086
2022-05-19 13:45:59 -07:00
Andy Heninger
85705f04e0 ICU-21960 C++20 Warnings from ATOMIC_VAR_INIT
Remove the ICU macros ATOMIC_INT32_T_INITIALIZER and U_INITONCE_INITIALIZER,
which made use of C++ ATOMIC_VAR_INIT, which has been removed from C++20.

With modern C++ features being available, these macros no longer served
any real need.
2022-05-17 15:45:06 -07:00
Frank Tang
863582c2a4 ICU-20465 Calendar/DateFormat listen to tz extension
See #1176
2020-08-04 13:33:03 -07:00
Markus Scherer
f02b496494 ICU-20783 C++ covariant return types: clone(), freeze() & friends 2019-08-22 16:24:41 -07:00
Andy Heninger
afa9b9b48e ICU-20588 UMutex, add cleanup of underlying mutexes, and simplify usage model 2019-05-24 13:24:59 -07:00
Andy Heninger
b772241b52 ICU-20520 UMutex refactoring.
- Use STATIC_NEW for mutex creation, to avoid order-of-destruction problems
    by avoiding destruction altogether, while avoiding memory leak reports.

  - Remove UConditionVar, replace with direct use of std::condition_variable
2019-05-07 13:50:49 -07:00
Andy Heninger
bc4bb89af2 ICU-20488 mutex static constructor fixes.
Remove the dependencies from the ICU library code on static constructors
that were introduced by using std::mutex and condition variables. The
mutexes are lazily initialized by embedding them as local static variables
in getter functions, and relying on the C++ compiler/runtime to do thread
safe initialization of them.
2019-03-12 09:52:16 -07:00
Andy Heninger
47d455a725 ICU-20179 Remove platform-specific mutex and atomics implementations.
Remove all POSIX and Win32 specific mutex, atomic and threading implementations
in favor of C++11 std library functions.

Move the related (internal) ICU types and functions into the icu namespace.
2018-11-19 17:17:09 -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
Andy Heninger
dbcf79f57b ICU-10799 ICU initialization code, review & cleanup.
X-SVN-Rev: 35649
2014-04-23 23:22:13 +00:00
Markus Scherer
8f38199123 ICU-10365 fix namespace issue: icu::UInitOnce
X-SVN-Rev: 34252
2013-09-10 00:34:12 +00:00
Steven R. Loomis
86c481026c ICU-10373 fix -DU_USING_ICU_NAMESPACE=0 issues
X-SVN-Rev: 34251
2013-09-10 00:13:41 +00:00
Andy Heninger
978f71fe78 ICU-10051 Mutexes: introduce UInitOnce; remove UMTX_CHECK; replace all uses of UMTX_CHECK.
X-SVN-Rev: 33787
2013-05-31 23:50:15 +00:00
Michael Ow
56a80addb8 ICU-9801 Fix some incorrect usage of UnicodeString constructor
X-SVN-Rev: 33312
2013-02-23 16:58:30 +00:00
Peter Edberg
47c5a5aa61 ICU-9616 Add DangiCalendar & tests, port from J to C
X-SVN-Rev: 33267
2013-02-18 23:36:57 +00:00
Peter Edberg
157ed28fc9 ICU-9616 ChineseCalendar changes to support Dangi subclass, port from J to C
X-SVN-Rev: 33265
2013-02-18 17:51:25 +00:00
Andy Heninger
803ac8f33c ICU-9461 Mutex Implementation Rework, merge from devel branch.
X-SVN-Rev: 32530
2012-10-05 21:22:02 +00:00
Markus Scherer
1beb0f1e4f ICU-8680 require C++ namespace, replace most U_NAMESPACE_QUALIFIER with icu::, remove still-draft U_STD_NS, U_STD_NSQ, and U_STD_NS_USE
X-SVN-Rev: 30281
2011-07-06 04:03:35 +00:00
Steven R. Loomis
2145eb11be ICU-6551 reduce use of common words in rename.
X-SVN-Rev: 24652
2008-09-25 20:24:14 +00:00