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

Side by Side Diff: third_party/WebKit/Source/platform/network/HTTPParsers.cpp

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 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) 2006 Alexey Proskuryakov (ap@webkit.org) 2 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
3 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
4 * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 4 * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
5 * Copyright (C) 2009 Google Inc. All rights reserved. 5 * Copyright (C) 2009 Google Inc. All rights reserved.
6 * Copyright (C) 2011 Apple Inc. All Rights Reserved. 6 * Copyright (C) 2011 Apple Inc. All Rights Reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 pos += 7; 447 pos += 7;
448 448
449 // skip whitespace 449 // skip whitespace
450 while (pos != length && mediaType[pos] <= ' ') 450 while (pos != length && mediaType[pos] <= ' ')
451 ++pos; 451 ++pos;
452 452
453 if (mediaType[pos++] != '=') // this "charset" substring wasn't a parameter 453 if (mediaType[pos++] != '=') // this "charset" substring wasn't a parameter
454 // name, but there may be others 454 // name, but there may be others
455 continue; 455 continue;
456 456
457 while (pos != length && (mediaType[pos] <= ' ' || mediaType[pos] == '"' || 457 while (pos != length &&
458 mediaType[pos] == '\'')) 458 (mediaType[pos] <= ' ' || mediaType[pos] == '"' ||
459 mediaType[pos] == '\''))
459 ++pos; 460 ++pos;
460 461
461 // we don't handle spaces within quoted parameter values, because charset 462 // we don't handle spaces within quoted parameter values, because charset
462 // names cannot have any 463 // names cannot have any
463 unsigned endpos = pos; 464 unsigned endpos = pos;
464 while (pos != length && mediaType[endpos] > ' ' && 465 while (pos != length && mediaType[endpos] > ' ' &&
465 mediaType[endpos] != '"' && mediaType[endpos] != '\'' && 466 mediaType[endpos] != '"' && mediaType[endpos] != '\'' &&
466 mediaType[endpos] != ';') 467 mediaType[endpos] != ';')
467 ++endpos; 468 ++endpos;
468 469
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 .stripWhiteSpace()); 633 .stripWhiteSpace());
633 pos += nextEqualSignPosition - pos + 1; 634 pos += nextEqualSignPosition - pos + 1;
634 635
635 String value = safeHeader.substring(pos, max - pos).stripWhiteSpace(); 636 String value = safeHeader.substring(pos, max - pos).stripWhiteSpace();
636 if (value[0] == '"') { 637 if (value[0] == '"') {
637 // The value is a quoted string 638 // The value is a quoted string
638 size_t nextDoubleQuotePosition = value.find('"', 1); 639 size_t nextDoubleQuotePosition = value.find('"', 1);
639 if (nextDoubleQuotePosition != kNotFound) { 640 if (nextDoubleQuotePosition != kNotFound) {
640 // Store the value as a quoted string without quotes 641 // Store the value as a quoted string without quotes
641 result.push_back(std::pair<String, String>( 642 result.push_back(std::pair<String, String>(
642 directive, value.substring(1, nextDoubleQuotePosition - 1) 643 directive,
643 .stripWhiteSpace())); 644 value.substring(1, nextDoubleQuotePosition - 1)
645 .stripWhiteSpace()));
644 pos += 646 pos +=
645 (safeHeader.find('"', pos) - pos) + nextDoubleQuotePosition + 1; 647 (safeHeader.find('"', pos) - pos) + nextDoubleQuotePosition + 1;
646 // Move past next comma, if there is one 648 // Move past next comma, if there is one
647 size_t nextCommaPosition2 = safeHeader.find(',', pos); 649 size_t nextCommaPosition2 = safeHeader.find(',', pos);
648 if (nextCommaPosition2 != kNotFound) 650 if (nextCommaPosition2 != kNotFound)
649 pos += nextCommaPosition2 - pos + 1; 651 pos += nextCommaPosition2 - pos + 1;
650 else 652 else
651 return; // Parse error if there is anything left with no comma 653 return; // Parse error if there is anything left with no comma
652 } else { 654 } else {
653 // Parse error; just use the rest as the value 655 // Parse error; just use the rest as the value
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 bool parseContentRangeHeaderFor206(const String& contentRange, 881 bool parseContentRangeHeaderFor206(const String& contentRange,
880 int64_t* firstBytePosition, 882 int64_t* firstBytePosition,
881 int64_t* lastBytePosition, 883 int64_t* lastBytePosition,
882 int64_t* instanceLength) { 884 int64_t* instanceLength) {
883 return net::HttpUtil::ParseContentRangeHeaderFor206( 885 return net::HttpUtil::ParseContentRangeHeaderFor206(
884 StringUTF8Adaptor(contentRange).asStringPiece(), firstBytePosition, 886 StringUTF8Adaptor(contentRange).asStringPiece(), firstBytePosition,
885 lastBytePosition, instanceLength); 887 lastBytePosition, instanceLength);
886 } 888 }
887 889
888 } // namespace blink 890 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698