// object reference, causing wrap->GetObject() to return undefined.
Local<Object> object = Local<Object>::New(wrap->GetObject());
- String::Utf8Value name(args[0]->ToString());
+ String::Utf8Value name(args[0]);
int r = wrap->Send(*name);
if (r) {
// object reference, causing wrap->GetObject() to return undefined.
Local<Object> object = Local<Object>::New(wrap->GetObject());
- String::Utf8Value name(args[0]->ToString());
+ String::Utf8Value name(args[0]);
int family = args[1]->Int32Value();
int r = wrap->Send(*name, family);
static Handle<Value> GetAddrInfo(const Arguments& args) {
HandleScope scope;
- String::Utf8Value hostname(args[0]->ToString());
+ String::Utf8Value hostname(args[0]);
int fam = AF_UNSPEC;
if (args[1]->IsInt32()) {
return ThrowException(Exception::TypeError(String::New("Bad arguments")));
}
- String::Utf8Value path(args[0]->ToString());
+ String::Utf8Value path(args[0]);
int r = uv_fs_event_init(uv_default_loop(), &wrap->handle_, *path, OnEvent, 0);
if (r == 0) {
if (!encoding_v->IsString()) return _default;
- String::Utf8Value encoding(encoding_v->ToString());
+ String::Utf8Value encoding(encoding_v);
if (strcasecmp(*encoding, "utf8") == 0) {
return UTF8;
fprintf(stderr, "%s: ", *name);
}
- String::Utf8Value msg(!isErrorObject ? er->ToString()
- : er->ToObject()->Get(String::New("message"))->ToString());
+ String::Utf8Value msg(!isErrorObject ? er
+ : er->ToObject()->Get(String::New("message")));
fprintf(stderr, "%s\n", *msg);
}
return ThrowException(Exception::Error(String::New("Bad argument.")));
}
- String::Utf8Value path(args[0]->ToString());
+ String::Utf8Value path(args[0]);
uv_err_t r = uv_chdir(*path);
if (args[0]->IsNumber()) {
gid = args[0]->Int32Value();
} else if (args[0]->IsString()) {
- String::Utf8Value grpnam(args[0]->ToString());
+ String::Utf8Value grpnam(args[0]);
struct group grp, *grpp = NULL;
int err;
if (args[0]->IsNumber()) {
uid = args[0]->Int32Value();
} else if (args[0]->IsString()) {
- String::Utf8Value pwnam(args[0]->ToString());
+ String::Utf8Value pwnam(args[0]);
struct passwd pwd, *pwdp = NULL;
int err;
return ThrowException(exception);
}
- String::Utf8Value filename(args[0]->ToString()); // Cast
+ String::Utf8Value filename(args[0]); // Cast
Local<Object> target = args[1]->ToObject(); // Cast
err = uv_dlopen(*filename, &lib);
return ThrowException(exception);
}
- String::Utf8Value path(args[0]->ToString());
+ String::Utf8Value path(args[0]);
base = *path;
/* Find the shared library filename within the full path. */
Local<Value> value,
const AccessorInfo& info) {
HandleScope scope;
- String::Utf8Value title(value->ToString());
+ String::Utf8Value title(value);
// TODO: protect with a lock
uv_set_process_title(*title);
}
"Argument must be a string")));
}
- String::AsciiValue s(args[0]->ToString());
+ String::AsciiValue s(args[0]);
size_t offset = args[1]->Int32Value();
size_t max_length = args[2]->IsUndefined() ? buffer->length_ - offset
: args[2]->Uint32Value();
OPENSSL_CONST SSL_METHOD *method = SSLv23_method();
if (args.Length() == 1 && args[0]->IsString()) {
- String::Utf8Value sslmethod(args[0]->ToString());
+ String::Utf8Value sslmethod(args[0]);
if (strcmp(*sslmethod, "SSLv2_method") == 0) {
#ifndef OPENSSL_NO_SSL2
int r = -1;
if (v->IsString()) {
- String::Utf8Value s(v->ToString());
+ String::Utf8Value s(v);
r = BIO_write(bio, *s, s.length());
} else if (Buffer::HasInstance(v)) {
Local<Object> buffer_obj = v->ToObject();
BIO *bio = LoadBIO(args[0]);
if (!bio) return False();
- String::Utf8Value passphrase(args[1]->ToString());
+ String::Utf8Value passphrase(args[1]);
EVP_PKEY* key = PEM_read_bio_PrivateKey(bio, NULL, NULL,
len == 1 ? NULL : *passphrase);
return ThrowException(Exception::TypeError(String::New("Bad parameter")));
}
- String::Utf8Value ciphers(args[0]->ToString());
+ String::Utf8Value ciphers(args[0]);
SSL_CTX_set_cipher_list(sc->ctx_, *ciphers);
return True();
return ThrowException(Exception::TypeError(String::New("Bad parameter")));
}
- String::Utf8Value sessionIdContext(args[0]->ToString());
+ String::Utf8Value sessionIdContext(args[0]);
const unsigned char* sid_ctx = (const unsigned char*) *sessionIdContext;
unsigned int sid_ctx_len = sessionIdContext.length();
if (is_server) {
SSL_CTX_set_tlsext_servername_callback(sc->ctx_, SelectSNIContextCallback_);
} else {
- String::Utf8Value servername(args[2]->ToString());
+ String::Utf8Value servername(args[2]);
SSL_set_tlsext_host_name(p->ssl_, *servername);
}
#endif
ssize_t key_written = DecodeWrite(key_buf, key_buf_len, args[1], BINARY);
assert(key_written == key_buf_len);
- String::Utf8Value cipherType(args[0]->ToString());
+ String::Utf8Value cipherType(args[0]);
bool r = cipher->CipherInit(*cipherType, key_buf, key_buf_len);
ssize_t iv_written = DecodeWrite(iv_buf, iv_len, args[2], BINARY);
assert(iv_written == iv_len);
- String::Utf8Value cipherType(args[0]->ToString());
+ String::Utf8Value cipherType(args[0]);
bool r = cipher->CipherInitIv(*cipherType, key_buf,key_len,iv_buf,iv_len);
ssize_t key_written = DecodeWrite(key_buf, key_len, args[1], BINARY);
assert(key_written == key_len);
- String::Utf8Value cipherType(args[0]->ToString());
+ String::Utf8Value cipherType(args[0]);
bool r = cipher->DecipherInit(*cipherType, key_buf,key_len);
ssize_t iv_written = DecodeWrite(iv_buf, iv_len, args[2], BINARY);
assert(iv_written == iv_len);
- String::Utf8Value cipherType(args[0]->ToString());
+ String::Utf8Value cipherType(args[0]);
bool r = cipher->DecipherInitIv(*cipherType, key_buf,key_len,iv_buf,iv_len);
return ThrowException(exception);
}
- String::Utf8Value hashType(args[0]->ToString());
+ String::Utf8Value hashType(args[0]);
bool r;
"Must give hashtype string as argument")));
}
- String::Utf8Value hashType(args[0]->ToString());
+ String::Utf8Value hashType(args[0]);
Hash *hash = new Hash();
if (!hash->HashInit(*hashType)) {
"Must give signtype string as argument")));
}
- String::Utf8Value signType(args[0]->ToString());
+ String::Utf8Value signType(args[0]);
bool r = sign->SignInit(*signType);
"Must give verifytype string as argument")));
}
- String::Utf8Value verifyType(args[0]->ToString());
+ String::Utf8Value verifyType(args[0]);
bool r = verify->VerifyInit(*verifyType);
String::New("No group name given")));
}
- String::Utf8Value group_name(args[0]->ToString());
+ String::Utf8Value group_name(args[0]);
modp_group* it = modp_groups;
return (ThrowException(Exception::Error(String::New("expected " \
"object for " #obj " to contain string member " #member)))); \
} \
- String::Utf8Value _##member(obj->Get(String::New(#member))->ToString()); \
+ String::Utf8Value _##member(obj->Get(String::New(#member))); \
if ((*(const char **)valp = *_##member) == NULL) \
*(const char **)valp = "<unknown>";
"object for request to contain string member headers"))));
Local<Value> strfwdfor = headers->Get(String::New("x-forwarded-for"));
- String::Utf8Value fwdfor(strfwdfor->ToString());
+ String::Utf8Value fwdfor(strfwdfor);
if (!strfwdfor->IsString() || (req.forwardedFor = *fwdfor) == NULL)
req.forwardedFor = const_cast<char*>("");
if (args.Length() < 1) return TYPE_ERROR("path required");
if (!args[0]->IsString()) return TYPE_ERROR("path must be a string");
- String::Utf8Value path(args[0]->ToString());
+ String::Utf8Value path(args[0]);
if (args[1]->IsFunction()) {
ASYNC_CALL(stat, args[1], *path)
if (args.Length() < 1) return TYPE_ERROR("path required");
if (!args[0]->IsString()) return TYPE_ERROR("path must be a string");
- String::Utf8Value path(args[0]->ToString());
+ String::Utf8Value path(args[0]);
if (args[1]->IsFunction()) {
ASYNC_CALL(lstat, args[1], *path)
if (!args[0]->IsString()) return TYPE_ERROR("dest path must be a string");
if (!args[1]->IsString()) return TYPE_ERROR("src path must be a string");
- String::Utf8Value dest(args[0]->ToString());
- String::Utf8Value path(args[1]->ToString());
+ String::Utf8Value dest(args[0]);
+ String::Utf8Value path(args[1]);
int flags = 0;
if (args[2]->IsString()) {
- String::Utf8Value mode(args[2]->ToString());
+ String::Utf8Value mode(args[2]);
if (memcmp(*mode, "dir\0", 4) == 0) {
flags |= UV_FS_SYMLINK_DIR;
}
if (!args[0]->IsString()) return TYPE_ERROR("dest path must be a string");
if (!args[1]->IsString()) return TYPE_ERROR("src path must be a string");
- String::Utf8Value orig_path(args[0]->ToString());
- String::Utf8Value new_path(args[1]->ToString());
+ String::Utf8Value orig_path(args[0]);
+ String::Utf8Value new_path(args[1]);
if (args[2]->IsFunction()) {
ASYNC_CALL(link, args[2], *orig_path, *new_path)
if (args.Length() < 1) return TYPE_ERROR("path required");
if (!args[0]->IsString()) return TYPE_ERROR("path must be a string");
- String::Utf8Value path(args[0]->ToString());
+ String::Utf8Value path(args[0]);
if (args[1]->IsFunction()) {
ASYNC_CALL(readlink, args[1], *path)
if (!args[0]->IsString()) return TYPE_ERROR("old path must be a string");
if (!args[1]->IsString()) return TYPE_ERROR("new path must be a string");
- String::Utf8Value old_path(args[0]->ToString());
- String::Utf8Value new_path(args[1]->ToString());
+ String::Utf8Value old_path(args[0]);
+ String::Utf8Value new_path(args[1]);
if (args[2]->IsFunction()) {
ASYNC_CALL(rename, args[2], *old_path, *new_path)
if (args.Length() < 1) return TYPE_ERROR("path required");
if (!args[0]->IsString()) return TYPE_ERROR("path must be a string");
- String::Utf8Value path(args[0]->ToString());
+ String::Utf8Value path(args[0]);
if (args[1]->IsFunction()) {
ASYNC_CALL(unlink, args[1], *path)
if (args.Length() < 1) return TYPE_ERROR("path required");
if (!args[0]->IsString()) return TYPE_ERROR("path must be a string");
- String::Utf8Value path(args[0]->ToString());
+ String::Utf8Value path(args[0]);
if (args[1]->IsFunction()) {
ASYNC_CALL(rmdir, args[1], *path)
return THROW_BAD_ARGS;
}
- String::Utf8Value path(args[0]->ToString());
+ String::Utf8Value path(args[0]);
int mode = static_cast<int>(args[1]->Int32Value());
if (args[2]->IsFunction()) {
if (args.Length() < 1) return TYPE_ERROR("path required");
if (!args[0]->IsString()) return TYPE_ERROR("path must be a string");
- String::Utf8Value path(args[0]->ToString());
+ String::Utf8Value path(args[0]);
if (args[1]->IsFunction()) {
ASYNC_CALL(readdir, args[1], *path, 0 /*flags*/)
if (!args[1]->IsInt32()) return TYPE_ERROR("flags must be an int");
if (!args[2]->IsInt32()) return TYPE_ERROR("mode must be an int");
- String::Utf8Value path(args[0]->ToString());
+ String::Utf8Value path(args[0]);
int flags = args[1]->Int32Value();
int mode = static_cast<int>(args[2]->Int32Value());
if(args.Length() < 2 || !args[0]->IsString() || !args[1]->IsInt32()) {
return THROW_BAD_ARGS;
}
- String::Utf8Value path(args[0]->ToString());
+ String::Utf8Value path(args[0]);
int mode = static_cast<int>(args[1]->Int32Value());
if(args[2]->IsFunction()) {
if (!args[1]->IsInt32()) return TYPE_ERROR("uid must be an int");
if (!args[2]->IsInt32()) return TYPE_ERROR("gid must be an int");
- String::Utf8Value path(args[0]->ToString());
+ String::Utf8Value path(args[0]);
int uid = static_cast<int>(args[1]->Int32Value());
int gid = static_cast<int>(args[2]->Int32Value());
if (!args[1]->IsNumber()) return TYPE_ERROR("atime must be a number");
if (!args[2]->IsNumber()) return TYPE_ERROR("mtime must be a number");
- const String::Utf8Value path(args[0]->ToString());
+ const String::Utf8Value path(args[0]);
const double atime = static_cast<double>(args[1]->NumberValue());
const double mtime = static_cast<double>(args[2]->NumberValue());
}
StatWatcher *handler = ObjectWrap::Unwrap<StatWatcher>(args.Holder());
- String::Utf8Value path(args[0]->ToString());
+ String::Utf8Value path(args[0]);
assert(handler->path_ == NULL);
handler->path_ = strdup(*path);
UNWRAP
- String::AsciiValue name(args[0]->ToString());
+ String::AsciiValue name(args[0]);
int r = uv_pipe_bind(&wrap->handle_, *name);
UNWRAP
- String::AsciiValue name(args[0]->ToString());
+ String::AsciiValue name(args[0]);
ConnectWrap* req_wrap = new ConnectWrap();
// Heap allocate to detect errors. +1 is for NULL.
options.args = new char*[argc + 1];
for (int i = 0; i < argc; i++) {
- String::Utf8Value arg(js_argv->Get(i)->ToString());
+ String::Utf8Value arg(js_argv->Get(i));
options.args[i] = strdup(*arg);
}
options.args[argc] = NULL;
int envc = env->Length();
options.env = new char*[envc + 1]; // Heap allocated to detect errors.
for (int i = 0; i < envc; i++) {
- String::Utf8Value pair(env->Get(i)->ToString());
+ String::Utf8Value pair(env->Get(i));
options.env[i] = strdup(*pair);
}
options.env[envc] = NULL;
UNWRAP
- String::AsciiValue ip_address(args[0]->ToString());
+ String::AsciiValue ip_address(args[0]);
int port = args[1]->Int32Value();
struct sockaddr_in address = uv_ip4_addr(*ip_address, port);
UNWRAP
- String::AsciiValue ip6_address(args[0]->ToString());
+ String::AsciiValue ip6_address(args[0]);
int port = args[1]->Int32Value();
struct sockaddr_in6 address = uv_ip6_addr(*ip6_address, port);
UNWRAP
- String::AsciiValue ip_address(args[0]->ToString());
+ String::AsciiValue ip_address(args[0]);
int port = args[1]->Int32Value();
struct sockaddr_in address = uv_ip4_addr(*ip_address, port);
UNWRAP
- String::AsciiValue ip_address(args[0]->ToString());
+ String::AsciiValue ip_address(args[0]);
int port = args[1]->Int32Value();
struct sockaddr_in6 address = uv_ip6_addr(*ip_address, port);
// bind(ip, port, flags)
assert(args.Length() == 3);
- String::Utf8Value address(args[0]->ToString());
+ String::Utf8Value address(args[0]);
const int port = args[1]->Uint32Value();
const int flags = args[2]->Uint32Value();
assert(args.Length() == 2);
- String::Utf8Value address(args[0]->ToString());
- String::Utf8Value iface(args[1]->ToString());
+ String::Utf8Value address(args[0]);
+ String::Utf8Value iface(args[1]);
const char* iface_cstr = *iface;
if (args[1]->IsUndefined() || args[1]->IsNull()) {
length);
const unsigned short port = args[3]->Uint32Value();
- String::Utf8Value address(args[4]->ToString());
+ String::Utf8Value address(args[4]);
switch (family) {
case AF_INET: