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

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

Issue 2811453002: Replace ASSERT, ASSERT_NOT_REACHED, and RELEASE_ASSERT in platform/text (Closed)
Patch Set: test Created 3 years, 8 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 static String ConvertWindowsDateTimeFormat(const String& format) { 200 static String ConvertWindowsDateTimeFormat(const String& format) {
201 StringBuilder converted; 201 StringBuilder converted;
202 StringBuilder literal_buffer; 202 StringBuilder literal_buffer;
203 bool in_quote = false; 203 bool in_quote = false;
204 bool last_quote_can_be_literal = false; 204 bool last_quote_can_be_literal = false;
205 for (unsigned i = 0; i < format.length(); ++i) { 205 for (unsigned i = 0; i < format.length(); ++i) {
206 UChar ch = format[i]; 206 UChar ch = format[i];
207 if (in_quote) { 207 if (in_quote) {
208 if (ch == '\'') { 208 if (ch == '\'') {
209 in_quote = false; 209 in_quote = false;
210 ASSERT(i); 210 DCHECK(i);
211 if (last_quote_can_be_literal && format[i - 1] == '\'') { 211 if (last_quote_can_be_literal && format[i - 1] == '\'') {
212 literal_buffer.Append('\''); 212 literal_buffer.Append('\'');
213 last_quote_can_be_literal = false; 213 last_quote_can_be_literal = false;
214 } else { 214 } else {
215 last_quote_can_be_literal = true; 215 last_quote_can_be_literal = true;
216 } 216 }
217 } else { 217 } else {
218 literal_buffer.Append(ch); 218 literal_buffer.Append(ch);
219 } 219 }
220 continue; 220 continue;
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 symbols.push_back("2"); 444 symbols.push_back("2");
445 symbols.push_back("3"); 445 symbols.push_back("3");
446 symbols.push_back("4"); 446 symbols.push_back("4");
447 symbols.push_back("5"); 447 symbols.push_back("5");
448 symbols.push_back("6"); 448 symbols.push_back("6");
449 symbols.push_back("7"); 449 symbols.push_back("7");
450 symbols.push_back("8"); 450 symbols.push_back("8");
451 symbols.push_back("9"); 451 symbols.push_back("9");
452 } else { 452 } else {
453 String digits = GetLocaleInfoString(LOCALE_SNATIVEDIGITS); 453 String digits = GetLocaleInfoString(LOCALE_SNATIVEDIGITS);
454 ASSERT(digits.length() >= 10); 454 DCHECK_GE(digits.length(), 10u);
455 for (unsigned i = 0; i < 10; ++i) 455 for (unsigned i = 0; i < 10; ++i)
456 symbols.push_back(digits.Substring(i, 1)); 456 symbols.push_back(digits.Substring(i, 1));
457 } 457 }
458 ASSERT(symbols.size() == kDecimalSeparatorIndex); 458 DCHECK(symbols.size() == kDecimalSeparatorIndex);
459 symbols.push_back(GetLocaleInfoString(LOCALE_SDECIMAL)); 459 symbols.push_back(GetLocaleInfoString(LOCALE_SDECIMAL));
460 ASSERT(symbols.size() == kGroupSeparatorIndex); 460 DCHECK(symbols.size() == kGroupSeparatorIndex);
461 symbols.push_back(GetLocaleInfoString(LOCALE_STHOUSAND)); 461 symbols.push_back(GetLocaleInfoString(LOCALE_STHOUSAND));
462 ASSERT(symbols.size() == kDecimalSymbolsSize); 462 DCHECK(symbols.size() == kDecimalSymbolsSize);
463 463
464 String negative_sign = GetLocaleInfoString(LOCALE_SNEGATIVESIGN); 464 String negative_sign = GetLocaleInfoString(LOCALE_SNEGATIVESIGN);
465 enum NegativeFormat { 465 enum NegativeFormat {
466 kNegativeFormatParenthesis = 0, 466 kNegativeFormatParenthesis = 0,
467 kNegativeFormatSignPrefix = 1, 467 kNegativeFormatSignPrefix = 1,
468 kNegativeFormatSignSpacePrefix = 2, 468 kNegativeFormatSignSpacePrefix = 2,
469 kNegativeFormatSignSuffix = 3, 469 kNegativeFormatSignSuffix = 3,
470 kNegativeFormatSpaceSignSuffix = 4, 470 kNegativeFormatSpaceSignSuffix = 4,
471 }; 471 };
472 DWORD negative_format = kNegativeFormatSignPrefix; 472 DWORD negative_format = kNegativeFormatSignPrefix;
(...skipping 17 matching lines...) Expand all
490 case kNegativeFormatSignPrefix: // Fall through. 490 case kNegativeFormatSignPrefix: // Fall through.
491 default: 491 default:
492 negative_prefix = negative_sign; 492 negative_prefix = negative_sign;
493 break; 493 break;
494 } 494 }
495 did_initialize_number_data_ = true; 495 did_initialize_number_data_ = true;
496 SetLocaleData(symbols, g_empty_string, g_empty_string, negative_prefix, 496 SetLocaleData(symbols, g_empty_string, g_empty_string, negative_prefix,
497 negative_suffix); 497 negative_suffix);
498 } 498 }
499 } 499 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698