Return AVERROR_EOF from the avio_read method when appropriate.
[dcpomatic.git] / src / lib / file_group.cc
index 71faacc4c0fa6bd27667c761c873ddce42d4ec88..f4d50028ecdc1037ae1547818e30248992fd64d4 100644 (file)
@@ -134,9 +134,8 @@ FileGroup::seek (int64_t pos, int whence) const
 /** Try to read some data from the current position into a buffer.
  *  @param buffer Buffer to write data into.
  *  @param amount Number of bytes to read.
- *  @return Number of bytes read.
  */
-int
+FileGroup::Result
 FileGroup::read (uint8_t* buffer, int amount) const
 {
        DCPOMATIC_ASSERT (_current_file);
@@ -173,13 +172,13 @@ FileGroup::read (uint8_t* buffer, int amount) const
                if (eof) {
                        /* See if there is another file to use */
                        if ((_current_path + 1) >= _paths.size()) {
-                               break;
+                               return { read, true };
                        }
                        ensure_open_path (_current_path + 1);
                }
        }
 
-       return read;
+       return { read, false };
 }