[Box Backup-commit] COMMIT r1365 - box/chris/general/lib/win32

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Mon, 05 Mar 2007 00:01:05 +0000


Author: chris
Date: 2007-03-05 00:01:05 +0000 (Mon, 05 Mar 2007)
New Revision: 1365

Modified:
   box/chris/general/lib/win32/emu.h
Log:
Reorder for clarity

Expose GetErrorMessage()

Improve comments


Modified: box/chris/general/lib/win32/emu.h
===================================================================
--- box/chris/general/lib/win32/emu.h	2007-03-05 00:00:42 UTC (rev 1364)
+++ box/chris/general/lib/win32/emu.h	2007-03-05 00:01:05 UTC (rev 1365)
@@ -291,7 +291,7 @@
 	time_t st_mtime;
 	time_t st_ctime;
 };
-#endif
+#endif // 0
 
 // need this for conversions
 time_t ConvertFileTimeToTime_t(FILETIME *fileTime);
@@ -319,6 +319,19 @@
 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,
@@ -330,15 +343,12 @@
 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
+// GetErrorMessage() returns a system error message, like strerror() 
+// but for Windows error codes.
+std::string GetErrorMessage(DWORD errorCode);
+
+// console_read() is a 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 */
-};
-
-int readv (int filedes, const struct iovec *vector, size_t count);
-int writev(int filedes, const struct iovec *vector, size_t count);
-
 #endif // !EMU_INCLUDE && WIN32