summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2022-09-01 12:18:47 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2022-09-01 12:19:35 -0700
commit30e43220e420880eba82238cd6c44a081bb4826d (patch)
tree70ee105ece9891c1eb6c568e2e00ada720288280
parentaf0babf01f3421aeca74b4eb5b15b9839ab710f9 (diff)
Import of CCTZ from GitHub.
PiperOrigin-RevId: 471600654 Change-Id: Iee722e5d736d341bc81cc10dac290383ba392f87
-rw-r--r--absl/time/internal/cctz/src/time_zone_lookup.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/absl/time/internal/cctz/src/time_zone_lookup.cc b/absl/time/internal/cctz/src/time_zone_lookup.cc
index 84aa037a..f6983aeb 100644
--- a/absl/time/internal/cctz/src/time_zone_lookup.cc
+++ b/absl/time/internal/cctz/src/time_zone_lookup.cc
@@ -140,8 +140,9 @@ time_zone local_time_zone() {
if (CFStringRef tz_name = CFTimeZoneGetName(tz_default)) {
CFStringEncoding encoding = kCFStringEncodingUTF8;
CFIndex length = CFStringGetLength(tz_name);
- buffer.resize(CFStringGetMaximumSizeForEncoding(length, encoding) + 1);
- if (CFStringGetCString(tz_name, &buffer[0], buffer.size(), encoding)) {
+ CFIndex max_size = CFStringGetMaximumSizeForEncoding(length, encoding) + 1;
+ buffer.resize(static_cast<size_t>(max_size));
+ if (CFStringGetCString(tz_name, &buffer[0], max_size, encoding)) {
zone = &buffer[0];
}
}