Commit 30e43220 by Abseil Team Committed by Copybara-Service

Import of CCTZ from GitHub.

PiperOrigin-RevId: 471600654
Change-Id: Iee722e5d736d341bc81cc10dac290383ba392f87
parent af0babf0
...@@ -140,8 +140,9 @@ time_zone local_time_zone() { ...@@ -140,8 +140,9 @@ time_zone local_time_zone() {
if (CFStringRef tz_name = CFTimeZoneGetName(tz_default)) { if (CFStringRef tz_name = CFTimeZoneGetName(tz_default)) {
CFStringEncoding encoding = kCFStringEncodingUTF8; CFStringEncoding encoding = kCFStringEncodingUTF8;
CFIndex length = CFStringGetLength(tz_name); CFIndex length = CFStringGetLength(tz_name);
buffer.resize(CFStringGetMaximumSizeForEncoding(length, encoding) + 1); CFIndex max_size = CFStringGetMaximumSizeForEncoding(length, encoding) + 1;
if (CFStringGetCString(tz_name, &buffer[0], buffer.size(), encoding)) { buffer.resize(static_cast<size_t>(max_size));
if (CFStringGetCString(tz_name, &buffer[0], max_size, encoding)) {
zone = &buffer[0]; zone = &buffer[0];
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment