From 40d737e975070ba43d15866b1b24e6e2d0922984 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 10 Mar 2007 19:05:52 +0000 Subject: Reorder for clarity Expose GetErrorMessage() Improve comments (refs #3, merges [1365]) --- lib/win32/emu.h | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/win32/emu.h b/lib/win32/emu.h index c8e15f3c..f8bccb02 100644 --- a/lib/win32/emu.h +++ b/lib/win32/emu.h @@ -321,7 +321,7 @@ struct stat { time_t st_mtime; time_t st_ctime; }; -#endif +#endif // 0 // need this for conversions time_t ConvertFileTimeToTime_t(FILETIME *fileTime); @@ -349,6 +349,19 @@ char* emu_getcwd (char* pBuffer, int BufSize); int statfs(const char * name, struct statfs * s); int poll(struct pollfd *ufds, unsigned long nfds, int timeout); + +struct iovec { + void *iov_base; /* Starting address */ + size_t iov_len; /* Number of bytes */ +}; + +int readv (int filedes, const struct iovec *vector, size_t count); +int writev(int filedes, const struct iovec *vector, size_t count); + +// The following functions are not emulations, but utilities for other +// parts of the code where Windows API is used or windows-specific stuff +// is needed, like codepage conversion. + bool EnableBackupRights( void ); bool ConvertEncoding (const std::string& rSource, int sourceCodePage, @@ -360,15 +373,12 @@ bool ConvertFromUtf8 (const std::string& rSource, std::string& rDest, bool ConvertUtf8ToConsole(const char* pString, std::string& rDest); bool ConvertConsoleToUtf8(const char* pString, std::string& rDest); -// replacement for _cgetws which requires a relatively recent C runtime lib -int console_read(char* pBuffer, size_t BufferSize); - -struct iovec { - void *iov_base; /* Starting address */ - size_t iov_len; /* Number of bytes */ -}; +// GetErrorMessage() returns a system error message, like strerror() +// but for Windows error codes. +std::string GetErrorMessage(DWORD errorCode); -int readv (int filedes, const struct iovec *vector, size_t count); -int writev(int filedes, const struct iovec *vector, size_t count); +// console_read() is a replacement for _cgetws which requires a +// relatively recent C runtime lib +int console_read(char* pBuffer, size_t BufferSize); #endif // !EMU_INCLUDE && WIN32 -- cgit v1.2.3