OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************* | 2 ******************************************************************************* |
3 * | 3 * |
4 * Copyright (C) 2003-2014, International Business Machines | 4 * Copyright (C) 2003-2015, International Business Machines |
5 * Corporation and others. All Rights Reserved. | 5 * Corporation and others. All Rights Reserved. |
6 * | 6 * |
7 ******************************************************************************* | 7 ******************************************************************************* |
8 * file name: ucol_swp.cpp | 8 * file name: ucol_swp.cpp |
9 * encoding: US-ASCII | 9 * encoding: US-ASCII |
10 * tab size: 8 (not used) | 10 * tab size: 8 (not used) |
11 * indentation:4 | 11 * indentation:4 |
12 * | 12 * |
13 * created on: 2003sep10 | 13 * created on: 2003sep10 |
14 * created by: Markus W. Scherer | 14 * created by: Markus W. Scherer |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 int dataCount = ds->readUInt16(*((uint16_t*)(inBytes+header.leadByte
ToScript + 2))); // each entry = uint16 | 333 int dataCount = ds->readUInt16(*((uint16_t*)(inBytes+header.leadByte
ToScript + 2))); // each entry = uint16 |
334 ds->swapArray16(ds, inBytes+header.leadByteToScript, | 334 ds->swapArray16(ds, inBytes+header.leadByteToScript, |
335 4 + (2 * indexCount) + (2 * dataCount), | 335 4 + (2 * indexCount) + (2 * dataCount), |
336 outBytes+header.leadByteToScript, pErrorCode); | 336 outBytes+header.leadByteToScript, pErrorCode); |
337 } | 337 } |
338 } | 338 } |
339 | 339 |
340 return header.size; | 340 return header.size; |
341 } | 341 } |
342 | 342 |
343 // swap formatVersion 4 ---------------------------------------------------- *** | 343 // swap formatVersion 4 or 5 ----------------------------------------------- *** |
344 | 344 |
345 // The following are copied from CollationDataReader, trading an awkward copy of
constants | 345 // The following are copied from CollationDataReader, trading an awkward copy of
constants |
346 // for an awkward relocation of the i18n collationdatareader.h file into the com
mon library. | 346 // for an awkward relocation of the i18n collationdatareader.h file into the com
mon library. |
347 // Keep them in sync! | 347 // Keep them in sync! |
348 | 348 |
349 enum { | 349 enum { |
350 IX_INDEXES_LENGTH, // 0 | 350 IX_INDEXES_LENGTH, // 0 |
351 IX_OPTIONS, | 351 IX_OPTIONS, |
352 IX_RESERVED2, | 352 IX_RESERVED2, |
353 IX_RESERVED3, | 353 IX_RESERVED3, |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 return swapFormatVersion3(ds, inData, length, outData, pErrorCode); | 559 return swapFormatVersion3(ds, inData, length, outData, pErrorCode); |
560 } | 560 } |
561 | 561 |
562 /* check data format and format version */ | 562 /* check data format and format version */ |
563 const UDataInfo &info=*(const UDataInfo *)((const char *)inData+4); | 563 const UDataInfo &info=*(const UDataInfo *)((const char *)inData+4); |
564 if(!( | 564 if(!( |
565 info.dataFormat[0]==0x55 && // dataFormat="UCol" | 565 info.dataFormat[0]==0x55 && // dataFormat="UCol" |
566 info.dataFormat[1]==0x43 && | 566 info.dataFormat[1]==0x43 && |
567 info.dataFormat[2]==0x6f && | 567 info.dataFormat[2]==0x6f && |
568 info.dataFormat[3]==0x6c && | 568 info.dataFormat[3]==0x6c && |
569 (info.formatVersion[0]==3 || info.formatVersion[0]==4) | 569 (3<=info.formatVersion[0] && info.formatVersion[0]<=5) |
570 )) { | 570 )) { |
571 udata_printError(ds, "ucol_swap(): data format %02x.%02x.%02x.%02x " | 571 udata_printError(ds, "ucol_swap(): data format %02x.%02x.%02x.%02x " |
572 "(format version %02x.%02x) is not recognized as collat
ion data\n", | 572 "(format version %02x.%02x) is not recognized as collat
ion data\n", |
573 info.dataFormat[0], info.dataFormat[1], | 573 info.dataFormat[0], info.dataFormat[1], |
574 info.dataFormat[2], info.dataFormat[3], | 574 info.dataFormat[2], info.dataFormat[3], |
575 info.formatVersion[0], info.formatVersion[1]); | 575 info.formatVersion[0], info.formatVersion[1]); |
576 *pErrorCode=U_UNSUPPORTED_ERROR; | 576 *pErrorCode=U_UNSUPPORTED_ERROR; |
577 return 0; | 577 return 0; |
578 } | 578 } |
579 | 579 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 | 679 |
680 /* swap the continuation table; contsSize counts UChars */ | 680 /* swap the continuation table; contsSize counts UChars */ |
681 ds->swapArray16(ds, inBytes+header.conts, header.contsSize*U_SIZEOF_UCHA
R, | 681 ds->swapArray16(ds, inBytes+header.conts, header.contsSize*U_SIZEOF_UCHA
R, |
682 outBytes+header.conts, pErrorCode); | 682 outBytes+header.conts, pErrorCode); |
683 } | 683 } |
684 | 684 |
685 return headerSize+header.byteSize; | 685 return headerSize+header.byteSize; |
686 } | 686 } |
687 | 687 |
688 #endif /* #if !UCONFIG_NO_COLLATION */ | 688 #endif /* #if !UCONFIG_NO_COLLATION */ |
OLD | NEW |