fix: -Wunsafe-buffer-usage warning in ChunkedDataPipeReadableStream (32-x-y) (#44440)
* fix: -Wunsafe-buffer-usage warning in ChunkedDataPipeReadableStream (#44211)
* chore: rename v8_value_serializer.cc,h to v8_util.cc,h
* feat: add electron::util::as_byte_span(v8::Local<v8::ArrayBuffer>)
* fix: -Wunsafe-buffer-usage warnings in ChunkedDataPipeReadableStream::ReadInternal()
Xref: 5619253
* refactor: restore node buffer span util
* refactor: remove redundant span wrapper
* empty commit to force the Valid Backport check to rerun 🤷
This commit is contained in:
parent
bc90b60005
commit
1cbd5f451a
13 changed files with 40 additions and 16 deletions
|
@ -21,7 +21,7 @@
|
|||
#include "shell/common/gin_converters/value_converter.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/keyboard_util.h"
|
||||
#include "shell/common/v8_value_serializer.h"
|
||||
#include "shell/common/v8_util.h"
|
||||
#include "third_party/blink/public/common/context_menu_data/edit_flags.h"
|
||||
#include "third_party/blink/public/common/input/web_input_event.h"
|
||||
#include "third_party/blink/public/common/input/web_keyboard_event.h"
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "shell/common/gin_converters/value_converter.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
#include "shell/common/v8_util.h"
|
||||
|
||||
namespace gin {
|
||||
|
||||
|
@ -366,10 +367,7 @@ class ChunkedDataPipeReadableStream final
|
|||
num_bytes = *size_ - bytes_read_;
|
||||
MojoResult rv = data_pipe_->ReadData(
|
||||
MOJO_READ_DATA_FLAG_NONE,
|
||||
base::span(static_cast<uint8_t*>(buf->Buffer()->Data()),
|
||||
buf->ByteLength())
|
||||
.subspan(buf->ByteOffset(), num_bytes),
|
||||
num_bytes);
|
||||
electron::util::as_byte_span(buf).first(num_bytes), num_bytes);
|
||||
if (rv == MOJO_RESULT_OK) {
|
||||
bytes_read_ += num_bytes;
|
||||
// Not needed for correctness, but this allows the consumer to send the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue