summaryrefslogtreecommitdiffstats
path: root/net/flip/flip_framer.cc
diff options
context:
space:
mode:
authormbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-07 22:12:13 +0000
committermbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-07 22:12:13 +0000
commita23a90aeb11a1be89c52712c8866bbc195b422d5 (patch)
treec20bc592167d3e670dcd8ba4ce872759f71b4638 /net/flip/flip_framer.cc
parentb89b00b655ac2359585ae39f1ebdd65e93da0aa4 (diff)
downloadchromium_src-a23a90aeb11a1be89c52712c8866bbc195b422d5.zip
chromium_src-a23a90aeb11a1be89c52712c8866bbc195b422d5.tar.gz
chromium_src-a23a90aeb11a1be89c52712c8866bbc195b422d5.tar.bz2
Change many of the int and uint32 uses to size_t.
I think we should avoid using uint32 except where we're defining protocol elements which specifically are intended to be 32 bits. Using size_t for lengths is a good way to avoid any accidental signed/unsigned comparisons. This cleanup is a result of the linux port, which gets lots of unsigned/signed warnings (which we treat as errors). BUG=none TEST=none Review URL: http://codereview.chromium.org/263004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28318 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/flip/flip_framer.cc')
-rw-r--r--net/flip/flip_framer.cc26
1 files changed, 13 insertions, 13 deletions
diff --git a/net/flip/flip_framer.cc b/net/flip/flip_framer.cc
index a8a4dc8..393331e 100644
--- a/net/flip/flip_framer.cc
+++ b/net/flip/flip_framer.cc
@@ -15,10 +15,10 @@ namespace flip {
// The initial size of the control frame buffer; this is used internally
// as we we parse though control frames.
-static const int kControlFrameBufferInitialSize = 32 * 1024;
+static const size_t kControlFrameBufferInitialSize = 32 * 1024;
// The maximum size of the control frame buffer that we support.
// TODO(mbelshe): We should make this stream-based so there are no limits.
-static const int kControlFrameBufferMaxSize = 64 * 1024;
+static const size_t kControlFrameBufferMaxSize = 64 * 1024;
// This implementation of Flip is version 1.
static const int kFlipProtocolVersion = 1;
@@ -100,7 +100,7 @@ const char* FlipFramer::StateToString(int state) {
return "UNKNOWN_STATE";
}
-uint32 FlipFramer::BytesSafeToRead() const {
+size_t FlipFramer::BytesSafeToRead() const {
switch (state_) {
case FLIP_ERROR:
case FLIP_DONE:
@@ -148,11 +148,11 @@ const char* FlipFramer::ErrorCodeToString(int error_code) {
return "UNKNOWN_STATE";
}
-uint32 FlipFramer::ProcessInput(const char* data, uint32 len) {
+size_t FlipFramer::ProcessInput(const char* data, size_t len) {
DCHECK(visitor_);
DCHECK(data);
- uint32 original_len = len;
+ size_t original_len = len;
while (len != 0) {
FlipControlFrame* current_control_frame =
reinterpret_cast<FlipControlFrame*>(current_frame_buffer_);
@@ -240,7 +240,7 @@ uint32 FlipFramer::ProcessInput(const char* data, uint32 len) {
// intentional fallthrough
case FLIP_FORWARD_STREAM_FRAME:
if (remaining_payload_) {
- uint32 amount_to_forward = std::min(remaining_payload_, len);
+ size_t amount_to_forward = std::min(remaining_payload_, len);
if (amount_to_forward && state_ != FLIP_IGNORE_REMAINING_PAYLOAD) {
const FlipDataFrame* data_frame =
reinterpret_cast<const FlipDataFrame*>(current_data_frame);
@@ -290,7 +290,7 @@ uint32 FlipFramer::ProcessInput(const char* data, uint32 len) {
return original_len - len;
}
-uint32 FlipFramer::ProcessCommonHeader(const char* data, uint32 len) {
+size_t FlipFramer::ProcessCommonHeader(const char* data, size_t len) {
// This should only be called when we're in the FLIP_READING_COMMON_HEADER
// state.
DCHECK(state_ == FLIP_READING_COMMON_HEADER);
@@ -301,8 +301,8 @@ uint32 FlipFramer::ProcessCommonHeader(const char* data, uint32 len) {
do {
if (current_frame_len_ < sizeof(FlipFrame)) {
- uint32 bytes_desired = sizeof(FlipFrame) - current_frame_len_;
- uint32 bytes_to_append = std::min(bytes_desired, len);
+ size_t bytes_desired = sizeof(FlipFrame) - current_frame_len_;
+ size_t bytes_to_append = std::min(bytes_desired, len);
char* header_buffer = current_frame_buffer_;
memcpy(&header_buffer[current_frame_len_], data, bytes_to_append);
current_frame_len_ += bytes_to_append;
@@ -328,11 +328,11 @@ uint32 FlipFramer::ProcessCommonHeader(const char* data, uint32 len) {
return original_len - len;
}
-uint32 FlipFramer::ProcessControlFramePayload(const char* data, uint32 len) {
- int original_len = len;
+size_t FlipFramer::ProcessControlFramePayload(const char* data, size_t len) {
+ size_t original_len = len;
do {
if (remaining_control_payload_) {
- uint32 amount_to_consume = std::min(remaining_control_payload_, len);
+ size_t amount_to_consume = std::min(remaining_control_payload_, len);
memcpy(&current_frame_buffer_[current_frame_len_], data,
amount_to_consume);
current_frame_len_ += amount_to_consume;
@@ -351,7 +351,7 @@ uint32 FlipFramer::ProcessControlFramePayload(const char* data, uint32 len) {
return original_len - len;
}
-void FlipFramer::ExpandControlFrameBuffer(int size) {
+void FlipFramer::ExpandControlFrameBuffer(size_t size) {
DCHECK(size < kControlFrameBufferMaxSize);
if (size < current_frame_capacity_)
return;