buffet: remove unnecessary NOLINTs and restored some C++11 code
The old cpplint was issuing a lot of false-positives for new C++11
features and I had to either explicitly disable the warning or
work around them (e.g. instead of using uniform initialization,
I used a normal constructor syntax with initializer list inside).
These redundancies are no longer needed since the linter has been
updated.
Also removed some of auto&& from loops because the new
cpplint complains about RValue references.
BUG=None
TEST=Unit tests still pass.
Change-Id: Ibe9538e3e1cb793be807a23e82627444e663934c
Reviewed-on: https://chromium-review.googlesource.com/203797
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/buffet/data_encoding.cc b/buffet/data_encoding.cc
index 9f351de..f2de937 100644
--- a/buffet/data_encoding.cc
+++ b/buffet/data_encoding.cc
@@ -77,7 +77,7 @@
bool encodeSpaceAsPlus) {
std::vector<std::string> pairs;
pairs.reserve(params.size());
- for (auto&& p : params) {
+ for (const auto& p : params) {
std::string key = UrlEncode(p.first.c_str(), encodeSpaceAsPlus);
std::string value = UrlEncode(p.second.c_str(), encodeSpaceAsPlus);
pairs.push_back(string_utils::Join('=', key, value));
@@ -89,7 +89,7 @@
WebParamList WebParamsDecode(const std::string& data) {
WebParamList result;
std::vector<std::string> params = string_utils::Split(data, '&');
- for (auto p : params) {
+ for (const auto& p : params) {
auto pair = string_utils::SplitAtFirst(p, '=');
result.emplace_back(UrlDecode(pair.first.c_str()),
UrlDecode(pair.second.c_str()));