Skip to content
This repository was archived by the owner on Oct 15, 2020. It is now read-only.

Commit 2f6e607

Browse files
committed
lint: fix lint errors
1 parent bf1d9d2 commit 2f6e607

2 files changed

Lines changed: 12 additions & 14 deletions

File tree

deps/chakrashim/src/jsrtutils.cc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,6 @@ JsErrorCode StringUtf8::LengthFrom(JsValueRef strRef) {
994994
}
995995

996996
JsErrorCode StringUtf8::From(JsValueRef strRef) {
997-
998997
CHAKRA_ASSERT(!_str);
999998

1000999
int strLength = 0;
@@ -1010,7 +1009,6 @@ JsErrorCode StringUtf8::From(JsValueRef strRef) {
10101009

10111010
// if string contains unicode characters, take slow path
10121011
if (actualLength != written) {
1013-
10141012
// free previously allocated buffer
10151013
free(_str);
10161014

@@ -1019,15 +1017,13 @@ JsErrorCode StringUtf8::From(JsValueRef strRef) {
10191017

10201018
IfJsErrorRet(JsCopyString(strRef, _str, actualLength, &written, nullptr));
10211019
CHAKRA_ASSERT(actualLength == written);
1022-
}
1023-
else {
1020+
} else {
10241021
CHAKRA_ASSERT(strLength == written);
10251022
}
10261023

10271024
_str[written] = '\0';
10281025
_length = written;
10291026
return JsNoError;
1030-
10311027
}
10321028

10331029
} // namespace jsrt

src/node_api_jsrt.cc

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ class ExternalCallback {
242242
};
243243

244244
class StringUtf8 {
245-
public:
245+
public:
246246
StringUtf8() : _str(nullptr), _length(0) {}
247247
~StringUtf8() {
248248
if (_str != nullptr) {
@@ -259,30 +259,32 @@ class StringUtf8 {
259259
CHAKRA_ASSERT(!_str);
260260

261261
int strLength = 0;
262-
CHECK_JSRT_EXPECTED(JsGetStringLength(strRef, &strLength), napi_string_expected);
262+
CHECK_JSRT_EXPECTED(JsGetStringLength(strRef, &strLength),
263+
napi_string_expected);
263264

264265
// assume string contains ascii characters only
265266
_str = reinterpret_cast<char*>(malloc(strLength + 1));
266267

267268
size_t written = 0;
268269
size_t actualLength = 0;
269-
CHECK_JSRT_EXPECTED(JsCopyString(strRef, _str, strLength, &written, &actualLength), napi_string_expected);
270+
CHECK_JSRT_EXPECTED(
271+
JsCopyString(strRef, _str, strLength, &written, &actualLength),
272+
napi_string_expected);
270273

271274
// if string contains unicode characters, take slow path
272275
if (actualLength != written) {
273-
274276
// free previously allocated buffer
275277
free(_str);
276278

277279
_str = reinterpret_cast<char*>(malloc(actualLength + 1));
278280
if (_str == nullptr) {
279281
return napi_set_last_error(napi_generic_failure);
280282
}
281-
282-
CHECK_JSRT_EXPECTED(JsCopyString(strRef, _str, actualLength, &written, nullptr), napi_string_expected);
283+
CHECK_JSRT_EXPECTED(
284+
JsCopyString(strRef, _str, actualLength, &written, nullptr),
285+
napi_string_expected);
283286
assert(actualLength == written);
284-
}
285-
else if (strLength != written) {
287+
} else if (strLength != written) {
286288
return napi_set_last_error(napi_generic_failure);
287289
}
288290

@@ -291,7 +293,7 @@ class StringUtf8 {
291293
return napi_ok;
292294
}
293295

294-
private:
296+
private:
295297
// Disallow copying and assigning
296298
StringUtf8(const StringUtf8&);
297299
void operator=(const StringUtf8&);

0 commit comments

Comments
 (0)