Commit 30066396 authored by thestig@chromium.org's avatar thestig@chromium.org

Cleanup: Remove std::string("") usage and fix lint errors.

TBR=oshima@chromium.org,stevenjb@chromium.org,bajones@chromium.org,rch@chromium.org

Review URL: https://codereview.chromium.org/149573004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247844 0039d316-1c4b-4281-b951-d872f2087c98
parent 04bce56a
......@@ -79,7 +79,7 @@ struct DisplayInfoSortFunctor {
};
struct ResolutionMatcher {
ResolutionMatcher(const gfx::Size& size) : size(size) {}
explicit ResolutionMatcher(const gfx::Size& size) : size(size) {}
bool operator()(const Resolution& resolution) {
return resolution.size == size;
}
......@@ -87,7 +87,7 @@ struct ResolutionMatcher {
};
struct ScaleComparator {
ScaleComparator(float s) : scale(s) {}
explicit ScaleComparator(float s) : scale(s) {}
bool operator()(float s) const {
const float kEpsilon = 0.0001f;
......@@ -474,10 +474,8 @@ void DisplayManager::RegisterDisplayProperty(
float ui_scale,
const gfx::Insets* overscan_insets,
const gfx::Size& resolution_in_pixels) {
if (display_info_.find(display_id) == display_info_.end()) {
display_info_[display_id] =
DisplayInfo(display_id, std::string(""), false);
}
if (display_info_.find(display_id) == display_info_.end())
display_info_[display_id] = DisplayInfo(display_id, std::string(), false);
display_info_[display_id].set_rotation(rotation);
// Just in case the preference file was corrupted.
......@@ -705,7 +703,6 @@ void DisplayManager::UpdateDisplays(
(current_display_info.size_in_pixel() !=
new_display.GetSizeInPixel()) ||
(current_display.rotation() != new_display.rotation())) {
changed_display_indices.push_back(new_displays.size());
}
......@@ -975,9 +972,9 @@ void DisplayManager::AddMirrorDisplayInfoIfAny(
void DisplayManager::InsertAndUpdateDisplayInfo(const DisplayInfo& new_info) {
std::map<int64, DisplayInfo>::iterator info =
display_info_.find(new_info.id());
if (info != display_info_.end())
if (info != display_info_.end()) {
info->second.Copy(new_info);
else {
} else {
display_info_[new_info.id()] = new_info;
display_info_[new_info.id()].set_native(false);
}
......@@ -1015,7 +1012,7 @@ bool DisplayManager::UpdateSecondaryDisplayBoundsForLayout(
(id_at_zero == first_display_id_ ||
id_at_zero == gfx::Display::InternalDisplayId()) ?
std::make_pair(id_at_zero, displays->at(1).id()) :
std::make_pair(displays->at(1).id(), id_at_zero) ;
std::make_pair(displays->at(1).id(), id_at_zero);
DisplayLayout layout =
layout_store_->ComputeDisplayLayoutForDisplayIdPair(pair);
......
......@@ -51,17 +51,17 @@ const char kContextNetwork[] = "network";
// Reads a key from the input string erasing the read values + delimiters read
// from the initial string
std::string ReadKey(std::string* data) {
std::string key;
size_t equal_sign = data->find("=");
if (equal_sign == std::string::npos)
return std::string("");
std::string key = data->substr(0, equal_sign);
return key;
key = data->substr(0, equal_sign);
data->erase(0, equal_sign);
if (data->size() > 0) {
// erase the equal to sign also
data->erase(0,1);
if (data->empty())
return key;
}
return std::string();
// erase the equal to sign also
data->erase(0, 1);
return key;
}
// Reads a value from the input string; erasing the read values from
......@@ -93,7 +93,8 @@ std::string ReadValue(std::string* data) {
std::string value = data->substr(0, next_multi);
data->erase(0, next_multi + 3);
return value;
} else { // single line value
} else {
// single line value
size_t endl_pos = data->find_first_of(kNewLineChars);
// if we don't find a new line, we just return the rest of the data
std::string value = data->substr(0, endl_pos);
......
......@@ -359,7 +359,7 @@ TEST_F(NetworkConfigurationHandlerTest, CreateConfiguration) {
network_configuration_handler_->CreateConfiguration(
value,
base::Bind(&StringResultCallback, std::string("/service/2")),
base::Bind(&ErrorCallback, false, std::string("")));
base::Bind(&ErrorCallback, false, std::string()));
message_loop_.RunUntilIdle();
}
......
......@@ -21,7 +21,7 @@ void DebugMarkerManager::Group::SetMarker(const std::string& marker) {
DebugMarkerManager::DebugMarkerManager() {
// Push root group.
group_stack_.push(Group(std::string("")));
group_stack_.push(Group(std::string()));
}
DebugMarkerManager::~DebugMarkerManager() {
......
......@@ -94,7 +94,7 @@ TEST_F(CtSerializationTest, EncodesV1SCTSignedData) {
base::Time timestamp = base::Time::UnixEpoch() +
base::TimeDelta::FromMilliseconds(1348589665525);
std::string dummy_entry("abc");
std::string empty_extensions("");
std::string empty_extensions;
// For now, no known failure cases.
std::string encoded;
ASSERT_TRUE(ct::EncodeV1SCTSignedData(
......@@ -145,7 +145,7 @@ TEST_F(CtSerializationTest, DecodesSignedCertificateTimestamp) {
// Subtracting 4 bytes for signature data (hash & sig algs),
// actual signature data should be 71 bytes.
EXPECT_EQ((size_t) 71, sct->signature.signature_data.size());
EXPECT_EQ(std::string(""), sct->extensions);
EXPECT_TRUE(sct->extensions.empty());
}
TEST_F(CtSerializationTest, FailsDecodingInvalidSignedCertificateTimestamp) {
......@@ -162,5 +162,5 @@ TEST_F(CtSerializationTest, FailsDecodingInvalidSignedCertificateTimestamp) {
ct::DecodeSignedCertificateTimestamp(&invalid_length_sct, &sct));
}
} // namespace net
} // namespace net
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment