aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/icu/i18n/astro.cpp
diff options
context:
space:
mode:
authorromankoshelev <romankoshelev@yandex-team.com>2023-08-14 19:51:50 +0300
committerromankoshelev <romankoshelev@yandex-team.com>2023-08-15 01:24:11 +0300
commitcfcd865e05c0d0525ea27d1e153a043b32a85138 (patch)
tree68d3b3b25271e8a4998505897a269ff7ce119b76 /contrib/libs/icu/i18n/astro.cpp
parentccb790c507bd5e8ffe2ef9886ce5ee0a7ce22a15 (diff)
downloadydb-cfcd865e05c0d0525ea27d1e153a043b32a85138.tar.gz
Update ICU to 73.2
Diffstat (limited to 'contrib/libs/icu/i18n/astro.cpp')
-rw-r--r--contrib/libs/icu/i18n/astro.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/contrib/libs/icu/i18n/astro.cpp b/contrib/libs/icu/i18n/astro.cpp
index 6dc463b4ca..575efeb175 100644
--- a/contrib/libs/icu/i18n/astro.cpp
+++ b/contrib/libs/icu/i18n/astro.cpp
@@ -44,8 +44,8 @@ static void debug_astro_msg(const char *pat, ...)
#include "unicode/ustring.h"
static const char * debug_astro_date(UDate d) {
static char gStrBuf[1024];
- static DateFormat *df = NULL;
- if(df == NULL) {
+ static DateFormat *df = nullptr;
+ if(df == nullptr) {
df = DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::MEDIUM, Locale::getUS());
df->adoptTimeZone(TimeZone::getGMT()->clone());
}
@@ -68,8 +68,8 @@ static inline UBool isINVALID(double d) {
static icu::UMutex ccLock;
U_CDECL_BEGIN
-static UBool calendar_astro_cleanup(void) {
- return TRUE;
+static UBool calendar_astro_cleanup() {
+ return true;
}
U_CDECL_END
@@ -242,7 +242,7 @@ inline static double normPI(double angle) {
* @deprecated ICU 2.4. This class may be removed or modified.
*/
CalendarAstronomer::CalendarAstronomer():
- fTime(Calendar::getNow()), fLongitude(0.0), fLatitude(0.0), fGmtOffset(0.0), moonPosition(0,0), moonPositionSet(FALSE) {
+ fTime(Calendar::getNow()), fLongitude(0.0), fLatitude(0.0), fGmtOffset(0.0), moonPosition(0,0), moonPositionSet(false) {
clearCache();
}
@@ -252,7 +252,7 @@ CalendarAstronomer::CalendarAstronomer():
* @internal
* @deprecated ICU 2.4. This class may be removed or modified.
*/
-CalendarAstronomer::CalendarAstronomer(UDate d): fTime(d), fLongitude(0.0), fLatitude(0.0), fGmtOffset(0.0), moonPosition(0,0), moonPositionSet(FALSE) {
+CalendarAstronomer::CalendarAstronomer(UDate d): fTime(d), fLongitude(0.0), fLatitude(0.0), fGmtOffset(0.0), moonPosition(0,0), moonPositionSet(false) {
clearCache();
}
@@ -272,7 +272,7 @@ CalendarAstronomer::CalendarAstronomer(UDate d): fTime(d), fLongitude(0.0), fLat
* @deprecated ICU 2.4. This class may be removed or modified.
*/
CalendarAstronomer::CalendarAstronomer(double longitude, double latitude) :
- fTime(Calendar::getNow()), moonPosition(0,0), moonPositionSet(FALSE) {
+ fTime(Calendar::getNow()), moonPosition(0,0), moonPositionSet(false) {
fLongitude = normPI(longitude * (double)DEG_RAD);
fLatitude = normPI(latitude * (double)DEG_RAD);
fGmtOffset = (double)(fLongitude * 24. * (double)HOUR_MS / (double)CalendarAstronomer_PI2);
@@ -1069,7 +1069,7 @@ const CalendarAstronomer::Equatorial& CalendarAstronomer::getMoonPosition()
// See page 142 of "Practical Astronomy with your Calculator",
// by Peter Duffet-Smith, for details on the algorithm.
//
- if (moonPositionSet == FALSE) {
+ if (moonPositionSet == false) {
// Calculate the solar longitude. Has the side effect of
// filling in "meanAnomalySun" as well.
getSunLongitude();
@@ -1138,7 +1138,7 @@ const CalendarAstronomer::Equatorial& CalendarAstronomer::getMoonPosition()
double moonEclipLat = ::asin(y * ::sin(moonI));
eclipticToEquatorial(moonPosition, moonEclipLong, moonEclipLat);
- moonPositionSet = TRUE;
+ moonPositionSet = true;
}
return moonPosition;
}
@@ -1446,7 +1446,7 @@ void CalendarAstronomer::clearCache() {
eclipObliquity = INVALID;
siderealTime = INVALID;
siderealT0 = INVALID;
- moonPositionSet = FALSE;
+ moonPositionSet = false;
}
//private static void out(String s) {
@@ -1471,7 +1471,7 @@ void CalendarAstronomer::clearCache() {
int32_t rawOffset;
int32_t dstOffset;
UErrorCode status = U_ZERO_ERROR;
- tz->getOffset(localMillis, TRUE, rawOffset, dstOffset, status);
+ tz->getOffset(localMillis, true, rawOffset, dstOffset, status);
delete tz;
return localMillis - rawOffset;
}*/
@@ -1481,7 +1481,7 @@ UnicodeString CalendarAstronomer::Ecliptic::toString() const
{
#ifdef U_DEBUG_ASTRO
char tmp[800];
- sprintf(tmp, "[%.5f,%.5f]", longitude*RAD_DEG, latitude*RAD_DEG);
+ snprintf(tmp, sizeof(tmp), "[%.5f,%.5f]", longitude*RAD_DEG, latitude*RAD_DEG);
return UnicodeString(tmp, "");
#else
return UnicodeString();
@@ -1492,7 +1492,7 @@ UnicodeString CalendarAstronomer::Equatorial::toString() const
{
#ifdef U_DEBUG_ASTRO
char tmp[400];
- sprintf(tmp, "%f,%f",
+ snprintf(tmp, sizeof(tmp), "%f,%f",
(ascension*RAD_DEG), (declination*RAD_DEG));
return UnicodeString(tmp, "");
#else
@@ -1504,7 +1504,7 @@ UnicodeString CalendarAstronomer::Horizon::toString() const
{
#ifdef U_DEBUG_ASTRO
char tmp[800];
- sprintf(tmp, "[%.5f,%.5f]", altitude*RAD_DEG, azimuth*RAD_DEG);
+ snprintf(tmp, sizeof(tmp), "[%.5f,%.5f]", altitude*RAD_DEG, azimuth*RAD_DEG);
return UnicodeString(tmp, "");
#else
return UnicodeString();
@@ -1532,13 +1532,13 @@ UnicodeString CalendarAstronomer::Horizon::toString() const
void CalendarCache::createCache(CalendarCache** cache, UErrorCode& status) {
ucln_i18n_registerCleanup(UCLN_I18N_ASTRO_CALENDAR, calendar_astro_cleanup);
- if(cache == NULL) {
+ if(cache == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
} else {
*cache = new CalendarCache(32, status);
if(U_FAILURE(status)) {
delete *cache;
- *cache = NULL;
+ *cache = nullptr;
}
}
}
@@ -1551,7 +1551,7 @@ int32_t CalendarCache::get(CalendarCache** cache, int32_t key, UErrorCode &statu
}
umtx_lock(&ccLock);
- if(*cache == NULL) {
+ if(*cache == nullptr) {
createCache(cache, status);
if(U_FAILURE(status)) {
umtx_unlock(&ccLock);
@@ -1572,7 +1572,7 @@ void CalendarCache::put(CalendarCache** cache, int32_t key, int32_t value, UErro
}
umtx_lock(&ccLock);
- if(*cache == NULL) {
+ if(*cache == nullptr) {
createCache(cache, status);
if(U_FAILURE(status)) {
umtx_unlock(&ccLock);
@@ -1587,12 +1587,12 @@ void CalendarCache::put(CalendarCache** cache, int32_t key, int32_t value, UErro
}
CalendarCache::CalendarCache(int32_t size, UErrorCode &status) {
- fTable = uhash_openSize(uhash_hashLong, uhash_compareLong, NULL, size, &status);
+ fTable = uhash_openSize(uhash_hashLong, uhash_compareLong, nullptr, size, &status);
U_DEBUG_ASTRO_MSG(("%p: Opening.\n", fTable));
}
CalendarCache::~CalendarCache() {
- if(fTable != NULL) {
+ if(fTable != nullptr) {
U_DEBUG_ASTRO_MSG(("%p: Closing.\n", fTable));
uhash_close(fTable);
}