OSDN Git Service

[COMMON][FILEIO] Re-Add FILEIO::Fflush().
authorK.Ohta <whatisthis.sowhat@gmail.com>
Sat, 13 Oct 2018 16:00:13 +0000 (01:00 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Sat, 13 Oct 2018 16:00:13 +0000 (01:00 +0900)
source/src/fileio.cpp
source/src/fileio.h

index fe34673..58d3dae 100644 (file)
@@ -977,6 +977,19 @@ bool FILEIO::Fcompare(const void* buffer, size_t size, size_t count)
        return result;
 }
 
+bool FILEIO::Fflush()
+{
+#ifdef USE_ZLIB
+       if(gz != NULL) {
+               return (gzflush(gz, Z_SYNC_FLUSH) == Z_OK) ? true : false;
+       } else
+#endif
+       {
+               return (fflush(fp) == 0) ? true : false;
+       }
+}
+
+
 bool FILEIO::StateCheckUint32(uint32_t val)
 {
        if(open_mode == FILEIO_READ_BINARY) {
index 78a6619..ab080de 100644 (file)
@@ -142,6 +142,7 @@ public:
        long Ftell();
        bool Fcompare(const void* buffer, size_t size);
        bool Fcompare(const void* buffer, size_t size, size_t count);
+       bool Fflush(); // Pls.Add 20181013 K.O
        
        bool StateCheckUint32(uint32_t val);
        bool StateCheckInt32(int32_t val);