diff options
author | Max Kellermann <max@duempel.org> | 2013-11-23 18:51:38 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-11-23 18:51:38 +0100 |
commit | 75e9c798e0aaf182d8d4ffc311c8d1ed0206bc2d (patch) | |
tree | f79f1a12703ccae98a7d6cab964ed14aea675e26 /src | |
parent | 99527051b5751d2ef7c6b593f1beda84d1bcc33f (diff) | |
download | mpd-75e9c798e0aaf182d8d4ffc311c8d1ed0206bc2d.tar.gz mpd-75e9c798e0aaf182d8d4ffc311c8d1ed0206bc2d.tar.xz mpd-75e9c798e0aaf182d8d4ffc311c8d1ed0206bc2d.zip |
archive/iso9660: simplify _read()
Diffstat (limited to 'src')
-rw-r--r-- | src/archive/Iso9660ArchivePlugin.cxx | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/archive/Iso9660ArchivePlugin.cxx b/src/archive/Iso9660ArchivePlugin.cxx index ad21d4a3d..0fbd9743b 100644 --- a/src/archive/Iso9660ArchivePlugin.cxx +++ b/src/archive/Iso9660ArchivePlugin.cxx @@ -201,25 +201,26 @@ iso9660_input_read(InputStream *is, void *ptr, size_t size, } else { no_blocks = size / ISO_BLOCKSIZE; } - if (no_blocks > 0) { - cur_block = is->offset / ISO_BLOCKSIZE; + if (no_blocks == 0) + return 0; - readed = iso9660_iso_seek_read (iis->archive->iso, ptr, - iis->statbuf->lsn + cur_block, no_blocks); + cur_block = is->offset / ISO_BLOCKSIZE; - if (readed != no_blocks * ISO_BLOCKSIZE) { - error.Format(iso9660_domain, - "error reading ISO file at lsn %lu", - (unsigned long)cur_block); - return 0; - } - if (left_bytes < size) { - readed = left_bytes; - } + readed = iso9660_iso_seek_read (iis->archive->iso, ptr, + iis->statbuf->lsn + cur_block, no_blocks); - is->offset += readed; + if (readed != no_blocks * ISO_BLOCKSIZE) { + error.Format(iso9660_domain, + "error reading ISO file at lsn %lu", + (unsigned long)cur_block); + return 0; } + if (left_bytes < size) { + readed = left_bytes; + } + + is->offset += readed; return readed; } |