OLD | NEW |
| (Empty) |
1 diff --git a/source/common/ucnv.c b/source/common/ucnv.c | |
2 index 5cf4d15..8d57010 100644 | |
3 --- a/source/common/ucnv.c | |
4 +++ b/source/common/ucnv.c | |
5 @@ -1,7 +1,7 @@ | |
6 /* | |
7 ****************************************************************************** | |
8 * | |
9 -* Copyright (C) 1998-2013, International Business Machines | |
10 +* Copyright (C) 1998-2015, International Business Machines | |
11 * Corporation and others. All Rights Reserved. | |
12 * | |
13 ****************************************************************************** | |
14 @@ -295,12 +295,7 @@ ucnv_safeClone(const UConverter* cnv, void *stackBuffer, in
t32_t *pBufferSize, U | |
15 } | |
16 | |
17 /* increment refcount of shared data if needed */ | |
18 - /* | |
19 - Checking whether it's an algorithic converter is okay | |
20 - in multithreaded applications because the value never changes. | |
21 - Don't check referenceCounter for any other value. | |
22 - */ | |
23 - if (cnv->sharedData->referenceCounter != ~0) { | |
24 + if (cnv->sharedData->isReferenceCounted) { | |
25 ucnv_incrementRefCount(cnv->sharedData); | |
26 } | |
27 | |
28 @@ -385,12 +380,7 @@ ucnv_close (UConverter * converter) | |
29 uprv_free(converter->subChars); | |
30 } | |
31 | |
32 - /* | |
33 - Checking whether it's an algorithic converter is okay | |
34 - in multithreaded applications because the value never changes. | |
35 - Don't check referenceCounter for any other value. | |
36 - */ | |
37 - if (converter->sharedData->referenceCounter != ~0) { | |
38 + if (converter->sharedData->isReferenceCounted) { | |
39 ucnv_unloadSharedDataIfReady(converter->sharedData); | |
40 } | |
41 | |
42 diff --git a/source/common/ucnv2022.cpp b/source/common/ucnv2022.cpp | |
43 index 7b8df9b..ea165ec 100644 | |
44 --- a/source/common/ucnv2022.cpp | |
45 +++ b/source/common/ucnv2022.cpp | |
46 @@ -3813,16 +3813,8 @@ static const UConverterStaticData _ISO2022StaticData={ | |
47 0, | |
48 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ | |
49 }; | |
50 -const UConverterSharedData _ISO2022Data={ | |
51 - sizeof(UConverterSharedData), | |
52 - ~((uint32_t) 0), | |
53 - NULL, | |
54 - NULL, | |
55 - &_ISO2022StaticData, | |
56 - FALSE, | |
57 - &_ISO2022Impl, | |
58 - 0, UCNV_MBCS_TABLE_INITIALIZER | |
59 -}; | |
60 +const UConverterSharedData _ISO2022Data= | |
61 + UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_ISO2022StaticData, &_ISO2022Im
pl); | |
62 | |
63 /*************JP****************/ | |
64 static const UConverterImpl _ISO2022JPImpl={ | |
65 @@ -3869,16 +3861,8 @@ static const UConverterStaticData _ISO2022JPStaticData={ | |
66 | |
67 namespace { | |
68 | |
69 -const UConverterSharedData _ISO2022JPData={ | |
70 - sizeof(UConverterSharedData), | |
71 - ~((uint32_t) 0), | |
72 - NULL, | |
73 - NULL, | |
74 - &_ISO2022JPStaticData, | |
75 - FALSE, | |
76 - &_ISO2022JPImpl, | |
77 - 0, UCNV_MBCS_TABLE_INITIALIZER | |
78 -}; | |
79 +const UConverterSharedData _ISO2022JPData= | |
80 + UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_ISO2022JPStaticData, &_ISO2022
JPImpl); | |
81 | |
82 } // namespace | |
83 | |
84 @@ -3928,16 +3912,8 @@ static const UConverterStaticData _ISO2022KRStaticData={ | |
85 | |
86 namespace { | |
87 | |
88 -const UConverterSharedData _ISO2022KRData={ | |
89 - sizeof(UConverterSharedData), | |
90 - ~((uint32_t) 0), | |
91 - NULL, | |
92 - NULL, | |
93 - &_ISO2022KRStaticData, | |
94 - FALSE, | |
95 - &_ISO2022KRImpl, | |
96 - 0, UCNV_MBCS_TABLE_INITIALIZER | |
97 -}; | |
98 +const UConverterSharedData _ISO2022KRData= | |
99 + UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_ISO2022KRStaticData, &_ISO2022
KRImpl); | |
100 | |
101 } // namespace | |
102 | |
103 @@ -3987,16 +3963,8 @@ static const UConverterStaticData _ISO2022CNStaticData={ | |
104 | |
105 namespace { | |
106 | |
107 -const UConverterSharedData _ISO2022CNData={ | |
108 - sizeof(UConverterSharedData), | |
109 - ~((uint32_t) 0), | |
110 - NULL, | |
111 - NULL, | |
112 - &_ISO2022CNStaticData, | |
113 - FALSE, | |
114 - &_ISO2022CNImpl, | |
115 - 0, UCNV_MBCS_TABLE_INITIALIZER | |
116 -}; | |
117 +const UConverterSharedData _ISO2022CNData= | |
118 + UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_ISO2022CNStaticData, &_ISO2022
CNImpl); | |
119 | |
120 } // namespace | |
121 #endif /* #if !UCONFIG_NO_NON_HTML5_CONVERSION */ | |
122 diff --git a/source/common/ucnv_bld.cpp b/source/common/ucnv_bld.cpp | |
123 index 047f18a..3357a64 100644 | |
124 --- a/source/common/ucnv_bld.cpp | |
125 +++ b/source/common/ucnv_bld.cpp | |
126 @@ -285,6 +285,7 @@ ucnv_data_unFlattenClone(UConverterLoadArgs *pArgs, UDataMem
ory *pData, UErrorCo | |
127 | |
128 if( (uint16_t)type >= UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES || | |
129 converterData[type] == NULL || | |
130 + !converterData[type]->isReferenceCounted || | |
131 converterData[type]->referenceCounter != 1 || | |
132 source->structSize != sizeof(UConverterStaticData)) | |
133 { | |
134 @@ -301,26 +302,6 @@ ucnv_data_unFlattenClone(UConverterLoadArgs *pArgs, UDataMe
mory *pData, UErrorCo | |
135 /* copy initial values from the static structure for this type */ | |
136 uprv_memcpy(data, converterData[type], sizeof(UConverterSharedData)); | |
137 | |
138 -#if 0 /* made UConverterMBCSTable part of UConverterSharedData -- markus 200311
07 */ | |
139 - /* | |
140 - * It would be much more efficient if the table were a direct member, not a
pointer. | |
141 - * However, that would add to the size of all UConverterSharedData objects | |
142 - * even if they do not use this table (especially algorithmic ones). | |
143 - * If this changes, then the static templates from converterData[type] | |
144 - * need more entries. | |
145 - * | |
146 - * In principle, it would be cleaner if the load() function below | |
147 - * allocated the table. | |
148 - */ | |
149 - data->table = (UConverterTable *)uprv_malloc(sizeof(UConverterTable)); | |
150 - if(data->table == NULL) { | |
151 - uprv_free(data); | |
152 - *status = U_MEMORY_ALLOCATION_ERROR; | |
153 - return NULL; | |
154 - } | |
155 - uprv_memset(data->table, 0, sizeof(UConverterTable)); | |
156 -#endif | |
157 - | |
158 data->staticData = source; | |
159 | |
160 data->sharedDataCached = FALSE; | |
161 @@ -331,7 +312,6 @@ ucnv_data_unFlattenClone(UConverterLoadArgs *pArgs, UDataMem
ory *pData, UErrorCo | |
162 if(data->impl->load != NULL) { | |
163 data->impl->load(data, pArgs, raw + source->structSize, status); | |
164 if(U_FAILURE(*status)) { | |
165 - uprv_free(data->table); | |
166 uprv_free(data); | |
167 return NULL; | |
168 } | |
169 @@ -535,25 +515,6 @@ ucnv_deleteSharedConverterData(UConverterSharedData * deadS
haredData) | |
170 udata_close(data); | |
171 } | |
172 | |
173 - if(deadSharedData->table != NULL) | |
174 - { | |
175 - uprv_free(deadSharedData->table); | |
176 - } | |
177 - | |
178 -#if 0 | |
179 - /* if the static data is actually owned by the shared data */ | |
180 - /* enable if we ever have this situation. */ | |
181 - if(deadSharedData->staticDataOwned == TRUE) /* see ucnv_bld.h */ | |
182 - { | |
183 - uprv_free((void*)deadSharedData->staticData); | |
184 - } | |
185 -#endif | |
186 - | |
187 -#if 0 | |
188 - /* Zap it ! */ | |
189 - uprv_memset(deadSharedData->0, sizeof(*deadSharedData)); | |
190 -#endif | |
191 - | |
192 uprv_free(deadSharedData); | |
193 | |
194 UTRACE_EXIT_VALUE((int32_t)TRUE); | |
195 @@ -604,7 +565,7 @@ ucnv_load(UConverterLoadArgs *pArgs, UErrorCode *err) { | |
196 | |
197 /** | |
198 * Unload a non-algorithmic converter. | |
199 - * It must be sharedData->referenceCounter != ~0 | |
200 + * It must be sharedData->isReferenceCounted | |
201 * and this function must be called inside umtx_lock(&cnvCacheMutex). | |
202 */ | |
203 U_CAPI void | |
204 @@ -623,12 +584,7 @@ ucnv_unload(UConverterSharedData *sharedData) { | |
205 U_CFUNC void | |
206 ucnv_unloadSharedDataIfReady(UConverterSharedData *sharedData) | |
207 { | |
208 - /* | |
209 - Checking whether it's an algorithic converter is okay | |
210 - in multithreaded applications because the value never changes. | |
211 - Don't check referenceCounter for any other value. | |
212 - */ | |
213 - if(sharedData != NULL && sharedData->referenceCounter != (uint32_t)~0) { | |
214 + if(sharedData != NULL && sharedData->isReferenceCounted) { | |
215 umtx_lock(&cnvCacheMutex); | |
216 ucnv_unload(sharedData); | |
217 umtx_unlock(&cnvCacheMutex); | |
218 @@ -638,12 +594,7 @@ ucnv_unloadSharedDataIfReady(UConverterSharedData *sharedDa
ta) | |
219 U_CFUNC void | |
220 ucnv_incrementRefCount(UConverterSharedData *sharedData) | |
221 { | |
222 - /* | |
223 - Checking whether it's an algorithic converter is okay | |
224 - in multithreaded applications because the value never changes. | |
225 - Don't check referenceCounter for any other value. | |
226 - */ | |
227 - if(sharedData != NULL && sharedData->referenceCounter != (uint32_t)~0) { | |
228 + if(sharedData != NULL && sharedData->isReferenceCounted) { | |
229 umtx_lock(&cnvCacheMutex); | |
230 sharedData->referenceCounter++; | |
231 umtx_unlock(&cnvCacheMutex); | |
232 @@ -933,12 +884,7 @@ ucnv_createAlgorithmicConverter(UConverter *myUConverter, | |
233 } | |
234 | |
235 sharedData = converterData[type]; | |
236 - /* | |
237 - Checking whether it's an algorithic converter is okay | |
238 - in multithreaded applications because the value never changes. | |
239 - Don't check referenceCounter for any other value. | |
240 - */ | |
241 - if(sharedData == NULL || sharedData->referenceCounter != (uint32_t)~0) { | |
242 + if(sharedData == NULL || sharedData->isReferenceCounted) { | |
243 /* not a valid type, or not an algorithmic converter */ | |
244 *err = U_ILLEGAL_ARGUMENT_ERROR; | |
245 UTRACE_EXIT_STATUS(U_ILLEGAL_ARGUMENT_ERROR); | |
246 diff --git a/source/common/ucnv_bld.h b/source/common/ucnv_bld.h | |
247 index ce6f374..2fbba14 100644 | |
248 --- a/source/common/ucnv_bld.h | |
249 +++ b/source/common/ucnv_bld.h | |
250 @@ -1,6 +1,6 @@ | |
251 /* | |
252 ********************************************************************** | |
253 -* Copyright (C) 1999-2011 International Business Machines | |
254 +* Copyright (C) 1999-2015 International Business Machines | |
255 * Corporation and others. All Rights Reserved. | |
256 ********************************************************************** | |
257 * | |
258 @@ -93,15 +93,15 @@ typedef struct UConverterStaticData { /* +offset: size */ | |
259 */ | |
260 struct UConverterSharedData { | |
261 uint32_t structSize; /* Size of this structure */ | |
262 - uint32_t referenceCounter; /* used to count number of clients, 0xfffff
fff for static SharedData */ | |
263 + uint32_t referenceCounter; /* used to count number of clients, unused
for static/immutable SharedData */ | |
264 | |
265 const void *dataMemory; /* from udata_openChoice() - for cleanup */ | |
266 - void *table; /* Unused. This used to be a UConverterTabl
e - Pointer to conversion data - see mbcs below */ | |
267 | |
268 const UConverterStaticData *staticData; /* pointer to the static (non chang
ing) data. */ | |
269 | |
270 UBool sharedDataCached; /* TRUE: shared data is in cache,
don't destroy on ucnv_close() if 0 ref. FALSE: shared data isn't in the cache,
do attempt to clean it up if the ref is 0 */ | |
271 - /*UBool staticDataOwned; TRUE if static data owned by shared
data & should be freed with it, NEVER true for udata() loaded statics. This igno
red variable was removed to make space for sharedDataCached. */ | |
272 + /** If FALSE, then referenceCounter is not used. Must not change after init
ialization. */ | |
273 + UBool isReferenceCounted; | |
274 | |
275 const UConverterImpl *impl; /* vtable-style struct of mostly function p
ointers */ | |
276 | |
277 @@ -115,16 +115,21 @@ struct UConverterSharedData { | |
278 * which always has a UConverterMBCSTable | |
279 * | |
280 * To eliminate one allocation, I am making the UConverterMBCSTable | |
281 - * a member of the shared data. It is the last member so that static | |
282 - * definitions of UConverterSharedData work as before. | |
283 - * The table field above also remains to avoid updating all static | |
284 - * definitions, but is now unused. | |
285 + * a member of the shared data. | |
286 * | |
287 * markus 2003-nov-07 | |
288 */ | |
289 UConverterMBCSTable mbcs; | |
290 }; | |
291 | |
292 +/** UConverterSharedData initializer for static, non-reference-counted converte
rs. */ | |
293 +#define UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(pStaticData, pImpl) \ | |
294 + { \ | |
295 + sizeof(UConverterSharedData), ~((uint32_t)0), \ | |
296 + NULL, pStaticData, FALSE, FALSE, pImpl, \ | |
297 + 0, UCNV_MBCS_TABLE_INITIALIZER \ | |
298 + } | |
299 + | |
300 /* Defines a UConverter, the lightweight mutable part the user sees */ | |
301 | |
302 struct UConverter { | |
303 @@ -266,7 +271,7 @@ ucnv_load(UConverterLoadArgs *pArgs, UErrorCode *err); | |
304 | |
305 /** | |
306 * Unload a non-algorithmic converter. | |
307 - * It must be sharedData->referenceCounter != ~0 | |
308 + * It must be sharedData->isReferenceCounted | |
309 * and this function must be called inside umtx_lock(&cnvCacheMutex). | |
310 */ | |
311 U_CAPI void | |
312 diff --git a/source/common/ucnv_ct.c b/source/common/ucnv_ct.c | |
313 index e723fa6..51362ed 100644 | |
314 --- a/source/common/ucnv_ct.c | |
315 +++ b/source/common/ucnv_ct.c | |
316 @@ -629,15 +629,7 @@ static const UConverterStaticData _CompoundTextStaticData =
{ | |
317 0, | |
318 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ | |
319 }; | |
320 -const UConverterSharedData _CompoundTextData = { | |
321 - sizeof(UConverterSharedData), | |
322 - ~((uint32_t) 0), | |
323 - NULL, | |
324 - NULL, | |
325 - &_CompoundTextStaticData, | |
326 - FALSE, | |
327 - &_CompoundTextImpl, | |
328 - 0 | |
329 -}; | |
330 +const UConverterSharedData _CompoundTextData = | |
331 + UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_CompoundTextStaticData, &_Comp
oundTextImpl); | |
332 | |
333 #endif /* #if !UCONFIG_NO_LEGACY_CONVERSION */ | |
334 diff --git a/source/common/ucnv_lmb.c b/source/common/ucnv_lmb.c | |
335 index a4fccee..6196660 100644 | |
336 --- a/source/common/ucnv_lmb.c | |
337 +++ b/source/common/ucnv_lmb.c | |
338 @@ -606,11 +606,8 @@ static const UConverterStaticData _LMBCSStaticData##n={\ | |
339 0, UCNV_IBM, UCNV_LMBCS_##n, 1, 3,\ | |
340 { 0x3f, 0, 0, 0 },1,FALSE,FALSE,0,0,{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
\ | |
341 };\ | |
342 -const UConverterSharedData _LMBCSData##n={\ | |
343 - sizeof(UConverterSharedData), ~((uint32_t) 0),\ | |
344 - NULL, NULL, &_LMBCSStaticData##n, FALSE, &_LMBCSImpl##n, \ | |
345 - 0 \ | |
346 -}; | |
347 +const UConverterSharedData _LMBCSData##n= \ | |
348 + UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_LMBCSStaticData##n, &_LMBCSImp
l##n); | |
349 | |
350 /* The only function we needed to duplicate 12 times was the 'open' | |
351 function, which will do basically the same thing except set a different | |
352 diff --git a/source/common/ucnv_u16.c b/source/common/ucnv_u16.c | |
353 index a2044aa..f4f902a 100644 | |
354 --- a/source/common/ucnv_u16.c | |
355 +++ b/source/common/ucnv_u16.c | |
356 @@ -1,6 +1,6 @@ | |
357 /* | |
358 ********************************************************************** | |
359 -* Copyright (C) 2002-2010, International Business Machines | |
360 +* Copyright (C) 2002-2015, International Business Machines | |
361 * Corporation and others. All Rights Reserved. | |
362 ********************************************************************** | |
363 * file name: ucnv_u16.c | |
364 @@ -635,11 +635,8 @@ static const UConverterStaticData _UTF16BEStaticData={ | |
365 }; | |
366 | |
367 | |
368 -const UConverterSharedData _UTF16BEData={ | |
369 - sizeof(UConverterSharedData), ~((uint32_t) 0), | |
370 - NULL, NULL, &_UTF16BEStaticData, FALSE, &_UTF16BEImpl, | |
371 - 0 | |
372 -}; | |
373 +const UConverterSharedData _UTF16BEData= | |
374 + UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF16BEStaticData, &_UTF16BEIm
pl); | |
375 | |
376 /* UTF-16LE ----------------------------------------------------------------- *
/ | |
377 | |
378 @@ -1235,11 +1232,8 @@ static const UConverterStaticData _UTF16LEStaticData={ | |
379 }; | |
380 | |
381 | |
382 -const UConverterSharedData _UTF16LEData={ | |
383 - sizeof(UConverterSharedData), ~((uint32_t) 0), | |
384 - NULL, NULL, &_UTF16LEStaticData, FALSE, &_UTF16LEImpl, | |
385 - 0 | |
386 -}; | |
387 +const UConverterSharedData _UTF16LEData= | |
388 + UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF16LEStaticData, &_UTF16LEIm
pl); | |
389 | |
390 /* UTF-16 (Detect BOM) ------------------------------------------------------ *
/ | |
391 | |
392 @@ -1511,11 +1505,8 @@ static const UConverterStaticData _UTF16StaticData = { | |
393 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ | |
394 }; | |
395 | |
396 -const UConverterSharedData _UTF16Data = { | |
397 - sizeof(UConverterSharedData), ~((uint32_t) 0), | |
398 - NULL, NULL, &_UTF16StaticData, FALSE, &_UTF16Impl, | |
399 - 0 | |
400 -}; | |
401 +const UConverterSharedData _UTF16Data = | |
402 + UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF16StaticData, &_UTF16Impl); | |
403 | |
404 static const UConverterImpl _UTF16v2Impl = { | |
405 UCNV_UTF16, | |
406 @@ -1552,10 +1543,7 @@ static const UConverterStaticData _UTF16v2StaticData = { | |
407 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ | |
408 }; | |
409 | |
410 -static const UConverterSharedData _UTF16v2Data = { | |
411 - sizeof(UConverterSharedData), ~((uint32_t) 0), | |
412 - NULL, NULL, &_UTF16v2StaticData, FALSE, &_UTF16v2Impl, | |
413 - 0 | |
414 -}; | |
415 +static const UConverterSharedData _UTF16v2Data = | |
416 + UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF16v2StaticData, &_UTF16v2Im
pl); | |
417 | |
418 #endif | |
419 diff --git a/source/common/ucnv_u32.c b/source/common/ucnv_u32.c | |
420 index c24aaee..49d6746 100644 | |
421 --- a/source/common/ucnv_u32.c | |
422 +++ b/source/common/ucnv_u32.c | |
423 @@ -495,11 +495,8 @@ static const UConverterStaticData _UTF32BEStaticData = { | |
424 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ | |
425 }; | |
426 | |
427 -const UConverterSharedData _UTF32BEData = { | |
428 - sizeof(UConverterSharedData), ~((uint32_t) 0), | |
429 - NULL, NULL, &_UTF32BEStaticData, FALSE, &_UTF32BEImpl, | |
430 - 0 | |
431 -}; | |
432 +const UConverterSharedData _UTF32BEData = | |
433 + UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF32BEStaticData, &_UTF32BEIm
pl); | |
434 | |
435 /* UTF-32LE ---------------------------------------------------------- */ | |
436 | |
437 @@ -991,11 +988,8 @@ static const UConverterStaticData _UTF32LEStaticData = { | |
438 }; | |
439 | |
440 | |
441 -const UConverterSharedData _UTF32LEData = { | |
442 - sizeof(UConverterSharedData), ~((uint32_t) 0), | |
443 - NULL, NULL, &_UTF32LEStaticData, FALSE, &_UTF32LEImpl, | |
444 - 0 | |
445 -}; | |
446 +const UConverterSharedData _UTF32LEData = | |
447 + UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF32LEStaticData, &_UTF32LEIm
pl); | |
448 | |
449 /* UTF-32 (Detect BOM) ------------------------------------------------------ *
/ | |
450 | |
451 @@ -1240,10 +1234,7 @@ static const UConverterStaticData _UTF32StaticData = { | |
452 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ | |
453 }; | |
454 | |
455 -const UConverterSharedData _UTF32Data = { | |
456 - sizeof(UConverterSharedData), ~((uint32_t) 0), | |
457 - NULL, NULL, &_UTF32StaticData, FALSE, &_UTF32Impl, | |
458 - 0 | |
459 -}; | |
460 +const UConverterSharedData _UTF32Data = | |
461 + UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF32StaticData, &_UTF32Impl); | |
462 | |
463 #endif | |
464 diff --git a/source/common/ucnv_u7.c b/source/common/ucnv_u7.c | |
465 index 6466b87..80bb209 100644 | |
466 --- a/source/common/ucnv_u7.c | |
467 +++ b/source/common/ucnv_u7.c | |
468 @@ -775,11 +775,8 @@ static const UConverterStaticData _UTF7StaticData={ | |
469 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ | |
470 }; | |
471 | |
472 -const UConverterSharedData _UTF7Data={ | |
473 - sizeof(UConverterSharedData), ~((uint32_t)0), | |
474 - NULL, NULL, &_UTF7StaticData, FALSE, &_UTF7Impl, | |
475 - 0 | |
476 -}; | |
477 +const UConverterSharedData _UTF7Data= | |
478 + UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF7StaticData, &_UTF7Impl); | |
479 | |
480 /* IMAP mailbox name encoding ----------------------------------------------- *
/ | |
481 | |
482 @@ -1475,10 +1472,7 @@ static const UConverterStaticData _IMAPStaticData={ | |
483 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ | |
484 }; | |
485 | |
486 -const UConverterSharedData _IMAPData={ | |
487 - sizeof(UConverterSharedData), ~((uint32_t)0), | |
488 - NULL, NULL, &_IMAPStaticData, FALSE, &_IMAPImpl, | |
489 - 0 | |
490 -}; | |
491 +const UConverterSharedData _IMAPData= | |
492 + UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_IMAPStaticData, &_IMAPImpl); | |
493 | |
494 #endif | |
495 diff --git a/source/common/ucnv_u8.c b/source/common/ucnv_u8.c | |
496 index 24205f5..15dfbd0 100644 | |
497 --- a/source/common/ucnv_u8.c | |
498 +++ b/source/common/ucnv_u8.c | |
499 @@ -1043,11 +1043,8 @@ static const UConverterStaticData _UTF8StaticData={ | |
500 }; | |
501 | |
502 | |
503 -const UConverterSharedData _UTF8Data={ | |
504 - sizeof(UConverterSharedData), ~((uint32_t) 0), | |
505 - NULL, NULL, &_UTF8StaticData, FALSE, &_UTF8Impl, | |
506 - 0 | |
507 -}; | |
508 +const UConverterSharedData _UTF8Data= | |
509 + UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF8StaticData, &_UTF8Impl); | |
510 | |
511 /* CESU-8 converter data ---------------------------------------------------- *
/ | |
512 | |
513 @@ -1086,10 +1083,7 @@ static const UConverterStaticData _CESU8StaticData={ | |
514 }; | |
515 | |
516 | |
517 -const UConverterSharedData _CESU8Data={ | |
518 - sizeof(UConverterSharedData), ~((uint32_t) 0), | |
519 - NULL, NULL, &_CESU8StaticData, FALSE, &_CESU8Impl, | |
520 - 0 | |
521 -}; | |
522 +const UConverterSharedData _CESU8Data= | |
523 + UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_CESU8StaticData, &_CESU8Impl); | |
524 | |
525 #endif | |
526 diff --git a/source/common/ucnvbocu.cpp b/source/common/ucnvbocu.cpp | |
527 index 281d6d9..a995207 100644 | |
528 --- a/source/common/ucnvbocu.cpp | |
529 +++ b/source/common/ucnvbocu.cpp | |
530 @@ -1392,11 +1392,7 @@ static const UConverterStaticData _Bocu1StaticData={ | |
531 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ | |
532 }; | |
533 | |
534 -const UConverterSharedData _Bocu1Data={ | |
535 - sizeof(UConverterSharedData), ~((uint32_t)0), | |
536 - NULL, NULL, &_Bocu1StaticData, FALSE, &_Bocu1Impl, | |
537 - 0, | |
538 - UCNV_MBCS_TABLE_INITIALIZER | |
539 -}; | |
540 +const UConverterSharedData _Bocu1Data= | |
541 + UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_Bocu1StaticData, &_Bocu1Impl); | |
542 | |
543 #endif | |
544 diff --git a/source/common/ucnvhz.c b/source/common/ucnvhz.c | |
545 index 51825e2..84df1a8 100644 | |
546 --- a/source/common/ucnvhz.c | |
547 +++ b/source/common/ucnvhz.c | |
548 @@ -622,17 +622,8 @@ static const UConverterStaticData _HZStaticData={ | |
549 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, /* reserved */ | |
550 | |
551 }; | |
552 - | |
553 - | |
554 -const UConverterSharedData _HZData={ | |
555 - sizeof(UConverterSharedData), | |
556 - ~((uint32_t) 0), | |
557 - NULL, | |
558 - NULL, | |
559 - &_HZStaticData, | |
560 - FALSE, | |
561 - &_HZImpl, | |
562 - 0 | |
563 -}; | |
564 + | |
565 +const UConverterSharedData _HZData= | |
566 + UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_HZStaticData, &_HZImpl); | |
567 | |
568 #endif /* #if !UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION && !UCONF
IG_NO_NON_HTML5_CONVERSION */ | |
569 diff --git a/source/common/ucnvisci.c b/source/common/ucnvisci.c | |
570 index 16fd0a3..70b6477 100644 | |
571 --- a/source/common/ucnvisci.c | |
572 +++ b/source/common/ucnvisci.c | |
573 @@ -1617,15 +1617,7 @@ static const UConverterStaticData _ISCIIStaticData={ | |
574 | |
575 }; | |
576 | |
577 -const UConverterSharedData _ISCIIData={ | |
578 - sizeof(UConverterSharedData), | |
579 - ~((uint32_t) 0), | |
580 - NULL, | |
581 - NULL, | |
582 - &_ISCIIStaticData, | |
583 - FALSE, | |
584 - &_ISCIIImpl, | |
585 - 0 | |
586 -}; | |
587 +const UConverterSharedData _ISCIIData= | |
588 + UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_ISCIIStaticData, &_ISCIIImpl); | |
589 | |
590 #endif /* #if !UCONFIG_NO_LEGACY_CONVERSION */ | |
591 diff --git a/source/common/ucnvlat1.c b/source/common/ucnvlat1.c | |
592 index 202f8aa..95e0495 100644 | |
593 --- a/source/common/ucnvlat1.c | |
594 +++ b/source/common/ucnvlat1.c | |
595 @@ -1,6 +1,6 @@ | |
596 /* | |
597 ********************************************************************** | |
598 -* Copyright (C) 2000-2012, International Business Machines | |
599 +* Copyright (C) 2000-2015, International Business Machines | |
600 * Corporation and others. All Rights Reserved. | |
601 ********************************************************************** | |
602 * file name: ucnvlat1.cpp | |
603 @@ -458,11 +458,8 @@ static const UConverterStaticData _Latin1StaticData={ | |
604 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ | |
605 }; | |
606 | |
607 -const UConverterSharedData _Latin1Data={ | |
608 - sizeof(UConverterSharedData), ~((uint32_t) 0), | |
609 - NULL, NULL, &_Latin1StaticData, FALSE, &_Latin1Impl, | |
610 - 0 | |
611 -}; | |
612 +const UConverterSharedData _Latin1Data= | |
613 + UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_Latin1StaticData, &_Latin1Impl
); | |
614 | |
615 /* US-ASCII ----------------------------------------------------------------- *
/ | |
616 | |
617 @@ -735,10 +732,7 @@ static const UConverterStaticData _ASCIIStaticData={ | |
618 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ | |
619 }; | |
620 | |
621 -const UConverterSharedData _ASCIIData={ | |
622 - sizeof(UConverterSharedData), ~((uint32_t) 0), | |
623 - NULL, NULL, &_ASCIIStaticData, FALSE, &_ASCIIImpl, | |
624 - 0 | |
625 -}; | |
626 +const UConverterSharedData _ASCIIData= | |
627 + UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_ASCIIStaticData, &_ASCIIImpl); | |
628 | |
629 #endif | |
630 diff --git a/source/common/ucnvmbcs.cpp b/source/common/ucnvmbcs.cpp | |
631 index f03f8a8..4e4de8d 100644 | |
632 --- a/source/common/ucnvmbcs.cpp | |
633 +++ b/source/common/ucnvmbcs.cpp | |
634 @@ -1,7 +1,7 @@ | |
635 /* | |
636 ****************************************************************************** | |
637 * | |
638 -* Copyright (C) 2000-2014, International Business Machines | |
639 +* Copyright (C) 2000-2015, International Business Machines | |
640 * Corporation and others. All Rights Reserved. | |
641 * | |
642 ****************************************************************************** | |
643 @@ -510,7 +510,7 @@ static const UConverterImpl _MBCSImpl={ | |
644 | |
645 const UConverterSharedData _MBCSData={ | |
646 sizeof(UConverterSharedData), 1, | |
647 - NULL, NULL, NULL, FALSE, &_MBCSImpl, | |
648 + NULL, NULL, FALSE, TRUE, &_MBCSImpl, | |
649 0, UCNV_MBCS_TABLE_INITIALIZER | |
650 }; | |
651 | |
652 diff --git a/source/common/ucnvscsu.c b/source/common/ucnvscsu.c | |
653 index a6f8c9e..5b4787f 100644 | |
654 --- a/source/common/ucnvscsu.c | |
655 +++ b/source/common/ucnvscsu.c | |
656 @@ -2009,10 +2009,7 @@ static const UConverterStaticData _SCSUStaticData={ | |
657 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ | |
658 }; | |
659 | |
660 -const UConverterSharedData _SCSUData={ | |
661 - sizeof(UConverterSharedData), ~((uint32_t)0), | |
662 - NULL, NULL, &_SCSUStaticData, FALSE, &_SCSUImpl, | |
663 - 0 | |
664 -}; | |
665 +const UConverterSharedData _SCSUData= | |
666 + UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_SCSUStaticData, &_SCSUImpl); | |
667 | |
668 #endif | |
OLD | NEW |