fs/io/FileOutputStream: add method Tell()
This commit is contained in:
parent
6387b52896
commit
f1f871f103
@ -48,6 +48,17 @@ FileOutputStream::FileOutputStream(Path _path, Error &error)
|
||||
GetPath().ToUTF8().c_str());
|
||||
}
|
||||
|
||||
uint64_t
|
||||
BaseFileOutputStream::Tell() const
|
||||
{
|
||||
LONG high = 0;
|
||||
DWORD low = SetFilePointer(handle, 0, &high, FILE_CURRENT);
|
||||
if (low == 0xffffffff)
|
||||
return 0;
|
||||
|
||||
return uint64_t(high) << 32 | uint64_t(low);
|
||||
}
|
||||
|
||||
bool
|
||||
BaseFileOutputStream::Write(const void *data, size_t size, Error &error)
|
||||
{
|
||||
@ -136,6 +147,12 @@ FileOutputStream::FileOutputStream(Path _path, Error &error)
|
||||
#endif
|
||||
}
|
||||
|
||||
uint64_t
|
||||
BaseFileOutputStream::Tell() const
|
||||
{
|
||||
return fd.Tell();
|
||||
}
|
||||
|
||||
bool
|
||||
BaseFileOutputStream::Write(const void *data, size_t size, Error &error)
|
||||
{
|
||||
|
@ -114,6 +114,9 @@ public:
|
||||
return path;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
uint64_t Tell() const;
|
||||
|
||||
/* virtual methods from class OutputStream */
|
||||
bool Write(const void *data, size_t size, Error &error) override;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user