Skip to content
Permalink
Browse files

src: remove unused parameters

PR-URL: #13085
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ron Korving <ron@ronkorving.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
  • Loading branch information...
mscdex authored and jasnell committed May 17, 2017
1 parent 1aa68f9 commit 1263b70e9eabacc467e566ed79bf1fcefc28cfd2
Showing with 9 additions and 18 deletions.
  1. +1 −2 src/node_file.cc
  2. +5 −9 src/string_bytes.cc
  3. +3 −7 src/string_bytes.h
@@ -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);
@@ -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)) {
@@ -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) {
@@ -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);
@@ -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;
@@ -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;
@@ -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);
@@ -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;
}
@@ -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
@@ -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);

@@ -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);

0 comments on commit 1263b70

Please sign in to comment.
You can’t perform that action at this time.