Skip to content

Commit 07a71f2

Browse files
authored
fix: Parity option broken in bindings (#2377)
closes #2373
1 parent 8712986 commit 07a71f2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/bindings/src/serialport.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Napi::Value Close(const Napi::CallbackInfo& info) {
130130
Napi::Function callback = info[1].As<Napi::Function>();
131131
CloseBaton* baton = new CloseBaton(callback);
132132
baton->fd = info[0].ToNumber().Int64Value();;
133-
133+
134134
baton->Queue();
135135
return env.Undefined();
136136
}
@@ -189,7 +189,7 @@ Napi::Value Set(const Napi::CallbackInfo& info) {
189189
baton->dtr = getBoolFromObject(options, "dtr");
190190
baton->dsr = getBoolFromObject(options, "dsr");
191191
baton->lowLatency = getBoolFromObject(options, "lowLatency");
192-
192+
193193
baton->Queue();
194194
return env.Undefined();
195195
}
@@ -263,13 +263,15 @@ Napi::Value Drain(const Napi::CallbackInfo& info) {
263263
Napi::Function callback = info[1].As<Napi::Function>();
264264
DrainBaton* baton = new DrainBaton(callback);
265265
baton->fd = fd;
266-
266+
267267
baton->Queue();
268268
return env.Undefined();
269269
}
270270

271271
inline SerialPortParity ToParityEnum(const Napi::String& napistr) {
272-
const char* str = napistr.Utf8Value().c_str();
272+
auto tmp = napistr.Utf8Value();
273+
const char* str = tmp.c_str();
274+
273275
size_t count = strlen(str);
274276
SerialPortParity parity = SERIALPORT_PARITY_NONE;
275277
if (!strncasecmp(str, "none", count)) {

0 commit comments

Comments
 (0)