Fix file reading

This commit is contained in:
Sebastian Messmer 2015-03-11 01:05:37 +01:00
parent 28056ed43f
commit c9b44d0801
4 changed files with 6 additions and 8 deletions

View File

@ -40,10 +40,8 @@ void CryOpenFile::truncate(off_t size) const {
_fileBlob->resize(size);
}
int CryOpenFile::read(void *buf, size_t count, off_t offset) {
//TODO Return number of read bytes
_fileBlob->read(buf, offset, count);
return count;
ssize_t CryOpenFile::read(void *buf, size_t count, off_t offset) {
return _fileBlob->read(buf, offset, count);
}
void CryOpenFile::write(const void *buf, size_t count, off_t offset) {

View File

@ -16,7 +16,7 @@ public:
void stat(struct ::stat *result) 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 flush() override;
void fsync() override;

View File

@ -29,8 +29,8 @@ unsigned char FileBlob::magicNumber() const {
return value;
}
void FileBlob::read(void *target, uint64_t offset, uint64_t count) const {
_blob->read(target, offset + 1, count);
ssize_t FileBlob::read(void *target, uint64_t offset, uint64_t count) const {
return _blob->tryRead(target, offset + 1, count);
}
void FileBlob::write(const void *source, uint64_t offset, uint64_t count) {

View File

@ -14,7 +14,7 @@ public:
FileBlob(std::unique_ptr<blobstore::Blob> blob);
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 resize(off_t size);