26 |
#include <string.h> |
#include <string.h> |
27 |
#include <unistd.h> |
#include <unistd.h> |
28 |
#include <fcntl.h> |
#include <fcntl.h> |
29 |
#include <sys/ioctl.h> |
#if defined(_CARBON_) || defined(__APPLE__) |
30 |
#if defined (__GNUC__) && (__GNUC__ >= 4) |
# if defined (__GNUC__) && (__GNUC__ >= 4) |
31 |
#include <sys/disk.h> |
# include <sys/disk.h> |
32 |
#else |
# else |
33 |
#include <dev/disk.h> |
# include <dev/disk.h> |
34 |
|
# endif |
35 |
#endif |
#endif |
36 |
#include <sys/types.h> |
#include <sys/types.h> |
37 |
#include <sys/stat.h> |
#include <sys/stat.h> |
38 |
#include <errno.h> |
#include <errno.h> |
|
#include <paths.h> |
|
39 |
#if defined(_CARBON_) || defined(__APPLE__) |
#if defined(_CARBON_) || defined(__APPLE__) |
40 |
|
#include <paths.h> |
41 |
|
#include <sys/ioctl.h> |
42 |
#include <sys/param.h> |
#include <sys/param.h> |
43 |
#include <IOKit/IOKitLib.h> |
#include <IOKit/IOKitLib.h> |
44 |
#include <IOKit/IOBSD.h> |
#include <IOKit/IOBSD.h> |
1669 |
#ifdef WIN32 |
#ifdef WIN32 |
1670 |
if (mCluster * mClusterSize != SetFilePointer(mFile, mCluster * mClusterSize, NULL, FILE_BEGIN)) { |
if (mCluster * mClusterSize != SetFilePointer(mFile, mCluster * mClusterSize, NULL, FILE_BEGIN)) { |
1671 |
printf("ERROR: couldn't seek device!\n"); |
printf("ERROR: couldn't seek device!\n"); |
1672 |
|
#if 0 // FIXME: endian correction is missing correct detection |
1673 |
if ((readbytes > 0) && (mEndian != eEndianNative)) { |
if ((readbytes > 0) && (mEndian != eEndianNative)) { |
1674 |
switch (WordSize) { |
switch (WordSize) { |
1675 |
case 2: bswap_16_s ((uint16*)pData, readbytes); break; |
case 2: bswap_16_s ((uint16*)pData, readbytes); break; |
1677 |
case 8: bswap_64_s ((uint64*)pData, readbytes); break; |
case 8: bswap_64_s ((uint64*)pData, readbytes); break; |
1678 |
} |
} |
1679 |
} |
} |
1680 |
|
#endif |
1681 |
return readbytes / WordSize; |
return readbytes / WordSize; |
1682 |
} |
} |
1683 |
DWORD size; |
DWORD size; |
1705 |
// printf("new pos %d\n",mPos); |
// printf("new pos %d\n",mPos); |
1706 |
} |
} |
1707 |
|
|
1708 |
#if 0 |
#if 0 // FIXME: endian correction is missing correct detection |
1709 |
if ((readbytes > 0) && (mEndian != eEndianNative)) |
if ((readbytes > 0) && (mEndian != eEndianNative)) |
1710 |
switch (WordSize) |
switch (WordSize) |
1711 |
{ |
{ |
1892 |
close(fOut); |
close(fOut); |
1893 |
return true; |
return true; |
1894 |
#endif // _CARBON_ || LINUX |
#endif // _CARBON_ || LINUX |
1895 |
|
return false; |
1896 |
} |
} |
1897 |
|
|
1898 |
inline void DiskImage::swapBytes_16(void* Word) { |
inline void DiskImage::swapBytes_16(void* Word) { |