Skip to content

Commit b992a6e

Browse files
lgritzzachlewis
authored andcommitted
api: IOProxy const method adjustments (AcademySoftwareFoundation#4415)
With 3.0 approaching, it seems like the only time to make these changes that I made note of a while back: * It seems to me that `tell()` should be const because it isn't going to modify or change the state of the IOProxy. * It seems to me that `flush()` should NOT be const, because it probably does change internal state. Signed-off-by: Larry Gritz <lg@larrygritz.com> Signed-off-by: Zach Lewis <zachcanbereached@gmail.com>
1 parent 5bf1fe1 commit b992a6e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/include/OpenImageIO/filesystem.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ class OIIO_UTIL_API IOProxy {
412412
virtual const char* proxytype () const = 0;
413413
virtual void close () { }
414414
virtual bool opened () const { return mode() != Closed; }
415-
virtual int64_t tell () { return m_pos; }
415+
virtual int64_t tell() const { return m_pos; }
416416
// Seek to the position, returning true on success, false on failure.
417417
// Note the difference between this and std::fseek() which returns 0 on
418418
// success, and -1 on failure.
@@ -440,7 +440,7 @@ class OIIO_UTIL_API IOProxy {
440440

441441
// Return the total size of the proxy data, in bytes.
442442
virtual size_t size () const { return 0; }
443-
virtual void flush () const { }
443+
virtual void flush() { }
444444

445445
Mode mode () const { return m_mode; }
446446
const std::string& filename () const { return m_filename; }
@@ -491,7 +491,7 @@ class OIIO_UTIL_API IOFile : public IOProxy {
491491
size_t pread(void* buf, size_t size, int64_t offset) override;
492492
size_t pwrite(const void* buf, size_t size, int64_t offset) override;
493493
size_t size() const override;
494-
void flush() const override;
494+
void flush() override;
495495

496496
// Access the FILE*
497497
FILE* handle() const { return m_file; }

src/libutil/filesystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1309,7 +1309,7 @@ Filesystem::IOFile::size() const
13091309
}
13101310

13111311
void
1312-
Filesystem::IOFile::flush() const
1312+
Filesystem::IOFile::flush()
13131313
{
13141314
if (m_file)
13151315
fflush(m_file);

0 commit comments

Comments
 (0)