diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc index 2550ca313a2c72..8c976b2e9f0b4c 100644 --- a/src/node_http_parser.cc +++ b/src/node_http_parser.cc @@ -189,7 +189,7 @@ class Parser : public BaseObject { if (num_fields_ == num_values_) { // start of new field name num_fields_++; - if (num_fields_ == static_cast(arraysize(fields_))) { + if (num_fields_ == arraysize(fields_)) { // ran out of space - flush to javascript land Flush(); num_fields_ = 1; @@ -198,7 +198,7 @@ class Parser : public BaseObject { fields_[num_fields_ - 1].Reset(); } - CHECK_LT(num_fields_, static_cast(arraysize(fields_))); + CHECK_LT(num_fields_, arraysize(fields_)); CHECK_EQ(num_fields_, num_values_ + 1); fields_[num_fields_ - 1].Update(at, length); @@ -214,7 +214,7 @@ class Parser : public BaseObject { values_[num_values_ - 1].Reset(); } - CHECK_LT(num_values_, static_cast(arraysize(values_))); + CHECK_LT(num_values_, arraysize(values_)); CHECK_EQ(num_values_, num_fields_); values_[num_values_ - 1].Update(at, length); @@ -377,11 +377,11 @@ class Parser : public BaseObject { url_.Save(); status_message_.Save(); - for (int i = 0; i < num_fields_; i++) { + for (size_t i = 0; i < num_fields_; i++) { fields_[i].Save(); } - for (int i = 0; i < num_values_; i++) { + for (size_t i = 0; i < num_values_; i++) { values_[i].Save(); } } @@ -631,11 +631,9 @@ class Parser : public BaseObject { } Local CreateHeaders() { - // num_values_ is either -1 or the entry # of the last header - // so num_values_ == 0 means there's a single header Local headers = Array::New(env()->isolate(), 2 * num_values_); - for (int i = 0; i < num_values_; ++i) { + for (size_t i = 0; i < num_values_; ++i) { headers->Set(2 * i, fields_[i].ToString(env())); headers->Set(2 * i + 1, values_[i].ToString(env())); } @@ -687,8 +685,8 @@ class Parser : public BaseObject { StringPtr values_[32]; // header values StringPtr url_; StringPtr status_message_; - int num_fields_; - int num_values_; + size_t num_fields_; + size_t num_values_; bool have_flushed_; bool got_exception_; Local current_buffer_;