Please be sure to read todo.txt before reporting any issues. === Description === Main objective of this patch is to make Transmission work with files correctly on Windows (hopefully not breaking *NIX stuff on the way). Existing code has several issues, including, but not limited to, missing support for foreign characters in filenames (everything in Transmission core is in UTF-8, while Microsoft CRT's `open()` expects paths in ANSI codepage). The changes here are somewhat radical, with file API being split out into separate module and all the functions implemented for Windows using WinAPI functions instead of CRT-provided ones. File descriptor type has consequently been changed to HANDLE, which required all checks for validity to be reviewed and fixed accordingly since `fd < 0` or `fd >= 0` or `fd != -1` would not work from now on (HANDLE is unsigned type, while on *NIX file descriptors are signed). Newly introduced file module interface is also fully 64-bit, regardless of target operating system support. This would probably require some additional care on *NIX to make all functions work as expected in case there's no support for 64-bit file operations in libc. As a side-effect, new error handling module has been introduced, with API resembling that of Glib. It should find its way to all the parts of the library someday, but for now is only used in the file module. Links: * https://trac.transmissionbt.com/ticket/4160 === My build/test environment === * GNU/Linux (Gentoo, x86_64): * GCC 4.8.1 * Microsoft Windows (8.1, x64): * Microsoft Visual Studio Express 2013 for Windows Desktop * MinGW 4.8.1 (mingw-builds) === Building steps === 1. checkout https://github.com/mikedld/transmission/commits/ticket/4160-foreign-characters-support 2. (re)configure and build as usual Building on Windows still requires a bit more patching (not published), and I also use CMake there (see ../cmake).