summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPixel <Pixel>2002-08-26 14:41:57 +0000
committerPixel <Pixel>2002-08-26 14:41:57 +0000
commit68c31dd0f98784d6b755d9f89e5b2a51d85eeddf (patch)
tree3dea88b39e3089781a18cf244a648297fd0e5c60 /lib
parent9abf17dd5aa9d367b90e3461c52f45464b718b2d (diff)
CD Reader working under linux!!!
Diffstat (limited to 'lib')
-rw-r--r--lib/cdreader.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/cdreader.cpp b/lib/cdreader.cpp
index f24e54b..cdb2671 100644
--- a/lib/cdreader.cpp
+++ b/lib/cdreader.cpp
@@ -78,16 +78,15 @@ ssize_t cdreader::read(void *buf, size_t count) throw (GeneralException) {
char sector[CD_FRAMESIZE_RAW];
size_t r = count;
- fprintf(stderr, "Asked to cd-read %i bytes at %i\n", count, (int) itell);
-
size_t remain = itell % CD_FRAMESIZE_RAW;
- fprintf(stderr, "Seeking to sector %li, to read at %i\n", itell / CD_FRAMESIZE_RAW, (int) remain);
sectorseek(itell / CD_FRAMESIZE_RAW);
while (count > 0) {
- size_t n = CD_FRAMESIZE_RAW - remain;
+ size_t n = MIN(CD_FRAMESIZE_RAW - remain, count);
getsector(sector);
- bcopy(sector + remain, buf, MIN(n, count));
+ bcopy(sector + remain, buf, n);
+ buf = ((char *) buf) + n;
+ itell += n;
count -= n;
remain = 0;
}