Skip to content

Commit f62e35f

Browse files
cjihrigtargos
authored andcommitted
src: fix warning in cares_wrap.cc
This commit fixes the following warning: ./src/cares_wrap.cc:1268:5: warning: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'int' [-Wsign-compare] CHECK_EQ(ret->Length(), a_count + aaaa_count); PR-URL: #25230 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent be45469 commit f62e35f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/cares_wrap.cc

+6-6
Original file line numberDiff line numberDiff line change
@@ -1212,15 +1212,15 @@ class QueryAnyWrap: public QueryWrap {
12121212
ret,
12131213
addrttls,
12141214
&naddrttls);
1215-
int a_count = ret->Length();
1215+
uint32_t a_count = ret->Length();
12161216
if (status != ARES_SUCCESS && status != ARES_ENODATA) {
12171217
ParseError(status);
12181218
return;
12191219
}
12201220

12211221
if (type == ns_t_a) {
1222-
CHECK_EQ(naddrttls, a_count);
1223-
for (int i = 0; i < a_count; i++) {
1222+
CHECK_EQ(static_cast<uint32_t>(naddrttls), a_count);
1223+
for (uint32_t i = 0; i < a_count; i++) {
12241224
Local<Object> obj = Object::New(env()->isolate());
12251225
obj->Set(context,
12261226
env()->address_string(),
@@ -1234,7 +1234,7 @@ class QueryAnyWrap: public QueryWrap {
12341234
ret->Set(context, i, obj).FromJust();
12351235
}
12361236
} else {
1237-
for (int i = 0; i < a_count; i++) {
1237+
for (uint32_t i = 0; i < a_count; i++) {
12381238
Local<Object> obj = Object::New(env()->isolate());
12391239
obj->Set(context,
12401240
env()->value_string(),
@@ -1258,13 +1258,13 @@ class QueryAnyWrap: public QueryWrap {
12581258
ret,
12591259
addr6ttls,
12601260
&naddr6ttls);
1261-
int aaaa_count = ret->Length() - a_count;
1261+
uint32_t aaaa_count = ret->Length() - a_count;
12621262
if (status != ARES_SUCCESS && status != ARES_ENODATA) {
12631263
ParseError(status);
12641264
return;
12651265
}
12661266

1267-
CHECK_EQ(aaaa_count, naddr6ttls);
1267+
CHECK_EQ(aaaa_count, static_cast<uint32_t>(naddr6ttls));
12681268
CHECK_EQ(ret->Length(), a_count + aaaa_count);
12691269
for (uint32_t i = a_count; i < ret->Length(); i++) {
12701270
Local<Object> obj = Object::New(env()->isolate());

0 commit comments

Comments
 (0)