Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: third_party/WebKit/Source/platform/text/TextBreakIteratorICU.cpp

Issue 2394683005: Remove ASSERT_UNUSED (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 pointer = reinterpret_cast<char*>(destination) + 152 pointer = reinterpret_cast<char*>(destination) +
153 (static_cast<const char*>(pointer) - 153 (static_cast<const char*>(pointer) -
154 reinterpret_cast<const char*>(source)); 154 reinterpret_cast<const char*>(source));
155 } 155 }
156 } 156 }
157 157
158 static UText* textClone(UText* destination, 158 static UText* textClone(UText* destination,
159 const UText* source, 159 const UText* source,
160 UBool deep, 160 UBool deep,
161 UErrorCode* status) { 161 UErrorCode* status) {
162 ASSERT_UNUSED(deep, !deep); 162 DCHECK(!deep);
163 if (U_FAILURE(*status)) 163 if (U_FAILURE(*status))
164 return 0; 164 return 0;
165 int32_t extraSize = source->extraSize; 165 int32_t extraSize = source->extraSize;
166 destination = utext_setup(destination, extraSize, status); 166 destination = utext_setup(destination, extraSize, status);
167 if (U_FAILURE(*status)) 167 if (U_FAILURE(*status))
168 return destination; 168 return destination;
169 void* extraNew = destination->pExtra; 169 void* extraNew = destination->pExtra;
170 int32_t flags = destination->flags; 170 int32_t flags = destination->flags;
171 int sizeToCopy = std::min(source->sizeOfStruct, destination->sizeOfStruct); 171 int sizeToCopy = std::min(source->sizeOfStruct, destination->sizeOfStruct);
172 memcpy(destination, source, sizeToCopy); 172 memcpy(destination, source, sizeToCopy);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 text->chunkContents = static_cast<const UChar*>(text->pExtra); 258 text->chunkContents = static_cast<const UChar*>(text->pExtra);
259 textLatin1MoveInPrimaryContext(text, nativeIndex, nativeLength, forward); 259 textLatin1MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
260 } 260 }
261 261
262 static void textLatin1MoveInPriorContext(UText* text, 262 static void textLatin1MoveInPriorContext(UText* text,
263 int64_t nativeIndex, 263 int64_t nativeIndex,
264 int64_t nativeLength, 264 int64_t nativeLength,
265 UBool forward) { 265 UBool forward) {
266 ASSERT(text->chunkContents == text->q); 266 ASSERT(text->chunkContents == text->q);
267 ASSERT(forward ? nativeIndex < text->b : nativeIndex <= text->b); 267 ASSERT(forward ? nativeIndex < text->b : nativeIndex <= text->b);
268 ASSERT_UNUSED(nativeLength, forward ? nativeIndex < nativeLength 268 DCHECK(forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
269 : nativeIndex <= nativeLength); 269 DCHECK(forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
270 ASSERT_UNUSED(forward, forward ? nativeIndex < nativeLength
271 : nativeIndex <= nativeLength);
272 text->chunkNativeStart = 0; 270 text->chunkNativeStart = 0;
273 text->chunkNativeLimit = text->b; 271 text->chunkNativeLimit = text->b;
274 text->chunkLength = text->b; 272 text->chunkLength = text->b;
275 text->nativeIndexingLimit = text->chunkLength; 273 text->nativeIndexingLimit = text->chunkLength;
276 int64_t offset = nativeIndex - text->chunkNativeStart; 274 int64_t offset = nativeIndex - text->chunkNativeStart;
277 // Ensure chunk offset is well defined if computed offset exceeds int32_t 275 // Ensure chunk offset is well defined if computed offset exceeds int32_t
278 // range or chunk length. 276 // range or chunk length.
279 ASSERT(offset <= std::numeric_limits<int32_t>::max()); 277 ASSERT(offset <= std::numeric_limits<int32_t>::max());
280 text->chunkOffset = std::min(offset <= std::numeric_limits<int32_t>::max() 278 text->chunkOffset = std::min(offset <= std::numeric_limits<int32_t>::max()
281 ? static_cast<int32_t>(offset) 279 ? static_cast<int32_t>(offset)
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 if (!text->chunkContents) 412 if (!text->chunkContents)
415 return NoContext; 413 return NoContext;
416 return text->chunkContents == text->p ? PrimaryContext : PriorContext; 414 return text->chunkContents == text->p ? PrimaryContext : PriorContext;
417 } 415 }
418 416
419 static void textUTF16MoveInPrimaryContext(UText* text, 417 static void textUTF16MoveInPrimaryContext(UText* text,
420 int64_t nativeIndex, 418 int64_t nativeIndex,
421 int64_t nativeLength, 419 int64_t nativeLength,
422 UBool forward) { 420 UBool forward) {
423 ASSERT(text->chunkContents == text->p); 421 ASSERT(text->chunkContents == text->p);
424 ASSERT_UNUSED(forward, 422 DCHECK(forward ? nativeIndex >= text->b : nativeIndex > text->b);
425 forward ? nativeIndex >= text->b : nativeIndex > text->b); 423 DCHECK(forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
426 ASSERT_UNUSED(forward, forward ? nativeIndex < nativeLength
427 : nativeIndex <= nativeLength);
428 text->chunkNativeStart = text->b; 424 text->chunkNativeStart = text->b;
429 text->chunkNativeLimit = nativeLength; 425 text->chunkNativeLimit = nativeLength;
430 int64_t length = text->chunkNativeLimit - text->chunkNativeStart; 426 int64_t length = text->chunkNativeLimit - text->chunkNativeStart;
431 // Ensure chunk length is well defined if computed length exceeds int32_t 427 // Ensure chunk length is well defined if computed length exceeds int32_t
432 // range. 428 // range.
433 ASSERT(length <= std::numeric_limits<int32_t>::max()); 429 ASSERT(length <= std::numeric_limits<int32_t>::max());
434 text->chunkLength = length <= std::numeric_limits<int32_t>::max() 430 text->chunkLength = length <= std::numeric_limits<int32_t>::max()
435 ? static_cast<int32_t>(length) 431 ? static_cast<int32_t>(length)
436 : 0; 432 : 0;
437 text->nativeIndexingLimit = text->chunkLength; 433 text->nativeIndexingLimit = text->chunkLength;
(...skipping 15 matching lines...) Expand all
453 text->chunkContents = static_cast<const UChar*>(text->p); 449 text->chunkContents = static_cast<const UChar*>(text->p);
454 textUTF16MoveInPrimaryContext(text, nativeIndex, nativeLength, forward); 450 textUTF16MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
455 } 451 }
456 452
457 static void textUTF16MoveInPriorContext(UText* text, 453 static void textUTF16MoveInPriorContext(UText* text,
458 int64_t nativeIndex, 454 int64_t nativeIndex,
459 int64_t nativeLength, 455 int64_t nativeLength,
460 UBool forward) { 456 UBool forward) {
461 ASSERT(text->chunkContents == text->q); 457 ASSERT(text->chunkContents == text->q);
462 ASSERT(forward ? nativeIndex < text->b : nativeIndex <= text->b); 458 ASSERT(forward ? nativeIndex < text->b : nativeIndex <= text->b);
463 ASSERT_UNUSED(nativeLength, forward ? nativeIndex < nativeLength 459 DCHECK(forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
464 : nativeIndex <= nativeLength); 460 DCHECK(forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
465 ASSERT_UNUSED(forward, forward ? nativeIndex < nativeLength
466 : nativeIndex <= nativeLength);
467 text->chunkNativeStart = 0; 461 text->chunkNativeStart = 0;
468 text->chunkNativeLimit = text->b; 462 text->chunkNativeLimit = text->b;
469 text->chunkLength = text->b; 463 text->chunkLength = text->b;
470 text->nativeIndexingLimit = text->chunkLength; 464 text->nativeIndexingLimit = text->chunkLength;
471 int64_t offset = nativeIndex - text->chunkNativeStart; 465 int64_t offset = nativeIndex - text->chunkNativeStart;
472 // Ensure chunk offset is well defined if computed offset exceeds int32_t 466 // Ensure chunk offset is well defined if computed offset exceeds int32_t
473 // range or chunk length. 467 // range or chunk length.
474 ASSERT(offset <= std::numeric_limits<int32_t>::max()); 468 ASSERT(offset <= std::numeric_limits<int32_t>::max());
475 text->chunkOffset = std::min(offset <= std::numeric_limits<int32_t>::max() 469 text->chunkOffset = std::min(offset <= std::numeric_limits<int32_t>::max()
476 ? static_cast<int32_t>(offset) 470 ? static_cast<int32_t>(offset)
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 "$Tel1 $TelV $Tel0;" // Telugu Virama (backward) 932 "$Tel1 $TelV $Tel0;" // Telugu Virama (backward)
939 "$Kan1 $KanV $Kan0;" // Kannada Virama (backward) 933 "$Kan1 $KanV $Kan0;" // Kannada Virama (backward)
940 "$Mal1 $MalV $Mal0;" // Malayalam Virama (backward) 934 "$Mal1 $MalV $Mal0;" // Malayalam Virama (backward)
941 "!!safe_reverse;" 935 "!!safe_reverse;"
942 "!!safe_forward;"; 936 "!!safe_forward;";
943 937
944 return setUpIteratorWithRules(kRules, string, length); 938 return setUpIteratorWithRules(kRules, string, length);
945 } 939 }
946 940
947 } // namespace blink 941 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698