From 6adca8421211f68f3838966cf70945d538476857 Mon Sep 17 00:00:00 2001 From: Pixel Date: Mon, 26 Aug 2002 15:02:15 +0000 Subject: Fixing some #ifdef --- lib/cdreader.cpp | 60 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'lib/cdreader.cpp') 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 -#include - -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 +#include + +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 -- cgit v1.2.3