[Box Backup-dev] COMMIT r418 - box/chris/win32/vc2005-compile-fixes/lib/win32
boxbackup-dev at fluffy.co.uk
boxbackup-dev at fluffy.co.uk
Sat Feb 11 13:04:47 GMT 2006
Author: chris
Date: 2006-02-11 13:04:45 +0000 (Sat, 11 Feb 2006)
New Revision: 418
Modified:
box/chris/win32/vc2005-compile-fixes/lib/win32/emu.h
Log:
* emu.h
- Use #defines to replace chmod, chdir, unlink, getcwd, stat, lstat, fstat
on MSVC, instead of inline functions, which don't work on MSVC (but work
better than #defines on MinGW)
Modified: box/chris/win32/vc2005-compile-fixes/lib/win32/emu.h
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/win32/emu.h 2006-02-11 13:03:03 UTC (rev 417)
+++ box/chris/win32/vc2005-compile-fixes/lib/win32/emu.h 2006-02-11 13:04:45 UTC (rev 418)
@@ -113,33 +113,44 @@
return 0;
}
-inline int chmod(const char * Filename, int mode)
-{
- // indicate success
- return 0;
-}
+int emu_chdir (const char* pDirName);
+int emu_unlink(const char* pFileName);
+char* emu_getcwd(char* pBuffer, int BufSize);
-int emu_chdir(const char* pDirName);
+#ifdef _MSC_VER
+ inline int emu_chmod(const char * Filename, int mode)
+ {
+ // indicate success
+ return 0;
+ }
-inline int chdir(const char* pDirName)
-{
- return emu_chdir(pDirName);
-}
+ #define chmod(file, mode) emu_chmod(file, mode)
+ #define chdir(directory) emu_chdir(directory)
+ #define unlink(file) emu_unlink(file)
+ #define getcwd(buffer, size) emu_getcwd(buffer, size)
+#else
+ inline int chmod(const char * Filename, int mode)
+ {
+ // indicate success
+ return 0;
+ }
-char* emu_getcwd(char* pBuffer, int BufSize);
+ inline int chdir(const char* pDirName)
+ {
+ return emu_chdir(pDirName);
+ }
-inline char* getcwd(char* pBuffer, int BufSize)
-{
- return emu_getcwd(pBuffer, BufSize);
-}
+ inline char* getcwd(char* pBuffer, int BufSize)
+ {
+ return emu_getcwd(pBuffer, BufSize);
+ }
-int emu_unlink(const char* pFileName);
+ inline int unlink(const char* pFileName)
+ {
+ return emu_unlink(pFileName);
+ }
+#endif
-inline int unlink(const char* pFileName)
-{
- return emu_unlink(pFileName);
-}
-
//I do not perceive a need to change the user or group on a backup client
//at any rate the owner of a service can be set in the service settings
inline int setegid(int)
@@ -432,18 +443,24 @@
return retVal;
}
-inline int stat(const char* filename, struct stat* stat)
-{
- return emu_stat(filename, stat);
-}
-inline int lstat(const char* filename, struct stat* stat)
-{
- return emu_stat(filename, stat);
-}
-inline int fstat(HANDLE handle, struct stat* stat)
-{
- return emu_fstat(handle, stat);
-}
+#ifdef _MSC_VER
+ #define stat(filename, struct) emu_stat (filename, struct)
+ #define lstat(filename, struct) emu_stat (filename, struct)
+ #define fstat(handle, struct) emu_fstat(handle, struct)
+#else
+ inline int stat(const char* filename, struct stat* stat)
+ {
+ return emu_stat(filename, stat);
+ }
+ inline int lstat(const char* filename, struct stat* stat)
+ {
+ return emu_stat(filename, stat);
+ }
+ inline int fstat(HANDLE handle, struct stat* stat)
+ {
+ return emu_fstat(handle, stat);
+ }
+#endif
int poll(struct pollfd *ufds, unsigned long nfds, int timeout);
bool EnableBackupRights( void );
More information about the Boxbackup-dev
mailing list