Skip to content

Commit b7dbc1c

Browse files
cjihrigBethGriggs
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 <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent a8f78f0 commit b7dbc1c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/cares_wrap.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,15 +1210,15 @@ class QueryAnyWrap: public QueryWrap {
12101210
ret,
12111211
addrttls,
12121212
&naddrttls);
1213-
int a_count = ret->Length();
1213+
uint32_t a_count = ret->Length();
12141214
if (status != ARES_SUCCESS && status != ARES_ENODATA) {
12151215
ParseError(status);
12161216
return;
12171217
}
12181218

12191219
if (type == ns_t_a) {
1220-
CHECK_EQ(naddrttls, a_count);
1221-
for (int i = 0; i < a_count; i++) {
1220+
CHECK_EQ(static_cast<uint32_t>(naddrttls), a_count);
1221+
for (uint32_t i = 0; i < a_count; i++) {
12221222
Local<Object> obj = Object::New(env()->isolate());
12231223
obj->Set(context,
12241224
env()->address_string(),
@@ -1232,7 +1232,7 @@ class QueryAnyWrap: public QueryWrap {
12321232
ret->Set(context, i, obj).FromJust();
12331233
}
12341234
} else {
1235-
for (int i = 0; i < a_count; i++) {
1235+
for (uint32_t i = 0; i < a_count; i++) {
12361236
Local<Object> obj = Object::New(env()->isolate());
12371237
obj->Set(context,
12381238
env()->value_string(),
@@ -1256,13 +1256,13 @@ class QueryAnyWrap: public QueryWrap {
12561256
ret,
12571257
addr6ttls,
12581258
&naddr6ttls);
1259-
int aaaa_count = ret->Length() - a_count;
1259+
uint32_t aaaa_count = ret->Length() - a_count;
12601260
if (status != ARES_SUCCESS && status != ARES_ENODATA) {
12611261
ParseError(status);
12621262
return;
12631263
}
12641264

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

0 commit comments

Comments
 (0)