summaryrefslogtreecommitdiffstats
path: root/net/websockets
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-04 21:03:47 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-04 21:03:47 +0000
commit6775e40aeb887f15dc9182b250cdc4100aa79ce0 (patch)
tree858e3064689861a9ad85975154ce653418aaf3d8 /net/websockets
parent5bd8d1716b3f27664348c7fcb2c33f2e3a4573a7 (diff)
downloadchromium_src-6775e40aeb887f15dc9182b250cdc4100aa79ce0.zip
chromium_src-6775e40aeb887f15dc9182b250cdc4100aa79ce0.tar.gz
chromium_src-6775e40aeb887f15dc9182b250cdc4100aa79ce0.tar.bz2
Change other usages of .size() to .empty() when applicable.
BUG=carnitas TEST=compiles Review URL: http://codereview.chromium.org/6609008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76962 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/websockets')
-rw-r--r--net/websockets/websocket_handshake_handler.cc22
-rw-r--r--net/websockets/websocket_job.cc2
2 files changed, 12 insertions, 12 deletions
diff --git a/net/websockets/websocket_handshake_handler.cc b/net/websockets/websocket_handshake_handler.cc
index 734b93e..68b0445 100644
--- a/net/websockets/websocket_handshake_handler.cc
+++ b/net/websockets/websocket_handshake_handler.cc
@@ -174,14 +174,14 @@ size_t WebSocketHandshakeRequestHandler::original_length() const {
void WebSocketHandshakeRequestHandler::AppendHeaderIfMissing(
const std::string& name, const std::string& value) {
- DCHECK(headers_.size() > 0);
+ DCHECK(!headers_.empty());
HttpUtil::AppendHeaderIfMissing(name.c_str(), value, &headers_);
}
void WebSocketHandshakeRequestHandler::RemoveHeaders(
const char* const headers_to_remove[],
size_t headers_to_remove_len) {
- DCHECK(headers_.size() > 0);
+ DCHECK(!headers_.empty());
headers_ = FilterHeaders(
headers_, headers_to_remove, headers_to_remove_len);
}
@@ -267,8 +267,8 @@ bool WebSocketHandshakeRequestHandler::GetRequestHeaderBlock(
}
std::string WebSocketHandshakeRequestHandler::GetRawRequest() {
- DCHECK(status_line_.size() > 0);
- DCHECK(headers_.size() > 0);
+ DCHECK(!status_line_.empty());
+ DCHECK(!headers_.empty());
DCHECK_EQ(kRequestKey3Size, key3_.size());
std::string raw_request = status_line_ + headers_ + "\r\n" + key3_;
raw_length_ = raw_request.size();
@@ -290,8 +290,8 @@ size_t WebSocketHandshakeResponseHandler::ParseRawResponse(
const char* data, int length) {
DCHECK_GT(length, 0);
if (HasResponse()) {
- DCHECK(status_line_.size() > 0);
- DCHECK(headers_.size() > 0);
+ DCHECK(!status_line_.empty());
+ DCHECK(!headers_.empty());
DCHECK_EQ(kResponseKeySize, key_.size());
return 0;
}
@@ -397,8 +397,8 @@ void WebSocketHandshakeResponseHandler::GetHeaders(
size_t headers_to_get_len,
std::vector<std::string>* values) {
DCHECK(HasResponse());
- DCHECK(status_line_.size() > 0);
- DCHECK(headers_.size() > 0);
+ DCHECK(!status_line_.empty());
+ DCHECK(!headers_.empty());
DCHECK_EQ(kResponseKeySize, key_.size());
FetchHeaders(headers_, headers_to_get, headers_to_get_len, values);
@@ -408,8 +408,8 @@ void WebSocketHandshakeResponseHandler::RemoveHeaders(
const char* const headers_to_remove[],
size_t headers_to_remove_len) {
DCHECK(HasResponse());
- DCHECK(status_line_.size() > 0);
- DCHECK(headers_.size() > 0);
+ DCHECK(!status_line_.empty());
+ DCHECK(!headers_.empty());
DCHECK_EQ(kResponseKeySize, key_.size());
headers_ = FilterHeaders(headers_, headers_to_remove, headers_to_remove_len);
@@ -423,7 +423,7 @@ std::string WebSocketHandshakeResponseHandler::GetRawResponse() const {
std::string WebSocketHandshakeResponseHandler::GetResponse() {
DCHECK(HasResponse());
- DCHECK(status_line_.size() > 0);
+ DCHECK(!status_line_.empty());
// headers_ might be empty for wrong response from server.
DCHECK_EQ(kResponseKeySize, key_.size());
diff --git a/net/websockets/websocket_job.cc b/net/websockets/websocket_job.cc
index 44c944d..8379523 100644
--- a/net/websockets/websocket_job.cc
+++ b/net/websockets/websocket_job.cc
@@ -234,7 +234,7 @@ void WebSocketJob::OnReceivedData(
receive_frame_handler_->GetCurrentBufferSize());
receive_frame_handler_->ReleaseCurrentBuffer();
}
- if (delegate_ && received_data.size() > 0)
+ if (delegate_ && !received_data.empty())
delegate_->OnReceivedData(
socket, received_data.data(), received_data.size());
}