| OLD | NEW |
| 1 // Copyright (C) 2016 and later: Unicode, Inc. and others. | 1 // Copyright (C) 2016 and later: Unicode, Inc. and others. |
| 2 // License & terms of use: http://www.unicode.org/copyright.html | 2 // License & terms of use: http://www.unicode.org/copyright.html |
| 3 /* | 3 /* |
| 4 ********************************************************************** | 4 ********************************************************************** |
| 5 * Copyright (C) 2014, International Business Machines | 5 * Copyright (C) 2014, International Business Machines |
| 6 * Corporation and others. All Rights Reserved. | 6 * Corporation and others. All Rights Reserved. |
| 7 ********************************************************************** | 7 ********************************************************************** |
| 8 * | 8 * |
| 9 * scriptset.cpp | 9 * scriptset.cpp |
| 10 * | 10 * |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 | 251 |
| 252 void ScriptSet::setScriptExtensions(UChar32 codePoint, UErrorCode& status) { | 252 void ScriptSet::setScriptExtensions(UChar32 codePoint, UErrorCode& status) { |
| 253 if (U_FAILURE(status)) { return; } | 253 if (U_FAILURE(status)) { return; } |
| 254 static const int32_t FIRST_GUESS_SCRIPT_CAPACITY = 5; | 254 static const int32_t FIRST_GUESS_SCRIPT_CAPACITY = 5; |
| 255 MaybeStackArray<UScriptCode,FIRST_GUESS_SCRIPT_CAPACITY> scripts; | 255 MaybeStackArray<UScriptCode,FIRST_GUESS_SCRIPT_CAPACITY> scripts; |
| 256 UErrorCode internalStatus = U_ZERO_ERROR; | 256 UErrorCode internalStatus = U_ZERO_ERROR; |
| 257 int32_t script_count = -1; | 257 int32_t script_count = -1; |
| 258 | 258 |
| 259 while (TRUE) { | 259 while (TRUE) { |
| 260 script_count = uscript_getScriptExtensions( | 260 script_count = uscript_getScriptExtensions( |
| 261 codePoint, scripts.getAlias(), FIRST_GUESS_SCRIPT_CAPACITY, &interna
lStatus); | 261 codePoint, scripts.getAlias(), scripts.getCapacity(), &internalStatu
s); |
| 262 if (internalStatus == U_BUFFER_OVERFLOW_ERROR) { | 262 if (internalStatus == U_BUFFER_OVERFLOW_ERROR) { |
| 263 // Need to allocate more space | 263 // Need to allocate more space |
| 264 if (scripts.resize(script_count) == NULL) { | 264 if (scripts.resize(script_count) == NULL) { |
| 265 status = U_MEMORY_ALLOCATION_ERROR; | 265 status = U_MEMORY_ALLOCATION_ERROR; |
| 266 return; | 266 return; |
| 267 } | 267 } |
| 268 internalStatus = U_ZERO_ERROR; | 268 internalStatus = U_ZERO_ERROR; |
| 269 } else { | 269 } else { |
| 270 break; | 270 break; |
| 271 } | 271 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 uhash_hashScriptSet(const UElement key) { | 312 uhash_hashScriptSet(const UElement key) { |
| 313 icu::ScriptSet *s = static_cast<icu::ScriptSet *>(key.pointer); | 313 icu::ScriptSet *s = static_cast<icu::ScriptSet *>(key.pointer); |
| 314 return s->hashCode(); | 314 return s->hashCode(); |
| 315 } | 315 } |
| 316 | 316 |
| 317 U_CAPI void U_EXPORT2 | 317 U_CAPI void U_EXPORT2 |
| 318 uhash_deleteScriptSet(void *obj) { | 318 uhash_deleteScriptSet(void *obj) { |
| 319 icu::ScriptSet *s = static_cast<icu::ScriptSet *>(obj); | 319 icu::ScriptSet *s = static_cast<icu::ScriptSet *>(obj); |
| 320 delete s; | 320 delete s; |
| 321 } | 321 } |
| OLD | NEW |