From 8e94b30da91f44a8a0d39de5c493983cfd08884e Mon Sep 17 00:00:00 2001 From: Robert Nelson Date: Mon, 3 Jul 2006 07:51:06 +0000 Subject: [PATCH] Fix header file includes. Move externs from source files to header files. Fix the old mingw Makefile so it builds with the new dependencies. Replace #ifdef'ed InitWinAPIWrapper with OSDependentInit macro. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3114 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/baconfig.h | 12 ++- bacula/src/bacula.h | 17 ++++- bacula/src/console/console.c | 7 +- bacula/src/dird/authenticate.c | 1 - bacula/src/dird/fd_cmds.c | 1 - bacula/src/dird/job.c | 1 - bacula/src/dird/ua_cmds.c | 1 - bacula/src/dird/ua_dotcmds.c | 2 - bacula/src/dird/ua_output.c | 3 - bacula/src/dird/ua_server.c | 2 - bacula/src/dird/ua_status.c | 4 - bacula/src/dird/verify.c | 3 - bacula/src/filed/filed.c | 3 - bacula/src/filed/filed.h | 2 - bacula/src/filed/job.c | 1 - bacula/src/filed/status.c | 7 -- bacula/src/filed/win32/winabout.cpp | 2 + bacula/src/filed/win32/winbacula.h | 13 ---- bacula/src/filed/win32/winevents.cpp | 2 + bacula/src/filed/win32/winmain.cpp | 11 +-- bacula/src/filed/win32/winservice.cpp | 4 +- bacula/src/filed/win32/winstat.cpp | 2 + bacula/src/filed/win32/wintray.cpp | 9 +-- bacula/src/findlib/Makefile.in | 2 +- bacula/src/findlib/attribs.c | 4 - bacula/src/findlib/bfile.h | 3 - bacula/src/findlib/match.c | 5 +- bacula/src/jcr.h | 3 +- bacula/src/lib/attr.c | 14 ++-- bacula/src/lib/events.c | 2 - bacula/src/lib/lib.h | 8 +- bacula/src/lib/message.c | 4 - bacula/src/lib/message.h | 18 +++-- bacula/src/lib/parse_conf.c | 2 - bacula/src/lib/smartall.h | 8 +- bacula/src/lib/var.c | 4 +- bacula/src/lib/watchdog.h | 4 + bacula/src/stored/bcopy.c | 2 + bacula/src/stored/bextract.c | 8 +- bacula/src/stored/block.c | 1 - bacula/src/stored/bls.c | 8 +- bacula/src/stored/bscan.c | 8 -- bacula/src/stored/btape.c | 2 + bacula/src/stored/device.c | 3 - bacula/src/stored/label.c | 3 - bacula/src/stored/record.c | 2 - bacula/src/stored/status.c | 4 - bacula/src/stored/stored_conf.c | 3 - bacula/src/tools/bregex.c | 2 + bacula/src/tools/bwild.c | 2 + bacula/src/tools/dbcheck.c | 2 + bacula/src/tools/fstype.c | 2 + bacula/src/tools/testls.c | 6 -- bacula/src/win32/Makefile.in | 76 +++++++------------ bacula/src/win32/compat/compat.cpp | 1 - bacula/src/win32/compat/compat.h | 65 ---------------- bacula/src/win32/compat/dirent.h | 1 - bacula/src/win32/compat/mingwconfig.h | 1 + bacula/src/win32/compat/mswinver.h | 2 - bacula/src/win32/compat/pwd.h | 1 - bacula/src/win32/compat/stdint.h | 4 +- bacula/src/win32/compat/sys/ioctl.h | 1 + bacula/src/win32/compat/unistd.h | 4 +- bacula/src/win32/compat/vss_generic.cpp | 25 +++--- bacula/src/wx-console/authenticate.c | 4 +- bacula/src/wx-console/console_conf.c | 4 +- bacula/src/wx-console/console_thread.cpp | 6 +- bacula/src/wx-console/main.cpp | 10 +-- bacula/src/wx-console/wxbconfigfileeditor.cpp | 2 + bacula/src/wx-console/wxbconfigpanel.cpp | 2 + bacula/src/wx-console/wxbhistorytextctrl.cpp | 4 +- bacula/src/wx-console/wxblistctrl.cpp | 2 + bacula/src/wx-console/wxbmainframe.cpp | 2 + bacula/src/wx-console/wxbrestorepanel.cpp | 2 + bacula/src/wx-console/wxbtableparser.cpp | 2 + bacula/src/wx-console/wxbtreectrl.cpp | 4 +- bacula/src/wx-console/wxbutils.cpp | 2 + 77 files changed, 175 insertions(+), 301 deletions(-) diff --git a/bacula/src/baconfig.h b/bacula/src/baconfig.h index f052b13cde..c6c6854e77 100644 --- a/bacula/src/baconfig.h +++ b/bacula/src/baconfig.h @@ -66,7 +66,17 @@ #define NPRT(x) (x)?(x):_("*None*") #if defined(HAVE_WIN32) +void InitWinAPIWrapper(); + +#define OSDependentInit() InitWinAPIWrapper() + #undef ENABLE_NLS +# define DLL_IMP_EXP +#else + +#define DLL_IMP_EXP + +#define OSDependentInit() #endif #ifdef ENABLE_NLS @@ -476,7 +486,7 @@ int m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...) /* Use our strdup with smartalloc */ -#ifndef __WXGTK__ +#ifndef HAVE_WXCONSOLE #undef strdup #define strdup(buf) bad_call_on_strdup_use_bstrdup(buf) #endif diff --git a/bacula/src/bacula.h b/bacula/src/bacula.h index f677f2458a..69b43828af 100644 --- a/bacula/src/bacula.h +++ b/bacula/src/bacula.h @@ -29,13 +29,12 @@ #if defined(HAVE_WIN32) #if defined(HAVE_MINGW) #include "mingwconfig.h" -#include "winhost.h" #define _STAT_H /* don't pull in MinGW stat.h */ #define _STAT_DEFINED /* don't pull in MinGW stat.h */ #else #include "winconfig.h" -#include "winhost.h" #endif +#include "winhost.h" #else #include "config.h" #include "host.h" @@ -134,11 +133,25 @@ /* Local Bacula includes. Be sure to put all the system * includes before these. */ +#if defined(HAVE_WIN32) +#include +#include "win32/compat/compat.h" +#endif + #include "version.h" #include "bc_types.h" #include "baconfig.h" #include "lib/lib.h" +#ifdef HAVE_WXCONSOLE +#undef New +#undef _ +#endif + +#if defined(HAVE_WIN32) +#include "lib/winapi.h" +#endif + #ifndef HAVE_ZLIB_H #undef HAVE_LIBZ /* no good without headers */ #endif diff --git a/bacula/src/console/console.c b/bacula/src/console/console.c index b4392f2b06..abdfc8f0f5 100644 --- a/bacula/src/console/console.c +++ b/bacula/src/console/console.c @@ -37,8 +37,6 @@ #endif #ifdef HAVE_WIN32 -#include -#include "../lib/winapi.h" #define isatty(fd) (fd==0) #endif @@ -388,10 +386,9 @@ int main(int argc, char *argv[]) signal(SIGTTIN, got_sigtin); signal(SIGTTOU, got_sigtout); trapctlc(); -#else - InitWinAPIWrapper(); #endif - + + OSDependentInit(); if (argc) { usage(); diff --git a/bacula/src/dird/authenticate.c b/bacula/src/dird/authenticate.c index 93d33ce29f..f0bcd4f026 100644 --- a/bacula/src/dird/authenticate.c +++ b/bacula/src/dird/authenticate.c @@ -29,7 +29,6 @@ #include "dird.h" extern DIRRES *director; -extern char my_name[]; /* Commands sent to Storage daemon and File daemon and received * from the User Agent */ diff --git a/bacula/src/dird/fd_cmds.c b/bacula/src/dird/fd_cmds.c index 3d884f4663..4a858abdc5 100644 --- a/bacula/src/dird/fd_cmds.c +++ b/bacula/src/dird/fd_cmds.c @@ -49,7 +49,6 @@ static char OKRunBeforeNow[] = "2000 OK RunBeforeNow\n"; /* Forward referenced functions */ /* External functions */ -extern int debug_level; extern DIRRES *director; extern int FDConnectTimeout; diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index 984f932041..44812a1d7b 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -36,7 +36,6 @@ extern void term_scheduler(); extern void term_ua_server(); /* Imported variables */ -extern time_t watchdog_time; jobq_t job_queue; diff --git a/bacula/src/dird/ua_cmds.c b/bacula/src/dird/ua_cmds.c index 7e71408bb4..f2d2bf2f8d 100644 --- a/bacula/src/dird/ua_cmds.c +++ b/bacula/src/dird/ua_cmds.c @@ -30,7 +30,6 @@ extern int r_first; extern int r_last; extern struct s_res resources[]; -extern char my_name[]; extern jobq_t job_queue; /* job queue */ diff --git a/bacula/src/dird/ua_dotcmds.c b/bacula/src/dird/ua_dotcmds.c index 613d17c7ed..f39d3a5d06 100644 --- a/bacula/src/dird/ua_dotcmds.c +++ b/bacula/src/dird/ua_dotcmds.c @@ -32,9 +32,7 @@ extern int r_first; extern int r_last; extern struct s_res resources[]; -extern char my_name[]; extern const char *client_backups; -extern int console_msg_pending; /* Imported functions */ extern void do_messages(UAContext *ua, const char *cmd); diff --git a/bacula/src/dird/ua_output.c b/bacula/src/dird/ua_output.c index a738dfe326..f53628e974 100644 --- a/bacula/src/dird/ua_output.c +++ b/bacula/src/dird/ua_output.c @@ -33,9 +33,6 @@ extern int r_first; extern int r_last; extern RES_TABLE resources[]; extern RES **res_head; -extern int console_msg_pending; -extern FILE *con_fd; -extern brwlock_t con_lock; /* Imported functions */ diff --git a/bacula/src/dird/ua_server.c b/bacula/src/dird/ua_server.c index 7f0c6b795c..5ebaa79f75 100644 --- a/bacula/src/dird/ua_server.c +++ b/bacula/src/dird/ua_server.c @@ -28,8 +28,6 @@ extern int r_first; extern int r_last; extern struct s_res resources[]; -extern int console_msg_pending; -extern char my_name[]; /* Forward referenced functions */ diff --git a/bacula/src/dird/ua_status.c b/bacula/src/dird/ua_status.c index c69d2526ad..49ddebd316 100644 --- a/bacula/src/dird/ua_status.c +++ b/bacula/src/dird/ua_status.c @@ -25,10 +25,6 @@ #include "bacula.h" #include "dird.h" -extern char my_name[]; -extern time_t daemon_start_time; -extern int num_jobs_run; - static void list_scheduled_jobs(UAContext *ua); static void list_running_jobs(UAContext *ua); static void list_terminated_jobs(UAContext *ua); diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index 3a46402ba6..84a2ba196c 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -33,9 +33,6 @@ #include "dird.h" #include "findlib/find.h" -/* Imported Global Variables */ -extern int debug_level; - /* Commands sent to File daemon */ static char verifycmd[] = "verify level=%s\n"; static char storaddr[] = "storage address=%s port=%d ssl=0\n"; diff --git a/bacula/src/filed/filed.c b/bacula/src/filed/filed.c index 5145735a1c..623de061a3 100644 --- a/bacula/src/filed/filed.c +++ b/bacula/src/filed/filed.c @@ -27,9 +27,6 @@ /* Imported Functions */ extern void *handle_client_request(void *dir_sock); -/* Imported Variables */ -extern time_t watchdog_sleep_time; - /* Forward referenced functions */ void terminate_filed(int sig); static int check_resources(); diff --git a/bacula/src/filed/filed.h b/bacula/src/filed/filed.h index 2c59f340c1..c107d30ff5 100644 --- a/bacula/src/filed/filed.h +++ b/bacula/src/filed/filed.h @@ -33,6 +33,4 @@ #define uLongf uint32_t #endif -extern int win32_client; /* Are we running on Windows? */ - extern CLIENT *me; /* "Global" Client resource */ diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index 5b88dd6772..9768fe2e30 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -28,7 +28,6 @@ static pthread_mutex_t vss_mutex = PTHREAD_MUTEX_INITIALIZER; #endif -extern char my_name[]; extern CLIENT *me; /* our client resource */ int enable_vss = 0; /* set to use vss */ diff --git a/bacula/src/filed/status.c b/bacula/src/filed/status.c index 2c90d7a0a9..7df988108c 100755 --- a/bacula/src/filed/status.c +++ b/bacula/src/filed/status.c @@ -24,11 +24,6 @@ #include "bacula.h" #include "filed.h" -extern char my_name[]; -extern int num_jobs_run; -extern time_t daemon_start_time; -extern bool get_trace(void); - /* Forward referenced functions */ static void list_terminated_jobs(void sendit(const char *msg, int len, void *sarg), void *arg); static void bsock_sendit(const char *msg, int len, void *arg); @@ -403,8 +398,6 @@ static const char *level_to_str(int level) #if defined(HAVE_WIN32) -#include - int bacstat = 0; struct s_win32_arg { diff --git a/bacula/src/filed/win32/winabout.cpp b/bacula/src/filed/win32/winabout.cpp index 69ace2286a..5fbccae3a9 100755 --- a/bacula/src/filed/win32/winabout.cpp +++ b/bacula/src/filed/win32/winabout.cpp @@ -21,8 +21,10 @@ Kern E. Sibbald, 2000 */ +#include "bacula.h" #include "winbacula.h" #include "winabout.h" +#include "winres.h" bacAbout::bacAbout() { diff --git a/bacula/src/filed/win32/winbacula.h b/bacula/src/filed/win32/winbacula.h index c61d39e8d4..088205be33 100755 --- a/bacula/src/filed/win32/winbacula.h +++ b/bacula/src/filed/win32/winbacula.h @@ -29,19 +29,6 @@ // -// WinUPS header file - -#ifdef HAVE_MINGW -#include "compat.h" -#endif - -#define STRICT 1 -#include -#include -#include -#include "winres.h" - - // Application specific messages // Message used for system tray notifications diff --git a/bacula/src/filed/win32/winevents.cpp b/bacula/src/filed/win32/winevents.cpp index c41cf7cd98..50edd0a5f5 100755 --- a/bacula/src/filed/win32/winevents.cpp +++ b/bacula/src/filed/win32/winevents.cpp @@ -24,8 +24,10 @@ /* Code for the Events dialogue */ +#include "bacula.h" #include "winbacula.h" #include "winevents.h" +#include "winres.h" extern "C" void FillEventsBox(HWND hwnd, int id_list); diff --git a/bacula/src/filed/win32/winmain.cpp b/bacula/src/filed/win32/winmain.cpp index 2cda05ad2b..4a662a56e7 100755 --- a/bacula/src/filed/win32/winmain.cpp +++ b/bacula/src/filed/win32/winmain.cpp @@ -15,20 +15,15 @@ */ -#ifndef HAVE_WIN32 -#define HAVE_CYGWIN 1 -#endif - #include -#include #include + +#include "bacula.h" #include "winbacula.h" #include "wintray.h" #include "winservice.h" #include #include -#include "../../lib/winapi.h" -#include "baconfig.h" extern int BaculaMain(int argc, char *argv[]); extern void terminate_filed(int sig); @@ -40,7 +35,7 @@ extern void d_msg(const char *, int, int, const char *, ...); HINSTANCE hAppInstance; const char *szAppName = "Bacula"; DWORD mainthreadId; -bool silent = false; +bool silent = false; /* Imported variables */ extern DWORD g_servicethread; diff --git a/bacula/src/filed/win32/winservice.cpp b/bacula/src/filed/win32/winservice.cpp index a1c7ddd009..7fc85b2e7d 100755 --- a/bacula/src/filed/win32/winservice.cpp +++ b/bacula/src/filed/win32/winservice.cpp @@ -37,12 +37,10 @@ // show events, ...) -#include -#undef PASCAL +#include "bacula.h" #include "winbacula.h" #include "winservice.h" #include "wintray.h" -#include "bacula.h" void set_service_description(SC_HANDLE hSCManager, SC_HANDLE hService, LPSTR lpDesc); diff --git a/bacula/src/filed/win32/winstat.cpp b/bacula/src/filed/win32/winstat.cpp index 79da6dcc7e..45e3c41ad1 100755 --- a/bacula/src/filed/win32/winstat.cpp +++ b/bacula/src/filed/win32/winstat.cpp @@ -24,8 +24,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "bacula.h" #include "winbacula.h" #include "winstat.h" +#include "winres.h" extern void FillStatusBox(HWND hwnd, int id_list); diff --git a/bacula/src/filed/win32/wintray.cpp b/bacula/src/filed/win32/wintray.cpp index 3a5518de10..044d34b7ce 100755 --- a/bacula/src/filed/win32/wintray.cpp +++ b/bacula/src/filed/win32/wintray.cpp @@ -34,15 +34,12 @@ // Implementation of a system tray icon & menu for Bacula +#include "bacula.h" +#include "jcr.h" #include "winbacula.h" #include "winservice.h" -#include - -// Header - +#include "winres.h" #include "wintray.h" -#include "bacula.h" -#include "jcr.h" // Constants #ifdef properties_implemented diff --git a/bacula/src/findlib/Makefile.in b/bacula/src/findlib/Makefile.in index b0fe8cbefe..a9e4a4ff76 100644 --- a/bacula/src/findlib/Makefile.in +++ b/bacula/src/findlib/Makefile.in @@ -34,7 +34,7 @@ LIBOBJS = find.o match.o find_one.o attribs.o create_file.o \ # inference rules .c.o: @echo "Compiling $<" - $(NO_ECHO)$(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) $(OPENSSL_INC) $(PYTHON_INC) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $< + $(NO_ECHO)$(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) $(PYTHON_INC) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $< #------------------------------------------------------------------------- all: Makefile libfind.a ../lib/libbac.a @echo "==== Make of findlib is good ====" diff --git a/bacula/src/findlib/attribs.c b/bacula/src/findlib/attribs.c index fdf0c67322..6a81ac5dac 100755 --- a/bacula/src/findlib/attribs.c +++ b/bacula/src/findlib/attribs.c @@ -27,10 +27,6 @@ #include "find.h" #if defined(HAVE_WIN32) - -#include "../lib/winapi.h" - - /* Forward referenced subroutines */ static bool set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd); void unix_name_to_win32(POOLMEM **win32_name, char *name); diff --git a/bacula/src/findlib/bfile.h b/bacula/src/findlib/bfile.h index 69cce6fb68..e6d4c34a06 100644 --- a/bacula/src/findlib/bfile.h +++ b/bacula/src/findlib/bfile.h @@ -66,9 +66,6 @@ typedef struct _PROCESS_WIN32_BACKUPAPIBLOCK_CONTEXT { */ #if defined(HAVE_WIN32) -#include -#include "../lib/winapi.h" - enum { BF_CLOSED, BF_READ, /* BackupRead */ diff --git a/bacula/src/findlib/match.c b/bacula/src/findlib/match.c index 4c239840a9..2e5bc26240 100644 --- a/bacula/src/findlib/match.c +++ b/bacula/src/findlib/match.c @@ -49,7 +49,6 @@ static const int fnmode = 0; #undef bmalloc #define bmalloc(x) sm_malloc(__FILE__, __LINE__, x) -extern int win32_client; int match_files(JCR *jcr, FF_PKT *ff, int callback(FF_PKT *ff_pkt, void *hpkt, bool), void *his_pkt) @@ -366,13 +365,15 @@ int file_is_excluded(FF_PKT *ff, const char *file) { const char *p; +#if defined(HAVE_WIN32) /* * ***NB*** this removes the drive from the exclude * rule. Why????? */ - if (win32_client && file[1] == ':') { + if (file[1] == ':') { file += 2; } +#endif if (file_in_excluded_list(ff->excluded_paths_list, file)) { return 1; diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index effa5580a0..f5f45ad74e 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -350,7 +350,7 @@ struct s_last_job { }; extern struct s_last_job last_job; -extern dlist *last_jobs; +extern dlist * DLL_IMP_EXP last_jobs; /* The following routines are found in lib/jcr.c */ @@ -362,6 +362,7 @@ extern JCR *get_jcr_by_partial_name(char *Job); extern JCR *get_jcr_by_full_name(char *Job); extern JCR *get_next_jcr(JCR *jcr); extern void set_jcr_job_status(JCR *jcr, int JobStatus); +extern int DLL_IMP_EXP num_jobs_run; #ifdef DEBUG extern void b_free_jcr(const char *file, int line, JCR *jcr); diff --git a/bacula/src/lib/attr.c b/bacula/src/lib/attr.c index c041f5fd56..2e30a11b62 100644 --- a/bacula/src/lib/attr.c +++ b/bacula/src/lib/attr.c @@ -23,7 +23,6 @@ #include "bacula.h" #include "jcr.h" -extern int win32_client; ATTR *new_attr() { @@ -141,9 +140,11 @@ void build_attr_output_fnames(JCR *jcr, ATTR *attr) const char *fn; int wherelen = strlen(jcr->where); pm_strcpy(attr->ofname, jcr->where); /* copy prefix */ - if (win32_client && attr->fname[1] == ':') { +#if defined(HAVE_WIN32) + if (attr->fname[1] == ':') { attr->fname[1] = '/'; /* convert : to / */ } +#endif fn = attr->fname; /* take whole name */ /* Ensure where is terminated with a slash */ if (jcr->where[wherelen-1] != '/' && fn[0] != '/') { @@ -166,9 +167,12 @@ void build_attr_output_fnames(JCR *jcr, ATTR *attr) attr->olname[0] = 0; add_link = false; } - if (win32_client && attr->lname[1] == ':') { + +#if defined(HAVE_WIN32) + if (attr->lname[1] == ':') { attr->lname[1] = '/'; /* turn : into / */ } +#endif fn = attr->lname; /* take whole name */ /* Ensure where is terminated with a slash */ if (add_link && jcr->where[wherelen-1] != '/' && fn[0] != '/') { @@ -177,10 +181,10 @@ void build_attr_output_fnames(JCR *jcr, ATTR *attr) pm_strcat(attr->olname, fn); /* copy rest of link */ } } - if (win32_client) { +#if defined(HAVE_WIN32) strip_double_slashes(attr->ofname); strip_double_slashes(attr->olname); - } +#endif } extern char *getuser(uid_t uid, char *name, int len); diff --git a/bacula/src/lib/events.c b/bacula/src/lib/events.c index 782778e12a..c89c413f02 100644 --- a/bacula/src/lib/events.c +++ b/bacula/src/lib/events.c @@ -140,8 +140,6 @@ bailout: #if defined(HAVE_WIN32) -#include - extern UPSINFO myUPS; extern int shm_OK; diff --git a/bacula/src/lib/lib.h b/bacula/src/lib/lib.h index 244bdc576f..9f86b25a83 100644 --- a/bacula/src/lib/lib.h +++ b/bacula/src/lib/lib.h @@ -31,6 +31,10 @@ #include "btime.h" #include "crypto.h" #include "mem_pool.h" +#include "rwlock.h" +#include "semlock.h" +#include "queue.h" +#include "serial.h" #include "message.h" #include "openssl.h" #include "lex.h" @@ -39,10 +43,6 @@ #include "bsock.h" #include "bshm.h" #include "workq.h" -#include "rwlock.h" -#include "semlock.h" -#include "queue.h" -#include "serial.h" #ifndef HAVE_FNMATCH #include "fnmatch.h" #endif diff --git a/bacula/src/lib/message.c b/bacula/src/lib/message.c index 1c4b685d9a..bac2f479da 100755 --- a/bacula/src/lib/message.c +++ b/bacula/src/lib/message.c @@ -26,10 +26,6 @@ #include "bacula.h" #include "jcr.h" -#if !defined(HAVE_CONSOLE) && defined(HAVE_WIN32) -#include -#endif - #define FULL_LOCATION 1 /* set for file:line in Debug messages */ /* diff --git a/bacula/src/lib/message.h b/bacula/src/lib/message.h index e49a697418..7f73169d68 100644 --- a/bacula/src/lib/message.h +++ b/bacula/src/lib/message.h @@ -129,10 +129,16 @@ void d_msg(const char *file, int line, int level, const char *fmt,...); void e_msg(const char *file, int line, int type, int level, const char *fmt,...); void Jmsg(JCR *jcr, int type, time_t mtime, const char *fmt,...); void Qmsg(JCR *jcr, int type, time_t mtime, const char *fmt,...); +bool get_trace(void); -extern int debug_level; -extern int verbose; -extern char my_name[]; -extern const char *working_directory; -extern time_t daemon_start_time; -extern char catalog_db[]; + +extern int DLL_IMP_EXP debug_level; +extern int DLL_IMP_EXP verbose; +extern char DLL_IMP_EXP my_name[]; +extern const char * DLL_IMP_EXP working_directory; +extern time_t DLL_IMP_EXP daemon_start_time; +extern char catalog_db[]; + +extern int DLL_IMP_EXP console_msg_pending; +extern FILE * DLL_IMP_EXP con_fd; /* Console file descriptor */ +extern brwlock_t DLL_IMP_EXP con_lock; /* Console lock structure */ diff --git a/bacula/src/lib/parse_conf.c b/bacula/src/lib/parse_conf.c index f95b609485..1ad44371e6 100755 --- a/bacula/src/lib/parse_conf.c +++ b/bacula/src/lib/parse_conf.c @@ -50,8 +50,6 @@ #include "bacula.h" -extern int debug_level; - /* Each daemon has a slightly different set of * resources, so it will define the following * global values. diff --git a/bacula/src/lib/smartall.h b/bacula/src/lib/smartall.h index 429549b9d1..1ddd3cacff 100644 --- a/bacula/src/lib/smartall.h +++ b/bacula/src/lib/smartall.h @@ -21,10 +21,10 @@ */ -extern uint64_t sm_max_bytes; -extern uint64_t sm_bytes; -extern uint32_t sm_max_buffers; -extern uint32_t sm_buffers; +extern uint64_t DLL_IMP_EXP sm_max_bytes; +extern uint64_t DLL_IMP_EXP sm_bytes; +extern uint32_t DLL_IMP_EXP sm_max_buffers; +extern uint32_t DLL_IMP_EXP sm_buffers; #ifdef SMARTALLOC #undef SMARTALLOC diff --git a/bacula/src/lib/var.c b/bacula/src/lib/var.c index 14a59227c1..14289b19a8 100644 --- a/bacula/src/lib/var.c +++ b/bacula/src/lib/var.c @@ -37,10 +37,11 @@ */ -#ifndef HAVE_WIN32 #include "bacula.h" #if defined(HAVE_PCREPOSIX) # include +#elif defined(HAVE_WIN32) +# include "bregex.h" #else # include #endif @@ -2716,4 +2717,3 @@ const char *var_strerror(var_t *var, var_rc_t rc) } return str; } -#endif diff --git a/bacula/src/lib/watchdog.h b/bacula/src/lib/watchdog.h index c8e1cebb58..8763928e0b 100644 --- a/bacula/src/lib/watchdog.h +++ b/bacula/src/lib/watchdog.h @@ -43,3 +43,7 @@ struct s_watchdog_t { time_t next_fire; }; typedef struct s_watchdog_t watchdog_t; + +/* Exported globals */ +extern time_t DLL_IMP_EXP watchdog_time; /* this has granularity of SLEEP_TIME */ +extern time_t DLL_IMP_EXP watchdog_sleep_time; /* examine things every 60 seconds */ diff --git a/bacula/src/stored/bcopy.c b/bacula/src/stored/bcopy.c index b072bd9a93..a23cd2547a 100644 --- a/bacula/src/stored/bcopy.c +++ b/bacula/src/stored/bcopy.c @@ -138,6 +138,8 @@ int main (int argc, char *argv[]) usage(); } + OSDependentInit(); + working_directory = wd; if (configfile == NULL) { diff --git a/bacula/src/stored/bextract.c b/bacula/src/stored/bextract.c index 1856539ac3..71a0b2512a 100644 --- a/bacula/src/stored/bextract.c +++ b/bacula/src/stored/bextract.c @@ -26,12 +26,6 @@ #include "stored.h" #include "findlib/find.h" -#if defined(HAVE_WIN32) -int win32_client = 1; -#else -int win32_client = 0; -#endif - static void do_extract(char *fname); static bool record_cb(DCR *dcr, DEV_RECORD *rec); @@ -98,6 +92,8 @@ int main (int argc, char *argv[]) my_name_is(argc, argv, "bextract"); init_msg(NULL, NULL); /* setup message handler */ + OSDependentInit(); + ff = init_find_files(); binit(&bfd); diff --git a/bacula/src/stored/block.c b/bacula/src/stored/block.c index 2917c0fb73..a3d354da1e 100644 --- a/bacula/src/stored/block.c +++ b/bacula/src/stored/block.c @@ -27,7 +27,6 @@ #include "bacula.h" #include "stored.h" -extern int debug_level; static bool terminate_writing_volume(DCR *dcr); static bool do_new_file_bookkeeping(DCR *dcr); static bool do_dvd_size_checks(DCR *dcr); diff --git a/bacula/src/stored/bls.c b/bacula/src/stored/bls.c index 40d348ccae..e12f6d47cf 100644 --- a/bacula/src/stored/bls.c +++ b/bacula/src/stored/bls.c @@ -23,12 +23,6 @@ #include "stored.h" #include "findlib/find.h" -#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32) -int win32_client = 1; -#else -int win32_client = 0; -#endif - /* Dummy functions */ int generate_daemon_event(JCR *jcr, const char *event) { return 1; } @@ -102,6 +96,8 @@ int main (int argc, char *argv[]) my_name_is(argc, argv, "bls"); init_msg(NULL, NULL); /* initialize message handler */ + OSDependentInit(); + ff = init_find_files(); while ((ch = getopt(argc, argv, "b:c:d:e:i:jkLpvV:?")) != -1) { diff --git a/bacula/src/stored/bscan.c b/bacula/src/stored/bscan.c index 6d979c96f5..397a86c437 100644 --- a/bacula/src/stored/bscan.c +++ b/bacula/src/stored/bscan.c @@ -51,14 +51,6 @@ static JCR *create_jcr(JOB_DBR *jr, DEV_RECORD *rec, uint32_t JobId); static int update_digest_record(B_DB *db, char *digest, DEV_RECORD *rec, int type); -/* Global variables */ -#if defined(HAVE_WIN32) -int win32_client = 1; -#else -int win32_client = 0; -#endif - - /* Local variables */ static DEVICE *dev = NULL; static B_DB *db; diff --git a/bacula/src/stored/btape.c b/bacula/src/stored/btape.c index 0198ed0687..a69a3d2e3a 100644 --- a/bacula/src/stored/btape.c +++ b/bacula/src/stored/btape.c @@ -188,6 +188,8 @@ int main(int margc, char *margv[]) my_name_is(margc, margv, "btape"); init_msg(NULL, NULL); + OSDependentInit(); + while ((ch = getopt(margc, margv, "b:c:d:psv?")) != -1) { switch (ch) { case 'b': /* bootstrap file */ diff --git a/bacula/src/stored/device.c b/bacula/src/stored/device.c index 30f6c403f6..be6ef15fb1 100644 --- a/bacula/src/stored/device.c +++ b/bacula/src/stored/device.c @@ -48,9 +48,6 @@ /* Forward referenced functions */ -extern char my_name[]; -extern int debug_level; - /* * This is the dreaded moment. We either have an end of * medium condition or worse, and error condition. diff --git a/bacula/src/stored/label.c b/bacula/src/stored/label.c index 43afb8933a..030a7ca2c2 100644 --- a/bacula/src/stored/label.c +++ b/bacula/src/stored/label.c @@ -28,9 +28,6 @@ /* Forward referenced functions */ static void create_volume_label_record(DCR *dcr, DEV_RECORD *rec); -extern char my_name[]; -extern int debug_level; - /* * Read the volume label * diff --git a/bacula/src/stored/record.c b/bacula/src/stored/record.c index 130a2884b7..8eb0509492 100644 --- a/bacula/src/stored/record.c +++ b/bacula/src/stored/record.c @@ -27,8 +27,6 @@ #include "bacula.h" #include "stored.h" -extern int debug_level; - /* * Convert a FileIndex into a printable * ASCII string. Not reentrant. diff --git a/bacula/src/stored/status.c b/bacula/src/stored/status.c index 46a72d95d6..5edd913ac1 100644 --- a/bacula/src/stored/status.c +++ b/bacula/src/stored/status.c @@ -30,10 +30,6 @@ extern BSOCK *filed_chan; extern int r_first, r_last; extern struct s_res resources[]; -extern char my_name[]; -extern time_t daemon_start_time; -extern int num_jobs_run; - /* Static variables */ static char qstatus[] = ".status %127s\n"; diff --git a/bacula/src/stored/stored_conf.c b/bacula/src/stored/stored_conf.c index cb9766cd6f..e392d0b3d1 100644 --- a/bacula/src/stored/stored_conf.c +++ b/bacula/src/stored/stored_conf.c @@ -23,9 +23,6 @@ #include "bacula.h" #include "stored.h" -extern int debug_level; - - /* First and last resource ids */ int r_first = R_FIRST; int r_last = R_LAST; diff --git a/bacula/src/tools/bregex.c b/bacula/src/tools/bregex.c index 9587658f38..f21240e0e0 100644 --- a/bacula/src/tools/bregex.c +++ b/bacula/src/tools/bregex.c @@ -109,6 +109,8 @@ int main(int argc, char *const *argv) usage(); } + OSDependentInit(); + for ( ;; ) { printf("Enter regex pattern: "); if (fgets(pat, sizeof(pat)-1, stdin) == NULL) { diff --git a/bacula/src/tools/bwild.c b/bacula/src/tools/bwild.c index a7b0977046..a1f579e91e 100644 --- a/bacula/src/tools/bwild.c +++ b/bacula/src/tools/bwild.c @@ -90,6 +90,8 @@ int main(int argc, char *const *argv) usage(); } + OSDependentInit(); + for ( ;; ) { printf("Enter a wild-card: "); if (fgets(pat, sizeof(pat)-1, stdin) == NULL) { diff --git a/bacula/src/tools/dbcheck.c b/bacula/src/tools/dbcheck.c index c7eaa5a0f6..66ae3858cd 100644 --- a/bacula/src/tools/dbcheck.c +++ b/bacula/src/tools/dbcheck.c @@ -152,6 +152,8 @@ int main (int argc, char *argv[]) argc -= optind; argv += optind; + OSDependentInit(); + if (configfile) { CAT *catalog = NULL; int found = 0; diff --git a/bacula/src/tools/fstype.c b/bacula/src/tools/fstype.c index 796588d9a6..3f1430a72a 100644 --- a/bacula/src/tools/fstype.c +++ b/bacula/src/tools/fstype.c @@ -75,6 +75,8 @@ main (int argc, char *const *argv) usage(); } + OSDependentInit(); + for (i = 0; i < argc; --argc, ++argv) { if (fstype(*argv, fs, sizeof(fs))) { if (verbose) { diff --git a/bacula/src/tools/testls.c b/bacula/src/tools/testls.c index 78ff15d3ec..54d46fa0f1 100755 --- a/bacula/src/tools/testls.c +++ b/bacula/src/tools/testls.c @@ -19,12 +19,6 @@ #include "bacula.h" #include "findlib/find.h" -#if defined(HAVE_WIN32) -int win32_client = 1; -#else -int win32_client = 0; -#endif - /* Dummy functions */ int generate_daemon_event(JCR *jcr, const char *event) { return 1; } int generate_job_event(JCR *jcr, const char *event) { return 1; } diff --git a/bacula/src/win32/Makefile.in b/bacula/src/win32/Makefile.in index 0d93a16b7f..69aeb1daf6 100644 --- a/bacula/src/win32/Makefile.in +++ b/bacula/src/win32/Makefile.in @@ -10,26 +10,20 @@ TOPDIR = @TOP_DIR@ CROSSTOOLS = $(TOPDIR)/cross-tools MINGW = $(CROSSTOOLS)/mingw32 -INCLUDE_MINGW = -I $(MINGW)/mingw32/include -INCLUDE_GCC = -I $(MINGW)/lib/gcc/mingw32/3.4.5/include -DEPKGS = $(TOPDIR)/depkgs-win32 +DEPKGS = $(TOPDIR)/depkgs-mingw32 -INCLUDE_BACULA = -I .. -I ./compat -INCLUDE_PTHREADS = -I$(DEPKGS)/pthreads -INCLUDE_ZLIB = -I$(DEPKGS)/zlib -INCLUDE_VSS = -I$(CROSSTOOLS) +INCLUDE_BACULA = -I .. -I ./compat -I$(DEPKGS)/include +INCLUDE_PTHREADS = -I$(DEPKGS)/include/pthreads +INCLUDE_VSS = -I$(DEPKGS)/vss INCLUDE_ICONS = -I ../filed/win32 -INCLUDE_OPENSSL = -I$(DEPKGS)/openssl/include -INCLUDE_WX = -I$(DEPKGS)/wx/include -LIB_MINGW = $(MINGW)/mingw32/lib -LIB_PTHREADS = $(DEPKGS)/pthreads/pthreadGCE.dll -LIB_ZLIB = $(DEPKGS)/zlib/libz.a -LIB_SSL = $(DEPKGS)/openssl/libssl.a -LIB_CRYPTO = $(DEPKGS)/openssl/libcrypto.a +LIB_PTHREADS = -lpthreadGCE +LIB_ZLIB = -lz +LIB_SSL = -lssl +LIB_CRYPTO = -lcrypto -LIBWX = $(DEPKGS)/wx/build-mingw32/lib +LIBWX = $(DEPKGS)/lib/wx_dll LIB_WX = $(LIBWX)/libwx_base-2.6.a \ $(LIBWX)/libwx_base_net-2.6.a \ $(LIBWX)/libwx_base_xml-2.6.a \ @@ -259,6 +253,7 @@ LIB_OBJS = \ $(LIBDIR)/bnet_server.o \ $(LIBDIR)/bpipe.o \ $(LIBDIR)/bregex.o \ + $(LIBDIR)/bsnprintf.o \ $(LIBDIR)/bsys.o \ $(LIBDIR)/btime.o \ $(LIBDIR)/btimers.o \ @@ -334,6 +329,9 @@ $(LIBDIR)/bpipe.o: ../lib/bpipe.c $(LIBDIR)/bregex.o: ../lib/bregex.c $(CXX) -c $< -o $@ +$(LIBDIR)/bsnprintf.o: ../lib/bsnprintf.c + $(CXX) -c $< -o $@ + $(LIBDIR)/bsys.o: ../lib/bsys.c $(CXX) -c $< -o $@ @@ -533,37 +531,29 @@ $(OBJDIR)/wx-console.res: ../wx-console/wx-console_private.rc FD_OBJS = $(LIB_OBJS) $(OBJS_COMPAT) $(OBJS_WIN) $(OBJS_FINDLIB) $(OBJS_FILED) FD_LIBS = \ - -L$(LIB_MINGW) \ + -L$(DEPKGS)/lib \ $(LIB_PTHREADS) \ $(LIB_SSL) \ $(LIB_CRYPTO) \ $(LIB_ZLIB) \ - $(LIB_MINGW)/libole32.a \ - $(LIB_MINGW)/liboleaut32.a \ - $(LIB_MINGW)/libuser32.a \ - $(LIB_MINGW)/libadvapi32.a \ - $(LIB_MINGW)/libgdi32.a \ - $(LIB_MINGW)/libwsock32.a \ - $(LIB_MINGW)/libshell32.a \ - $(LIB_MINGW)/libnetapi32.a \ - $(LIB_MINGW)/libuuid.a + -lgdi32 \ + -lole32 \ + -loleaut32 \ + -lwsock32 \ + -luuid CONS_OBJS = $(LIB_OBJS) $(OBJS_COMPAT) $(OBJS_CONSOLE) CONS_LIBS = \ - -L$(LIB_MINGW) \ + -L$(DEPKGS)/lib \ $(LIB_PTHREADS) \ $(LIB_SSL) \ $(LIB_CRYPTO) \ - $(LIB_MINGW)/libole32.a \ - $(LIB_MINGW)/liboleaut32.a \ - $(LIB_MINGW)/libuser32.a \ - $(LIB_MINGW)/libadvapi32.a \ - $(LIB_MINGW)/libgdi32.a \ - $(LIB_MINGW)/libwsock32.a \ - $(LIB_MINGW)/libshell32.a \ - $(LIB_MINGW)/libnetapi32.a \ - $(LIB_MINGW)/libuuid.a + -lole32 \ + -loleaut32 \ + -lwsock32 \ + -luuid + WXCONS_OBJS = $(LIB_OBJS) $(OBJS_COMPAT) $(OBJS_WXCONSOLE) @@ -572,15 +562,7 @@ WXCONS_LIBS = \ $(LIB_PTHREADS) \ $(LIB_SSL) \ $(LIB_CRYPTO) \ - $(LIB_MINGW)/libole32.a \ - $(LIB_MINGW)/liboleaut32.a \ - $(LIB_MINGW)/libuser32.a \ - $(LIB_MINGW)/libadvapi32.a \ - $(LIB_MINGW)/libgdi32.a \ - $(LIB_MINGW)/libwsock32.a \ - $(LIB_MINGW)/libshell32.a \ - $(LIB_MINGW)/libnetapi32.a \ - $(LIB_MINGW)/libuuid.a + @@ -595,20 +577,20 @@ all: bacula-fd.exe bconsole.exe # Link the File daemon executable ... bacula-fd.exe: $(FD_OBJS) $(CXX) $(FD_OBJS) $(FD_LIBS) -o $(OBJDIR)/bacula-fd.exe - cp -f $(DEPKGS)/pthreads/pthreadGCE.dll . + cp -f $(DEPKGS)/bin/pthreadGCE.dll . cp -f $(MINGW)/mingw32/bin/mingwm10.dll . # Link the File daemon executable ... bconsole.exe: $(CONS_OBJS) $(CXX) $(CONS_OBJS) $(CONS_LIBS) -o $(OBJDIR)/bconsole.exe - cp -f $(DEPKGS)/pthreads/pthreadGCE.dll . + cp -f $(DEPKGS)/bin/pthreadGCE.dll . cp -f $(MINGW)/mingw32/bin/mingwm10.dll . # Link the File daemon executable ... # Not yet complete wx-console.exe: $(WXCONS_OBJS) $(CXX) $(WX_INC) $(WXCONS_OBJS) $(WXCONS_LIBS) -o $(OBJDIR)/wx-console.exe - cp -f $(DEPKGS)/pthreads/pthreadGCE.dll . + cp -f $(DEPKGS)/bin/pthreadGCE.dll . cp -f $(MINGW)/mingw32/bin/mingwm10.dll . diff --git a/bacula/src/win32/compat/compat.cpp b/bacula/src/win32/compat/compat.cpp index 50451a37fe..f0ea48a82c 100644 --- a/bacula/src/win32/compat/compat.cpp +++ b/bacula/src/win32/compat/compat.cpp @@ -24,7 +24,6 @@ #include "bacula.h" #include "compat.h" #include "jcr.h" -#include "../../lib/winapi.h" #include "vss.h" diff --git a/bacula/src/win32/compat/compat.h b/bacula/src/win32/compat/compat.h index 5ac44ad0e3..c8f3504201 100644 --- a/bacula/src/win32/compat/compat.h +++ b/bacula/src/win32/compat/compat.h @@ -48,44 +48,7 @@ #define __STDC__ 1 #endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include - -#include "getopt.h" - -#define HAVE_WIN32 1 - -#ifndef HAVE_MINGW -#ifdef HAVE_CYGWIN -#undef HAVE_CYGWIN -#else -#endif //HAVE_CYGWIN -#endif //HAVE_MINGW typedef UINT64 u_int64_t; typedef UINT64 uint64_t; @@ -118,13 +81,6 @@ typedef __int64 off_t; /* STDC=1 means we can define this */ typedef long _off_t; /* must be same as sys/types.h */ #endif -#ifndef HAVE_MINGW -#ifndef HAVE_WXCONSOLE -typedef int BOOL; -#define bool BOOL -#endif -#endif - typedef UINT32 u_int32_t; typedef unsigned char u_int8_t; typedef unsigned short u_int16_t; @@ -189,7 +145,6 @@ int gettimeofday(struct timeval *, struct timezone *); #define ENOMEDIUM 123 #endif -#ifndef HAVE_WXCONSOLE struct stat { _dev_t st_dev; @@ -207,8 +162,6 @@ struct stat uint64_t st_blocks; }; -#endif - #undef S_IFMT #define S_IFMT 0170000 /* file type mask */ #undef S_IFDIR @@ -399,23 +352,5 @@ void openlog(const char *ident, int option, int facility); #define INVALID_FILE_ATTRIBUTES ((DWORD)-1) #endif -/* Temp kludge ***FIXME*** */ -#ifdef __APCUPSD__ -#define SIGCHLD 0 -#define SIGALRM 0 -#define SIGHUP 0 -#define SIGCHLD 0 -#define SIGPIPE 0 -unsigned int alarm(unsigned int seconds); -#define PM_FNAME 2000 -#define PM_MESSAGE 2000 -#define get_pool_memory(x) (char *)malloc(x) -#define free_pool_memory(x) free((char *)x) -#define check_pool_memory_size(x, y) x -#define ASSERT(x) -#define bstrncat astrncat -#define bstrncpy astrncpy - -#endif #endif /* __COMPAT_H_ */ diff --git a/bacula/src/win32/compat/dirent.h b/bacula/src/win32/compat/dirent.h index 7273fef6de..e69de29bb2 100644 --- a/bacula/src/win32/compat/dirent.h +++ b/bacula/src/win32/compat/dirent.h @@ -1 +0,0 @@ -#include "compat.h" diff --git a/bacula/src/win32/compat/mingwconfig.h b/bacula/src/win32/compat/mingwconfig.h index e28d40120d..934ea79752 100644 --- a/bacula/src/win32/compat/mingwconfig.h +++ b/bacula/src/win32/compat/mingwconfig.h @@ -56,6 +56,7 @@ /* Set to correct scanf value for long long int */ #define lld "lld" #define llu "llu" +/* #define USE_BSNPRINTF */ #define HAVE_STRTOLL 1 diff --git a/bacula/src/win32/compat/mswinver.h b/bacula/src/win32/compat/mswinver.h index c30ecdc650..730ac91971 100644 --- a/bacula/src/win32/compat/mswinver.h +++ b/bacula/src/win32/compat/mswinver.h @@ -1,8 +1,6 @@ #ifndef __MSWINVER_H_ #define __MSWINVER_H_ -#include "winbase.h" - #define MS_MAJOR_WINDOWS_3 3 #define MS_MAJOR_WINDOWS_95 4 #define MS_MAJOR_WINDOWS_98 4 diff --git a/bacula/src/win32/compat/pwd.h b/bacula/src/win32/compat/pwd.h index 7273fef6de..e69de29bb2 100644 --- a/bacula/src/win32/compat/pwd.h +++ b/bacula/src/win32/compat/pwd.h @@ -1 +0,0 @@ -#include "compat.h" diff --git a/bacula/src/win32/compat/stdint.h b/bacula/src/win32/compat/stdint.h index ce2c545f75..048a4541bc 100644 --- a/bacula/src/win32/compat/stdint.h +++ b/bacula/src/win32/compat/stdint.h @@ -1,5 +1,3 @@ -#ifndef HAVE_MINGW -#include "compat.h" -#else +#if defined(__GNUC__) #include_next #endif diff --git a/bacula/src/win32/compat/sys/ioctl.h b/bacula/src/win32/compat/sys/ioctl.h index e69de29bb2..c09d6d9634 100644 --- a/bacula/src/win32/compat/sys/ioctl.h +++ b/bacula/src/win32/compat/sys/ioctl.h @@ -0,0 +1 @@ +extern int ioctl(int __fd, unsigned long int __request, ...); diff --git a/bacula/src/win32/compat/unistd.h b/bacula/src/win32/compat/unistd.h index ac1b9baa49..beb96285ed 100644 --- a/bacula/src/win32/compat/unistd.h +++ b/bacula/src/win32/compat/unistd.h @@ -1,5 +1,3 @@ -#ifndef HAVE_MINGW -#include "compat.h" -#else +#if defined(__GNUC__) #include_next #endif diff --git a/bacula/src/win32/compat/vss_generic.cpp b/bacula/src/win32/compat/vss_generic.cpp index dbf8d85975..1701c039fd 100644 --- a/bacula/src/win32/compat/vss_generic.cpp +++ b/bacula/src/win32/compat/vss_generic.cpp @@ -24,7 +24,7 @@ #ifdef WIN32_VSS #ifdef HAVE_MINGW -#include "compat.h" +#include "bacula.h" #else #include #include @@ -54,6 +54,7 @@ #endif +#undef setlocale // STL includes #include @@ -66,12 +67,16 @@ using namespace std; #include "ms_atl.h" #include +#if !defined(ENABLE_NLS) +#define setlocale(p, d) +#endif + #ifdef HAVE_STRSAFE_H // Used for safe string manipulation #include #endif -#include "../../lib/winapi.h" + class IXMLDOMDocument; @@ -79,9 +84,9 @@ class IXMLDOMDocument; #pragma message("compile VSS for Windows XP") #define VSSClientGeneric VSSClientXP - #include "vss/inc/WinXP/vss.h" - #include "vss/inc/WinXP/vswriter.h" - #include "vss/inc/WinXP/vsbackup.h" + #include "inc/WinXP/vss.h" + #include "inc/WinXP/vswriter.h" + #include "inc/WinXP/vsbackup.h" /* In VSSAPI.DLL */ typedef HRESULT (STDAPICALLTYPE* t_CreateVssBackupComponents)(OUT IVssBackupComponents **); @@ -97,9 +102,9 @@ class IXMLDOMDocument; #pragma message("compile VSS for Windows 2003") #define VSSClientGeneric VSSClient2003 - #include "vss/inc/Win2003/vss.h" - #include "vss/inc/Win2003/vswriter.h" - #include "vss/inc/Win2003/vsbackup.h" + #include "inc/Win2003/vss.h" + #include "inc/Win2003/vswriter.h" + #include "inc/Win2003/vsbackup.h" /* In VSSAPI.DLL */ typedef HRESULT (STDAPICALLTYPE* t_CreateVssBackupComponents)(OUT IVssBackupComponents **); @@ -133,7 +138,7 @@ inline wstring AppendBackslash(wstring str) // Get the unique volume name for the given path inline wstring GetUniqueVolumeNameForPath(wstring path) { - if (!path.length() > 0) { + if (path.length() <= 0) { return L""; } @@ -348,7 +353,7 @@ BOOL VSSClientGeneric::WaitAndCheckForAsyncOperation(IVssAsync* pAsync) #ifdef DEBUG // Check if the async operation succeeded... if(hrReturned != VSS_S_ASYNC_FINISHED) { - Pwchar_t pwszBuffer = NULL; + wchar_t *pwszBuffer = NULL; DWORD dwRet = ::FormatMessageW( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM diff --git a/bacula/src/wx-console/authenticate.c b/bacula/src/wx-console/authenticate.c index fcab7be0c7..f84244bf8e 100644 --- a/bacula/src/wx-console/authenticate.c +++ b/bacula/src/wx-console/authenticate.c @@ -28,12 +28,12 @@ /* _("...") macro returns a wxChar*, so if we need a char*, we need to convert it with: * wxString(_("...")).mb_str(*wxConvCurrent) */ -#include - #include "bacula.h" #include "console_conf.h" #include "jcr.h" +#include + #include "csprint.h" void senditf(char *fmt, ...); diff --git a/bacula/src/wx-console/console_conf.c b/bacula/src/wx-console/console_conf.c index 7be2c3ec02..678dcf411f 100644 --- a/bacula/src/wx-console/console_conf.c +++ b/bacula/src/wx-console/console_conf.c @@ -37,11 +37,11 @@ /* _("...") macro returns a wxChar*, so if we need a char*, we need to convert it with: * wxString(_("...")).mb_str(*wxConvCurrent) */ -#include - #include "bacula.h" #include "console_conf.h" +#include + /* Define the first and last resource ID record * types. Note, these should be unique for each * daemon though not a requirement. diff --git a/bacula/src/wx-console/console_thread.cpp b/bacula/src/wx-console/console_thread.cpp index dc4b2ccaad..3898f4c56e 100644 --- a/bacula/src/wx-console/console_thread.cpp +++ b/bacula/src/wx-console/console_thread.cpp @@ -26,6 +26,9 @@ /* _("...") macro returns a wxChar*, so if we need a char*, we need to convert it with: * wxString(_("...")).mb_str(*wxConvCurrent) */ +#include "bacula.h" +#include "console_conf.h" + #include "console_thread.h" // class's header file #include @@ -33,12 +36,9 @@ #include #include -#include "console_conf.h" - #include "csprint.h" #ifdef HAVE_WIN32 -#include char OK_msg[] = "2000 OK\n"; char TERM_msg[] = "2999 Terminate\n"; #endif diff --git a/bacula/src/wx-console/main.cpp b/bacula/src/wx-console/main.cpp index 5dae9b5d83..22bb92e6b5 100644 --- a/bacula/src/wx-console/main.cpp +++ b/bacula/src/wx-console/main.cpp @@ -29,7 +29,7 @@ // headers // ---------------------------------------------------------------------------- -#include "config.h" +#include "bacula.h" #include #include @@ -39,8 +39,6 @@ #include "csprint.h" -void InitWinAPIWrapper(); - /* Dummy functions */ int generate_daemon_event(JCR *jcr, const char *event) { return 1; } int generate_job_event(JCR *jcr, const char *event) { return 1; } @@ -77,7 +75,7 @@ bool MyApp::OnInit() long posx, posy, sizex, sizey; int displayx, displayy; - InitWinAPIWrapper(); + OSDependentInit(); wxConfig::Get()->Read(wxT("/Position/X"), &posx, 50); wxConfig::Get()->Read(wxT("/Position/Y"), &posy, 50); wxConfig::Get()->Read(wxT("/Size/Width"), &sizex, 780); @@ -109,7 +107,3 @@ bool MyApp::OnInit() return TRUE; } - -#ifndef HAVE_WIN32 -void InitWinAPIWrapper() { }; -#endif diff --git a/bacula/src/wx-console/wxbconfigfileeditor.cpp b/bacula/src/wx-console/wxbconfigfileeditor.cpp index 7ea7ccf7f1..de89f16c64 100644 --- a/bacula/src/wx-console/wxbconfigfileeditor.cpp +++ b/bacula/src/wx-console/wxbconfigfileeditor.cpp @@ -21,6 +21,8 @@ */ +#include "bacula.h" + #include "wxbconfigfileeditor.h" #include diff --git a/bacula/src/wx-console/wxbconfigpanel.cpp b/bacula/src/wx-console/wxbconfigpanel.cpp index 8cce34fa88..3e35dca3e5 100644 --- a/bacula/src/wx-console/wxbconfigpanel.cpp +++ b/bacula/src/wx-console/wxbconfigpanel.cpp @@ -21,6 +21,8 @@ */ +#include "bacula.h" + #include "wxbconfigpanel.h" #include diff --git a/bacula/src/wx-console/wxbhistorytextctrl.cpp b/bacula/src/wx-console/wxbhistorytextctrl.cpp index 56e90ee04f..88da7d80a0 100644 --- a/bacula/src/wx-console/wxbhistorytextctrl.cpp +++ b/bacula/src/wx-console/wxbhistorytextctrl.cpp @@ -20,7 +20,9 @@ the file LICENSE for additional details. */ - + +#include "bacula.h" + #include "wxbhistorytextctrl.h" BEGIN_EVENT_TABLE(wxbHistoryTextCtrl, wxTextCtrl) diff --git a/bacula/src/wx-console/wxblistctrl.cpp b/bacula/src/wx-console/wxblistctrl.cpp index 0e13ffe7a4..b0beb57b52 100644 --- a/bacula/src/wx-console/wxblistctrl.cpp +++ b/bacula/src/wx-console/wxblistctrl.cpp @@ -22,6 +22,8 @@ */ +#include "bacula.h" + #include "wxblistctrl.h" #include "csprint.h" diff --git a/bacula/src/wx-console/wxbmainframe.cpp b/bacula/src/wx-console/wxbmainframe.cpp index e9550f28a6..61a25cde12 100644 --- a/bacula/src/wx-console/wxbmainframe.cpp +++ b/bacula/src/wx-console/wxbmainframe.cpp @@ -21,6 +21,8 @@ */ +#include "bacula.h" + #include "wxbmainframe.h" // class's header file #include "wxbrestorepanel.h" diff --git a/bacula/src/wx-console/wxbrestorepanel.cpp b/bacula/src/wx-console/wxbrestorepanel.cpp index 94d74d92ec..97d37dc156 100644 --- a/bacula/src/wx-console/wxbrestorepanel.cpp +++ b/bacula/src/wx-console/wxbrestorepanel.cpp @@ -49,6 +49,8 @@ Parameters to modify: Select parameter to modify (1-11): */ +#include "bacula.h" + #include "wxbrestorepanel.h" #include "wxbmainframe.h" diff --git a/bacula/src/wx-console/wxbtableparser.cpp b/bacula/src/wx-console/wxbtableparser.cpp index e4139fa39f..3857fdfcc2 100644 --- a/bacula/src/wx-console/wxbtableparser.cpp +++ b/bacula/src/wx-console/wxbtableparser.cpp @@ -28,6 +28,8 @@ */ +#include "bacula.h" + #include "wxbtableparser.h" // class's header file #include "csprint.h" diff --git a/bacula/src/wx-console/wxbtreectrl.cpp b/bacula/src/wx-console/wxbtreectrl.cpp index ddfc1f1518..23f416b383 100644 --- a/bacula/src/wx-console/wxbtreectrl.cpp +++ b/bacula/src/wx-console/wxbtreectrl.cpp @@ -20,7 +20,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the the file LICENSE for additional details. - */ +*/ + +#include "bacula.h" #include "wxbtreectrl.h" diff --git a/bacula/src/wx-console/wxbutils.cpp b/bacula/src/wx-console/wxbutils.cpp index fb6841899f..7af8e1a8bf 100644 --- a/bacula/src/wx-console/wxbutils.cpp +++ b/bacula/src/wx-console/wxbutils.cpp @@ -21,6 +21,8 @@ */ +#include "bacula.h" + #include "wxbutils.h" #include "wxbmainframe.h" -- 2.39.5