| OLD | NEW |
| 1 /* | 1 /* |
| 2 ****************************************************************************** | 2 ****************************************************************************** |
| 3 * | 3 * |
| 4 * Copyright (C) 2001-2013, International Business Machines | 4 * Copyright (C) 2001-2014, International Business Machines |
| 5 * Corporation and others. All Rights Reserved. | 5 * Corporation and others. All Rights Reserved. |
| 6 * | 6 * |
| 7 ****************************************************************************** | 7 ****************************************************************************** |
| 8 * file name: utrie2.cpp | 8 * file name: utrie2.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: 2008aug16 (starting from a copy of utrie.c) | 13 * created on: 2008aug16 (starting from a copy of utrie.c) |
| 14 * created by: Markus W. Scherer | 14 * created by: Markus W. Scherer |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 } | 392 } |
| 393 if(signature==UTRIE_SIG) { | 393 if(signature==UTRIE_SIG) { |
| 394 return 1; | 394 return 1; |
| 395 } | 395 } |
| 396 if(anyEndianOk && signature==UTRIE_OE_SIG) { | 396 if(anyEndianOk && signature==UTRIE_OE_SIG) { |
| 397 return 1; | 397 return 1; |
| 398 } | 398 } |
| 399 return 0; | 399 return 0; |
| 400 } | 400 } |
| 401 | 401 |
| 402 U_CAPI UBool U_EXPORT2 |
| 403 utrie2_isFrozen(const UTrie2 *trie) { |
| 404 return (UBool)(trie->newTrie==NULL); |
| 405 } |
| 406 |
| 407 U_CAPI int32_t U_EXPORT2 |
| 408 utrie2_serialize(const UTrie2 *trie, |
| 409 void *data, int32_t capacity, |
| 410 UErrorCode *pErrorCode) { |
| 411 /* argument check */ |
| 412 if(U_FAILURE(*pErrorCode)) { |
| 413 return 0; |
| 414 } |
| 415 |
| 416 if( trie==NULL || trie->memory==NULL || trie->newTrie!=NULL || |
| 417 capacity<0 || (capacity>0 && (data==NULL || (U_POINTER_MASK_LSB(data, 3)
!=0))) |
| 418 ) { |
| 419 *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; |
| 420 return 0; |
| 421 } |
| 422 |
| 423 if(capacity>=trie->length) { |
| 424 uprv_memcpy(data, trie->memory, trie->length); |
| 425 } else { |
| 426 *pErrorCode=U_BUFFER_OVERFLOW_ERROR; |
| 427 } |
| 428 return trie->length; |
| 429 } |
| 430 |
| 402 U_CAPI int32_t U_EXPORT2 | 431 U_CAPI int32_t U_EXPORT2 |
| 403 utrie2_swap(const UDataSwapper *ds, | 432 utrie2_swap(const UDataSwapper *ds, |
| 404 const void *inData, int32_t length, void *outData, | 433 const void *inData, int32_t length, void *outData, |
| 405 UErrorCode *pErrorCode) { | 434 UErrorCode *pErrorCode) { |
| 406 const UTrie2Header *inTrie; | 435 const UTrie2Header *inTrie; |
| 407 UTrie2Header trie; | 436 UTrie2Header trie; |
| 408 int32_t dataLength, size; | 437 int32_t dataLength, size; |
| 409 UTrie2ValueBits valueBits; | 438 UTrie2ValueBits valueBits; |
| 410 | 439 |
| 411 if(U_FAILURE(*pErrorCode)) { | 440 if(U_FAILURE(*pErrorCode)) { |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 if(codePointLimit==limit) { | 756 if(codePointLimit==limit) { |
| 728 codePoint=U_SENTINEL; | 757 codePoint=U_SENTINEL; |
| 729 return 0; | 758 return 0; |
| 730 } | 759 } |
| 731 uint16_t result; | 760 uint16_t result; |
| 732 UTRIE2_U16_NEXT16(trie, codePointLimit, limit, codePoint, result); | 761 UTRIE2_U16_NEXT16(trie, codePointLimit, limit, codePoint, result); |
| 733 return result; | 762 return result; |
| 734 } | 763 } |
| 735 | 764 |
| 736 U_NAMESPACE_END | 765 U_NAMESPACE_END |
| OLD | NEW |