@@ -49,11 +49,11 @@ CF_EXPORT const CFStringRef kCFDateFormatterCalendarIdentifierKey;
49
49
50
50
static CFStringRef __CFDateFormatterCreateForcedTemplate (CFLocaleRef locale , CFStringRef inString , Boolean stripAMPM );
51
51
52
- // If you pass in a string in template , you get back NULL (failure) or a CFStringRef.
53
- // If you pass in an array in template , you get back NULL (global failure) or a CFArrayRef with CFStringRefs or kCFNulls (per-template failure) at each corresponding index.
52
+ // If you pass in a string in tmplate , you get back NULL (failure) or a CFStringRef.
53
+ // If you pass in an array in tmplate , you get back NULL (global failure) or a CFArrayRef with CFStringRefs or kCFNulls (per-template failure) at each corresponding index.
54
54
55
- CFArrayRef CFDateFormatterCreateDateFormatsFromTemplates (CFAllocatorRef allocator , CFArrayRef templates , CFOptionFlags options , CFLocaleRef locale ) {
56
- return (CFArrayRef )CFDateFormatterCreateDateFormatFromTemplate (allocator , (CFStringRef )templates , options , locale );
55
+ CFArrayRef CFDateFormatterCreateDateFormatsFromTemplates (CFAllocatorRef allocator , CFArrayRef tmplates , CFOptionFlags options , CFLocaleRef locale ) {
56
+ return (CFArrayRef )CFDateFormatterCreateDateFormatFromTemplate (allocator , (CFStringRef )tmplates , options , locale );
57
57
}
58
58
59
59
static Boolean useTemplatePatternGenerator (CFLocaleRef locale , void (^work )(UDateTimePatternGenerator * ptg )) {
@@ -122,21 +122,21 @@ static void _CFDateFormatterStripAMPMIndicators(UniChar **bpat, int32_t *bpatlen
122
122
}
123
123
}
124
124
125
- CFStringRef CFDateFormatterCreateDateFormatFromTemplate (CFAllocatorRef allocator , CFStringRef template , CFOptionFlags options , CFLocaleRef locale ) {
125
+ CFStringRef CFDateFormatterCreateDateFormatFromTemplate (CFAllocatorRef allocator , CFStringRef tmplate , CFOptionFlags options , CFLocaleRef locale ) {
126
126
if (allocator ) __CFGenericValidateType (allocator , CFAllocatorGetTypeID ());
127
127
if (locale ) __CFGenericValidateType (locale , CFLocaleGetTypeID ());
128
- Boolean tmplateIsString = (CFStringGetTypeID () == CFGetTypeID (template ));
128
+ Boolean tmplateIsString = (CFStringGetTypeID () == CFGetTypeID (tmplate ));
129
129
if (!tmplateIsString ) {
130
- __CFGenericValidateType (template , CFArrayGetTypeID ());
130
+ __CFGenericValidateType (tmplate , CFArrayGetTypeID ());
131
131
}
132
132
133
133
__block CFTypeRef result = tmplateIsString ? NULL : (CFTypeRef )CFArrayCreateMutable (allocator , 0 , & kCFTypeArrayCallBacks );
134
134
135
135
Boolean success = useTemplatePatternGenerator (locale , ^(UDateTimePatternGenerator * ptg ) {
136
136
137
137
138
- for (CFIndex idx = 0 , cnt = tmplateIsString ? 1 : CFArrayGetCount ((CFArrayRef )template ); idx < cnt ; idx ++ ) {
139
- CFStringRef tmplateString = tmplateIsString ? (CFStringRef )template : (CFStringRef )CFArrayGetValueAtIndex ((CFArrayRef )template , idx );
138
+ for (CFIndex idx = 0 , cnt = tmplateIsString ? 1 : CFArrayGetCount ((CFArrayRef )tmplate ); idx < cnt ; idx ++ ) {
139
+ CFStringRef tmplateString = tmplateIsString ? (CFStringRef )tmplate : (CFStringRef )CFArrayGetValueAtIndex ((CFArrayRef )tmplate , idx );
140
140
CFStringRef resultString = NULL ;
141
141
142
142
Boolean stripAMPM = CFStringFind (tmplateString , CFSTR ("J" ), 0 ).location != kCFNotFound ;
@@ -155,12 +155,12 @@ CFStringRef CFDateFormatterCreateDateFormatFromTemplate(CFAllocatorRef allocator
155
155
}
156
156
157
157
UChar pattern [BUFFER_SIZE ] = {0 }, skel [BUFFER_SIZE ] = {0 }, bpat [BUFFER_SIZE ] = {0 };
158
- CFIndex tmpltLen = CFStringGetLength (tmplateString );
159
- if (BUFFER_SIZE < tmpltLen ) tmpltLen = BUFFER_SIZE ;
160
- CFStringGetCharacters (tmplateString , CFRangeMake (0 , tmpltLen ), (UniChar * )pattern );
158
+ CFIndex tmplateLen = CFStringGetLength (tmplateString );
159
+ if (BUFFER_SIZE < tmplateLen ) tmplateLen = BUFFER_SIZE ;
160
+ CFStringGetCharacters (tmplateString , CFRangeMake (0 , tmplateLen ), (UniChar * )pattern );
161
161
CFRelease (tmplateString );
162
162
163
- int32_t patlen = tmpltLen ;
163
+ int32_t patlen = tmplateLen ;
164
164
UErrorCode status = U_ZERO_ERROR ;
165
165
int32_t skellen = __cficu_udatpg_getSkeleton (ptg , pattern , patlen , skel , sizeof (skel ) / sizeof (skel [0 ]), & status );
166
166
if (!U_FAILURE (status )) {
@@ -2173,9 +2173,9 @@ CFTypeRef CFDateFormatterCopyProperty(CFDateFormatterRef formatter, CFStringRef
2173
2173
return NULL ;
2174
2174
}
2175
2175
2176
- CFStringRef _CFDateFormatterCreateSkeletonFromTemplate (CFStringRef templateString , CFLocaleRef locale , UErrorCode * outErrorCode ) {
2177
- CFIndex const tmpltLen = CFStringGetLength (templateString );
2178
- if (tmpltLen == 0 ) {
2176
+ CFStringRef _CFDateFormatterCreateSkeletonFromTemplate (CFStringRef tmplateString , CFLocaleRef locale , UErrorCode * outErrorCode ) {
2177
+ CFIndex const tmplateLen = CFStringGetLength (tmplateString );
2178
+ if (tmplateLen == 0 ) {
2179
2179
if (outErrorCode ) {
2180
2180
* outErrorCode = U_ILLEGAL_ARGUMENT_ERROR ;
2181
2181
}
@@ -2186,15 +2186,15 @@ CFStringRef _CFDateFormatterCreateSkeletonFromTemplate(CFStringRef templateStrin
2186
2186
Boolean success = useTemplatePatternGenerator (locale , ^(UDateTimePatternGenerator * ptg ) {
2187
2187
#define BUFFER_SIZE 768
2188
2188
2189
- SAFE_STACK_BUFFER_DECL (UChar , ubuffer , tmpltLen , BUFFER_SIZE );
2190
- UChar const * ustr = (UChar * )CFStringGetCharactersPtr (templateString );
2189
+ SAFE_STACK_BUFFER_DECL (UChar , ubuffer , tmplateLen , BUFFER_SIZE );
2190
+ UChar const * ustr = (UChar * )CFStringGetCharactersPtr (tmplateString );
2191
2191
if (ustr == NULL ) {
2192
- CFStringGetCharacters (templateString , CFRangeMake (0 , tmpltLen ), (UniChar * )ubuffer );
2192
+ CFStringGetCharacters (tmplateString , CFRangeMake (0 , tmplateLen ), (UniChar * )ubuffer );
2193
2193
ustr = ubuffer ;
2194
2194
}
2195
2195
2196
2196
UChar skel [BUFFER_SIZE ] = {0 };
2197
- int32_t patlen = tmpltLen ;
2197
+ int32_t patlen = tmplateLen ;
2198
2198
UErrorCode status = U_ZERO_ERROR ;
2199
2199
int32_t skelLen = __cficu_udatpg_getSkeleton (ptg , ustr , patlen , skel , sizeof (skel ) / sizeof (skel [0 ]), & status );
2200
2200
if (U_SUCCESS (status )) {
0 commit comments