@@ -49,11 +49,11 @@ CF_EXPORT const CFStringRef kCFDateFormatterCalendarIdentifierKey;
4949
5050static CFStringRef __CFDateFormatterCreateForcedTemplate (CFLocaleRef locale , CFStringRef inString , Boolean stripAMPM );
5151
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.
5454
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 );
5757}
5858
5959static Boolean useTemplatePatternGenerator (CFLocaleRef locale , void (^work )(UDateTimePatternGenerator * ptg )) {
@@ -122,21 +122,21 @@ static void _CFDateFormatterStripAMPMIndicators(UniChar **bpat, int32_t *bpatlen
122122 }
123123}
124124
125- CFStringRef CFDateFormatterCreateDateFormatFromTemplate (CFAllocatorRef allocator , CFStringRef template , CFOptionFlags options , CFLocaleRef locale ) {
125+ CFStringRef CFDateFormatterCreateDateFormatFromTemplate (CFAllocatorRef allocator , CFStringRef tmplate , CFOptionFlags options , CFLocaleRef locale ) {
126126 if (allocator ) __CFGenericValidateType (allocator , CFAllocatorGetTypeID ());
127127 if (locale ) __CFGenericValidateType (locale , CFLocaleGetTypeID ());
128- Boolean tmplateIsString = (CFStringGetTypeID () == CFGetTypeID (template ));
128+ Boolean tmplateIsString = (CFStringGetTypeID () == CFGetTypeID (tmplate ));
129129 if (!tmplateIsString ) {
130- __CFGenericValidateType (template , CFArrayGetTypeID ());
130+ __CFGenericValidateType (tmplate , CFArrayGetTypeID ());
131131 }
132132
133133 __block CFTypeRef result = tmplateIsString ? NULL : (CFTypeRef )CFArrayCreateMutable (allocator , 0 , & kCFTypeArrayCallBacks );
134134
135135 Boolean success = useTemplatePatternGenerator (locale , ^(UDateTimePatternGenerator * ptg ) {
136136
137137
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 );
140140 CFStringRef resultString = NULL ;
141141
142142 Boolean stripAMPM = CFStringFind (tmplateString , CFSTR ("J" ), 0 ).location != kCFNotFound ;
@@ -155,12 +155,12 @@ CFStringRef CFDateFormatterCreateDateFormatFromTemplate(CFAllocatorRef allocator
155155 }
156156
157157 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 );
161161 CFRelease (tmplateString );
162162
163- int32_t patlen = tmpltLen ;
163+ int32_t patlen = tmplateLen ;
164164 UErrorCode status = U_ZERO_ERROR ;
165165 int32_t skellen = __cficu_udatpg_getSkeleton (ptg , pattern , patlen , skel , sizeof (skel ) / sizeof (skel [0 ]), & status );
166166 if (!U_FAILURE (status )) {
@@ -2173,9 +2173,9 @@ CFTypeRef CFDateFormatterCopyProperty(CFDateFormatterRef formatter, CFStringRef
21732173 return NULL ;
21742174}
21752175
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 ) {
21792179 if (outErrorCode ) {
21802180 * outErrorCode = U_ILLEGAL_ARGUMENT_ERROR ;
21812181 }
@@ -2186,15 +2186,15 @@ CFStringRef _CFDateFormatterCreateSkeletonFromTemplate(CFStringRef templateStrin
21862186 Boolean success = useTemplatePatternGenerator (locale , ^(UDateTimePatternGenerator * ptg ) {
21872187#define BUFFER_SIZE 768
21882188
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 );
21912191 if (ustr == NULL ) {
2192- CFStringGetCharacters (templateString , CFRangeMake (0 , tmpltLen ), (UniChar * )ubuffer );
2192+ CFStringGetCharacters (tmplateString , CFRangeMake (0 , tmplateLen ), (UniChar * )ubuffer );
21932193 ustr = ubuffer ;
21942194 }
21952195
21962196 UChar skel [BUFFER_SIZE ] = {0 };
2197- int32_t patlen = tmpltLen ;
2197+ int32_t patlen = tmplateLen ;
21982198 UErrorCode status = U_ZERO_ERROR ;
21992199 int32_t skelLen = __cficu_udatpg_getSkeleton (ptg , ustr , patlen , skel , sizeof (skel ) / sizeof (skel [0 ]), & status );
22002200 if (U_SUCCESS (status )) {
0 commit comments