Fix file reading
This commit is contained in:
parent
28056ed43f
commit
c9b44d0801
@ -40,10 +40,8 @@ void CryOpenFile::truncate(off_t size) const {
|
|||||||
_fileBlob->resize(size);
|
_fileBlob->resize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CryOpenFile::read(void *buf, size_t count, off_t offset) {
|
ssize_t CryOpenFile::read(void *buf, size_t count, off_t offset) {
|
||||||
//TODO Return number of read bytes
|
return _fileBlob->read(buf, offset, count);
|
||||||
_fileBlob->read(buf, offset, count);
|
|
||||||
return count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CryOpenFile::write(const void *buf, size_t count, off_t offset) {
|
void CryOpenFile::write(const void *buf, size_t count, off_t offset) {
|
||||||
|
@ -16,7 +16,7 @@ public:
|
|||||||
|
|
||||||
void stat(struct ::stat *result) const override;
|
void stat(struct ::stat *result) const override;
|
||||||
void truncate(off_t size) const override;
|
void truncate(off_t size) const override;
|
||||||
int read(void *buf, size_t count, off_t offset) override;
|
ssize_t read(void *buf, size_t count, off_t offset) override;
|
||||||
void write(const void *buf, size_t count, off_t offset) override;
|
void write(const void *buf, size_t count, off_t offset) override;
|
||||||
void flush() override;
|
void flush() override;
|
||||||
void fsync() override;
|
void fsync() override;
|
||||||
|
@ -29,8 +29,8 @@ unsigned char FileBlob::magicNumber() const {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileBlob::read(void *target, uint64_t offset, uint64_t count) const {
|
ssize_t FileBlob::read(void *target, uint64_t offset, uint64_t count) const {
|
||||||
_blob->read(target, offset + 1, count);
|
return _blob->tryRead(target, offset + 1, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileBlob::write(const void *source, uint64_t offset, uint64_t count) {
|
void FileBlob::write(const void *source, uint64_t offset, uint64_t count) {
|
||||||
|
@ -14,7 +14,7 @@ public:
|
|||||||
FileBlob(std::unique_ptr<blobstore::Blob> blob);
|
FileBlob(std::unique_ptr<blobstore::Blob> blob);
|
||||||
virtual ~FileBlob();
|
virtual ~FileBlob();
|
||||||
|
|
||||||
void read(void *target, uint64_t offset, uint64_t count) const;
|
ssize_t read(void *target, uint64_t offset, uint64_t count) const;
|
||||||
void write(const void *source, uint64_t offset, uint64_t count);
|
void write(const void *source, uint64_t offset, uint64_t count);
|
||||||
|
|
||||||
void resize(off_t size);
|
void resize(off_t size);
|
||||||
|
Loading…
Reference in New Issue
Block a user