| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d3fc791 commit a43928a
1 file 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<void>(), data(), size()); | ||
| 759 | + buf.data<char>()[size()] = 0; | ||
| 760 | + return std::move(buf).release(size()); | ||
| 763 | 761 | } | |
| 764 | 762 | ||
| 765 | 763 | template <typename M> | |
| Back | FazBrowse Home | New Git URL |
0 commit comments