Skip to content

Commit 0a2bfad

Browse files
committed
fixup
Signed-off-by: Paolo Insogna <[email protected]>
1 parent d33227e commit 0a2bfad

4 files changed

Lines changed: 16 additions & 16 deletions

File tree

doc/api/errors.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,6 +1332,12 @@ added: v14.0.0
13321332
Used when a feature that is not available
13331333
to the current platform which is running Node.js is used.
13341334

1335+
<a id="ERR_FFI_CALL_FAILED"></a>
1336+
1337+
### `ERR_FFI_CALL_FAILED`
1338+
1339+
A low-level FFI call failed.
1340+
13351341
<a id="ERR_FFI_INVALID_POINTER"></a>
13361342

13371343
### `ERR_FFI_INVALID_POINTER`
@@ -1344,12 +1350,6 @@ An invalid pointer was passed to an FFI operation.
13441350

13451351
An operation was attempted on an FFI dynamic library after it was closed.
13461352

1347-
<a id="ERR_FFI_SYSCALL_FAILED"></a>
1348-
1349-
### `ERR_FFI_SYSCALL_FAILED`
1350-
1351-
A low-level FFI call failed.
1352-
13531353
<a id="ERR_FS_CP_DIR_TO_NON_DIR"></a>
13541354

13551355
### `ERR_FS_CP_DIR_TO_NON_DIR`

src/ffi/data.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ void ExportBytes(const FunctionCallbackInfo<Value>& args) {
675675
return;
676676
}
677677

678-
uint8_t* source_data = nullptr;
678+
const uint8_t* source_data = nullptr;
679679
size_t source_len = 0;
680680

681681
if (args[0]->IsArrayBuffer()) {
@@ -685,15 +685,15 @@ void ExportBytes(const FunctionCallbackInfo<Value>& args) {
685685
THROW_ERR_INVALID_ARG_VALUE(env, "Invalid ArrayBuffer backing store");
686686
return;
687687
}
688-
source_data = static_cast<uint8_t*>(store->Data());
688+
source_data = static_cast<const uint8_t*>(store->Data());
689689
source_len = array_buffer->ByteLength();
690690
} else if (args[0]->IsArrayBufferView()) {
691691
ArrayBufferViewContents<uint8_t> view(args[0]);
692692
if (view.WasDetached()) {
693693
THROW_ERR_INVALID_ARG_VALUE(env, "Invalid ArrayBufferView backing store");
694694
return;
695695
}
696-
source_data = const_cast<uint8_t*>(view.data());
696+
source_data = view.data();
697697
source_len = view.length();
698698
} else {
699699
THROW_ERR_INVALID_ARG_TYPE(

src/node_errors.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ void OOMErrorHandler(const char* location, const v8::OOMDetails& details);
7979
V(ERR_DLOPEN_FAILED, Error) \
8080
V(ERR_ENCODING_INVALID_ENCODED_DATA, TypeError) \
8181
V(ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE, Error) \
82+
V(ERR_FFI_CALL_FAILED, Error) \
8283
V(ERR_FFI_INVALID_POINTER, Error) \
8384
V(ERR_FFI_LIBRARY_CLOSED, Error) \
84-
V(ERR_FFI_SYSCALL_FAILED, Error) \
8585
V(ERR_FS_CP_EINVAL, Error) \
8686
V(ERR_FS_CP_DIR_TO_NON_DIR, Error) \
8787
V(ERR_FS_CP_NON_DIR_TO_DIR, Error) \

src/node_ffi.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ bool DynamicLibrary::ResolveSymbol(Environment* env,
9999
} else {
100100
if (uv_dlsym(&lib_, name.c_str(), &ptr) != 0) {
101101
std::string msg = std::string("dlsym failed: ") + uv_dlerror(&lib_);
102-
THROW_ERR_FFI_SYSCALL_FAILED(env, msg.c_str());
102+
THROW_ERR_FFI_CALL_FAILED(env, msg.c_str());
103103
return false;
104104
}
105105
}
@@ -160,7 +160,7 @@ bool DynamicLibrary::PrepareFunction(Environment* env,
160160
break;
161161
}
162162

163-
THROW_ERR_FFI_SYSCALL_FAILED(env, msg);
163+
THROW_ERR_FFI_CALL_FAILED(env, msg);
164164
return false;
165165
}
166166

@@ -265,7 +265,7 @@ void DynamicLibrary::New(const FunctionCallbackInfo<Value>& args) {
265265
// Open the library
266266
if (uv_dlopen(library_path, &lib->lib_) != 0) {
267267
std::string msg = std::string("dlopen failed: ") + uv_dlerror(&lib->lib_);
268-
THROW_ERR_FFI_SYSCALL_FAILED(env, msg.c_str());
268+
THROW_ERR_FFI_CALL_FAILED(env, msg.c_str());
269269
return;
270270
}
271271

@@ -751,7 +751,7 @@ void DynamicLibrary::RegisterCallback(const FunctionCallbackInfo<Value>& args) {
751751
ffi_closure_alloc(sizeof(ffi_closure), &callback->ptr));
752752

753753
if (callback->closure == nullptr) {
754-
THROW_ERR_FFI_SYSCALL_FAILED(env, "ffi_closure_alloc failed");
754+
THROW_ERR_FFI_CALL_FAILED(env, "ffi_closure_alloc failed");
755755
delete callback;
756756
return;
757757
}
@@ -776,7 +776,7 @@ void DynamicLibrary::RegisterCallback(const FunctionCallbackInfo<Value>& args) {
776776
break;
777777
}
778778

779-
THROW_ERR_FFI_SYSCALL_FAILED(env, msg);
779+
THROW_ERR_FFI_CALL_FAILED(env, msg);
780780
delete callback;
781781
return;
782782
}
@@ -800,7 +800,7 @@ void DynamicLibrary::RegisterCallback(const FunctionCallbackInfo<Value>& args) {
800800
break;
801801
}
802802

803-
THROW_ERR_FFI_SYSCALL_FAILED(env, msg);
803+
THROW_ERR_FFI_CALL_FAILED(env, msg);
804804
delete callback;
805805
return;
806806
}

0 commit comments

Comments
 (0)