@@ -1058,6 +1058,20 @@ Boolean _CFTimeZoneInitInternal(CFTimeZoneRef timezone, CFStringRef name, CFData
1058
1058
return success ;
1059
1059
}
1060
1060
1061
+ CFDataRef _CFTimeZoneDataCreate (CFURLRef baseURL , CFStringRef tzName ) {
1062
+ void * bytes ;
1063
+ CFIndex length ;
1064
+ CFDataRef data = NULL ;
1065
+ CFURLRef tempURL = CFURLCreateCopyAppendingPathComponent (kCFAllocatorSystemDefault , baseURL , tzName , false);
1066
+ if (NULL != tempURL ) {
1067
+ if (_CFReadBytesFromFile (kCFAllocatorSystemDefault , tempURL , & bytes , & length , 0 , 0 )) {
1068
+ data = CFDataCreateWithBytesNoCopy (kCFAllocatorSystemDefault , bytes , length , kCFAllocatorSystemDefault );
1069
+ }
1070
+ CFRelease (tempURL );
1071
+ }
1072
+ return data ;
1073
+ }
1074
+
1061
1075
Boolean _CFTimeZoneInit (CFTimeZoneRef timeZone , CFStringRef name , CFDataRef data ) {
1062
1076
if (!name || !__nameStringOK (name )) {
1063
1077
return false;
@@ -1093,9 +1107,7 @@ Boolean _CFTimeZoneInit(CFTimeZoneRef timeZone, CFStringRef name, CFDataRef data
1093
1107
}
1094
1108
1095
1109
CFStringRef tzName = NULL ;
1096
- CFURLRef baseURL , tempURL ;
1097
- void * bytes ;
1098
- CFIndex length ;
1110
+ CFURLRef baseURL ;
1099
1111
Boolean result = false;
1100
1112
1101
1113
#if TARGET_OS_WIN32
@@ -1128,13 +1140,7 @@ Boolean _CFTimeZoneInit(CFTimeZoneRef timeZone, CFStringRef name, CFDataRef data
1128
1140
CFDictionaryRef abbrevs = CFTimeZoneCopyAbbreviationDictionary ();
1129
1141
tzName = CFDictionaryGetValue (abbrevs , name );
1130
1142
if (NULL != tzName ) {
1131
- tempURL = CFURLCreateCopyAppendingPathComponent (kCFAllocatorSystemDefault , baseURL , tzName , false);
1132
- if (NULL != tempURL ) {
1133
- if (_CFReadBytesFromFile (kCFAllocatorSystemDefault , tempURL , & bytes , & length , 0 , 0 )) {
1134
- data = CFDataCreateWithBytesNoCopy (kCFAllocatorSystemDefault , bytes , length , kCFAllocatorSystemDefault );
1135
- }
1136
- CFRelease (tempURL );
1137
- }
1143
+ data = _CFTimeZoneDataCreate (baseURL , tzName );
1138
1144
}
1139
1145
CFRelease (abbrevs );
1140
1146
@@ -1159,13 +1165,7 @@ Boolean _CFTimeZoneInit(CFTimeZoneRef timeZone, CFStringRef name, CFDataRef data
1159
1165
}
1160
1166
if (NULL == data ) {
1161
1167
tzName = name ;
1162
- tempURL = CFURLCreateCopyAppendingPathComponent (kCFAllocatorSystemDefault , baseURL , tzName , false);
1163
- if (NULL != tempURL ) {
1164
- if (_CFReadBytesFromFile (kCFAllocatorSystemDefault , tempURL , & bytes , & length , 0 , 0 )) {
1165
- data = CFDataCreateWithBytesNoCopy (kCFAllocatorSystemDefault , bytes , length , kCFAllocatorSystemDefault );
1166
- }
1167
- CFRelease (tempURL );
1168
- }
1168
+ data = _CFTimeZoneDataCreate (baseURL , tzName );
1169
1169
}
1170
1170
CFRelease (baseURL );
1171
1171
if (NULL != data ) {
@@ -1311,9 +1311,7 @@ CFTimeZoneRef CFTimeZoneCreateWithName(CFAllocatorRef allocator, CFStringRef nam
1311
1311
}
1312
1312
}
1313
1313
}
1314
- CFURLRef baseURL , tempURL ;
1315
- void * bytes ;
1316
- CFIndex length ;
1314
+ CFURLRef baseURL ;
1317
1315
1318
1316
#if TARGET_OS_WIN32
1319
1317
CFDictionaryRef abbrevs = CFTimeZoneCopyAbbreviationDictionary ();
@@ -1344,13 +1342,7 @@ CFTimeZoneRef CFTimeZoneCreateWithName(CFAllocatorRef allocator, CFStringRef nam
1344
1342
CFDictionaryRef abbrevs = CFTimeZoneCopyAbbreviationDictionary ();
1345
1343
tzName = CFDictionaryGetValue (abbrevs , name );
1346
1344
if (NULL != tzName ) {
1347
- tempURL = CFURLCreateCopyAppendingPathComponent (kCFAllocatorSystemDefault , baseURL , tzName , false);
1348
- if (NULL != tempURL ) {
1349
- if (_CFReadBytesFromFile (kCFAllocatorSystemDefault , tempURL , & bytes , & length , 0 , 0 )) {
1350
- data = CFDataCreateWithBytesNoCopy (kCFAllocatorSystemDefault , bytes , length , kCFAllocatorSystemDefault );
1351
- }
1352
- CFRelease (tempURL );
1353
- }
1345
+ data = _CFTimeZoneDataCreate (baseURL , tzName );
1354
1346
}
1355
1347
CFRelease (abbrevs );
1356
1348
}
@@ -1375,13 +1367,7 @@ CFTimeZoneRef CFTimeZoneCreateWithName(CFAllocatorRef allocator, CFStringRef nam
1375
1367
}
1376
1368
if (NULL == data ) {
1377
1369
tzName = name ;
1378
- tempURL = CFURLCreateCopyAppendingPathComponent (kCFAllocatorSystemDefault , baseURL , tzName , false);
1379
- if (NULL != tempURL ) {
1380
- if (_CFReadBytesFromFile (kCFAllocatorSystemDefault , tempURL , & bytes , & length , 0 , 0 )) {
1381
- data = CFDataCreateWithBytesNoCopy (kCFAllocatorSystemDefault , bytes , length , kCFAllocatorSystemDefault );
1382
- }
1383
- CFRelease (tempURL );
1384
- }
1370
+ data = _CFTimeZoneDataCreate (baseURL , tzName );
1385
1371
}
1386
1372
CFRelease (baseURL );
1387
1373
if (NULL != data ) {
0 commit comments