Skip to content

Commit 9a9d2a7

Browse files
authored
Merge pull request #181 from s0meone/warnings
Fix deprecations to remove the compile warnings
2 parents b27f5f0 + eea3c26 commit 9a9d2a7

11 files changed

+127
-127
lines changed

src/openzwave-config.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ namespace OZW {
2929
{
3030
Nan::HandleScope scope;
3131
CheckMinArgs(3, "nodeid, param, value");
32-
uint8 nodeid = info[0]->ToNumber()->Value();
33-
uint8 param = info[1]->ToNumber()->Value();
34-
int32 value = info[2]->ToNumber()->Value();
32+
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
33+
uint8 param = Nan::To<Number>(info[1]).ToLocalChecked()->Value();
34+
int32 value = Nan::To<Number>(info[2]).ToLocalChecked()->Value();
3535
if (info.Length() < 4) {
3636
OpenZWave::Manager::Get()->SetConfigParam(homeid, nodeid, param, value);
3737
}
3838
else {
39-
uint8 size = info[3]->ToNumber()->Value();
39+
uint8 size = Nan::To<Number>(info[3]).ToLocalChecked()->Value();
4040
OpenZWave::Manager::Get()->SetConfigParam(homeid, nodeid, param, value, size);
4141
}
4242
}
@@ -62,8 +62,8 @@ namespace OZW {
6262
{
6363
Nan::HandleScope scope;
6464
CheckMinArgs(2, "nodeid, param");
65-
uint8 nodeid = info[0]->ToNumber()->Value();
66-
uint8 param = info[1]->ToNumber()->Value();
65+
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
66+
uint8 param = Nan::To<Number>(info[1]).ToLocalChecked()->Value();
6767
OpenZWave::Manager::Get()->RequestConfigParam(homeid, nodeid, param);
6868
}
6969

@@ -78,7 +78,7 @@ namespace OZW {
7878
{
7979
Nan::HandleScope scope;
8080
CheckMinArgs(1, "nodeid");
81-
uint8 nodeid = info[0]->ToNumber()->Value();
81+
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
8282
OpenZWave::Manager::Get()->RequestAllConfigParams (homeid, nodeid);
8383
}
8484

src/openzwave-groups.cc

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace OZW {
3333
{
3434
Nan::HandleScope scope;
3535
CheckMinArgs(1, "nodeid");
36-
uint8 nodeid = info[0]->ToNumber()->Value();
36+
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
3737
uint8 numGroups = OpenZWave::Manager::Get()->GetNumGroups(homeid, nodeid);
3838
info.GetReturnValue().Set(Nan::New<Integer>(numGroups));
3939
}
@@ -48,8 +48,8 @@ namespace OZW {
4848
Nan::HandleScope scope;
4949
CheckMinArgs(2, "nodeid, groupidx");
5050
uint8* associations;
51-
uint8 nodeid = info[0]->ToNumber()->Value();
52-
uint8 groupidx = info[1]->ToNumber()->Value();
51+
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
52+
uint8 groupidx = Nan::To<Number>(info[1]).ToLocalChecked()->Value();
5353

5454
uint32 numNodes = OpenZWave::Manager::Get()->GetAssociations(
5555
homeid, nodeid, groupidx, &associations
@@ -77,8 +77,8 @@ namespace OZW {
7777
{
7878
Nan::HandleScope scope;
7979
CheckMinArgs(2, "nodeid, groupidx");
80-
uint8 nodeid = info[0]->ToNumber()->Value();
81-
uint8 groupidx = info[1]->ToNumber()->Value();
80+
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
81+
uint8 groupidx = Nan::To<Number>(info[1]).ToLocalChecked()->Value();
8282

8383
uint8 numMaxAssoc = OpenZWave::Manager::Get()->GetMaxAssociations(
8484
homeid, nodeid, groupidx
@@ -96,8 +96,8 @@ namespace OZW {
9696
{
9797
Nan::HandleScope scope;
9898
CheckMinArgs(2, "nodeid, groupidx");
99-
uint8 nodeid = info[0]->ToNumber()->Value();
100-
uint8 groupidx = info[1]->ToNumber()->Value();
99+
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
100+
uint8 groupidx = Nan::To<Number>(info[1]).ToLocalChecked()->Value();
101101

102102
std::string groupLabel = OpenZWave::Manager::Get()->GetGroupLabel(
103103
homeid, nodeid, groupidx
@@ -118,9 +118,9 @@ namespace OZW {
118118
{
119119
Nan::HandleScope scope;
120120
CheckMinArgs(3, "nodeid, groupidx, tgtnodeid");
121-
uint8 nodeid = info[0]->ToNumber()->Value();
122-
uint8 groupidx = info[1]->ToNumber()->Value();
123-
uint8 tgtnodeid = info[2]->ToNumber()->Value();
121+
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
122+
uint8 groupidx = Nan::To<Number>(info[1]).ToLocalChecked()->Value();
123+
uint8 tgtnodeid = Nan::To<Number>(info[2]).ToLocalChecked()->Value();
124124

125125
OpenZWave::Manager::Get()->AddAssociation(
126126
homeid,nodeid,groupidx,tgtnodeid
@@ -136,9 +136,9 @@ namespace OZW {
136136
{
137137
Nan::HandleScope scope;
138138
CheckMinArgs(3, "nodeid, groupidx, tgtnodeid");
139-
uint8 nodeid = info[0]->ToNumber()->Value();
140-
uint8 groupidx = info[1]->ToNumber()->Value();
141-
uint8 tgtnodeid = info[2]->ToNumber()->Value();
139+
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
140+
uint8 groupidx = Nan::To<Number>(info[1]).ToLocalChecked()->Value();
141+
uint8 tgtnodeid = Nan::To<Number>(info[2]).ToLocalChecked()->Value();
142142

143143
OpenZWave::Manager::Get()->RemoveAssociation(homeid,nodeid,groupidx,tgtnodeid);
144144
}

src/openzwave-management.cc

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace OZW {
3838
// =================================================================
3939
{
4040
Nan::HandleScope scope;
41-
bool doSecurity = info.Length() > 0 && info[0]->ToBoolean()->Value();
41+
bool doSecurity = info.Length() > 0 && Nan::To<Boolean>(info[0]).ToLocalChecked()->Value();
4242
info.GetReturnValue().Set(Nan::New<Boolean>(
4343
OpenZWave::Manager::Get()->AddNode(homeid, doSecurity)
4444
));
@@ -74,7 +74,7 @@ namespace OZW {
7474
{
7575
Nan::HandleScope scope;
7676
CheckMinArgs(1, "nodeid");
77-
uint8 nodeid = info[0]->ToNumber()->Value();
77+
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
7878
info.GetReturnValue().Set(Nan::New<Boolean>(
7979
OpenZWave::Manager::Get()->RemoveFailedNode(homeid, nodeid)
8080
));
@@ -93,7 +93,7 @@ namespace OZW {
9393
{
9494
Nan::HandleScope scope;
9595
CheckMinArgs(1, "nodeid");
96-
uint8 nodeid = info[0]->ToNumber()->Value();
96+
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
9797
info.GetReturnValue().Set(Nan::New<Boolean>(
9898
OpenZWave::Manager::Get()->HasNodeFailed(homeid, nodeid)
9999
));
@@ -109,7 +109,7 @@ namespace OZW {
109109
{
110110
Nan::HandleScope scope;
111111
CheckMinArgs(1, "nodeid");
112-
uint8 nodeid = info[0]->ToNumber()->Value();
112+
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
113113
info.GetReturnValue().Set(Nan::New<Boolean>(
114114
OpenZWave::Manager::Get()->RequestNodeNeighborUpdate(homeid, nodeid)
115115
));
@@ -125,7 +125,7 @@ namespace OZW {
125125
{
126126
Nan::HandleScope scope;
127127
CheckMinArgs(1, "nodeid");
128-
uint8 nodeid = info[0]->ToNumber()->Value();
128+
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
129129
info.GetReturnValue().Set(Nan::New<Boolean>(
130130
OpenZWave::Manager::Get()->AssignReturnRoute(homeid, nodeid)
131131
));
@@ -142,7 +142,7 @@ namespace OZW {
142142
{
143143
Nan::HandleScope scope;
144144
CheckMinArgs(1, "nodeid");
145-
uint8 nodeid = info[0]->ToNumber()->Value();
145+
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
146146
info.GetReturnValue().Set(Nan::New<Boolean>(
147147
OpenZWave::Manager::Get()->DeleteAllReturnRoutes(homeid, nodeid)
148148
));
@@ -158,7 +158,7 @@ namespace OZW {
158158
{
159159
Nan::HandleScope scope;
160160
CheckMinArgs(1, "nodeid");
161-
uint8 nodeid = info[0]->ToNumber()->Value();
161+
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
162162
info.GetReturnValue().Set(Nan::New<Boolean>(
163163
OpenZWave::Manager::Get()->SendNodeInformation(homeid, nodeid)
164164
));
@@ -206,7 +206,7 @@ namespace OZW {
206206
{
207207
Nan::HandleScope scope;
208208
CheckMinArgs(1, "nodeid");
209-
uint8 nodeid = info[0]->ToNumber()->Value();
209+
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
210210
info.GetReturnValue().Set(Nan::New<Boolean>(
211211
OpenZWave::Manager::Get()->ReplaceFailedNode(homeid, nodeid)
212212
));
@@ -235,7 +235,7 @@ namespace OZW {
235235
{
236236
Nan::HandleScope scope;
237237
CheckMinArgs(1, "nodeid");
238-
uint8 nodeid = info[0]->ToNumber()->Value();
238+
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
239239
info.GetReturnValue().Set(Nan::New<Boolean>(
240240
OpenZWave::Manager::Get()->RequestNetworkUpdate(homeid, nodeid)
241241
));
@@ -250,7 +250,7 @@ namespace OZW {
250250
{
251251
Nan::HandleScope scope;
252252
CheckMinArgs(1, "nodeid");
253-
uint8 nodeid = info[0]->ToNumber()->Value();
253+
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
254254
info.GetReturnValue().Set(Nan::New<Boolean>(
255255
OpenZWave::Manager::Get()->ReplicationSend(homeid, nodeid)
256256
));
@@ -265,8 +265,8 @@ namespace OZW {
265265
{
266266
Nan::HandleScope scope;
267267
CheckMinArgs(2, "nodeid, buttonid");
268-
uint8 nodeid = info[0]->ToNumber()->Value();
269-
uint8 btnid = info[1]->ToNumber()->Value();
268+
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
269+
uint8 btnid = Nan::To<Number>(info[1]).ToLocalChecked()->Value();
270270
info.GetReturnValue().Set(Nan::New<Boolean>(
271271
OpenZWave::Manager::Get()->CreateButton(homeid, nodeid, btnid)
272272
));
@@ -281,8 +281,8 @@ namespace OZW {
281281
{
282282
Nan::HandleScope scope;
283283
CheckMinArgs(2, "nodeid, buttonid");
284-
uint8 nodeid = info[0]->ToNumber()->Value();
285-
uint8 btnid = info[1]->ToNumber()->Value();
284+
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
285+
uint8 btnid = Nan::To<Number>(info[1]).ToLocalChecked()->Value();
286286
info.GetReturnValue().Set(Nan::New<Boolean>(
287287
OpenZWave::Manager::Get()->DeleteButton(homeid, nodeid, btnid)
288288
));
@@ -299,16 +299,16 @@ namespace OZW {
299299
{
300300
Nan::HandleScope scope;
301301
CheckMinArgs(1, "command");
302-
std::string ctrcmd = (*String::Utf8Value(info[0]->ToString()));
302+
std::string ctrcmd = (*String::Utf8Value(Nan::To<String>(info[0]).ToLocalChecked()));
303303
uint8 nodeid1 = 0xff;
304304
uint8 nodeid2 = 0;
305305
bool highpower = false;
306306
if (info.Length() > 1) {
307-
highpower = info[1]->ToBoolean()->Value();
307+
highpower = Nan::To<Boolean>(info[1]).ToLocalChecked()->Value();
308308
if (info.Length() > 2) {
309-
nodeid1 = info[2]->ToNumber()->Value();
309+
nodeid1 = Nan::To<Number>(info[2]).ToLocalChecked()->Value();
310310
if (info.Length() > 3) {
311-
nodeid2 = info[3]->ToNumber()->Value();
311+
nodeid2 = Nan::To<Number>(info[3]).ToLocalChecked()->Value();
312312
}
313313
}
314314
}
@@ -400,7 +400,7 @@ namespace OZW {
400400
Nan::HandleScope scope;
401401
CheckMinArgs(1, "nodeid");
402402
OpenZWave::Node::NodeData data;
403-
uint8 nodeid = info[0]->ToNumber()->Value();
403+
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
404404

405405
OpenZWave::Manager::Get()->GetNodeStatistics(homeid, nodeid, &data);
406406

src/openzwave-network.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ namespace OZW {
3131
{
3232
Nan::HandleScope scope;
3333
CheckMinArgs(1, "nodeid");
34-
uint8 nodeid = info[0]->ToNumber()->Value();
35-
uint8 nummsg = (info.Length() > 1) ? info[1]->ToNumber()->Value() : 1;
34+
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
35+
uint8 nummsg = (info.Length() > 1) ? Nan::To<Number>(info[1]).ToLocalChecked()->Value() : 1;
3636
OpenZWave::Manager::Get()->TestNetworkNode(homeid, nodeid, nummsg);
3737
}
3838

@@ -45,7 +45,7 @@ namespace OZW {
4545
// ===================================================================
4646
{
4747
Nan::HandleScope scope;
48-
uint8 nummsg = (info.Length() > 0) ? info[0]->ToNumber()->Value() : 1;
48+
uint8 nummsg = (info.Length() > 0) ? Nan::To<Number>(info[0]).ToLocalChecked()->Value() : 1;
4949
OpenZWave::Manager::Get()->TestNetwork(homeid, nummsg);
5050
}
5151

@@ -58,8 +58,8 @@ namespace OZW {
5858
{
5959
Nan::HandleScope scope;
6060
CheckMinArgs(1, "nodeid");
61-
uint8 nodeid = info[0]->ToNumber()->Value();
62-
uint8 doRR = (info.Length() > 1) ? info[1]->ToBoolean()->Value() : false;
61+
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
62+
uint8 doRR = (info.Length() > 1) ? Nan::To<Boolean>(info[1]).ToLocalChecked()->Value() : false;
6363
OpenZWave::Manager::Get()->HealNetworkNode(homeid, nodeid, doRR);
6464
}
6565

@@ -73,7 +73,7 @@ namespace OZW {
7373
// ===================================================================
7474
{
7575
Nan::HandleScope scope;
76-
bool doRR = (info.Length() > 0) ? info[0]->ToBoolean()->Value() : false;
76+
bool doRR = (info.Length() > 0) ? Nan::To<Boolean>(info[0]).ToLocalChecked()->Value() : false;
7777
OpenZWave::Manager::Get()->HealNetwork(homeid, doRR);
7878
}
7979
}

0 commit comments

Comments
 (0)