Chromium Code Reviews| Index: base/i18n/rtl.cc |
| diff --git a/base/i18n/rtl.cc b/base/i18n/rtl.cc |
| index 851b03642defb3ce43742b1a74405e8f05362cd5..75a6b15a3082b7a9b88a0e7b09025faa6365a11f 100644 |
| --- a/base/i18n/rtl.cc |
| +++ b/base/i18n/rtl.cc |
| @@ -261,17 +261,19 @@ bool AdjustStringForLocaleDirection(string16* text) { |
| bool ui_direction_is_rtl = IsRTL(); |
| bool has_rtl_chars = StringContainsStrongRTLChars(*text); |
| + const size_t pos = 0; |
| + const size_t num = 1; |
| if (!ui_direction_is_rtl && has_rtl_chars) { |
| WrapStringWithRTLFormatting(text); |
| - text->insert(0U, 1U, kLeftToRightMark); |
| + text->insert(pos, num, kLeftToRightMark); |
|
rmcilroy
2014/02/25 11:01:37
Is this change really necessary? This file is alr
rmcilroy
2014/02/26 15:14:31
Please just do a static_cast<size_t>(0) here (and
|
| text->push_back(kLeftToRightMark); |
| } else if (ui_direction_is_rtl && has_rtl_chars) { |
| WrapStringWithRTLFormatting(text); |
| - text->insert(0U, 1U, kRightToLeftMark); |
| + text->insert(pos, num, kRightToLeftMark); |
| text->push_back(kRightToLeftMark); |
| } else if (ui_direction_is_rtl) { |
| WrapStringWithLTRFormatting(text); |
| - text->insert(0U, 1U, kRightToLeftMark); |
| + text->insert(pos, num, kRightToLeftMark); |
| text->push_back(kRightToLeftMark); |
| } else { |
| return false; |
| @@ -332,7 +334,8 @@ void WrapStringWithLTRFormatting(string16* text) { |
| return; |
| // Inserting an LRE (Left-To-Right Embedding) mark as the first character. |
| - text->insert(0U, 1U, kLeftToRightEmbeddingMark); |
| + text->insert(static_cast<size_t>(0), static_cast<size_t>(1), |
| + kLeftToRightEmbeddingMark); |
| // Inserting a PDF (Pop Directional Formatting) mark as the last character. |
| text->push_back(kPopDirectionalFormatting); |
| @@ -343,7 +346,8 @@ void WrapStringWithRTLFormatting(string16* text) { |
| return; |
| // Inserting an RLE (Right-To-Left Embedding) mark as the first character. |
| - text->insert(0U, 1U, kRightToLeftEmbeddingMark); |
| + text->insert(static_cast<size_t>(0), static_cast<size_t>(1), |
| + kRightToLeftEmbeddingMark); |
| // Inserting a PDF (Pop Directional Formatting) mark as the last character. |
| text->push_back(kPopDirectionalFormatting); |