Skip to content

Commit 1263b70

Browse files
mscdexjasnell
authored andcommitted
src: remove unused parameters
PR-URL: #13085 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ron Korving <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]>
1 parent 1aa68f9 commit 1263b70

File tree

3 files changed

+9
-18
lines changed

3 files changed

+9
-18
lines changed

src/node_file.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -1099,8 +1099,7 @@ static void WriteString(const FunctionCallbackInfo<Value>& args) {
10991099
FSReqWrap::Ownership ownership = FSReqWrap::COPY;
11001100

11011101
// will assign buf and len if string was external
1102-
if (!StringBytes::GetExternalParts(env->isolate(),
1103-
string,
1102+
if (!StringBytes::GetExternalParts(string,
11041103
const_cast<const char**>(&buf),
11051104
&len)) {
11061105
enum encoding enc = ParseEncoding(env->isolate(), args[3], UTF8);

src/string_bytes.cc

+5-9
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,7 @@ static size_t hex_decode(char* buf,
270270
}
271271

272272

273-
bool StringBytes::GetExternalParts(Isolate* isolate,
274-
Local<Value> val,
273+
bool StringBytes::GetExternalParts(Local<Value> val,
275274
const char** data,
276275
size_t* len) {
277276
if (Buffer::HasInstance(val)) {
@@ -306,8 +305,6 @@ bool StringBytes::GetExternalParts(Isolate* isolate,
306305

307306
size_t StringBytes::WriteUCS2(char* buf,
308307
size_t buflen,
309-
size_t nbytes,
310-
const char* data,
311308
Local<String> str,
312309
int flags,
313310
size_t* chars_written) {
@@ -353,7 +350,7 @@ size_t StringBytes::Write(Isolate* isolate,
353350
HandleScope scope(isolate);
354351
const char* data = nullptr;
355352
size_t nbytes = 0;
356-
const bool is_extern = GetExternalParts(isolate, val, &data, &nbytes);
353+
const bool is_extern = GetExternalParts(val, &data, &nbytes);
357354
const size_t external_nbytes = nbytes;
358355

359356
CHECK(val->IsString() == true);
@@ -391,7 +388,7 @@ size_t StringBytes::Write(Isolate* isolate,
391388
memcpy(buf, data, nbytes);
392389
nchars = nbytes / sizeof(uint16_t);
393390
} else {
394-
nbytes = WriteUCS2(buf, buflen, nbytes, data, str, flags, &nchars);
391+
nbytes = WriteUCS2(buf, buflen, str, flags, &nchars);
395392
}
396393
if (chars_written != nullptr)
397394
*chars_written = nchars;
@@ -439,8 +436,7 @@ size_t StringBytes::Write(Isolate* isolate,
439436
}
440437

441438

442-
bool StringBytes::IsValidString(Isolate* isolate,
443-
Local<String> string,
439+
bool StringBytes::IsValidString(Local<String> string,
444440
enum encoding enc) {
445441
if (enc == HEX && string->Length() % 2 != 0)
446442
return false;
@@ -512,7 +508,7 @@ size_t StringBytes::Size(Isolate* isolate,
512508
return Buffer::Length(val);
513509

514510
const char* data;
515-
if (GetExternalParts(isolate, val, &data, &data_size))
511+
if (GetExternalParts(val, &data, &data_size))
516512
return data_size;
517513

518514
Local<String> str = val->ToString(isolate);

src/string_bytes.h

+3-7
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class StringBytes {
4343
v8::Local<v8::Value> encoding,
4444
enum encoding _default) {
4545
enum encoding enc = ParseEncoding(env->isolate(), encoding, _default);
46-
if (!StringBytes::IsValidString(env->isolate(), string, enc)) {
46+
if (!StringBytes::IsValidString(string, enc)) {
4747
env->ThrowTypeError("Bad input string");
4848
return false;
4949
}
@@ -69,8 +69,7 @@ class StringBytes {
6969
// Does the string match the encoding? Quick but non-exhaustive.
7070
// Example: a HEX string must have a length that's a multiple of two.
7171
// FIXME(bnoordhuis) IsMaybeValidString()? Naming things is hard...
72-
static bool IsValidString(v8::Isolate* isolate,
73-
v8::Local<v8::String> string,
72+
static bool IsValidString(v8::Local<v8::String> string,
7473
enum encoding enc);
7574

7675
// Fast, but can be 2 bytes oversized for Base64, and
@@ -87,8 +86,7 @@ class StringBytes {
8786

8887
// If the string is external then assign external properties to data and len,
8988
// then return true. If not return false.
90-
static bool GetExternalParts(v8::Isolate* isolate,
91-
v8::Local<v8::Value> val,
89+
static bool GetExternalParts(v8::Local<v8::Value> val,
9290
const char** data,
9391
size_t* len);
9492

@@ -125,8 +123,6 @@ class StringBytes {
125123
private:
126124
static size_t WriteUCS2(char* buf,
127125
size_t buflen,
128-
size_t nbytes,
129-
const char* data,
130126
v8::Local<v8::String> str,
131127
int flags,
132128
size_t* chars_written);

0 commit comments

Comments
 (0)