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

Unified Diff: net/http/http_content_disposition.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: net/http/http_content_disposition.cc
diff --git a/net/http/http_content_disposition.cc b/net/http/http_content_disposition.cc
index 83098f4c4d8d302996c03caf9478b2a976e06d97..0c2629f112b970d35bc6cc1c8626ef7565941fe4 100644
--- a/net/http/http_content_disposition.cc
+++ b/net/http/http_content_disposition.cc
@@ -16,10 +16,7 @@
namespace {
-enum RFC2047EncodingType {
- Q_ENCODING,
- B_ENCODING
-};
+enum RFC2047EncodingType { Q_ENCODING, B_ENCODING };
// Decodes a "Q" encoded string as described in RFC 2047 section 4.2. Similar to
// decoding a quoted-printable string. Returns true if the input was valid.
@@ -35,8 +32,8 @@ bool DecodeQEncoding(const std::string& input, std::string* output) {
!IsHexDigit(static_cast<unsigned char>(*(it + 1))) ||
!IsHexDigit(static_cast<unsigned char>(*(it + 2))))
return false;
- unsigned char ch = HexDigitToInt(*(it + 1)) * 16 +
- HexDigitToInt(*(it + 2));
+ unsigned char ch =
+ HexDigitToInt(*(it + 1)) * 16 + HexDigitToInt(*(it + 2));
temp.push_back(static_cast<char>(ch));
++it;
++it;
@@ -63,8 +60,8 @@ bool DecodeBQEncoding(const std::string& part,
const std::string& charset,
std::string* output) {
std::string decoded;
- if (!((enc_type == B_ENCODING) ?
- base::Base64Decode(part, &decoded) : DecodeQEncoding(part, &decoded))) {
+ if (!((enc_type == B_ENCODING) ? base::Base64Decode(part, &decoded)
+ : DecodeQEncoding(part, &decoded))) {
return false;
}
@@ -93,8 +90,8 @@ bool DecodeWord(const std::string& encoded_word,
} else {
base::string16 utf16_output;
if (!referrer_charset.empty() &&
- net::ConvertToUTF16(encoded_word, referrer_charset.c_str(),
- &utf16_output)) {
+ net::ConvertToUTF16(
+ encoded_word, referrer_charset.c_str(), &utf16_output)) {
*output = base::UTF16ToUTF8(utf16_output);
} else {
*output = base::WideToUTF8(base::SysNativeMBToWide(encoded_word));
@@ -186,8 +183,8 @@ bool DecodeWord(const std::string& encoded_word,
// web browser.
// What IE6/7 does: %-escaped UTF-8.
- decoded_word = net::UnescapeURLComponent(encoded_word,
- net::UnescapeRule::SPACES);
+ decoded_word =
+ net::UnescapeURLComponent(encoded_word, net::UnescapeRule::SPACES);
if (decoded_word != encoded_word)
*parse_result_flags |=
net::HttpContentDisposition::HAS_PERCENT_ENCODED_STRINGS;
@@ -235,8 +232,11 @@ bool DecodeFilenameValue(const std::string& input,
// in a single encoded-word. Firefox/Thunderbird do not support
// it, either.
std::string decoded;
- if (!DecodeWord(t.token(), referrer_charset, &is_previous_token_rfc2047,
- &decoded, &current_parse_result_flags))
+ if (!DecodeWord(t.token(),
+ referrer_charset,
+ &is_previous_token_rfc2047,
+ &decoded,
+ &current_parse_result_flags))
return false;
decoded_value.append(decoded);
}
@@ -328,14 +328,14 @@ bool DecodeExtValue(const std::string& param_value, std::string* decoded) {
return net::ConvertToUtf8AndNormalize(unescaped, charset.c_str(), decoded);
}
-} // namespace
+} // namespace
namespace net {
HttpContentDisposition::HttpContentDisposition(
- const std::string& header, const std::string& referrer_charset)
- : type_(INLINE),
- parse_result_flags_(INVALID) {
+ const std::string& header,
+ const std::string& referrer_charset)
+ : type_(INLINE), parse_result_flags_(INVALID) {
Parse(header, referrer_charset);
}
@@ -343,7 +343,8 @@ HttpContentDisposition::~HttpContentDisposition() {
}
std::string::const_iterator HttpContentDisposition::ConsumeDispositionType(
- std::string::const_iterator begin, std::string::const_iterator end) {
+ std::string::const_iterator begin,
+ std::string::const_iterator end) {
DCHECK(type_ == INLINE);
std::string::const_iterator delimiter = std::find(begin, end, ';');
@@ -405,22 +406,21 @@ void HttpContentDisposition::Parse(const std::string& header,
HttpUtil::NameValuePairsIterator iter(pos, end, ';');
while (iter.GetNext()) {
- if (filename.empty() && LowerCaseEqualsASCII(iter.name_begin(),
- iter.name_end(),
- "filename")) {
- DecodeFilenameValue(iter.value(), referrer_charset, &filename,
- &parse_result_flags_);
+ if (filename.empty() &&
+ LowerCaseEqualsASCII(iter.name_begin(), iter.name_end(), "filename")) {
+ DecodeFilenameValue(
+ iter.value(), referrer_charset, &filename, &parse_result_flags_);
if (!filename.empty())
parse_result_flags_ |= HAS_FILENAME;
- } else if (name.empty() && LowerCaseEqualsASCII(iter.name_begin(),
- iter.name_end(),
- "name")) {
+ } else if (name.empty() &&
+ LowerCaseEqualsASCII(
+ iter.name_begin(), iter.name_end(), "name")) {
DecodeFilenameValue(iter.value(), referrer_charset, &name, NULL);
if (!name.empty())
parse_result_flags_ |= HAS_NAME;
- } else if (ext_filename.empty() && LowerCaseEqualsASCII(iter.name_begin(),
- iter.name_end(),
- "filename*")) {
+ } else if (ext_filename.empty() &&
+ LowerCaseEqualsASCII(
+ iter.name_begin(), iter.name_end(), "filename*")) {
DecodeExtValue(iter.raw_value(), &ext_filename);
if (!ext_filename.empty())
parse_result_flags_ |= HAS_EXT_FILENAME;

Powered by Google App Engine
This is Rietveld 408576698