diff --git a/docs/manual.html b/docs/manual.html index 11e0ed2f2..1505e11b8 100755 --- a/docs/manual.html +++ b/docs/manual.html @@ -211,7 +211,7 @@ on how to do this BOOST_BUILD_PATH to point to your boost build installation. Also you have to modify the user_config.jam to reflect the toolsets you have installed. (if you're building with gcc, uncomment the line "using gcc ;")

-

You also need to install boost (at least version 1.31.0).

+

You also need to install boost (at least version 1.32.0).

Before you invoke bjam you have to set the environment variable BOOST_ROOT to the path where you installed boost. This will be used to build and link against the required boost libraries as well as be used as include path for boost headers.

@@ -228,9 +228,7 @@ abstraction. There's one file_win files larger than 2 Gigabytes. This does not work in vc6 for some reason, possibly because it may require windows NT and above. The other file, file.cpp is the default implementation that simply relies on the standard low level io routines (read, write etc.), -this is the preferred implementation that should be used in all cases. The file_win.cpp -have had some problems with failing seeks (I don't know why), so I advise everyone to use -the other file.

+this is the preferred implementation that should be used in all cases.

cygwin and msvc

Note that if you're building on windows using the msvc toolset, you cannot run it diff --git a/docs/manual.rst b/docs/manual.rst index 57931a930..24714cb89 100755 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -95,7 +95,7 @@ installation. Also you have to modify the ``user_config.jam`` to reflect the too .. _`boost-build`: http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=80982&release_id=278763 -You also need to install boost__ (at least version 1.31.0). +You also need to install boost__ (at least version 1.32.0). __ http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=8041&release_id=284047 @@ -121,9 +121,7 @@ abstraction. There's one ``file_win.cpp`` which relies on windows file API that files larger than 2 Gigabytes. This does not work in vc6 for some reason, possibly because it may require windows NT and above. The other file, ``file.cpp`` is the default implementation that simply relies on the standard low level io routines (read, write etc.), -this is the preferred implementation that should be used in all cases. The ``file_win.cpp`` -have had some problems with failing seeks (I don't know why), so I advise everyone to use -the other file. +this is the preferred implementation that should be used in all cases. cygwin and msvc diff --git a/src/file_win.cpp b/src/file_win.cpp index eb6814a34..a8badd080 100644 --- a/src/file_win.cpp +++ b/src/file_win.cpp @@ -55,17 +55,46 @@ namespace HLOCAL m_memory; }; + + std::wstring safe_convert(std::string const& s) + { + try + { + return libtorrent::utf8_wchar(s); + } + catch (std::exception) + { + std::wstring ret; + for (const char* i = &*s.begin(); i < &*s.end(); ++i) + { + wchar_t c; + c = '.'; + std::mbtowc(&c, i, 1); + ret += c; + } + return ret; + } + } + + std::string utf8_native(std::string const& s) { - std::wstring ws; - libtorrent::utf8_wchar(s, ws); - std::size_t size = wcstombs(0, ws.c_str(), 0); - if (size == std::size_t(-1)) return s; - std::string ret; - ret.resize(size); - size = wcstombs(&ret[0], ws.c_str(), size + 1); - ret.resize(size-1); - return ret; + try + { + std::wstring ws; + libtorrent::utf8_wchar(s, ws); + std::size_t size = wcstombs(0, ws.c_str(), 0); + if (size == std::size_t(-1)) return s; + std::string ret; + ret.resize(size); + size = wcstombs(&ret[0], ws.c_str(), size + 1); + ret.resize(size-1); + return ret; + } + catch(std::exception) + { + return s; + } } void throw_exception(const char* thrower) @@ -135,7 +164,7 @@ namespace libtorrent assert(access_mask & (GENERIC_READ | GENERIC_WRITE)); #ifdef UNICODE - std::wstring wfile_name(utf8_wchar(file_name)); + std::wstring wfile_name(safe_convert(file_name)); HANDLE new_handle = CreateFile( (LPCWSTR)wfile_name.c_str() , access_mask