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

Side by Side Diff: Source/core/platform/network/ResourceResponse.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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Google Inc. All rights reserved. 3 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 m_haveParsedLastModifiedHeader = true; 467 m_haveParsedLastModifiedHeader = true;
468 } 468 }
469 return m_lastModified; 469 return m_lastModified;
470 } 470 }
471 471
472 bool ResourceResponse::isAttachment() const 472 bool ResourceResponse::isAttachment() const
473 { 473 {
474 DEFINE_STATIC_LOCAL(const AtomicString, headerName, ("content-disposition", AtomicString::ConstructFromLiteral)); 474 DEFINE_STATIC_LOCAL(const AtomicString, headerName, ("content-disposition", AtomicString::ConstructFromLiteral));
475 String value = m_httpHeaderFields.get(headerName); 475 String value = m_httpHeaderFields.get(headerName);
476 size_t loc = value.find(';'); 476 size_t loc = value.find(';');
477 if (loc != notFound) 477 if (loc != kNotFound)
478 value = value.left(loc); 478 value = value.left(loc);
479 value = value.stripWhiteSpace(); 479 value = value.stripWhiteSpace();
480 DEFINE_STATIC_LOCAL(const AtomicString, attachmentString, ("attachment", Ato micString::ConstructFromLiteral)); 480 DEFINE_STATIC_LOCAL(const AtomicString, attachmentString, ("attachment", Ato micString::ConstructFromLiteral));
481 return equalIgnoringCase(value, attachmentString); 481 return equalIgnoringCase(value, attachmentString);
482 } 482 }
483 483
484 void ResourceResponse::setLastModifiedDate(time_t lastModifiedDate) 484 void ResourceResponse::setLastModifiedDate(time_t lastModifiedDate)
485 { 485 {
486 m_lastModifiedDate = lastModifiedDate; 486 m_lastModifiedDate = lastModifiedDate;
487 } 487 }
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 return str.substring(0, str.find(isCacheHeaderSeparator)); 620 return str.substring(0, str.find(isCacheHeaderSeparator));
621 } 621 }
622 622
623 static void parseCacheHeader(const String& header, Vector<pair<String, String> > & result) 623 static void parseCacheHeader(const String& header, Vector<pair<String, String> > & result)
624 { 624 {
625 const String safeHeader = header.removeCharacters(isControlCharacter); 625 const String safeHeader = header.removeCharacters(isControlCharacter);
626 unsigned max = safeHeader.length(); 626 unsigned max = safeHeader.length();
627 for (unsigned pos = 0; pos < max; /* pos incremented in loop */) { 627 for (unsigned pos = 0; pos < max; /* pos incremented in loop */) {
628 size_t nextCommaPosition = safeHeader.find(',', pos); 628 size_t nextCommaPosition = safeHeader.find(',', pos);
629 size_t nextEqualSignPosition = safeHeader.find('=', pos); 629 size_t nextEqualSignPosition = safeHeader.find('=', pos);
630 if (nextEqualSignPosition != notFound && (nextEqualSignPosition < nextCo mmaPosition || nextCommaPosition == notFound)) { 630 if (nextEqualSignPosition != kNotFound && (nextEqualSignPosition < nextC ommaPosition || nextCommaPosition == kNotFound)) {
631 // Get directive name, parse right hand side of equal sign, then add to map 631 // Get directive name, parse right hand side of equal sign, then add to map
632 String directive = trimToNextSeparator(safeHeader.substring(pos, nex tEqualSignPosition - pos).stripWhiteSpace()); 632 String directive = trimToNextSeparator(safeHeader.substring(pos, nex tEqualSignPosition - pos).stripWhiteSpace());
633 pos += nextEqualSignPosition - pos + 1; 633 pos += nextEqualSignPosition - pos + 1;
634 634
635 String value = safeHeader.substring(pos, max - pos).stripWhiteSpace( ); 635 String value = safeHeader.substring(pos, max - pos).stripWhiteSpace( );
636 if (value[0] == '"') { 636 if (value[0] == '"') {
637 // The value is a quoted string 637 // The value is a quoted string
638 size_t nextDoubleQuotePosition = value.find('"', 1); 638 size_t nextDoubleQuotePosition = value.find('"', 1);
639 if (nextDoubleQuotePosition != notFound) { 639 if (nextDoubleQuotePosition != kNotFound) {
640 // Store the value as a quoted string without quotes 640 // Store the value as a quoted string without quotes
641 result.append(pair<String, String>(directive, value.substrin g(1, nextDoubleQuotePosition - 1).stripWhiteSpace())); 641 result.append(pair<String, String>(directive, value.substrin g(1, nextDoubleQuotePosition - 1).stripWhiteSpace()));
642 pos += (safeHeader.find('"', pos) - pos) + nextDoubleQuotePo sition + 1; 642 pos += (safeHeader.find('"', pos) - pos) + nextDoubleQuotePo sition + 1;
643 // Move past next comma, if there is one 643 // Move past next comma, if there is one
644 size_t nextCommaPosition2 = safeHeader.find(',', pos); 644 size_t nextCommaPosition2 = safeHeader.find(',', pos);
645 if (nextCommaPosition2 != notFound) 645 if (nextCommaPosition2 != kNotFound)
646 pos += nextCommaPosition2 - pos + 1; 646 pos += nextCommaPosition2 - pos + 1;
647 else 647 else
648 return; // Parse error if there is anything left with no comma 648 return; // Parse error if there is anything left with no comma
649 } else { 649 } else {
650 // Parse error; just use the rest as the value 650 // Parse error; just use the rest as the value
651 result.append(pair<String, String>(directive, trimToNextSepa rator(value.substring(1, value.length() - 1).stripWhiteSpace()))); 651 result.append(pair<String, String>(directive, trimToNextSepa rator(value.substring(1, value.length() - 1).stripWhiteSpace())));
652 return; 652 return;
653 } 653 }
654 } else { 654 } else {
655 // The value is a token until the next comma 655 // The value is a token until the next comma
656 size_t nextCommaPosition2 = value.find(','); 656 size_t nextCommaPosition2 = value.find(',');
657 if (nextCommaPosition2 != notFound) { 657 if (nextCommaPosition2 != kNotFound) {
658 // The value is delimited by the next comma 658 // The value is delimited by the next comma
659 result.append(pair<String, String>(directive, trimToNextSepa rator(value.substring(0, nextCommaPosition2).stripWhiteSpace()))); 659 result.append(pair<String, String>(directive, trimToNextSepa rator(value.substring(0, nextCommaPosition2).stripWhiteSpace())));
660 pos += (safeHeader.find(',', pos) - pos) + 1; 660 pos += (safeHeader.find(',', pos) - pos) + 1;
661 } else { 661 } else {
662 // The rest is the value; no change to value needed 662 // The rest is the value; no change to value needed
663 result.append(pair<String, String>(directive, trimToNextSepa rator(value))); 663 result.append(pair<String, String>(directive, trimToNextSepa rator(value)));
664 return; 664 return;
665 } 665 }
666 } 666 }
667 } else if (nextCommaPosition != notFound && (nextCommaPosition < nextEqu alSignPosition || nextEqualSignPosition == notFound)) { 667 } else if (nextCommaPosition != kNotFound && (nextCommaPosition < nextEq ualSignPosition || nextEqualSignPosition == kNotFound)) {
668 // Add directive to map with empty string as value 668 // Add directive to map with empty string as value
669 result.append(pair<String, String>(trimToNextSeparator(safeHeader.su bstring(pos, nextCommaPosition - pos).stripWhiteSpace()), "")); 669 result.append(pair<String, String>(trimToNextSeparator(safeHeader.su bstring(pos, nextCommaPosition - pos).stripWhiteSpace()), ""));
670 pos += nextCommaPosition - pos + 1; 670 pos += nextCommaPosition - pos + 1;
671 } else { 671 } else {
672 // Add last directive to map with empty string as value 672 // Add last directive to map with empty string as value
673 result.append(pair<String, String>(trimToNextSeparator(safeHeader.su bstring(pos, max - pos).stripWhiteSpace()), "")); 673 result.append(pair<String, String>(trimToNextSeparator(safeHeader.su bstring(pos, max - pos).stripWhiteSpace()), ""));
674 return; 674 return;
675 } 675 }
676 } 676 }
677 } 677 }
678 678
679 } 679 }
OLDNEW
« no previous file with comments | « Source/core/platform/network/ParsedContentType.cpp ('k') | Source/core/platform/text/DateTimeFormat.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698