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

Side by Side Diff: base/i18n/bidi_line_iterator.cc

Issue 10939010: Cleanup: avoid foo ? true : false, part 1. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rebase Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/component_updater/component_updater_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/i18n/bidi_line_iterator.h" 5 #include "base/i18n/bidi_line_iterator.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace base { 9 namespace base {
10 namespace i18n { 10 namespace i18n {
(...skipping 14 matching lines...) Expand all
25 DCHECK(!bidi_); 25 DCHECK(!bidi_);
26 UErrorCode error = U_ZERO_ERROR; 26 UErrorCode error = U_ZERO_ERROR;
27 bidi_ = ubidi_openSized(static_cast<int>(text.length()), 0, &error); 27 bidi_ = ubidi_openSized(static_cast<int>(text.length()), 0, &error);
28 if (U_FAILURE(error)) 28 if (U_FAILURE(error))
29 return false; 29 return false;
30 if (right_to_left && url) 30 if (right_to_left && url)
31 ubidi_setReorderingMode(bidi_, UBIDI_REORDER_RUNS_ONLY); 31 ubidi_setReorderingMode(bidi_, UBIDI_REORDER_RUNS_ONLY);
32 ubidi_setPara(bidi_, text.data(), static_cast<int>(text.length()), 32 ubidi_setPara(bidi_, text.data(), static_cast<int>(text.length()),
33 right_to_left ? UBIDI_DEFAULT_RTL : UBIDI_DEFAULT_LTR, 33 right_to_left ? UBIDI_DEFAULT_RTL : UBIDI_DEFAULT_LTR,
34 NULL, &error); 34 NULL, &error);
35 return U_SUCCESS(error) ? true : false; 35 return (U_SUCCESS(error) == TRUE);
36 } 36 }
37 37
38 int BiDiLineIterator::CountRuns() { 38 int BiDiLineIterator::CountRuns() {
39 DCHECK(bidi_ != NULL); 39 DCHECK(bidi_ != NULL);
40 UErrorCode error = U_ZERO_ERROR; 40 UErrorCode error = U_ZERO_ERROR;
41 const int runs = ubidi_countRuns(bidi_, &error); 41 const int runs = ubidi_countRuns(bidi_, &error);
42 return U_SUCCESS(error) ? runs : 0; 42 return U_SUCCESS(error) ? runs : 0;
43 } 43 }
44 44
45 UBiDiDirection BiDiLineIterator::GetVisualRun(int index, 45 UBiDiDirection BiDiLineIterator::GetVisualRun(int index,
46 int* start, 46 int* start,
47 int* length) { 47 int* length) {
48 DCHECK(bidi_ != NULL); 48 DCHECK(bidi_ != NULL);
49 return ubidi_getVisualRun(bidi_, index, start, length); 49 return ubidi_getVisualRun(bidi_, index, start, length);
50 } 50 }
51 51
52 void BiDiLineIterator::GetLogicalRun(int start, 52 void BiDiLineIterator::GetLogicalRun(int start,
53 int* end, 53 int* end,
54 UBiDiLevel* level) { 54 UBiDiLevel* level) {
55 DCHECK(bidi_ != NULL); 55 DCHECK(bidi_ != NULL);
56 ubidi_getLogicalRun(bidi_, start, end, level); 56 ubidi_getLogicalRun(bidi_, start, end, level);
57 } 57 }
58 58
59 } // namespace i18n 59 } // namespace i18n
60 } // namespace base 60 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/component_updater/component_updater_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698