Skip to content

Commit 4d2f539

Browse files
committed
resolve feedback on fast callbacks
1 parent ef4dd77 commit 4d2f539

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
@@ -1206,8 +1206,8 @@ void FastSwap16(Local<Value> receiver,
12061206
FastApiCallbackOptions& options) {
12071207
TRACK_V8_FAST_API_CALL("buffer.swap16");
12081208
HandleScope scope(options.isolate);
1209-
ArrayBufferViewContents<char> buffer(buffer_obj);
1210-
CHECK(nbytes::SwapBytes16(const_cast<char*>(buffer.data()), buffer.length()));
1209+
SPREAD_BUFFER_ARG(buffer_obj, ts_obj);
1210+
CHECK(nbytes::SwapBytes16(ts_obj_data, ts_obj_length));
12111211
}
12121212

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

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

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

0 commit comments

Comments
 (0)