Skip to content

Commit

Permalink
Replaced deprecated used of v8::String::Utf8Value with Nan::Uft8String
Browse files Browse the repository at this point in the history
  • Loading branch information
cjbj committed May 22, 2018
1 parent a22648b commit 00313f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/njsCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ void njsBaton::CheckJSException(Nan::TryCatch *tryCatch)
{
if (tryCatch->HasCaught()) {
Local<String> message = tryCatch->Message()->Get();
v8::String::Utf8Value v8str(message->ToString());
Nan::Utf8String v8str(message->ToString());
error = std::string(*v8str, static_cast<size_t>(v8str.length()));
tryCatch->Reset();
}
Expand Down Expand Up @@ -560,7 +560,7 @@ bool njsBaton::GetStringFromJSON(Local<Object> obj, const char *key, int index,
return false;

if (jsValue->IsString()) {
v8::String::Utf8Value utf8str(jsValue->ToString());
Nan::Utf8String utf8str(jsValue->ToString());
value = std::string(*utf8str, static_cast<size_t>(utf8str.length()));
return true;
} else if (jsValue->IsUndefined()) {
Expand Down Expand Up @@ -714,7 +714,7 @@ bool njsCommon::GetStringArg(Nan::NAN_METHOD_ARGS_TYPE args,
Nan::ThrowError(errMsg.c_str());
return false;
}
v8::String::Utf8Value utf8str(args[index]->ToString());
Nan::Utf8String utf8str(args[index]->ToString());
value = std::string(*utf8str, static_cast<size_t>(utf8str.length()));
return true;
}
Expand Down Expand Up @@ -809,7 +809,7 @@ bool njsCommon::SetPropString(Local<Value> value, std::string *valuePtr,
Nan::ThrowError(errMsg.c_str());
return false;
}
v8::String::Utf8Value utfstr(value->ToString());
Nan::Utf8String utfstr(value->ToString());
*valuePtr = std::string(*utfstr, static_cast<size_t>(utfstr.length()));
return true;
}
Expand Down
12 changes: 6 additions & 6 deletions src/njsConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ bool njsConnection::ScanExecuteBindUnit(Local<Object> bindUnit,
for (uint32_t i = 0; i < keys->Length(); i++) {
Local<String> temp =
Nan::Get(keys, i).ToLocalChecked().As<String>();
v8::String::Utf8Value utf8str(temp);
Nan::Utf8String utf8str(temp);
std::string key =
std::string(*utf8str, static_cast<size_t>(utf8str.length()));
if (key.compare("dir") == 0 || key.compare("type") == 0 ||
Expand Down Expand Up @@ -1046,7 +1046,7 @@ bool njsConnection::InitBindVars(Local<Object> bindObj,
var->pos = i + 1;
else {
Local<Value> temp = Nan::Get(bindNames, i).ToLocalChecked();
v8::String::Utf8Value v8str(temp->ToString());
Nan::Utf8String v8str(temp->ToString());
std::string str = std::string(*v8str,
static_cast<size_t>(v8str.length()));
var->name = ":" + str;
Expand Down Expand Up @@ -1128,7 +1128,7 @@ bool njsConnection::ProcessScalarBindValue(Local<Value> value,
bindOk = (var->varTypeNum == DPI_ORACLE_TYPE_VARCHAR ||
var->varTypeNum == DPI_ORACLE_TYPE_CLOB);
if (bindOk) {
v8::String::Utf8Value utf8str(value);
Nan::Utf8String utf8str(value);
if (utf8str.length() == 0)
data->isNull = 1;
else if (inExecuteMany &&
Expand Down Expand Up @@ -1253,7 +1253,7 @@ bool njsConnection::GetBindTypeAndSizeFromValue(njsVariable *var,
*maxSize = 1;
} else if (value->IsString()) {
*bindType = NJS_DATATYPE_STR;
v8::String::Utf8Value utf8str(value->ToString());
Nan::Utf8String utf8str(value->ToString());
*maxSize = static_cast<uint32_t>(utf8str.length());
} else if (value->IsInt32() || value->IsUint32()) {
*bindType = NJS_DATATYPE_INT;
Expand Down Expand Up @@ -1341,7 +1341,7 @@ bool njsConnection::ProcessExecuteOptions(Local<Object> options,
baton->fetchInfo = new njsFetchInfo[baton->numFetchInfo];
for (uint32_t i = 0; i < baton->numFetchInfo; i++) {
Local<Value> temp = Nan::Get(keys, i).ToLocalChecked();
v8::String::Utf8Value utf8str(temp->ToString());
Nan::Utf8String utf8str(temp->ToString());
baton->fetchInfo[i].name = std::string(*utf8str,
static_cast<size_t>(utf8str.length()));
Local<Object> colInfo =
Expand Down Expand Up @@ -1599,7 +1599,7 @@ void njsConnection::SetTextAttribute(Nan::NAN_SETTER_ARGS_TYPE args,
Nan::ThrowError(errMsg.c_str());
return;
}
v8::String::Utf8Value utfstr(value->ToString());
Nan::Utf8String utfstr(value->ToString());
uint32_t valueLength = static_cast<uint32_t>(utfstr.length());
if ((*setter)(connection->dpiConnHandle, *utfstr, valueLength) < 0)
njsOracledb::ThrowDPIError();
Expand Down

0 comments on commit 00313f8

Please sign in to comment.