diff options
author | Max Kellermann <max@musicpd.org> | 2019-01-20 21:59:57 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2019-01-20 21:59:57 +0100 |
commit | 10a6c5c57d0fa04c55fdd40f260af557b024cc39 (patch) | |
tree | 2f21f5979704ef623a218d28c8dc9f0fe4de934a /src/input | |
parent | 2cc2bab30908cc095a509700c65452d7f050099b (diff) |
input/CdioParanoia: make variables more local
Diffstat (limited to 'src/input')
-rw-r--r-- | src/input/plugins/CdioParanoiaInputPlugin.cxx | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/input/plugins/CdioParanoiaInputPlugin.cxx b/src/input/plugins/CdioParanoiaInputPlugin.cxx index b9d880809..00b637686 100644 --- a/src/input/plugins/CdioParanoiaInputPlugin.cxx +++ b/src/input/plugins/CdioParanoiaInputPlugin.cxx @@ -285,32 +285,27 @@ size_t CdioParanoiaInputStream::Read(void *ptr, size_t length) { size_t nbytes = 0; - int diff; - size_t len, maxwrite; - int16_t *rbuf; - char *s_err, *s_mess; char *wptr = (char *) ptr; while (length > 0) { - - /* end of track ? */ if (lsn_from + lsn_relofs > lsn_to) break; //current sector was changed ? + int16_t *rbuf; if (lsn_relofs != buffer_lsn) { const ScopeUnlock unlock(mutex); rbuf = cdio_paranoia_read(para, nullptr); - s_err = cdda_errors(drv); + char *s_err = cdda_errors(drv); if (s_err) { FormatError(cdio_domain, "paranoia_read: %s", s_err); free(s_err); } - s_mess = cdda_messages(drv); + char *s_mess = cdda_messages(drv); if (s_mess) { free(s_mess); } @@ -326,12 +321,12 @@ CdioParanoiaInputStream::Read(void *ptr, size_t length) } //correct offset - diff = offset - lsn_relofs * CDIO_CD_FRAMESIZE_RAW; + const int diff = offset - lsn_relofs * CDIO_CD_FRAMESIZE_RAW; assert(diff >= 0 && diff < CDIO_CD_FRAMESIZE_RAW); - maxwrite = CDIO_CD_FRAMESIZE_RAW - diff; //# of bytes pending in current buffer - len = (length < maxwrite? length : maxwrite); + const size_t maxwrite = CDIO_CD_FRAMESIZE_RAW - diff; //# of bytes pending in current buffer + const size_t len = (length < maxwrite? length : maxwrite); //skip diff bytes from this lsn memcpy(wptr, ((char*)rbuf) + diff, len); |