summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPixel <Pixel>2002-08-26 15:02:15 +0000
committerPixel <Pixel>2002-08-26 15:02:15 +0000
commit6adca8421211f68f3838966cf70945d538476857 (patch)
treec8036a448e157453624bba37ece6c5ebe58737d8 /lib
parent68c31dd0f98784d6b755d9f89e5b2a51d85eeddf (diff)
Fixing some #ifdef
Diffstat (limited to 'lib')
-rw-r--r--lib/cdreader.cpp60
1 files changed, 30 insertions, 30 deletions
diff --git a/lib/cdreader.cpp b/lib/cdreader.cpp
index cdb2671..59c8127 100644
--- a/lib/cdreader.cpp
+++ b/lib/cdreader.cpp
@@ -14,32 +14,6 @@
#define _(x) x
#endif
-#ifdef __linux__
-#include <sys/ioctl.h>
-#include <linux/cdrom.h>
-
-cdreader::cdreader(const String & no) throw (GeneralException) :
- Handle(open(no.to_charp(), O_RDONLY)), n(no), sector(0) {
-
-#ifdef DEBUG
- fprintf(stderr, "Opening file %s, cdreader at %p\n", no.to_charp(), this);
-#endif
-
- if (GetHandle() < 0) {
- throw IOGeneral(String(_("Error opening file ")) + no + _(" for reading: ") + strerror(errno));
- }
-
- struct stat s;
- fstat(GetHandle(), &s);
-
- if (!S_ISBLK(s.st_mode)) {
- throw GeneralException(no + " is not a block device.");
- }
-}
-
-cdreader::cdreader(const cdreader & i) : Handle(i), n(i.n) {
-}
-
bool cdreader::CanWrite() {
return 0;
}
@@ -94,6 +68,36 @@ ssize_t cdreader::read(void *buf, size_t count) throw (GeneralException) {
return r;
}
+void cdreader::sectorseek(int sec) {
+ sector = sec;
+}
+
+#ifdef __linux__
+#include <sys/ioctl.h>
+#include <linux/cdrom.h>
+
+cdreader::cdreader(const String & no) throw (GeneralException) :
+ Handle(open(no.to_charp(), O_RDONLY)), n(no), sector(0) {
+
+#ifdef DEBUG
+ fprintf(stderr, "Opening file %s, cdreader at %p\n", no.to_charp(), this);
+#endif
+
+ if (GetHandle() < 0) {
+ throw IOGeneral(String(_("Error opening file ")) + no + _(" for reading: ") + strerror(errno));
+ }
+
+ struct stat s;
+ fstat(GetHandle(), &s);
+
+ if (!S_ISBLK(s.st_mode)) {
+ throw GeneralException(no + " is not a block device.");
+ }
+}
+
+cdreader::cdreader(const cdreader & i) : Handle(i), n(i.n) {
+}
+
void cdreader::getsector(void *buf, int sec) throw (GeneralException) {
struct cdrom_msf * msf = (struct cdrom_msf *) buf;
if (sec >= 0)
@@ -117,8 +121,4 @@ void cdreader::getsector(void *buf, int sec) throw (GeneralException) {
sector++;
}
-void cdreader::sectorseek(int sec) {
- sector = sec;
-}
-
#endif