Skip to content

Commit 9226bb1

Browse files
committed
fixup! src: use Utf8Value and TwoByteValue instead of V8 helpers
1 parent 83907b6 commit 9226bb1

File tree

5 files changed

+24
-22
lines changed

5 files changed

+24
-22
lines changed

src/api/async_resource.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ AsyncResource::AsyncResource(Isolate* isolate,
1616
Local<Object> resource,
1717
const char* name,
1818
async_id trigger_async_id)
19-
: AsyncResource(isolate, resource, std::string_view(name), trigger_async_id) {}
19+
: AsyncResource(
20+
isolate, resource, std::string_view(name), trigger_async_id) {}
2021

2122
AsyncResource::AsyncResource(Isolate* isolate,
2223
Local<Object> resource,

src/api/hooks.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ using v8::Isolate;
1212
using v8::Just;
1313
using v8::Local;
1414
using v8::Maybe;
15-
using v8::NewStringType;
1615
using v8::Nothing;
1716
using v8::Object;
1817
using v8::String;
@@ -201,7 +200,8 @@ async_context EmitAsyncInit(Isolate* isolate,
201200
Local<Object> resource,
202201
const char* name,
203202
async_id trigger_async_id) {
204-
return EmitAsyncInit(isolate, resource, std::string_view(name), trigger_async_id);
203+
return EmitAsyncInit(
204+
isolate, resource, std::string_view(name), trigger_async_id);
205205
}
206206

207207
async_context EmitAsyncInit(Isolate* isolate,
@@ -210,8 +210,8 @@ async_context EmitAsyncInit(Isolate* isolate,
210210
async_id trigger_async_id) {
211211
HandleScope handle_scope(isolate);
212212
Local<String> type = ToV8Value(isolate->GetCurrentContext(), name, isolate)
213-
.ToLocalChecked()
214-
.As<String>();
213+
.ToLocalChecked()
214+
.As<String>();
215215
return EmitAsyncInit(isolate, resource, type, trigger_async_id);
216216
}
217217

src/node_buffer.cc

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,13 +1007,12 @@ void IndexOfString(const FunctionCallbackInfo<Value>& args) {
10071007
offset / 2,
10081008
is_forward);
10091009
} else {
1010-
result =
1011-
nbytes::SearchString(reinterpret_cast<const uint16_t*>(haystack),
1012-
haystack_length / 2,
1013-
needle_value.out(),
1014-
needle_value.length(),
1015-
offset / 2,
1016-
is_forward);
1010+
result = nbytes::SearchString(reinterpret_cast<const uint16_t*>(haystack),
1011+
haystack_length / 2,
1012+
needle_value.out(),
1013+
needle_value.length(),
1014+
offset / 2,
1015+
is_forward);
10171016
}
10181017
result *= 2;
10191018
} else if (enc == UTF8) {
@@ -1022,13 +1021,13 @@ void IndexOfString(const FunctionCallbackInfo<Value>& args) {
10221021
return args.GetReturnValue().Set(-1);
10231022
CHECK_GE(needle_length, needle_value.length());
10241023

1025-
result =
1026-
nbytes::SearchString(reinterpret_cast<const uint8_t*>(haystack),
1027-
haystack_length,
1028-
reinterpret_cast<const uint8_t*>(needle_value.out()),
1029-
needle_length,
1030-
offset,
1031-
is_forward);
1024+
result = nbytes::SearchString(
1025+
reinterpret_cast<const uint8_t*>(haystack),
1026+
haystack_length,
1027+
reinterpret_cast<const uint8_t*>(needle_value.out()),
1028+
needle_length,
1029+
offset,
1030+
is_forward);
10321031
} else if (enc == LATIN1) {
10331032
uint8_t* needle_data = node::UncheckedMalloc<uint8_t>(needle_length);
10341033
if (needle_data == nullptr) {

src/node_errors.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,8 +1026,11 @@ void PerIsolateMessageListener(Local<Message> message, Local<Value> error) {
10261026
Utf8Value filename(isolate, message->GetScriptOrigin().ResourceName());
10271027
Utf8Value msg(isolate, message->Get());
10281028
// (filename):(line) (message)
1029-
std::string warning = SPrintF("%s:%s %s",
1030-
filename, message->GetLineNumber(env->context()).FromMaybe(-1), msg);
1029+
std::string warning =
1030+
SPrintF("%s:%s %s",
1031+
filename,
1032+
message->GetLineNumber(env->context()).FromMaybe(-1),
1033+
msg);
10311034
USE(ProcessEmitWarningGeneric(env, warning, "V8"));
10321035
break;
10331036
}

src/permission/permission.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ using v8::IntegrityLevel;
2121
using v8::Local;
2222
using v8::MaybeLocal;
2323
using v8::Object;
24-
using v8::String;
2524
using v8::Value;
2625

2726
namespace permission {

0 commit comments

Comments
 (0)