From: Nicolas Boichat Date: Mon, 19 Apr 2004 20:54:03 +0000 (+0000) Subject: Added compatibility for MinGW. X-Git-Tag: Release-1.34.3~145 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=bef1658117eea9f489ba321fcb5a5e1d587541b0;p=bacula%2Fbacula Added compatibility for MinGW. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1253 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/filed/win32/winbacula.h b/bacula/src/filed/win32/winbacula.h index 36dcee03c0..ea33d26a50 100755 --- a/bacula/src/filed/win32/winbacula.h +++ b/bacula/src/filed/win32/winbacula.h @@ -17,7 +17,7 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. // -// If the source code for the VNC system is not available from the place +// If the source code for the VNC system is not available from the place // whence you received this file, check http://www.uk.research.att.com/vnc or contact // the authors on vnc@uk.research.att.com for information on obtaining it. // @@ -37,6 +37,10 @@ #include #include "winres.h" +#ifdef HAVE_MINGW +#include "compat.h" +#endif + // Application specific messages // Message used for system tray notifications diff --git a/bacula/src/filed/win32/winres.rc b/bacula/src/filed/win32/winres.rc index 1aad255ea5..e4e997b141 100644 --- a/bacula/src/filed/win32/winres.rc +++ b/bacula/src/filed/win32/winres.rc @@ -20,7 +20,7 @@ IDI_JOB_ERROR ICON DISCARDABLE "error.ico" // Menu // -IDR_TRAYMENU MENU DISCARDABLE +IDR_TRAYMENU MENU DISCARDABLE BEGIN POPUP "tray" BEGIN @@ -91,7 +91,7 @@ IDB_BACULABMP BITMAP DISCARDABLE "bacula.bmp" // String Table // -STRINGTABLE DISCARDABLE +STRINGTABLE DISCARDABLE BEGIN IDI_BACULA "Bacula" END @@ -103,7 +103,7 @@ END #ifdef properties_implemented IDD_PROPERTIES DIALOG DISCARDABLE 0, 0, 221, 204 -STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | +STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Bacula Properties" FONT 8, "MS Sans Serif" @@ -128,7 +128,9 @@ BEGIN DEFPUSHBUTTON "OK",IDOK,190,120,50,15 // CONTROL "\3", IDC_BACULABMP,"Static",SS_ICON | SS_CENTERIMAGE | // SS_SUNKEN,7,5,73,65 +#ifndef HAVE_MINGW CONTROL IDB_BACULABMP,IDB_BACULABMP,"Static",SS_BITMAP|SS_SUNKEN,7,5,32,32 +#endif LTEXT " by Kern Sibbald",IDC_NAME,134,38,78,10 LTEXT "For more information, see:",-1,115,60,100,10 @@ -150,7 +152,7 @@ END // IDD_STATUS DIALOG DISCARDABLE 0, 0, 411, 244 -STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | +STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Bacula Status" FONT 8, "Courier New" @@ -165,7 +167,7 @@ END // IDD_EVENTS DIALOG DISCARDABLE 0, 0, 411, 204 -STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | +STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Bacula Events" FONT 8, "Courier New" diff --git a/bacula/src/findlib/attribs.c b/bacula/src/findlib/attribs.c index 99237457fb..d73622e821 100755 --- a/bacula/src/findlib/attribs.c +++ b/bacula/src/findlib/attribs.c @@ -117,10 +117,17 @@ void encode_stat(char *buf, FF_PKT *ff_pkt, int data_stream) *p++ = ' '; p += to_base64((int64_t)statp->st_size, p); *p++ = ' '; +#ifndef HAVE_MINGW p += to_base64((int64_t)statp->st_blksize, p); *p++ = ' '; p += to_base64((int64_t)statp->st_blocks, p); *p++ = ' '; +#else + p += to_base64((int64_t)0, p); /* output place holder */ + *p++ = ' '; + p += to_base64((int64_t)0, p); /* output place holder */ + *p++ = ' '; +#endif p += to_base64((int64_t)statp->st_atime, p); *p++ = ' '; p += to_base64((int64_t)statp->st_mtime, p); @@ -174,12 +181,21 @@ int decode_stat(char *buf, struct stat *statp, int32_t *LinkFI) p += from_base64(&val, p); statp->st_size = val; p++; +#ifndef HAVE_MINGW p += from_base64(&val, p); statp->st_blksize = val; p++; p += from_base64(&val, p); statp->st_blocks = val; p++; +#else + p += from_base64(&val, p); +// statp->st_blksize = val; + p++; + p += from_base64(&val, p); +// statp->st_blocks = val; + p++; +#endif p += from_base64(&val, p); statp->st_atime = val; p++; diff --git a/bacula/src/win32/compat/compat.cpp b/bacula/src/win32/compat/compat.cpp index 90d20b784b..e6c197aed3 100644 --- a/bacula/src/win32/compat/compat.cpp +++ b/bacula/src/win32/compat/compat.cpp @@ -34,7 +34,9 @@ #define USE_WIN32_COMPAT_IO 1 extern void d_msg(const char *file, int line, int level, const char *fmt,...); +#ifndef HAVE_MINGW extern DWORD g_platform_id; +#endif // from CYGWIN (should be diff between Jan 1 1601 and Jan 1 1970 #ifdef HAVE_MINGW @@ -360,6 +362,8 @@ stat(const char *file, struct stat *sb) return 0; } +#endif //HAVE_MINGW + int lstat(const char *file, struct stat *sb) { @@ -372,8 +376,6 @@ sleep(int sec) Sleep(sec * 1000); } -#endif //HAVE_MINGW - int geteuid(void) { @@ -496,7 +498,6 @@ getgrgid(uid_t) return NULL; } -#ifndef HAVE_MINGW // implement opendir/readdir/closedir on top of window's API typedef struct _dir { @@ -519,6 +520,7 @@ opendir(const char *path) char *tspec = (char *)malloc(max_len); if (tspec == NULL) goto err1; +#ifndef HAVE_MINGW if (g_platform_id != VER_PLATFORM_WIN32_WINDOWS) { // allow path to be 32767 bytes tspec[0] = '\\'; @@ -530,6 +532,9 @@ opendir(const char *path) } else { cygwin_conv_to_win32_path(path, tspec); } +#else + cygwin_conv_to_win32_path(path, tspec); +#endif strncat(tspec, "\\*", max_len); rval->spec = tspec; @@ -590,6 +595,7 @@ copyin(struct dirent &dp, const char *fname) *cp = 0; return dp.d_reclen; } + int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result) { @@ -609,7 +615,6 @@ readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result) dp->valid = FindNextFile(dp->dirh, &dp->data); return 0; } -#endif //HAVE_MINGW int inet_aton(const char *a, struct in_addr *inp) diff --git a/bacula/src/win32/compat/compat.h b/bacula/src/win32/compat/compat.h index a75b9bad2b..90b1f93ece 100644 --- a/bacula/src/win32/compat/compat.h +++ b/bacula/src/win32/compat/compat.h @@ -129,6 +129,7 @@ typedef UINT32 uid_t; typedef UINT32 gid_t; typedef UINT32 mode_t; typedef INT64 ssize_t; +#endif //HAVE_MINGW struct dirent { uint64_t d_ino; @@ -137,8 +138,6 @@ struct dirent { char d_name[256]; }; -#endif //HAVE_MINGW - typedef void DIR; #ifndef __cplusplus @@ -290,10 +289,8 @@ int readlink(const char *, char *, int); int geteuid(); -#ifndef HAVE_MINGW DIR *opendir(const char *name); int closedir(DIR *dir); -#endif //HAVE_MINGW struct passwd { char *foo; diff --git a/bacula/src/win32/compat/unistd.h b/bacula/src/win32/compat/unistd.h index 7273fef6de..ac1b9baa49 100644 --- a/bacula/src/win32/compat/unistd.h +++ b/bacula/src/win32/compat/unistd.h @@ -1 +1,5 @@ +#ifndef HAVE_MINGW #include "compat.h" +#else +#include_next +#endif diff --git a/bacula/src/win32/compat/winconfig.h b/bacula/src/win32/compat/winconfig.h index cf67ce7f41..5f0d78b269 100644 --- a/bacula/src/win32/compat/winconfig.h +++ b/bacula/src/win32/compat/winconfig.h @@ -123,7 +123,9 @@ /* #undef ino_t */ /* Define to 1 if utime.h exists and declares struct utimbuf. */ -/* #undef HAVE_UTIME_H 1 */ +#ifdef HAVE_MINGW +#define HAVE_UTIME_H 1 +#endif #if (HAVE_MYSQL||HAVE_PGSQL||HAVE_MSQL||HAVE_IODBC||HAVE_UNIXODBC||HAVE_SOLID||HAVE_VIRT||HAVE_IBASE||HAVE_ORACLE8||HAVE_ORACLE7||HAVE_EASYSOFT) #define HAVE_SQL