Lines Matching defs:header
90 /* swap the header */
115 // First check for format version 4+ which has a standard data header.
135 * check the length against the header size before reading the size field
137 UCATableHeader header;
138 uprv_memset(&header, 0, sizeof(header));
140 header.size=udata_readInt32(ds, inHeader->size);
141 } else if((length<(42*4) || length<(header.size=udata_readInt32(ds, inHeader->size)))) {
145 header.magic=ds->readUInt32(inHeader->magic);
147 header.magic==UCOL_HEADER_MAGIC &&
163 /* swap a header-less collation formatVersion=3 binary, inside a resource bundle or ucadata.icu */
173 UCATableHeader header;
196 * check the length against the header size before reading the size field
198 uprv_memset(&header, 0, sizeof(header));
200 header.size=udata_readInt32(ds, inHeader->size);
201 } else if((length<(42*4) || length<(header.size=udata_readInt32(ds, inHeader->size)))) {
202 udata_printError(ds, "ucol_swap(formatVersion=3): too few bytes (%d after header) for collation data\n",
208 header.magic=ds->readUInt32(inHeader->magic);
210 header.magic==UCOL_HEADER_MAGIC &&
215 header.magic,
231 uprv_memcpy(outBytes, inBytes, header.size);
237 header.options= ds->readUInt32(inHeader->options);
238 header.UCAConsts= ds->readUInt32(inHeader->UCAConsts);
239 header.contractionUCACombos= ds->readUInt32(inHeader->contractionUCACombos);
240 header.mappingPosition= ds->readUInt32(inHeader->mappingPosition);
241 header.expansion= ds->readUInt32(inHeader->expansion);
242 header.contractionIndex= ds->readUInt32(inHeader->contractionIndex);
243 header.contractionCEs= ds->readUInt32(inHeader->contractionCEs);
244 header.contractionSize= ds->readUInt32(inHeader->contractionSize);
245 header.endExpansionCE= ds->readUInt32(inHeader->endExpansionCE);
246 header.expansionCESize= ds->readUInt32(inHeader->expansionCESize);
247 header.endExpansionCECount= udata_readInt32(ds, inHeader->endExpansionCECount);
248 header.contractionUCACombosSize=udata_readInt32(ds, inHeader->contractionUCACombosSize);
249 header.scriptToLeadByte= ds->readUInt32(inHeader->scriptToLeadByte);
250 header.leadByteToScript= ds->readUInt32(inHeader->leadByteToScript);
252 /* swap the 32-bit integers in the header */
255 ds->swapArray32(ds, &(inHeader->scriptToLeadByte), sizeof(header.scriptToLeadByte) + sizeof(header.leadByteToScript),
262 if(header.options!=0) {
263 ds->swapArray32(ds, inBytes+header.options, header.expansion-header.options,
264 outBytes+header.options, pErrorCode);
268 if(header.mappingPosition!=0 && header.expansion!=0) {
269 if(header.contractionIndex!=0) {
271 count=header.contractionIndex-header.expansion;
274 count=header.mappingPosition-header.expansion;
276 ds->swapArray32(ds, inBytes+header.expansion, (int32_t)count,
277 outBytes+header.expansion, pErrorCode);
281 if(header.contractionSize!=0) {
283 ds->swapArray16(ds, inBytes+header.contractionIndex, header.contractionSize*2,
284 outBytes+header.contractionIndex, pErrorCode);
287 ds->swapArray32(ds, inBytes+header.contractionCEs, header.contractionSize*4,
288 outBytes+header.contractionCEs, pErrorCode);
292 if(header.mappingPosition!=0) {
293 count=header.endExpansionCE-header.mappingPosition;
294 utrie_swap(ds, inBytes+header.mappingPosition, (int32_t)count,
295 outBytes+header.mappingPosition, pErrorCode);
299 if(header.endExpansionCECount!=0) {
300 ds->swapArray32(ds, inBytes+header.endExpansionCE, header.endExpansionCECount*4,
301 outBytes+header.endExpansionCE, pErrorCode);
307 if(header.UCAConsts!=0) {
312 ds->swapArray32(ds, inBytes+header.UCAConsts, header.contractionUCACombos-header.UCAConsts,
313 outBytes+header.UCAConsts, pErrorCode);
317 if(header.contractionUCACombosSize!=0) {
318 count=header.contractionUCACombosSize*inHeader->contractionUCACombosWidth*U_SIZEOF_UCHAR;
319 ds->swapArray16(ds, inBytes+header.contractionUCACombos, (int32_t)count,
320 outBytes+header.contractionUCACombos, pErrorCode);
324 if(header.scriptToLeadByte!=0) {
325 int indexCount = ds->readUInt16(*((uint16_t*)(inBytes+header.scriptToLeadByte))); // each entry = 2 * uint16
326 int dataCount = ds->readUInt16(*((uint16_t*)(inBytes+header.scriptToLeadByte + 2))); // each entry = uint16
327 ds->swapArray16(ds, inBytes+header.scriptToLeadByte,
329 outBytes+header.scriptToLeadByte, pErrorCode);
333 if(header.leadByteToScript!=0) {
334 int indexCount = ds->readUInt16(*((uint16_t*)(inBytes+header.leadByteToScript))); // each entry = uint16
335 int dataCount = ds->readUInt16(*((uint16_t*)(inBytes+header.leadByteToScript + 2))); // each entry = uint16
336 ds->swapArray16(ds, inBytes+header.leadByteToScript,
338 outBytes+header.leadByteToScript, pErrorCode);
342 return header.size;
393 "(%d after header) for collation data\n",
402 "(%d after header) for collation data\n",
429 "(%d after header) for collation data\n",
559 // Try to swap the old format version which did not have a standard data header.
611 InverseUCATableHeader header={ 0,0,0,0,0,{0,0,0,0},{0,0,0,0,0,0,0,0} };
647 * check the length against the header size before reading the size field
650 header.byteSize=udata_readInt32(ds, inHeader->byteSize);
653 (uint32_t)(length-headerSize)<(header.byteSize=udata_readInt32(ds, inHeader->byteSize)))
655 udata_printError(ds, "ucol_swapInverseUCA(): too few bytes (%d after header) for inverse UCA collation data\n",
664 uprv_memcpy(outBytes, inBytes, header.byteSize);
670 header.tableSize= ds->readUInt32(inHeader->tableSize);
671 header.contsSize= ds->readUInt32(inHeader->contsSize);
672 header.table= ds->readUInt32(inHeader->table);
673 header.conts= ds->readUInt32(inHeader->conts);
675 /* swap the 32-bit integers in the header */
679 ds->swapArray32(ds, inBytes+header.table, header.tableSize*3*4,
680 outBytes+header.table, pErrorCode);
683 ds->swapArray16(ds, inBytes+header.conts, header.contsSize*U_SIZEOF_UCHAR,
684 outBytes+header.conts, pErrorCode);
687 return headerSize+header.byteSize;