Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: remove unused parameter #13085

Merged
merged 2 commits into from
May 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1099,8 +1099,7 @@ static void WriteString(const FunctionCallbackInfo<Value>& args) {
FSReqWrap::Ownership ownership = FSReqWrap::COPY;

// will assign buf and len if string was external
if (!StringBytes::GetExternalParts(env->isolate(),
string,
if (!StringBytes::GetExternalParts(string,
const_cast<const char**>(&buf),
&len)) {
enum encoding enc = ParseEncoding(env->isolate(), args[3], UTF8);
Expand Down
2 changes: 1 addition & 1 deletion src/node_i18n.cc
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ void Transcode(const FunctionCallbackInfo<Value>&args) {
tfn = &TranscodeUtf8FromUcs2;
break;
default:
tfn = TranscodeFromUcs2;
tfn = &TranscodeFromUcs2;
}
break;
default:
Expand Down
14 changes: 5 additions & 9 deletions src/string_bytes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,7 @@ static size_t hex_decode(char* buf,
}


bool StringBytes::GetExternalParts(Isolate* isolate,
Local<Value> val,
bool StringBytes::GetExternalParts(Local<Value> val,
const char** data,
size_t* len) {
if (Buffer::HasInstance(val)) {
Expand Down Expand Up @@ -306,8 +305,6 @@ bool StringBytes::GetExternalParts(Isolate* isolate,

size_t StringBytes::WriteUCS2(char* buf,
size_t buflen,
size_t nbytes,
const char* data,
Local<String> str,
int flags,
size_t* chars_written) {
Expand Down Expand Up @@ -353,7 +350,7 @@ size_t StringBytes::Write(Isolate* isolate,
HandleScope scope(isolate);
const char* data = nullptr;
size_t nbytes = 0;
const bool is_extern = GetExternalParts(isolate, val, &data, &nbytes);
const bool is_extern = GetExternalParts(val, &data, &nbytes);
const size_t external_nbytes = nbytes;

CHECK(val->IsString() == true);
Expand Down Expand Up @@ -391,7 +388,7 @@ size_t StringBytes::Write(Isolate* isolate,
memcpy(buf, data, nbytes);
nchars = nbytes / sizeof(uint16_t);
} else {
nbytes = WriteUCS2(buf, buflen, nbytes, data, str, flags, &nchars);
nbytes = WriteUCS2(buf, buflen, str, flags, &nchars);
}
if (chars_written != nullptr)
*chars_written = nchars;
Expand Down Expand Up @@ -439,8 +436,7 @@ size_t StringBytes::Write(Isolate* isolate,
}


bool StringBytes::IsValidString(Isolate* isolate,
Local<String> string,
bool StringBytes::IsValidString(Local<String> string,
enum encoding enc) {
if (enc == HEX && string->Length() % 2 != 0)
return false;
Expand Down Expand Up @@ -512,7 +508,7 @@ size_t StringBytes::Size(Isolate* isolate,
return Buffer::Length(val);

const char* data;
if (GetExternalParts(isolate, val, &data, &data_size))
if (GetExternalParts(val, &data, &data_size))
return data_size;

Local<String> str = val->ToString(isolate);
Expand Down
10 changes: 3 additions & 7 deletions src/string_bytes.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class StringBytes {
v8::Local<v8::Value> encoding,
enum encoding _default) {
enum encoding enc = ParseEncoding(env->isolate(), encoding, _default);
if (!StringBytes::IsValidString(env->isolate(), string, enc)) {
if (!StringBytes::IsValidString(string, enc)) {
env->ThrowTypeError("Bad input string");
return false;
}
Expand All @@ -69,8 +69,7 @@ class StringBytes {
// Does the string match the encoding? Quick but non-exhaustive.
// Example: a HEX string must have a length that's a multiple of two.
// FIXME(bnoordhuis) IsMaybeValidString()? Naming things is hard...
static bool IsValidString(v8::Isolate* isolate,
v8::Local<v8::String> string,
static bool IsValidString(v8::Local<v8::String> string,
enum encoding enc);

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

// If the string is external then assign external properties to data and len,
// then return true. If not return false.
static bool GetExternalParts(v8::Isolate* isolate,
v8::Local<v8::Value> val,
static bool GetExternalParts(v8::Local<v8::Value> val,
const char** data,
size_t* len);

Expand Down Expand Up @@ -125,8 +123,6 @@ class StringBytes {
private:
static size_t WriteUCS2(char* buf,
size_t buflen,
size_t nbytes,
const char* data,
v8::Local<v8::String> str,
int flags,
size_t* chars_written);
Expand Down