GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: use size_t for http parser array size fields · nodejs/node@90306bb

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • node_http_parser.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/node_http_parser.cc‎

Copy file name to clipboardExpand all lines: src/node_http_parser.cc
+8-10Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ class Parser : public BaseObject {
189189
if (num_fields_ == num_values_) {
190190
// start of new field name
191191
num_fields_++;
192-
if (num_fields_ == static_cast<int>(arraysize(fields_))) {
192+
if (num_fields_ == arraysize(fields_)) {
193193
// ran out of space - flush to javascript land
194194
Flush();
195195
num_fields_ = 1;
@@ -198,7 +198,7 @@ class Parser : public BaseObject {
198198
fields_[num_fields_ - 1].Reset();
199199
}
200200

201-
CHECK_LT(num_fields_, static_cast<int>(arraysize(fields_)));
201+
CHECK_LT(num_fields_, arraysize(fields_));
202202
CHECK_EQ(num_fields_, num_values_ + 1);
203203

204204
fields_[num_fields_ - 1].Update(at, length);
@@ -214,7 +214,7 @@ class Parser : public BaseObject {
214214
values_[num_values_ - 1].Reset();
215215
}
216216

217-
CHECK_LT(num_values_, static_cast<int>(arraysize(values_)));
217+
CHECK_LT(num_values_, arraysize(values_));
218218
CHECK_EQ(num_values_, num_fields_);
219219

220220
values_[num_values_ - 1].Update(at, length);
@@ -377,11 +377,11 @@ class Parser : public BaseObject {
377377
url_.Save();
378378
status_message_.Save();
379379

380-
for (int i = 0; i < num_fields_; i++) {
380+
for (size_t i = 0; i < num_fields_; i++) {
381381
fields_[i].Save();
382382
}
383383

384-
for (int i = 0; i < num_values_; i++) {
384+
for (size_t i = 0; i < num_values_; i++) {
385385
values_[i].Save();
386386
}
387387
}
@@ -631,11 +631,9 @@ class Parser : public BaseObject {
631631
}
632632

633633
Local<Array> CreateHeaders() {
634-
// num_values_ is either -1 or the entry # of the last header
635-
// so num_values_ == 0 means there's a single header
636634
Local<Array> headers = Array::New(env()->isolate(), 2 * num_values_);
637635

638-
for (int i = 0; i < num_values_; ++i) {
636+
for (size_t i = 0; i < num_values_; ++i) {
639637
headers->Set(2 * i, fields_[i].ToString(env()));
640638
headers->Set(2 * i + 1, values_[i].ToString(env()));
641639
}
@@ -687,8 +685,8 @@ class Parser : public BaseObject {
687685
StringPtr values_[32]; // header values
688686
StringPtr url_;
689687
StringPtr status_message_;
690-
int num_fields_;
691-
int num_values_;
688+
size_t num_fields_;
689+
size_t num_values_;
692690
bool have_flushed_;
693691
bool got_exception_;
694692
Local<Object> current_buffer_;

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.