blob: 3338a72457e82626127d4449322cf3bea2aa3d58 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# Allow to set the Gregorian change date for ISO8601 calendars.
#
# ICU bug: https://unicode-org.atlassian.net/browse/ICU-22412
diff --git a/intl/icu/source/i18n/ucal.cpp b/intl/icu/source/i18n/ucal.cpp
--- a/intl/icu/source/i18n/ucal.cpp
+++ b/intl/icu/source/i18n/ucal.cpp
@@ -22,10 +22,11 @@
#include "unicode/ustring.h"
#include "unicode/strenum.h"
#include "unicode/localpointer.h"
#include "cmemory.h"
#include "cstring.h"
+#include "iso8601cal.h"
#include "ustrenum.h"
#include "uenumimp.h"
#include "ulist.h"
#include "ulocimp.h"
@@ -305,11 +306,12 @@ ucal_setGregorianChange(UCalendar *cal,
// We normally don't check "this" pointers for nullptr, but this here avoids
// compiler-generated exception-throwing code in case cal == nullptr.
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
- if(typeid(*cpp_cal) != typeid(GregorianCalendar)) {
+ if(typeid(*cpp_cal) != typeid(GregorianCalendar) &&
+ typeid(*cpp_cal) != typeid(ISO8601Calendar)) {
*pErrorCode = U_UNSUPPORTED_ERROR;
return;
}
gregocal->setGregorianChange(date, *pErrorCode);
}
@@ -327,11 +329,12 @@ ucal_getGregorianChange(const UCalendar
// We normally don't check "this" pointers for nullptr, but this here avoids
// compiler-generated exception-throwing code in case cal == nullptr.
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
return (UDate)0;
}
- if(typeid(*cpp_cal) != typeid(GregorianCalendar)) {
+ if(typeid(*cpp_cal) != typeid(GregorianCalendar) &&
+ typeid(*cpp_cal) != typeid(ISO8601Calendar)) {
*pErrorCode = U_UNSUPPORTED_ERROR;
return (UDate)0;
}
return gregocal->getGregorianChange();
}
|