summaryrefslogtreecommitdiff
path: root/zen/file_io.h
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2021-03-02 17:23:41 -0500
committerB Stack <bgstack15@gmail.com>2021-03-02 17:23:41 -0500
commit840e906a4ddbbb32b8a5989e8a0ce10c8c374819 (patch)
tree6fb17404841b30822a2d9204e3e0932e55f05ebb /zen/file_io.h
parentMerge branch '11.6' into 'master' (diff)
downloadFreeFileSync-840e906a4ddbbb32b8a5989e8a0ce10c8c374819.tar.gz
FreeFileSync-840e906a4ddbbb32b8a5989e8a0ce10c8c374819.tar.bz2
FreeFileSync-840e906a4ddbbb32b8a5989e8a0ce10c8c374819.zip
add upstream 11.7
Diffstat (limited to 'zen/file_io.h')
-rw-r--r--zen/file_io.h23
1 files changed, 11 insertions, 12 deletions
diff --git a/zen/file_io.h b/zen/file_io.h
index a7385241..3d1dfee7 100644
--- a/zen/file_io.h
+++ b/zen/file_io.h
@@ -32,8 +32,7 @@ public:
FileHandle getHandle() { return hFile_; }
//Windows: use 64kB ?? https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-2000-server/cc938632%28v=technet.10%29
- //Linux: use st_blksize?
- //macOS: use f_iosize?
+ //macOS, Linux: use st_blksize?
static size_t getBlockSize() { return 128 * 1024; };
const Zstring& getFilePath() const { return filePath_; }
@@ -57,15 +56,15 @@ private:
class FileInput : public FileBase
{
public:
- FileInput( const Zstring& filePath, const IOCallback& notifyUnbufferedIO /*throw X*/); //throw FileError, ErrorFileLocked
- FileInput(FileHandle handle, const Zstring& filePath, const IOCallback& notifyUnbufferedIO /*throw X*/); //takes ownership!
+ FileInput( const Zstring& filePath, const IoCallback& notifyUnbufferedIO /*throw X*/); //throw FileError, ErrorFileLocked
+ FileInput(FileHandle handle, const Zstring& filePath, const IoCallback& notifyUnbufferedIO /*throw X*/); //takes ownership!
size_t read(void* buffer, size_t bytesToRead); //throw FileError, ErrorFileLocked, X; return "bytesToRead" bytes unless end of stream!
private:
size_t tryRead(void* buffer, size_t bytesToRead); //throw FileError, ErrorFileLocked; may return short, only 0 means EOF! => CONTRACT: bytesToRead > 0!
- const IOCallback notifyUnbufferedIO_; //throw X
+ const IoCallback notifyUnbufferedIO_; //throw X
std::vector<std::byte> memBuf_ = std::vector<std::byte>(getBlockSize());
size_t bufPos_ = 0;
@@ -76,8 +75,8 @@ private:
class FileOutput : public FileBase
{
public:
- FileOutput( const Zstring& filePath, const IOCallback& notifyUnbufferedIO /*throw X*/); //throw FileError, ErrorTargetExisting
- FileOutput(FileHandle handle, const Zstring& filePath, const IOCallback& notifyUnbufferedIO /*throw X*/); //takes ownership!
+ FileOutput( const Zstring& filePath, const IoCallback& notifyUnbufferedIO /*throw X*/); //throw FileError, ErrorTargetExisting
+ FileOutput(FileHandle handle, const Zstring& filePath, const IoCallback& notifyUnbufferedIO /*throw X*/); //takes ownership!
~FileOutput();
void reserveSpace(uint64_t expectedSize); //throw FileError
@@ -91,7 +90,7 @@ public:
private:
size_t tryWrite(const void* buffer, size_t bytesToWrite); //throw FileError; may return short! CONTRACT: bytesToWrite > 0
- IOCallback notifyUnbufferedIO_; //throw X
+ IoCallback notifyUnbufferedIO_; //throw X
std::vector<std::byte> memBuf_ = std::vector<std::byte>(getBlockSize());
size_t bufPos_ = 0;
size_t bufPosEnd_ = 0;
@@ -102,7 +101,7 @@ private:
class TempFileOutput
{
public:
- TempFileOutput( const Zstring& filePath, const IOCallback& notifyUnbufferedIO /*throw X*/) : //throw FileError
+ TempFileOutput( const Zstring& filePath, const IoCallback& notifyUnbufferedIO /*throw X*/) : //throw FileError
filePath_(filePath),
tmpFile_(tmpFilePath_, notifyUnbufferedIO) {} //throw FileError, (ErrorTargetExisting)
@@ -110,7 +109,7 @@ public:
void write(const void* buffer, size_t bytesToWrite) { tmpFile_.write(buffer, bytesToWrite); } //throw FileError, X
- FileOutput& refTempFile() { return tmpFile_; }
+ FileOutput& refTempFile() { return tmpFile_; }
void commit() //throw FileError, X
{
@@ -133,10 +132,10 @@ private:
};
-[[nodiscard]] std::string getFileContent(const Zstring& filePath, const IOCallback& notifyUnbufferedIO /*throw X*/); //throw FileError, X
+[[nodiscard]] std::string getFileContent(const Zstring& filePath, const IoCallback& notifyUnbufferedIO /*throw X*/); //throw FileError, X
//overwrites if existing + transactional! :)
-void setFileContent(const Zstring& filePath, const std::string& bytes, const IOCallback& notifyUnbufferedIO /*throw X*/); //throw FileError, X
+void setFileContent(const Zstring& filePath, const std::string& bytes, const IoCallback& notifyUnbufferedIO /*throw X*/); //throw FileError, X
}
#endif //FILE_IO_H_89578342758342572345
bgstack15