diff options
-rw-r--r-- | includes/cdreader.h | 3 | ||||
-rw-r--r-- | includes/cdutils.h | 8 | ||||
-rw-r--r-- | lib/cdreader.cpp | 9 | ||||
-rw-r--r-- | lib/cdutils.cpp | 6 |
4 files changed, 12 insertions, 14 deletions
diff --git a/includes/cdreader.h b/includes/cdreader.h index acf6765..6e952bb 100644 --- a/includes/cdreader.h +++ b/includes/cdreader.h @@ -28,9 +28,6 @@ class cdreader : public Handle { private: String n; int sector; -#if defined (_MSC_VER) || defined (__MINGW32__) - HANDLE hF; -#endif }; #endif diff --git a/includes/cdutils.h b/includes/cdutils.h index e389efd..12746dd 100644 --- a/includes/cdutils.h +++ b/includes/cdutils.h @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: cdutils.h,v 1.10 2003-11-23 14:43:06 pixel Exp $ */ +/* $Id: cdutils.h,v 1.11 2003-11-25 01:55:45 pixel Exp $ */ #ifndef __CDUTILS_H__ #define __CDUTILS_H__ @@ -39,7 +39,7 @@ extern const long sec_sizes[]; extern const long sec_offsts[]; extern const String sec_modes[]; -#ifdef _WIN32 +#ifdef _MSC_VER #pragma pack(1) #endif @@ -68,7 +68,7 @@ class cdutils : public Base { unsigned short VolSeq; unsigned short BEVolSeq; unsigned char N; - char id; + char id[1]; } PACKED; @@ -100,7 +100,7 @@ class cdutils : public Base { struct DirEntry * find_dir_entry(Byte ** buffer, struct DirEntry * dir, String name); unsigned char from_BCD(unsigned char x); unsigned char to_BCD(unsigned char x); - int is_valid_BCD(unsigned char x); + bool is_valid_BCD(unsigned char x); unsigned long from_MSF(unsigned long msf, unsigned long start = 150); unsigned long from_MSF(unsigned char m, unsigned char s, unsigned char f, unsigned long start = 150); private: diff --git a/lib/cdreader.cpp b/lib/cdreader.cpp index 33ba1b2..d3d315f 100644 --- a/lib/cdreader.cpp +++ b/lib/cdreader.cpp @@ -126,15 +126,16 @@ void cdreader::getsector(void *buf, int sec) throw (GeneralException) { #if defined (_MSC_VER) || defined (__MINGW32__) cdreader::cdreader(const String & no) throw (GeneralException) : Handle(-1), n(no), sector(0) { - if (!(hF = cdabstract::OpenIOCTLFile(no[0]))) + if (!(hFile = cdabstract::OpenIOCTLFile(no[0]))) throw GeneralException("Error opening device " + no); } -cdreader::cdreader(const cdreader & i) : Handle(i), n(i.n), hF(i.hF) { +cdreader::cdreader(const cdreader & i) : Handle(i), n(i.n) { + hFile = i.hFile; } void cdreader::close() throw (GeneralException) { - CloseHandle(hF); + CloseHandle(hFile); } typedef enum _TRACK_MODE_TYPE {
@@ -163,7 +164,7 @@ void cdreader::getsector(void *buf, int sec) throw (GeneralException) { while (!done) {
SetLastError(0);
- bStat = DeviceIoControl(hF, IOCTL_CDROM_RAW_READ,
+ bStat = DeviceIoControl(hFile, IOCTL_CDROM_RAW_READ,
&rawIOCTL, sizeof(RAW_READ_INFO),
buf, 2352, &dwRet, NULL);
if (!bStat) {
diff --git a/lib/cdutils.cpp b/lib/cdutils.cpp index 4082267..413f95d 100644 --- a/lib/cdutils.cpp +++ b/lib/cdutils.cpp @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: cdutils.cpp,v 1.14 2003-11-23 14:43:06 pixel Exp $ */ +/* $Id: cdutils.cpp,v 1.15 2003-11-25 01:55:45 pixel Exp $ */ #include <stdio.h> #include <string.h> @@ -46,7 +46,7 @@ unsigned char cdutils::to_BCD(unsigned char x) { return ((x / 10) << 4) | (x % 10); } -int cdutils::is_valid_BCD(unsigned char x) { +bool cdutils::is_valid_BCD(unsigned char x) { return (((x & 15) < 10) && ((x >> 4) < 10)); } @@ -337,7 +337,7 @@ int cdutils::show_entry(struct DirEntry * dir) { return 1; } - strncpy(pbuf, (char *) &(dir->id), dir->N); + strncpy(pbuf, dir->id, dir->N); pbuf[dir->N] = 0; if ((dir->N == 1) && (pbuf[0] == 0)) { strcpy(pbuf, "."); |