*** empty log message ***

This commit is contained in:
Arvid Norberg 2004-04-04 22:15:31 +00:00
parent 1313fb9fb8
commit b164286e52
2 changed files with 21 additions and 8 deletions

View File

@ -93,6 +93,11 @@ ZLIB_SOURCES =
if [ modules.peek : NT ] if [ modules.peek : NT ]
{ {
LIBS += winsock ; LIBS += winsock ;
SOURCES += file_win.cpp
}
else
{
SOURCES += file.cpp
} }
lib torrent lib torrent

View File

@ -56,6 +56,11 @@ typedef int mode_t;
#define O_BINARY 0 #define O_BINARY 0
#endif #endif
#ifndef O_RANDOM
#define O_RANDOM 0
#endif
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
namespace namespace
@ -65,8 +70,8 @@ namespace
mode_t map_open_mode(int m) mode_t map_open_mode(int m)
{ {
// if (m == (mode_in | mode_out)) return O_RDWR | O_BINARY; // if (m == (mode_in | mode_out)) return O_RDWR | O_BINARY;
if (m == mode_out) return O_WRONLY | O_CREAT | O_BINARY; if (m == mode_out) return O_WRONLY | O_CREAT | O_BINARY | O_RANDOM;
if (m == mode_in) return O_RDONLY | O_BINARY; if (m == mode_in) return O_RDONLY | O_BINARY | O_RANDOM;
assert(false); assert(false);
} }
} }
@ -113,9 +118,6 @@ namespace libtorrent
<< strerror(errno); << strerror(errno);
throw file_error(msg.str()); throw file_error(msg.str());
} }
#ifdef WIN32
assert(_lseeki64(m_fd, 0, SEEK_SET) == 0);
#endif
m_open_mode = mode; m_open_mode = mode;
} }
@ -172,14 +174,20 @@ namespace libtorrent
#else #else
size_type ret = lseek(m_fd, offset, seekdir); size_type ret = lseek(m_fd, offset, seekdir);
#endif #endif
/*
// For some strange reason this fails
// on win32. Use windows specific file
// wrapper instead.
if (ret == -1) if (ret == -1)
{ {
std::stringstream msg; std::stringstream msg;
msg << "seek failed: '" << strerror(errno) << "' fd: " << m_fd << " offset: " << offset << " seekdir: " << seekdir; msg << "seek failed: '" << strerror(errno)
<< "' fd: " << m_fd
<< " offset: " << offset
<< " seekdir: " << seekdir;
throw file_error(msg.str()); throw file_error(msg.str());
} }
*/
} }
size_type tell() size_type tell()