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

Unified Diff: Source/modules/websockets/DOMWebSocket.cpp

Issue 735433002: DOMWebSocket::bufferedAmount() should not return an "unsigned long" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « Source/modules/websockets/DOMWebSocket.h ('k') | Source/modules/websockets/DOMWebSocketTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/websockets/DOMWebSocket.cpp
diff --git a/Source/modules/websockets/DOMWebSocket.cpp b/Source/modules/websockets/DOMWebSocket.cpp
index 4ac91877ab57d6ddc6489c4b69561437e3c8307c..a95e3d767d6ab8afcf11c78bb2020cb36438bfa1 100644
--- a/Source/modules/websockets/DOMWebSocket.cpp
+++ b/Source/modules/websockets/DOMWebSocket.cpp
@@ -205,10 +205,10 @@ static String joinStrings(const Vector<String>& strings, const char* separator)
return builder.toString();
}
-static unsigned long saturateAdd(unsigned long a, unsigned long b)
tyoshino (SeeGerritForStatus) 2014/11/17 14:15:32 please leave the second argument type "unsigned lo
Paritosh Kumar 2014/11/18 09:38:44 Thanks Done.
+static unsigned saturateAdd(unsigned a, unsigned b)
{
- if (std::numeric_limits<unsigned long>::max() - a < b)
- return std::numeric_limits<unsigned long>::max();
+ if (std::numeric_limits<unsigned>::max() - a < b)
+ return std::numeric_limits<unsigned>::max();
return a + b;
}
@@ -349,7 +349,7 @@ void DOMWebSocket::connect(const String& url, const Vector<String>& protocols, E
}
}
-void DOMWebSocket::updateBufferedAmountAfterClose(unsigned long payloadSize)
tyoshino (SeeGerritForStatus) 2014/11/17 14:15:32 please leave this unchanged
Paritosh Kumar 2014/11/18 09:38:44 Done.
+void DOMWebSocket::updateBufferedAmountAfterClose(unsigned payloadSize)
{
m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, payloadSize);
m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, getFramingOverhead(payloadSize));
@@ -500,7 +500,7 @@ DOMWebSocket::State DOMWebSocket::readyState() const
return m_state;
}
-unsigned long DOMWebSocket::bufferedAmount() const
+unsigned DOMWebSocket::bufferedAmount() const
{
return saturateAdd(m_bufferedAmount, m_bufferedAmountAfterClose);
}
« no previous file with comments | « Source/modules/websockets/DOMWebSocket.h ('k') | Source/modules/websockets/DOMWebSocketTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698