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

Side by Side Diff: Source/core/xml/XPathFunctions.cpp

Issue 23464095: WTF::notFound looks too much like a local variable. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 | « Source/core/tests/ArenaTestHelpers.h ('k') | Source/core/xml/XPathParser.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org> 2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org>
3 * Copyright (C) 2006, 2009 Apple Inc. 3 * Copyright (C) 2006, 2009 Apple Inc.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 Value FunSubstringBefore::evaluate() const 471 Value FunSubstringBefore::evaluate() const
472 { 472 {
473 String s1 = arg(0)->evaluate().toString(); 473 String s1 = arg(0)->evaluate().toString();
474 String s2 = arg(1)->evaluate().toString(); 474 String s2 = arg(1)->evaluate().toString();
475 475
476 if (s2.isEmpty()) 476 if (s2.isEmpty())
477 return ""; 477 return "";
478 478
479 size_t i = s1.find(s2); 479 size_t i = s1.find(s2);
480 480
481 if (i == notFound) 481 if (i == kNotFound)
482 return ""; 482 return "";
483 483
484 return s1.left(i); 484 return s1.left(i);
485 } 485 }
486 486
487 Value FunSubstringAfter::evaluate() const 487 Value FunSubstringAfter::evaluate() const
488 { 488 {
489 String s1 = arg(0)->evaluate().toString(); 489 String s1 = arg(0)->evaluate().toString();
490 String s2 = arg(1)->evaluate().toString(); 490 String s2 = arg(1)->evaluate().toString();
491 491
492 size_t i = s1.find(s2); 492 size_t i = s1.find(s2);
493 if (i == notFound) 493 if (i == kNotFound)
494 return ""; 494 return "";
495 495
496 return s1.substring(i + s2.length()); 496 return s1.substring(i + s2.length());
497 } 497 }
498 498
499 Value FunSubstring::evaluate() const 499 Value FunSubstring::evaluate() const
500 { 500 {
501 String s = arg(0)->evaluate().toString(); 501 String s = arg(0)->evaluate().toString();
502 double doublePos = arg(1)->evaluate().toNumber(); 502 double doublePos = arg(1)->evaluate().toNumber();
503 if (std::isnan(doublePos)) 503 if (std::isnan(doublePos))
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 { 549 {
550 String s1 = arg(0)->evaluate().toString(); 550 String s1 = arg(0)->evaluate().toString();
551 String s2 = arg(1)->evaluate().toString(); 551 String s2 = arg(1)->evaluate().toString();
552 String s3 = arg(2)->evaluate().toString(); 552 String s3 = arg(2)->evaluate().toString();
553 StringBuilder result; 553 StringBuilder result;
554 554
555 for (unsigned i1 = 0; i1 < s1.length(); ++i1) { 555 for (unsigned i1 = 0; i1 < s1.length(); ++i1) {
556 UChar ch = s1[i1]; 556 UChar ch = s1[i1];
557 size_t i2 = s2.find(ch); 557 size_t i2 = s2.find(ch);
558 558
559 if (i2 == notFound) 559 if (i2 == kNotFound)
560 result.append(ch); 560 result.append(ch);
561 else if (i2 < s3.length()) 561 else if (i2 < s3.length())
562 result.append(s3[i2]); 562 result.append(s3[i2]);
563 } 563 }
564 564
565 return result.toString(); 565 return result.toString();
566 } 566 }
567 567
568 Value FunBoolean::evaluate() const 568 Value FunBoolean::evaluate() const
569 { 569 {
(...skipping 30 matching lines...) Expand all
600 if (!languageAttribute) 600 if (!languageAttribute)
601 return false; 601 return false;
602 602
603 String langValue = languageAttribute->value(); 603 String langValue = languageAttribute->value();
604 while (true) { 604 while (true) {
605 if (equalIgnoringCase(langValue, lang)) 605 if (equalIgnoringCase(langValue, lang))
606 return true; 606 return true;
607 607
608 // Remove suffixes one by one. 608 // Remove suffixes one by one.
609 size_t index = langValue.reverseFind('-'); 609 size_t index = langValue.reverseFind('-');
610 if (index == notFound) 610 if (index == kNotFound)
611 break; 611 break;
612 langValue = langValue.left(index); 612 langValue = langValue.left(index);
613 } 613 }
614 614
615 return false; 615 return false;
616 } 616 }
617 617
618 Value FunFalse::evaluate() const 618 Value FunFalse::evaluate() const
619 { 619 {
620 return false; 620 return false;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 return 0; 724 return 0;
725 725
726 Function* function = functionRec->factoryFn(); 726 Function* function = functionRec->factoryFn();
727 function->setArguments(args); 727 function->setArguments(args);
728 function->setName(name); 728 function->setName(name);
729 return function; 729 return function;
730 } 730 }
731 731
732 } 732 }
733 } 733 }
OLDNEW
« no previous file with comments | « Source/core/tests/ArenaTestHelpers.h ('k') | Source/core/xml/XPathParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698