Skip to content

Commit f5c875b

Browse files
committed
resolve feedback on fast callbacks
1 parent 6b3cf03 commit f5c875b

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/node_buffer.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,8 +1210,8 @@ void FastSwap16(Local<Value> receiver,
12101210
FastApiCallbackOptions& options) {
12111211
TRACK_V8_FAST_API_CALL("buffer.swap16");
12121212
HandleScope scope(options.isolate);
1213-
ArrayBufferViewContents<char> buffer(buffer_obj);
1214-
CHECK(nbytes::SwapBytes16(const_cast<char*>(buffer.data()), buffer.length()));
1213+
SPREAD_BUFFER_ARG(buffer_obj, ts_obj);
1214+
CHECK(nbytes::SwapBytes16(ts_obj_data, ts_obj_length));
12151215
}
12161216

12171217
static CFunction fast_swap16(CFunction::Make(FastSwap16));
@@ -1227,8 +1227,8 @@ void FastSwap32(Local<Value> receiver,
12271227
FastApiCallbackOptions& options) {
12281228
TRACK_V8_FAST_API_CALL("buffer.swap32");
12291229
HandleScope scope(options.isolate);
1230-
ArrayBufferViewContents<char> buffer(buffer_obj);
1231-
CHECK(nbytes::SwapBytes32(const_cast<char*>(buffer.data()), buffer.length()));
1230+
SPREAD_BUFFER_ARG(buffer_obj, ts_obj);
1231+
CHECK(nbytes::SwapBytes32(ts_obj_data, ts_obj_length));
12321232
}
12331233

12341234
static CFunction fast_swap32(CFunction::Make(FastSwap32));
@@ -1244,8 +1244,8 @@ void FastSwap64(Local<Value> receiver,
12441244
FastApiCallbackOptions& options) {
12451245
TRACK_V8_FAST_API_CALL("buffer.swap64");
12461246
HandleScope scope(options.isolate);
1247-
ArrayBufferViewContents<char> buffer(buffer_obj);
1248-
CHECK(nbytes::SwapBytes64(const_cast<char*>(buffer.data()), buffer.length()));
1247+
SPREAD_BUFFER_ARG(buffer_obj, ts_obj);
1248+
CHECK(nbytes::SwapBytes64(ts_obj_data, ts_obj_length));
12491249
}
12501250

12511251
static CFunction fast_swap64(CFunction::Make(FastSwap64));

0 commit comments

Comments
 (0)