File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -747,19 +747,17 @@ class ArrayBufferOrViewContents {
747
747
748
748
inline ByteSource ToCopy () const {
749
749
if (size () == 0 ) return ByteSource ();
750
- char * buf = MallocOpenSSL<char >(size ());
751
- CHECK_NOT_NULL (buf);
752
- memcpy (buf, data (), size ());
753
- return ByteSource::Allocated (buf, size ());
750
+ ByteSource::Builder buf (size ());
751
+ memcpy (buf.data <void >(), data (), size ());
752
+ return std::move (buf).release ();
754
753
}
755
754
756
755
inline ByteSource ToNullTerminatedCopy () const {
757
756
if (size () == 0 ) return ByteSource ();
758
- char * buf = MallocOpenSSL<char >(size () + 1 );
759
- CHECK_NOT_NULL (buf);
760
- buf[size ()] = 0 ;
761
- memcpy (buf, data (), size ());
762
- return ByteSource::Allocated (buf, size ());
757
+ ByteSource::Builder buf (size () + 1 );
758
+ memcpy (buf.data <char >(), data (), size ());
759
+ buf.data <char >()[size ()] = 0 ;
760
+ return std::move (buf).release ();
763
761
}
764
762
765
763
template <typename M>
You can’t perform that action at this time.
0 commit comments