@@ -73,16 +73,14 @@ FileOperationHandle FileHandle::readLineBinary(size_t lineNumber, uint8_t delimi
7373 auto buf = rh.contentsBytes ();
7474 size_t idx = 0 ;
7575 std::vector<uint8_t > line;
76- auto byteDelim = static_cast <std::byte>(delimiter);
7776 for (size_t i = 0 ; i < buf.size (); ++i) {
78- if (buf[i] == byteDelim ) {
77+ if (buf[i] == delimiter ) {
7978 if (idx == lineNumber) break ; else { line.clear (); ++idx; continue ; }
8079 }
81- line.push_back (static_cast < uint8_t >( buf[i]) );
80+ line.push_back (buf[i]);
8281 }
8382 if (idx != lineNumber) { s.complete (FileOpStatus::Partial); return ; }
84- s.bytes .assign (reinterpret_cast <const std::byte*>(line.data ()),
85- reinterpret_cast <const std::byte*>(line.data () + line.size ()));
83+ s.bytes .assign (line.begin (), line.end ());
8684 s.complete (FileOpStatus::Complete);
8785 });
8886}
@@ -92,7 +90,7 @@ FileOperationHandle FileHandle::writeAll(std::span<const uint8_t> bytes) const {
9290 WriteOptions opts; opts.truncate = true ;
9391 auto data = std::vector<uint8_t >(bytes.begin (), bytes.end ());
9492 return _vfs->submitSerialized (_meta.path , [opts, data=std::move (data)](FileOperationHandle::OpState& s, std::shared_ptr<IFileSystemBackend> backend, const std::string& p, const ExecContext&) mutable {
95- auto byteSpan = std::as_bytes (std:: span<const uint8_t >(data.data (), data.size () ));
93+ auto byteSpan = std::span<const uint8_t >(data.data (), data.size ());
9694 auto inner = backend->writeFile (p, byteSpan, opts);
9795 inner.wait ();
9896 auto st = inner.status ();
@@ -114,7 +112,7 @@ FileOperationHandle FileHandle::writeAll(std::span<const uint8_t> bytes, const W
114112 if (_backend && _vfs) {
115113 auto data = std::vector<uint8_t >(bytes.begin (), bytes.end ());
116114 return _vfs->submitSerialized (_meta.path , [opts, data=std::move (data)](FileOperationHandle::OpState& s, std::shared_ptr<IFileSystemBackend> backend, const std::string& p, const ExecContext&) mutable {
117- auto byteSpan = std::as_bytes (std:: span<const uint8_t >(data.data (), data.size () ));
115+ auto byteSpan = std::span<const uint8_t >(data.data (), data.size ());
118116 if (auto * local = dynamic_cast <LocalFileSystemBackend*>(backend.get ())) {
119117 local->doWriteFile (s, p, byteSpan, opts);
120118 } else {
@@ -141,7 +139,7 @@ FileOperationHandle FileHandle::writeRange(uint64_t offset, std::span<const uint
141139 if (_backend && _vfs) {
142140 auto data = std::vector<uint8_t >(bytes.begin (), bytes.end ());
143141 return _vfs->submitSerialized (_meta.path , [opts, data=std::move (data)](FileOperationHandle::OpState& s, std::shared_ptr<IFileSystemBackend> backend, const std::string& p, const ExecContext&) mutable {
144- auto byteSpan = std::as_bytes (std:: span<const uint8_t >(data.data (), data.size () ));
142+ auto byteSpan = std::span<const uint8_t >(data.data (), data.size ());
145143 if (auto * local = dynamic_cast <LocalFileSystemBackend*>(backend.get ())) {
146144 local->doWriteFile (s, p, byteSpan, opts);
147145 } else {
@@ -170,7 +168,7 @@ FileOperationHandle FileHandle::writeRange(uint64_t offset, std::span<const uint
170168 wopts.truncate = false ;
171169 auto data = std::vector<uint8_t >(bytes.begin (), bytes.end ());
172170 return _vfs->submitSerialized (_meta.path , [wopts, data=std::move (data)](FileOperationHandle::OpState& s, std::shared_ptr<IFileSystemBackend> backend, const std::string& p, const ExecContext&) mutable {
173- auto byteSpan = std::as_bytes (std:: span<const uint8_t >(data.data (), data.size () ));
171+ auto byteSpan = std::span<const uint8_t >(data.data (), data.size ());
174172 if (auto * local = dynamic_cast <LocalFileSystemBackend*>(backend.get ())) {
175173 local->doWriteFile (s, p, byteSpan, wopts);
176174 } else {
@@ -222,7 +220,7 @@ FileOperationHandle FileHandle::writeAll(std::string_view text) const {
222220 WriteOptions opts; opts.truncate = true ;
223221 auto textCopy = std::string (text);
224222 return _vfs->submitSerialized (_meta.path , [opts, textCopy=std::move (textCopy)](FileOperationHandle::OpState& s, std::shared_ptr<IFileSystemBackend> backend, const std::string& p, const ExecContext&) mutable {
225- auto spanBytes = std::as_bytes (std:: span<const char >( textCopy.data (), textCopy.size () ));
223+ auto spanBytes = std::span<const uint8_t >( reinterpret_cast < const uint8_t *>( textCopy.data ()) , textCopy.size ());
226224 if (auto * local = dynamic_cast <LocalFileSystemBackend*>(backend.get ())) {
227225 local->doWriteFile (s, p, spanBytes, opts);
228226 } else {
@@ -248,7 +246,7 @@ FileOperationHandle FileHandle::writeAll(std::string_view text, const WriteOptio
248246 if (_backend && _vfs) {
249247 auto textCopy = std::string (text);
250248 return _vfs->submitSerialized (_meta.path , [opts, textCopy=std::move (textCopy)](FileOperationHandle::OpState& s, std::shared_ptr<IFileSystemBackend> backend, const std::string& p, const ExecContext&) mutable {
251- auto spanBytes = std::as_bytes (std:: span<const char >( textCopy.data (), textCopy.size () ));
249+ auto spanBytes = std::span<const uint8_t >( reinterpret_cast < const uint8_t *>( textCopy.data ()) , textCopy.size ());
252250 if (auto * local = dynamic_cast <LocalFileSystemBackend*>(backend.get ())) {
253251 local->doWriteFile (s, p, spanBytes, opts);
254252 } else {
0 commit comments