OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Lars Knoll <lars@trolltech.com> | 2 * Copyright (C) 2006 Lars Knoll <lars@trolltech.com> |
3 * Copyright (C) 2007, 2011, 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2007, 2011, 2012 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "wtf/PassOwnPtr.h" | 28 #include "wtf/PassOwnPtr.h" |
29 #include "wtf/ThreadSpecific.h" | 29 #include "wtf/ThreadSpecific.h" |
30 #include "wtf/ThreadingPrimitives.h" | 30 #include "wtf/ThreadingPrimitives.h" |
31 #include "wtf/text/AtomicString.h" | 31 #include "wtf/text/AtomicString.h" |
32 #include "wtf/text/CString.h" | 32 #include "wtf/text/CString.h" |
33 #include "wtf/text/WTFString.h" | 33 #include "wtf/text/WTFString.h" |
34 #include <unicode/rbbi.h> | 34 #include <unicode/rbbi.h> |
35 #include <unicode/ubrk.h> | 35 #include <unicode/ubrk.h> |
36 | 36 |
37 using namespace WTF; | 37 using namespace WTF; |
38 using namespace std; | |
39 | 38 |
40 namespace blink { | 39 namespace blink { |
41 | 40 |
42 class LineBreakIteratorPool { | 41 class LineBreakIteratorPool { |
43 WTF_MAKE_NONCOPYABLE(LineBreakIteratorPool); | 42 WTF_MAKE_NONCOPYABLE(LineBreakIteratorPool); |
44 public: | 43 public: |
45 static LineBreakIteratorPool& sharedPool() | 44 static LineBreakIteratorPool& sharedPool() |
46 { | 45 { |
47 static WTF::ThreadSpecific<LineBreakIteratorPool>* pool = new WTF::Threa
dSpecific<LineBreakIteratorPool>; | 46 static WTF::ThreadSpecific<LineBreakIteratorPool>* pool = new WTF::Threa
dSpecific<LineBreakIteratorPool>; |
48 return **pool; | 47 return **pool; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 { | 146 { |
148 ASSERT_UNUSED(deep, !deep); | 147 ASSERT_UNUSED(deep, !deep); |
149 if (U_FAILURE(*status)) | 148 if (U_FAILURE(*status)) |
150 return 0; | 149 return 0; |
151 int32_t extraSize = source->extraSize; | 150 int32_t extraSize = source->extraSize; |
152 destination = utext_setup(destination, extraSize, status); | 151 destination = utext_setup(destination, extraSize, status); |
153 if (U_FAILURE(*status)) | 152 if (U_FAILURE(*status)) |
154 return destination; | 153 return destination; |
155 void* extraNew = destination->pExtra; | 154 void* extraNew = destination->pExtra; |
156 int32_t flags = destination->flags; | 155 int32_t flags = destination->flags; |
157 int sizeToCopy = min(source->sizeOfStruct, destination->sizeOfStruct); | 156 int sizeToCopy = std::min(source->sizeOfStruct, destination->sizeOfStruct); |
158 memcpy(destination, source, sizeToCopy); | 157 memcpy(destination, source, sizeToCopy); |
159 destination->pExtra = extraNew; | 158 destination->pExtra = extraNew; |
160 destination->flags = flags; | 159 destination->flags = flags; |
161 memcpy(destination->pExtra, source->pExtra, extraSize); | 160 memcpy(destination->pExtra, source->pExtra, extraSize); |
162 textFixPointer(source, destination, destination->context); | 161 textFixPointer(source, destination, destination->context); |
163 textFixPointer(source, destination, destination->p); | 162 textFixPointer(source, destination, destination->p); |
164 textFixPointer(source, destination, destination->q); | 163 textFixPointer(source, destination, destination->q); |
165 ASSERT(!destination->r); | 164 ASSERT(!destination->r); |
166 const void * chunkContents = static_cast<const void*>(destination->chunkCont
ents); | 165 const void * chunkContents = static_cast<const void*>(destination->chunkCont
ents); |
167 textFixPointer(source, destination, chunkContents); | 166 textFixPointer(source, destination, chunkContents); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 text->chunkNativeLimit = nativeLength; | 209 text->chunkNativeLimit = nativeLength; |
211 } else { | 210 } else { |
212 ASSERT(nativeIndex > text->b && nativeIndex <= nativeLength); | 211 ASSERT(nativeIndex > text->b && nativeIndex <= nativeLength); |
213 text->chunkNativeLimit = nativeIndex; | 212 text->chunkNativeLimit = nativeIndex; |
214 text->chunkNativeStart = nativeIndex - text->extraSize / sizeof(UChar); | 213 text->chunkNativeStart = nativeIndex - text->extraSize / sizeof(UChar); |
215 if (text->chunkNativeStart < text->b) | 214 if (text->chunkNativeStart < text->b) |
216 text->chunkNativeStart = text->b; | 215 text->chunkNativeStart = text->b; |
217 } | 216 } |
218 int64_t length = text->chunkNativeLimit - text->chunkNativeStart; | 217 int64_t length = text->chunkNativeLimit - text->chunkNativeStart; |
219 // Ensure chunk length is well defined if computed length exceeds int32_t ra
nge. | 218 // Ensure chunk length is well defined if computed length exceeds int32_t ra
nge. |
220 ASSERT(length <= numeric_limits<int32_t>::max()); | 219 ASSERT(length <= std::numeric_limits<int32_t>::max()); |
221 text->chunkLength = length <= numeric_limits<int32_t>::max() ? static_cast<i
nt32_t>(length) : 0; | 220 text->chunkLength = length <= std::numeric_limits<int32_t>::max() ? static_c
ast<int32_t>(length) : 0; |
222 text->nativeIndexingLimit = text->chunkLength; | 221 text->nativeIndexingLimit = text->chunkLength; |
223 text->chunkOffset = forward ? 0 : text->chunkLength; | 222 text->chunkOffset = forward ? 0 : text->chunkLength; |
224 StringImpl::copyChars(const_cast<UChar*>(text->chunkContents), static_cast<c
onst LChar*>(text->p) + (text->chunkNativeStart - text->b), static_cast<unsigned
>(text->chunkLength)); | 223 StringImpl::copyChars(const_cast<UChar*>(text->chunkContents), static_cast<c
onst LChar*>(text->p) + (text->chunkNativeStart - text->b), static_cast<unsigned
>(text->chunkLength)); |
225 } | 224 } |
226 | 225 |
227 static void textLatin1SwitchToPrimaryContext(UText* text, int64_t nativeIndex, i
nt64_t nativeLength, UBool forward) | 226 static void textLatin1SwitchToPrimaryContext(UText* text, int64_t nativeIndex, i
nt64_t nativeLength, UBool forward) |
228 { | 227 { |
229 ASSERT(!text->chunkContents || text->chunkContents == text->q); | 228 ASSERT(!text->chunkContents || text->chunkContents == text->q); |
230 text->chunkContents = static_cast<const UChar*>(text->pExtra); | 229 text->chunkContents = static_cast<const UChar*>(text->pExtra); |
231 textLatin1MoveInPrimaryContext(text, nativeIndex, nativeLength, forward); | 230 textLatin1MoveInPrimaryContext(text, nativeIndex, nativeLength, forward); |
232 } | 231 } |
233 | 232 |
234 static void textLatin1MoveInPriorContext(UText* text, int64_t nativeIndex, int64
_t nativeLength, UBool forward) | 233 static void textLatin1MoveInPriorContext(UText* text, int64_t nativeIndex, int64
_t nativeLength, UBool forward) |
235 { | 234 { |
236 ASSERT(text->chunkContents == text->q); | 235 ASSERT(text->chunkContents == text->q); |
237 ASSERT(forward ? nativeIndex < text->b : nativeIndex <= text->b); | 236 ASSERT(forward ? nativeIndex < text->b : nativeIndex <= text->b); |
238 ASSERT_UNUSED(nativeLength, forward ? nativeIndex < nativeLength : nativeInd
ex <= nativeLength); | 237 ASSERT_UNUSED(nativeLength, forward ? nativeIndex < nativeLength : nativeInd
ex <= nativeLength); |
239 ASSERT_UNUSED(forward, forward ? nativeIndex < nativeLength : nativeIndex <=
nativeLength); | 238 ASSERT_UNUSED(forward, forward ? nativeIndex < nativeLength : nativeIndex <=
nativeLength); |
240 text->chunkNativeStart = 0; | 239 text->chunkNativeStart = 0; |
241 text->chunkNativeLimit = text->b; | 240 text->chunkNativeLimit = text->b; |
242 text->chunkLength = text->b; | 241 text->chunkLength = text->b; |
243 text->nativeIndexingLimit = text->chunkLength; | 242 text->nativeIndexingLimit = text->chunkLength; |
244 int64_t offset = nativeIndex - text->chunkNativeStart; | 243 int64_t offset = nativeIndex - text->chunkNativeStart; |
245 // Ensure chunk offset is well defined if computed offset exceeds int32_t ra
nge or chunk length. | 244 // Ensure chunk offset is well defined if computed offset exceeds int32_t ra
nge or chunk length. |
246 ASSERT(offset <= numeric_limits<int32_t>::max()); | 245 ASSERT(offset <= std::numeric_limits<int32_t>::max()); |
247 text->chunkOffset = min(offset <= numeric_limits<int32_t>::max() ? static_ca
st<int32_t>(offset) : 0, text->chunkLength); | 246 text->chunkOffset = std::min(offset <= std::numeric_limits<int32_t>::max() ?
static_cast<int32_t>(offset) : 0, text->chunkLength); |
248 } | 247 } |
249 | 248 |
250 static void textLatin1SwitchToPriorContext(UText* text, int64_t nativeIndex, int
64_t nativeLength, UBool forward) | 249 static void textLatin1SwitchToPriorContext(UText* text, int64_t nativeIndex, int
64_t nativeLength, UBool forward) |
251 { | 250 { |
252 ASSERT(!text->chunkContents || text->chunkContents == text->pExtra); | 251 ASSERT(!text->chunkContents || text->chunkContents == text->pExtra); |
253 text->chunkContents = static_cast<const UChar*>(text->q); | 252 text->chunkContents = static_cast<const UChar*>(text->q); |
254 textLatin1MoveInPriorContext(text, nativeIndex, nativeLength, forward); | 253 textLatin1MoveInPriorContext(text, nativeIndex, nativeLength, forward); |
255 } | 254 } |
256 | 255 |
257 static inline bool textInChunkOrOutOfRange(UText* text, int64_t nativeIndex, int
64_t nativeLength, UBool forward, UBool& isAccessible) | 256 static inline bool textInChunkOrOutOfRange(UText* text, int64_t nativeIndex, int
64_t nativeLength, UBool forward, UBool& isAccessible) |
258 { | 257 { |
259 if (forward) { | 258 if (forward) { |
260 if (nativeIndex >= text->chunkNativeStart && nativeIndex < text->chunkNa
tiveLimit) { | 259 if (nativeIndex >= text->chunkNativeStart && nativeIndex < text->chunkNa
tiveLimit) { |
261 int64_t offset = nativeIndex - text->chunkNativeStart; | 260 int64_t offset = nativeIndex - text->chunkNativeStart; |
262 // Ensure chunk offset is well formed if computed offset exceeds int
32_t range. | 261 // Ensure chunk offset is well formed if computed offset exceeds int
32_t range. |
263 ASSERT(offset <= numeric_limits<int32_t>::max()); | 262 ASSERT(offset <= std::numeric_limits<int32_t>::max()); |
264 text->chunkOffset = offset <= numeric_limits<int32_t>::max() ? stati
c_cast<int32_t>(offset) : 0; | 263 text->chunkOffset = offset <= std::numeric_limits<int32_t>::max() ?
static_cast<int32_t>(offset) : 0; |
265 isAccessible = TRUE; | 264 isAccessible = TRUE; |
266 return true; | 265 return true; |
267 } | 266 } |
268 if (nativeIndex >= nativeLength && text->chunkNativeLimit == nativeLengt
h) { | 267 if (nativeIndex >= nativeLength && text->chunkNativeLimit == nativeLengt
h) { |
269 text->chunkOffset = text->chunkLength; | 268 text->chunkOffset = text->chunkLength; |
270 isAccessible = FALSE; | 269 isAccessible = FALSE; |
271 return true; | 270 return true; |
272 } | 271 } |
273 } else { | 272 } else { |
274 if (nativeIndex > text->chunkNativeStart && nativeIndex <= text->chunkNa
tiveLimit) { | 273 if (nativeIndex > text->chunkNativeStart && nativeIndex <= text->chunkNa
tiveLimit) { |
275 int64_t offset = nativeIndex - text->chunkNativeStart; | 274 int64_t offset = nativeIndex - text->chunkNativeStart; |
276 // Ensure chunk offset is well formed if computed offset exceeds int
32_t range. | 275 // Ensure chunk offset is well formed if computed offset exceeds int
32_t range. |
277 ASSERT(offset <= numeric_limits<int32_t>::max()); | 276 ASSERT(offset <= std::numeric_limits<int32_t>::max()); |
278 text->chunkOffset = offset <= numeric_limits<int32_t>::max() ? stati
c_cast<int32_t>(offset) : 0; | 277 text->chunkOffset = offset <= std::numeric_limits<int32_t>::max() ?
static_cast<int32_t>(offset) : 0; |
279 isAccessible = TRUE; | 278 isAccessible = TRUE; |
280 return true; | 279 return true; |
281 } | 280 } |
282 if (nativeIndex <= 0 && !text->chunkNativeStart) { | 281 if (nativeIndex <= 0 && !text->chunkNativeStart) { |
283 text->chunkOffset = 0; | 282 text->chunkOffset = 0; |
284 isAccessible = FALSE; | 283 isAccessible = FALSE; |
285 return true; | 284 return true; |
286 } | 285 } |
287 } | 286 } |
288 return false; | 287 return false; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 text->a = length; | 335 text->a = length; |
337 text->q = priorContext; | 336 text->q = priorContext; |
338 text->b = priorContextLength; | 337 text->b = priorContextLength; |
339 } | 338 } |
340 | 339 |
341 static UText* textOpenLatin1(UTextWithBuffer* utWithBuffer, const LChar* string,
unsigned length, const UChar* priorContext, int priorContextLength, UErrorCode*
status) | 340 static UText* textOpenLatin1(UTextWithBuffer* utWithBuffer, const LChar* string,
unsigned length, const UChar* priorContext, int priorContextLength, UErrorCode*
status) |
342 { | 341 { |
343 if (U_FAILURE(*status)) | 342 if (U_FAILURE(*status)) |
344 return 0; | 343 return 0; |
345 | 344 |
346 if (!string || length > static_cast<unsigned>(numeric_limits<int32_t>::max()
)) { | 345 if (!string || length > static_cast<unsigned>(std::numeric_limits<int32_t>::
max())) { |
347 *status = U_ILLEGAL_ARGUMENT_ERROR; | 346 *status = U_ILLEGAL_ARGUMENT_ERROR; |
348 return 0; | 347 return 0; |
349 } | 348 } |
350 UText* text = utext_setup(&utWithBuffer->text, sizeof(utWithBuffer->buffer),
status); | 349 UText* text = utext_setup(&utWithBuffer->text, sizeof(utWithBuffer->buffer),
status); |
351 if (U_FAILURE(*status)) { | 350 if (U_FAILURE(*status)) { |
352 ASSERT(!text); | 351 ASSERT(!text); |
353 return 0; | 352 return 0; |
354 } | 353 } |
355 textInit(text, &textLatin1Funcs, string, length, priorContext, priorContextL
ength); | 354 textInit(text, &textLatin1Funcs, string, length, priorContext, priorContextL
ength); |
356 return text; | 355 return text; |
357 } | 356 } |
358 | 357 |
359 static inline TextContext textUTF16GetCurrentContext(const UText* text) | 358 static inline TextContext textUTF16GetCurrentContext(const UText* text) |
360 { | 359 { |
361 if (!text->chunkContents) | 360 if (!text->chunkContents) |
362 return NoContext; | 361 return NoContext; |
363 return text->chunkContents == text->p ? PrimaryContext : PriorContext; | 362 return text->chunkContents == text->p ? PrimaryContext : PriorContext; |
364 } | 363 } |
365 | 364 |
366 static void textUTF16MoveInPrimaryContext(UText* text, int64_t nativeIndex, int6
4_t nativeLength, UBool forward) | 365 static void textUTF16MoveInPrimaryContext(UText* text, int64_t nativeIndex, int6
4_t nativeLength, UBool forward) |
367 { | 366 { |
368 ASSERT(text->chunkContents == text->p); | 367 ASSERT(text->chunkContents == text->p); |
369 ASSERT_UNUSED(forward, forward ? nativeIndex >= text->b : nativeIndex > text
->b); | 368 ASSERT_UNUSED(forward, forward ? nativeIndex >= text->b : nativeIndex > text
->b); |
370 ASSERT_UNUSED(forward, forward ? nativeIndex < nativeLength : nativeIndex <=
nativeLength); | 369 ASSERT_UNUSED(forward, forward ? nativeIndex < nativeLength : nativeIndex <=
nativeLength); |
371 text->chunkNativeStart = text->b; | 370 text->chunkNativeStart = text->b; |
372 text->chunkNativeLimit = nativeLength; | 371 text->chunkNativeLimit = nativeLength; |
373 int64_t length = text->chunkNativeLimit - text->chunkNativeStart; | 372 int64_t length = text->chunkNativeLimit - text->chunkNativeStart; |
374 // Ensure chunk length is well defined if computed length exceeds int32_t ra
nge. | 373 // Ensure chunk length is well defined if computed length exceeds int32_t ra
nge. |
375 ASSERT(length <= numeric_limits<int32_t>::max()); | 374 ASSERT(length <= std::numeric_limits<int32_t>::max()); |
376 text->chunkLength = length <= numeric_limits<int32_t>::max() ? static_cast<i
nt32_t>(length) : 0; | 375 text->chunkLength = length <= std::numeric_limits<int32_t>::max() ? static_c
ast<int32_t>(length) : 0; |
377 text->nativeIndexingLimit = text->chunkLength; | 376 text->nativeIndexingLimit = text->chunkLength; |
378 int64_t offset = nativeIndex - text->chunkNativeStart; | 377 int64_t offset = nativeIndex - text->chunkNativeStart; |
379 // Ensure chunk offset is well defined if computed offset exceeds int32_t ra
nge or chunk length. | 378 // Ensure chunk offset is well defined if computed offset exceeds int32_t ra
nge or chunk length. |
380 ASSERT(offset <= numeric_limits<int32_t>::max()); | 379 ASSERT(offset <= std::numeric_limits<int32_t>::max()); |
381 text->chunkOffset = min(offset <= numeric_limits<int32_t>::max() ? static_ca
st<int32_t>(offset) : 0, text->chunkLength); | 380 text->chunkOffset = std::min(offset <= std::numeric_limits<int32_t>::max() ?
static_cast<int32_t>(offset) : 0, text->chunkLength); |
382 } | 381 } |
383 | 382 |
384 static void textUTF16SwitchToPrimaryContext(UText* text, int64_t nativeIndex, in
t64_t nativeLength, UBool forward) | 383 static void textUTF16SwitchToPrimaryContext(UText* text, int64_t nativeIndex, in
t64_t nativeLength, UBool forward) |
385 { | 384 { |
386 ASSERT(!text->chunkContents || text->chunkContents == text->q); | 385 ASSERT(!text->chunkContents || text->chunkContents == text->q); |
387 text->chunkContents = static_cast<const UChar*>(text->p); | 386 text->chunkContents = static_cast<const UChar*>(text->p); |
388 textUTF16MoveInPrimaryContext(text, nativeIndex, nativeLength, forward); | 387 textUTF16MoveInPrimaryContext(text, nativeIndex, nativeLength, forward); |
389 } | 388 } |
390 | 389 |
391 static void textUTF16MoveInPriorContext(UText* text, int64_t nativeIndex, int64_
t nativeLength, UBool forward) | 390 static void textUTF16MoveInPriorContext(UText* text, int64_t nativeIndex, int64_
t nativeLength, UBool forward) |
392 { | 391 { |
393 ASSERT(text->chunkContents == text->q); | 392 ASSERT(text->chunkContents == text->q); |
394 ASSERT(forward ? nativeIndex < text->b : nativeIndex <= text->b); | 393 ASSERT(forward ? nativeIndex < text->b : nativeIndex <= text->b); |
395 ASSERT_UNUSED(nativeLength, forward ? nativeIndex < nativeLength : nativeInd
ex <= nativeLength); | 394 ASSERT_UNUSED(nativeLength, forward ? nativeIndex < nativeLength : nativeInd
ex <= nativeLength); |
396 ASSERT_UNUSED(forward, forward ? nativeIndex < nativeLength : nativeIndex <=
nativeLength); | 395 ASSERT_UNUSED(forward, forward ? nativeIndex < nativeLength : nativeIndex <=
nativeLength); |
397 text->chunkNativeStart = 0; | 396 text->chunkNativeStart = 0; |
398 text->chunkNativeLimit = text->b; | 397 text->chunkNativeLimit = text->b; |
399 text->chunkLength = text->b; | 398 text->chunkLength = text->b; |
400 text->nativeIndexingLimit = text->chunkLength; | 399 text->nativeIndexingLimit = text->chunkLength; |
401 int64_t offset = nativeIndex - text->chunkNativeStart; | 400 int64_t offset = nativeIndex - text->chunkNativeStart; |
402 // Ensure chunk offset is well defined if computed offset exceeds int32_t ra
nge or chunk length. | 401 // Ensure chunk offset is well defined if computed offset exceeds int32_t ra
nge or chunk length. |
403 ASSERT(offset <= numeric_limits<int32_t>::max()); | 402 ASSERT(offset <= std::numeric_limits<int32_t>::max()); |
404 text->chunkOffset = min(offset <= numeric_limits<int32_t>::max() ? static_ca
st<int32_t>(offset) : 0, text->chunkLength); | 403 text->chunkOffset = std::min(offset <= std::numeric_limits<int32_t>::max() ?
static_cast<int32_t>(offset) : 0, text->chunkLength); |
405 } | 404 } |
406 | 405 |
407 static void textUTF16SwitchToPriorContext(UText* text, int64_t nativeIndex, int6
4_t nativeLength, UBool forward) | 406 static void textUTF16SwitchToPriorContext(UText* text, int64_t nativeIndex, int6
4_t nativeLength, UBool forward) |
408 { | 407 { |
409 ASSERT(!text->chunkContents || text->chunkContents == text->p); | 408 ASSERT(!text->chunkContents || text->chunkContents == text->p); |
410 text->chunkContents = static_cast<const UChar*>(text->q); | 409 text->chunkContents = static_cast<const UChar*>(text->q); |
411 textUTF16MoveInPriorContext(text, nativeIndex, nativeLength, forward); | 410 textUTF16MoveInPriorContext(text, nativeIndex, nativeLength, forward); |
412 } | 411 } |
413 | 412 |
414 static UBool textUTF16Access(UText* text, int64_t nativeIndex, UBool forward) | 413 static UBool textUTF16Access(UText* text, int64_t nativeIndex, UBool forward) |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 0, 0, 0, 0, | 447 0, 0, 0, 0, |
449 textClose, | 448 textClose, |
450 0, 0, 0, | 449 0, 0, 0, |
451 }; | 450 }; |
452 | 451 |
453 static UText* textOpenUTF16(UText* text, const UChar* string, unsigned length, c
onst UChar* priorContext, int priorContextLength, UErrorCode* status) | 452 static UText* textOpenUTF16(UText* text, const UChar* string, unsigned length, c
onst UChar* priorContext, int priorContextLength, UErrorCode* status) |
454 { | 453 { |
455 if (U_FAILURE(*status)) | 454 if (U_FAILURE(*status)) |
456 return 0; | 455 return 0; |
457 | 456 |
458 if (!string || length > static_cast<unsigned>(numeric_limits<int32_t>::max()
)) { | 457 if (!string || length > static_cast<unsigned>(std::numeric_limits<int32_t>::
max())) { |
459 *status = U_ILLEGAL_ARGUMENT_ERROR; | 458 *status = U_ILLEGAL_ARGUMENT_ERROR; |
460 return 0; | 459 return 0; |
461 } | 460 } |
462 | 461 |
463 text = utext_setup(text, 0, status); | 462 text = utext_setup(text, 0, status); |
464 if (U_FAILURE(*status)) { | 463 if (U_FAILURE(*status)) { |
465 ASSERT(!text); | 464 ASSERT(!text); |
466 return 0; | 465 return 0; |
467 } | 466 } |
468 textInit(text, &textUTF16Funcs, string, length, priorContext, priorContextLe
ngth); | 467 textInit(text, &textUTF16Funcs, string, length, priorContext, priorContextLe
ngth); |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 "$Tel1 $TelV $Tel0;" // Telugu Virama (backward) | 837 "$Tel1 $TelV $Tel0;" // Telugu Virama (backward) |
839 "$Kan1 $KanV $Kan0;" // Kannada Virama (backward) | 838 "$Kan1 $KanV $Kan0;" // Kannada Virama (backward) |
840 "$Mal1 $MalV $Mal0;" // Malayalam Virama (backward) | 839 "$Mal1 $MalV $Mal0;" // Malayalam Virama (backward) |
841 "!!safe_reverse;" | 840 "!!safe_reverse;" |
842 "!!safe_forward;"; | 841 "!!safe_forward;"; |
843 | 842 |
844 return setUpIteratorWithRules(kRules, string, length); | 843 return setUpIteratorWithRules(kRules, string, length); |
845 } | 844 } |
846 | 845 |
847 } | 846 } |
OLD | NEW |