@@ -1580,15 +1580,16 @@ void ConvertIpv6StringToBuffer(const FunctionCallbackInfo<Value>& args) {
1580
1580
1581
1581
if (uv_inet_pton (AF_INET6, *ip, dst) != 0 ) {
1582
1582
isolate->ThrowException (Exception::Error (
1583
- String::NewFromUtf8 (isolate, " Invalid IPv6 address" ). ToLocalChecked ( )));
1583
+ FIXED_ONE_BYTE_STRING (isolate, " Invalid IPv6 address" )));
1584
1584
return ;
1585
1585
}
1586
1586
1587
- Local<Object> buffer =
1588
- node::Buffer::Copy (
1587
+ Local<Object> buffer;
1588
+ if ( node::Buffer::Copy (
1589
1589
isolate, reinterpret_cast <const char *>(dst), sizeof (dst))
1590
- .ToLocalChecked ();
1591
- args.GetReturnValue ().Set (buffer);
1590
+ .ToLocal (&buffer)) {
1591
+ args.GetReturnValue ().Set (buffer);
1592
+ }
1592
1593
}
1593
1594
1594
1595
void GetAddrInfo (const FunctionCallbackInfo<Value>& args) {
@@ -1750,22 +1751,27 @@ void SetServers(const FunctionCallbackInfo<Value>& args) {
1750
1751
int err;
1751
1752
1752
1753
for (uint32_t i = 0 ; i < len; i++) {
1753
- CHECK (arr->Get (env->context (), i).ToLocalChecked ()->IsArray ());
1754
-
1755
- Local<Array> elm = arr->Get (env->context (), i).ToLocalChecked ().As <Array>();
1756
-
1757
- CHECK (elm->Get (env->context (),
1758
- 0 ).ToLocalChecked ()->Int32Value (env->context ()).FromJust ());
1759
- CHECK (elm->Get (env->context (), 1 ).ToLocalChecked ()->IsString ());
1760
- CHECK (elm->Get (env->context (),
1761
- 2 ).ToLocalChecked ()->Int32Value (env->context ()).FromJust ());
1762
-
1763
- int fam = elm->Get (env->context (), 0 )
1764
- .ToLocalChecked ()->Int32Value (env->context ()).FromJust ();
1765
- node::Utf8Value ip (env->isolate (),
1766
- elm->Get (env->context (), 1 ).ToLocalChecked ());
1767
- int port = elm->Get (env->context (), 2 )
1768
- .ToLocalChecked ()->Int32Value (env->context ()).FromJust ();
1754
+ Local<Value> val;
1755
+ if (!arr->Get (env->context (), i).ToLocal (&val)) return ;
1756
+ CHECK (val->IsArray ());
1757
+
1758
+ Local<Array> elm = val.As <Array>();
1759
+
1760
+ Local<Value> familyValue;
1761
+ Local<Value> ipValue;
1762
+ Local<Value> portValue;
1763
+
1764
+ if (!elm->Get (env->context (), 0 ).ToLocal (&familyValue)) return ;
1765
+ if (!elm->Get (env->context (), 1 ).ToLocal (&ipValue)) return ;
1766
+ if (!elm->Get (env->context (), 2 ).ToLocal (&portValue)) return ;
1767
+
1768
+ CHECK (familyValue->Int32Value (env->context ()).FromJust ());
1769
+ CHECK (ipValue->IsString ());
1770
+ CHECK (portValue->Int32Value (env->context ()).FromJust ());
1771
+
1772
+ int fam = familyValue->Int32Value (env->context ()).FromJust ();
1773
+ node::Utf8Value ip (env->isolate (), ipValue);
1774
+ int port = portValue->Int32Value (env->context ()).FromJust ();
1769
1775
1770
1776
ares_addr_port_node* cur = &servers[i];
1771
1777
0 commit comments