OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************* | 2 ******************************************************************************* |
3 * * | 3 * Copyright (C) 1999-2014, International Business Machines Corporation |
4 * Copyright (C) 1999-2012, International Business Machines Corporation * | 4 * and others. All Rights Reserved. |
5 * and others. All Rights Reserved. * | |
6 * * | |
7 ******************************************************************************* | 5 ******************************************************************************* |
8 * file name: uresdata.c | 6 * file name: uresdata.c |
9 * encoding: US-ASCII | 7 * encoding: US-ASCII |
10 * tab size: 8 (not used) | 8 * tab size: 8 (not used) |
11 * indentation:4 | 9 * indentation:4 |
12 * | 10 * |
13 * created on: 1999dec08 | 11 * created on: 1999dec08 |
14 * created by: Markus W. Scherer | 12 * created by: Markus W. Scherer |
15 * Modification History: | 13 * Modification History: |
16 * | 14 * |
17 * Date Name Description | 15 * Date Name Description |
18 * 06/20/2000 helena OS/400 port changes; mostly typecast. | 16 * 06/20/2000 helena OS/400 port changes; mostly typecast. |
19 * 06/24/02 weiv Added support for resource sharing | 17 * 06/24/02 weiv Added support for resource sharing |
20 */ | 18 */ |
21 | 19 |
22 #include "unicode/utypes.h" | 20 #include "unicode/utypes.h" |
23 #include "unicode/udata.h" | 21 #include "unicode/udata.h" |
24 #include "unicode/ustring.h" | 22 #include "unicode/ustring.h" |
25 #include "unicode/utf16.h" | 23 #include "unicode/utf16.h" |
26 #include "cmemory.h" | 24 #include "cmemory.h" |
27 #include "cstring.h" | 25 #include "cstring.h" |
28 #include "uarrsort.h" | 26 #include "uarrsort.h" |
29 #include "udataswp.h" | 27 #include "udataswp.h" |
30 #include "ucol_swp.h" | 28 #include "ucol_swp.h" |
31 #include "uinvchar.h" | 29 #include "uinvchar.h" |
32 #include "uresdata.h" | 30 #include "uresdata.h" |
33 #include "uresimp.h" | 31 #include "uresimp.h" |
34 #include "uassert.h" | 32 #include "uassert.h" |
35 | 33 |
36 #define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0])) | |
37 | |
38 /* | 34 /* |
39 * Resource access helpers | 35 * Resource access helpers |
40 */ | 36 */ |
41 | 37 |
42 /* get a const char* pointer to the key with the keyOffset byte offset from pRoo
t */ | 38 /* get a const char* pointer to the key with the keyOffset byte offset from pRoo
t */ |
43 #define RES_GET_KEY16(pResData, keyOffset) \ | 39 #define RES_GET_KEY16(pResData, keyOffset) \ |
44 ((keyOffset)<(pResData)->localKeyLimit ? \ | 40 ((keyOffset)<(pResData)->localKeyLimit ? \ |
45 (const char *)(pResData)->pRoot+(keyOffset) : \ | 41 (const char *)(pResData)->pRoot+(keyOffset) : \ |
46 (pResData)->poolBundleKeys+(keyOffset)-(pResData)->localKeyLimit) | 42 (pResData)->poolBundleKeys+(keyOffset)-(pResData)->localKeyLimit) |
47 | 43 |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 /* swap length */ | 740 /* swap length */ |
745 ds->swapArray32(ds, p, 4, q, pErrorCode); | 741 ds->swapArray32(ds, p, 4, q, pErrorCode); |
746 /* no need to swap or copy bytes - ures_swap() copied them all */ | 742 /* no need to swap or copy bytes - ures_swap() copied them all */ |
747 | 743 |
748 /* swap known formats */ | 744 /* swap known formats */ |
749 #if !UCONFIG_NO_COLLATION | 745 #if !UCONFIG_NO_COLLATION |
750 if( key!=NULL && /* the binary is in a table */ | 746 if( key!=NULL && /* the binary is in a table */ |
751 (key!=gUnknownKey ? | 747 (key!=gUnknownKey ? |
752 /* its table key string is "%%CollationBin" */ | 748 /* its table key string is "%%CollationBin" */ |
753 0==ds->compareInvChars(ds, key, -1, | 749 0==ds->compareInvChars(ds, key, -1, |
754 gCollationBinKey, LENGTHOF(gCollationBinK
ey)-1) : | 750 gCollationBinKey, UPRV_LENGTHOF(gCollatio
nBinKey)-1) : |
755 /* its table key string is unknown but it looks like a collation
binary */ | 751 /* its table key string is unknown but it looks like a collation
binary */ |
756 ucol_looksLikeCollationBinary(ds, p+1, count)) | 752 ucol_looksLikeCollationBinary(ds, p+1, count)) |
757 ) { | 753 ) { |
758 ucol_swapBinary(ds, p+1, count, q+1, pErrorCode); | 754 ucol_swap(ds, p+1, count, q+1, pErrorCode); |
759 } | 755 } |
760 #endif | 756 #endif |
761 break; | 757 break; |
762 case URES_TABLE: | 758 case URES_TABLE: |
763 case URES_TABLE32: | 759 case URES_TABLE32: |
764 { | 760 { |
765 const uint16_t *pKey16; | 761 const uint16_t *pKey16; |
766 uint16_t *qKey16; | 762 uint16_t *qKey16; |
767 | 763 |
768 const int32_t *pKey32; | 764 const int32_t *pKey32; |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 if(tempTable.resFlags!=stackResFlags) { | 1134 if(tempTable.resFlags!=stackResFlags) { |
1139 uprv_free(tempTable.resFlags); | 1135 uprv_free(tempTable.resFlags); |
1140 } | 1136 } |
1141 | 1137 |
1142 /* swap the root resource and indexes */ | 1138 /* swap the root resource and indexes */ |
1143 ds->swapArray32(ds, inBundle, keysBottom*4, outBundle, pErrorCode); | 1139 ds->swapArray32(ds, inBundle, keysBottom*4, outBundle, pErrorCode); |
1144 } | 1140 } |
1145 | 1141 |
1146 return headerSize+4*top; | 1142 return headerSize+4*top; |
1147 } | 1143 } |
OLD | NEW |