From: Kern Sibbald Date: Fri, 25 Aug 2006 12:35:45 +0000 (+0000) Subject: kes wx-console crashes because of differences between Bacula and wxWidgets X-Git-Tag: Release-2.0.0~548 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6ac131ced49a5cf7dab89324ad97ea0992da9fd2;p=bacula%2Fbacula kes wx-console crashes because of differences between Bacula and wxWidgets malloc()/free(). Tweek wx-console to use bmalloc()/bfree() for Bacula calls. kes correct improper indenting in wx-console/console_conf.c kes update wx-console header copyrights kes Fix bug #658 where wx-console mangles file/directory names containing commas. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3368 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/bacula.h b/bacula/src/bacula.h index 9d49a63aee..5619c0d7f2 100644 --- a/bacula/src/bacula.h +++ b/bacula/src/bacula.h @@ -142,9 +142,18 @@ #include "baconfig.h" #include "lib/lib.h" +/* + * For wx-console compiles, we undo some Bacula defines. + * This prevents conflicts between wx-Widgets and Bacula. + * In wx-console files that malloc or free() Bacula structures + * config/resources and interface to the Bacula libraries, + * you must use bmalloc() and bfree(). + */ #ifdef HAVE_WXCONSOLE #undef New #undef _ +#undef free +#undef malloc #endif #if defined(HAVE_WIN32) diff --git a/bacula/src/lib/bsys.c b/bacula/src/lib/bsys.c index aa2be79c06..a4dc7231aa 100644 --- a/bacula/src/lib/bsys.c +++ b/bacula/src/lib/bsys.c @@ -176,12 +176,16 @@ int cstrlen(const char *str) -#ifndef DEBUG +#ifndef bmalloc void *bmalloc(size_t size) { void *buf; +#ifdef SMARTALLOC + buf = sm_malloc(file, line, size); +#else buf = malloc(size); +#endif if (buf == NULL) { berrno be; Emsg1(M_ABORT, 0, _("Out of memory: ERR=%s\n"), be.strerror()); @@ -207,6 +211,18 @@ void *b_malloc(const char *file, int line, size_t size) } +void bfree(void *buf) +{ +#ifdef SMARTALLOC + sm_free(__FILE__, __LINE__, buf); +#else + free(buf); +#endif +} + + + + void *brealloc (void *buf, size_t size) { buf = realloc(buf, size); diff --git a/bacula/src/lib/protos.h b/bacula/src/lib/protos.h index dc2a2d9de2..d0ddd5326e 100644 --- a/bacula/src/lib/protos.h +++ b/bacula/src/lib/protos.h @@ -42,9 +42,10 @@ char *bstrncat (char *dest, POOL_MEM &src, int maxlen); bool bstrcmp (const char *s1, const char *s2); int cstrlen (const char *str); void *b_malloc (const char *file, int line, size_t size); -#ifndef DEBUG +#ifndef bmalloc void *bmalloc (size_t size); #endif +void bfree (void *buf); void *brealloc (void *buf, size_t size); void *bcalloc (size_t size1, size_t size2); int bsnprintf (char *str, int32_t size, const char *format, ...); diff --git a/bacula/src/wx-console/console_conf.c b/bacula/src/wx-console/console_conf.c index 678dcf411f..b4b880cee4 100644 --- a/bacula/src/wx-console/console_conf.c +++ b/bacula/src/wx-console/console_conf.c @@ -37,11 +37,13 @@ /* _("...") macro returns a wxChar*, so if we need a char*, we need to convert it with: * wxString(_("...")).mb_str(*wxConvCurrent) */ -#include "bacula.h" +#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. @@ -132,16 +134,16 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm recurse = 0; } switch (type) { - case R_CONSOLE: - printf(wxString(_("Console: name=%s rcfile=%s histfile=%s\n")).mb_str(*wxConvCurrent), reshdr->name, - res->res_cons.rc_file, res->res_cons.hist_file); - break; - case R_DIRECTOR: - printf(wxString(_("Director: name=%s address=%s DIRport=%d\n")).mb_str(*wxConvCurrent), reshdr->name, - res->res_dir.address, res->res_dir.DIRport); - break; - default: - printf(wxString(_("Unknown resource type %d\n")).mb_str(*wxConvCurrent), type); + case R_CONSOLE: + printf(wxString(_("Console: name=%s rcfile=%s histfile=%s\n")).mb_str(*wxConvCurrent), reshdr->name, + res->res_cons.rc_file, res->res_cons.hist_file); + break; + case R_DIRECTOR: + printf(wxString(_("Director: name=%s address=%s DIRport=%d\n")).mb_str(*wxConvCurrent), reshdr->name, + res->res_dir.address, res->res_dir.DIRport); + break; + default: + printf(wxString(_("Unknown resource type %d\n")).mb_str(*wxConvCurrent), type); } if (recurse && res->res_dir.hdr.next) { dump_resource(type, res->res_dir.hdr.next, sendit, sock); @@ -166,60 +168,60 @@ void free_resource(RES *sres, int type) /* common stuff -- free the resource name */ nres = (RES *)res->res_dir.hdr.next; if (res->res_dir.hdr.name) { - free(res->res_dir.hdr.name); + bfree(res->res_dir.hdr.name); } if (res->res_dir.hdr.desc) { - free(res->res_dir.hdr.desc); + bfree(res->res_dir.hdr.desc); } switch (type) { case R_CONSOLE: if (res->res_cons.rc_file) { - free(res->res_cons.rc_file); + bfree(res->res_cons.rc_file); } if (res->res_cons.hist_file) { - free(res->res_cons.hist_file); + bfree(res->res_cons.hist_file); } if (res->res_cons.tls_ctx) { free_tls_context(res->res_cons.tls_ctx); } if (res->res_cons.tls_ca_certfile) { - free(res->res_cons.tls_ca_certfile); + bfree(res->res_cons.tls_ca_certfile); } if (res->res_cons.tls_ca_certdir) { - free(res->res_cons.tls_ca_certdir); + bfree(res->res_cons.tls_ca_certdir); } if (res->res_cons.tls_certfile) { - free(res->res_cons.tls_certfile); + bfree(res->res_cons.tls_certfile); } if (res->res_cons.tls_keyfile) { - free(res->res_cons.tls_keyfile); + bfree(res->res_cons.tls_keyfile); } case R_DIRECTOR: if (res->res_dir.address) { - free(res->res_dir.address); + bfree(res->res_dir.address); } if (res->res_dir.tls_ctx) { free_tls_context(res->res_dir.tls_ctx); } if (res->res_dir.tls_ca_certfile) { - free(res->res_dir.tls_ca_certfile); + bfree(res->res_dir.tls_ca_certfile); } if (res->res_dir.tls_ca_certdir) { - free(res->res_dir.tls_ca_certdir); + bfree(res->res_dir.tls_ca_certdir); } if (res->res_dir.tls_certfile) { - free(res->res_dir.tls_certfile); + bfree(res->res_dir.tls_certfile); } if (res->res_dir.tls_keyfile) { - free(res->res_dir.tls_keyfile); + bfree(res->res_dir.tls_keyfile); } break; default: printf(wxString(_("Unknown resource type %d\n")).mb_str(*wxConvCurrent), type); } /* Common stuff again -- free the resource, recurse to next one */ - free(res); + bfree(res); if (nres) { free_resource(nres, type); } @@ -255,62 +257,62 @@ void save_resource(int type, RES_ITEM *items, int pass) */ if (pass == 2) { switch (type) { - /* Resources not containing a resource */ - case R_CONSOLE: - case R_DIRECTOR: - break; + /* Resources not containing a resource */ + case R_CONSOLE: + case R_DIRECTOR: + break; - default: - Emsg1(M_ERROR, 0, wxString(_("Unknown resource type %d\n")).mb_str(*wxConvCurrent), type); - error = 1; - break; + default: + Emsg1(M_ERROR, 0, wxString(_("Unknown resource type %d\n")).mb_str(*wxConvCurrent), type); + error = 1; + break; } /* Note, the resoure name was already saved during pass 1, * so here, we can just release it. */ if (res_all.res_dir.hdr.name) { - free(res_all.res_dir.hdr.name); - res_all.res_dir.hdr.name = NULL; + bfree(res_all.res_dir.hdr.name); + res_all.res_dir.hdr.name = NULL; } if (res_all.res_dir.hdr.desc) { - free(res_all.res_dir.hdr.desc); - res_all.res_dir.hdr.desc = NULL; + bfree(res_all.res_dir.hdr.desc); + res_all.res_dir.hdr.desc = NULL; } return; } /* The following code is only executed during pass 1 */ switch (type) { - case R_CONSOLE: - size = sizeof(CONRES); - break; - case R_DIRECTOR: - size = sizeof(DIRRES); - break; - default: - printf(wxString(_("Unknown resource type %d\n")).mb_str(*wxConvCurrent), type); - error = 1; - size = 1; - break; + case R_CONSOLE: + size = sizeof(CONRES); + break; + case R_DIRECTOR: + size = sizeof(DIRRES); + break; + default: + printf(wxString(_("Unknown resource type %d\n")).mb_str(*wxConvCurrent), type); + error = 1; + size = 1; + break; } /* Common */ if (!error) { - res = (URES *)malloc(size); + res = (URES *)bmalloc(size); memcpy(res, &res_all, size); if (!res_head[rindex]) { - res_head[rindex] = (RES *)res; /* store first entry */ + res_head[rindex] = (RES *)res; /* store first entry */ } else { - RES *next; - for (next=res_head[rindex]; next->next; next=next->next) { - if (strcmp(next->name, res->res_dir.hdr.name) == 0) { - Emsg2(M_ERROR_TERM, 0, - wxString(_("Attempt to define second %s resource named \"%s\" is not permitted.\n")).mb_str(*wxConvCurrent), - resources[rindex].name, res->res_dir.hdr.name); - } - } - next->next = (RES *)res; - Dmsg2(90, "Inserting %s res: %s\n", res_to_str(type), - res->res_dir.hdr.name); + RES *next; + for (next=res_head[rindex]; next->next; next=next->next) { + if (strcmp(next->name, res->res_dir.hdr.name) == 0) { + Emsg2(M_ERROR_TERM, 0, + wxString(_("Attempt to define second %s resource named \"%s\" is not permitted.\n")).mb_str(*wxConvCurrent), + resources[rindex].name, res->res_dir.hdr.name); + } + } + next->next = (RES *)res; + Dmsg2(90, "Inserting %s res: %s\n", res_to_str(type), + res->res_dir.hdr.name); } } } diff --git a/bacula/src/wx-console/console_conf.h b/bacula/src/wx-console/console_conf.h index 5ef1fc3c7f..ab5e8c9156 100644 --- a/bacula/src/wx-console/console_conf.h +++ b/bacula/src/wx-console/console_conf.h @@ -2,7 +2,7 @@ * Version $Id$ */ /* - Copyright (C) 2000-2005 Kern Sibbald + Copyright (C) 2000-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/bacula/src/wx-console/console_thread.cpp b/bacula/src/wx-console/console_thread.cpp index 3898f4c56e..97c2acc196 100644 --- a/bacula/src/wx-console/console_thread.cpp +++ b/bacula/src/wx-console/console_thread.cpp @@ -7,7 +7,7 @@ * Version $Id$ */ /* - Copyright (C) 2004-2005 Kern Sibbald + Copyright (C) 2004-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -143,7 +143,8 @@ void console_thread::SetWorkingDirectory(wxString w_dir) { } } -void console_thread::InitLib() { +void console_thread::InitLib() +{ if (WSA_Init() != 0) { csprint(_("Error while initializing windows sockets...\n")); inited = false; @@ -157,7 +158,8 @@ void console_thread::InitLib() { inited = true; } -void console_thread::FreeLib() { +void console_thread::FreeLib() +{ if (inited) { if (WSACleanup() != 0) { csprint(_("Error while cleaning up windows sockets...\n")); @@ -194,7 +196,8 @@ static void scan_err(const char *file, int line, LEX *lc, const char *msg, ...) errmsg << err; } -wxString console_thread::LoadConfig(wxString configfile) { +wxString console_thread::LoadConfig(wxString configfile) +{ if (!inited) { InitLib(); if (!inited) @@ -203,7 +206,7 @@ wxString console_thread::LoadConfig(wxString configfile) { free_config_resources(); - MSGS* msgs = (MSGS *)malloc(sizeof(MSGS)); + MSGS* msgs = (MSGS *)bmalloc(sizeof(MSGS)); memset(msgs, 0, sizeof(MSGS)); for (int i=1; i<=M_MAX; i++) { #ifndef HAVE_WIN32 diff --git a/bacula/src/wx-console/csprint.h b/bacula/src/wx-console/csprint.h index d8fd95139d..909c3813f1 100644 --- a/bacula/src/wx-console/csprint.h +++ b/bacula/src/wx-console/csprint.h @@ -7,22 +7,17 @@ * Version $Id$ */ /* - Copyright (C) 2004 Kern Sibbald and John Walker + Copyright (C) 2004-2006 Kern Sibbald This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. + modify it under the terms of the GNU General Public License + version 2 as amended with additional clauses defined in the + file LICENSE in the main source directory. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + the file LICENSE for additional details. */ diff --git a/bacula/src/wx-console/main.cpp b/bacula/src/wx-console/main.cpp index e07fd0331b..e2fb8b526a 100644 --- a/bacula/src/wx-console/main.cpp +++ b/bacula/src/wx-console/main.cpp @@ -38,11 +38,10 @@ #include #include #include - #include "wxbmainframe.h" - #include "csprint.h" + /* 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/wx-console/wxbconfigfileeditor.cpp b/bacula/src/wx-console/wxbconfigfileeditor.cpp index de89f16c64..61b0a16bc9 100644 --- a/bacula/src/wx-console/wxbconfigfileeditor.cpp +++ b/bacula/src/wx-console/wxbconfigfileeditor.cpp @@ -7,7 +7,7 @@ * Version $Id$ */ /* - Copyright (C) 2004-2005 Kern Sibbald + Copyright (C) 2004-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -22,12 +22,11 @@ */ #include "bacula.h" - #include "wxbconfigfileeditor.h" - #include #include + enum { Save = 1, diff --git a/bacula/src/wx-console/wxbconfigfileeditor.h b/bacula/src/wx-console/wxbconfigfileeditor.h index 10061b16d6..2476fafaef 100644 --- a/bacula/src/wx-console/wxbconfigfileeditor.h +++ b/bacula/src/wx-console/wxbconfigfileeditor.h @@ -7,21 +7,18 @@ * Version $Id$ */ /* - Copyright (C) 2004 Kern Sibbald and John Walker + Copyright (C) 2004-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. + version 2 as amended with additional clauses defined in the + file LICENSE in the main source directory. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + the file LICENSE for additional details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "wx/wxprec.h" @@ -32,8 +29,8 @@ class wxbConfigFileEditor : public wxDialog { public: - wxbConfigFileEditor(wxWindow* parent, wxString filename); - virtual ~wxbConfigFileEditor(); + wxbConfigFileEditor(wxWindow* parent, wxString filename); + virtual ~wxbConfigFileEditor(); private: wxString filename; diff --git a/bacula/src/wx-console/wxbconfigpanel.cpp b/bacula/src/wx-console/wxbconfigpanel.cpp index 3e35dca3e5..b378896a68 100644 --- a/bacula/src/wx-console/wxbconfigpanel.cpp +++ b/bacula/src/wx-console/wxbconfigpanel.cpp @@ -7,7 +7,7 @@ * Version $Id$ */ /* - Copyright (C) 2004-2005 Kern Sibbald + Copyright (C) 2004-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -22,11 +22,10 @@ */ #include "bacula.h" - #include "wxbconfigpanel.h" - #include + WX_DEFINE_OBJARRAY(wxbConfig); /* Create a new config parameter */ diff --git a/bacula/src/wx-console/wxbconfigpanel.h b/bacula/src/wx-console/wxbconfigpanel.h index bcbe1d39a7..5b6fa24b6e 100644 --- a/bacula/src/wx-console/wxbconfigpanel.h +++ b/bacula/src/wx-console/wxbconfigpanel.h @@ -7,21 +7,18 @@ * Version $Id$ */ /* - Copyright (C) 2004 Kern Sibbald and John Walker + Copyright (C) 2004-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. + version 2 as amended with additional clauses defined in the + file LICENSE in the main source directory. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + the file LICENSE for additional details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef WXBCONFIGPANEL_H @@ -82,8 +79,8 @@ WX_DECLARE_OBJARRAY(wxbConfigParam, wxbConfig); class wxbConfigPanel : public wxPanel { public: /* Creates a new config panel, config must be allocated with new */ - wxbConfigPanel(wxWindow* parent, wxbConfig* config, wxString title, wxWindowID ok, wxWindowID cancel, wxWindowID apply = -1); - ~wxbConfigPanel(); + wxbConfigPanel(wxWindow* parent, wxbConfig* config, wxString title, wxWindowID ok, wxWindowID cancel, wxWindowID apply = -1); + ~wxbConfigPanel(); void SetRowString(const wxChar* title, wxString value); wxString GetRowString(const wxChar* title); diff --git a/bacula/src/wx-console/wxbhistorytextctrl.cpp b/bacula/src/wx-console/wxbhistorytextctrl.cpp index 88da7d80a0..e55b9c2b9b 100644 --- a/bacula/src/wx-console/wxbhistorytextctrl.cpp +++ b/bacula/src/wx-console/wxbhistorytextctrl.cpp @@ -7,7 +7,7 @@ * Version $Id$ */ /* - Copyright (C) 2004-2005 Kern Sibbald + Copyright (C) 2004-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -22,7 +22,6 @@ */ #include "bacula.h" - #include "wxbhistorytextctrl.h" BEGIN_EVENT_TABLE(wxbHistoryTextCtrl, wxTextCtrl) diff --git a/bacula/src/wx-console/wxbhistorytextctrl.h b/bacula/src/wx-console/wxbhistorytextctrl.h index 7a874f9a7b..01ead6e01f 100644 --- a/bacula/src/wx-console/wxbhistorytextctrl.h +++ b/bacula/src/wx-console/wxbhistorytextctrl.h @@ -7,21 +7,18 @@ * Version $Id$ */ /* - Copyright (C) 2004 Kern Sibbald and John Walker + Copyright (C) 2004-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. + version 2 as amended with additional clauses defined in the + file LICENSE in the main source directory. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + the file LICENSE for additional details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef WXBHISTORYTEXTCTRL @@ -41,10 +38,10 @@ WX_DECLARE_STRING_HASH_MAP( wxString, wxbCommands ); class wxbHistoryTextCtrl: public wxTextCtrl { public: wxbHistoryTextCtrl(wxStaticText* help, wxWindow* parent, wxWindowID id, - const wxString& value = wxT(""), const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxTextCtrlNameStr); + const wxString& value = wxT(""), const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTextCtrlNameStr); void HistoryAdd(wxString cmd); diff --git a/bacula/src/wx-console/wxblistctrl.cpp b/bacula/src/wx-console/wxblistctrl.cpp index b0beb57b52..ddfd79b6ba 100644 --- a/bacula/src/wx-console/wxblistctrl.cpp +++ b/bacula/src/wx-console/wxblistctrl.cpp @@ -8,7 +8,7 @@ * Version $Id$ */ /* - Copyright (C) 2004-2005 Kern Sibbald + Copyright (C) 2004-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -25,7 +25,6 @@ #include "bacula.h" #include "wxblistctrl.h" - #include "csprint.h" #include "wxbmainframe.h" diff --git a/bacula/src/wx-console/wxblistctrl.h b/bacula/src/wx-console/wxblistctrl.h index f7f9950978..4146e2f6a3 100644 --- a/bacula/src/wx-console/wxblistctrl.h +++ b/bacula/src/wx-console/wxblistctrl.h @@ -8,21 +8,18 @@ * Version $Id$ */ /* - Copyright (C) 2004 Kern Sibbald and John Walker + Copyright (C) 2004-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. + version 2 as amended with additional clauses defined in the + file LICENSE in the main source directory. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + the file LICENSE for additional details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef WXBLISTCTRL_H @@ -54,9 +51,9 @@ typedef void (wxEvtHandler::*wxListMarkedEventFunction)(wxbListMarkedEvent&); #define EVT_LIST_MARKED_EVENT(id, fn) \ DECLARE_EVENT_TABLE_ENTRY( \ - wxbLIST_MARKED_EVENT, id, wxID_ANY, \ - (wxObjectEventFunction)(wxEventFunction)(wxListMarkedEventFunction)&fn, \ - (wxObject *) NULL \ + wxbLIST_MARKED_EVENT, id, wxID_ANY, \ + (wxObjectEventFunction)(wxEventFunction)(wxListMarkedEventFunction)&fn, \ + (wxObject *) NULL \ ), /* Customized list, which transmit double clicks on images */ diff --git a/bacula/src/wx-console/wxbmainframe.cpp b/bacula/src/wx-console/wxbmainframe.cpp index 61a25cde12..e33f8a42e5 100644 --- a/bacula/src/wx-console/wxbmainframe.cpp +++ b/bacula/src/wx-console/wxbmainframe.cpp @@ -7,7 +7,7 @@ * Version $Id$ */ /* - Copyright (C) 2004-2005 Kern Sibbald + Copyright (C) 2004-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/bacula/src/wx-console/wxbmainframe.h b/bacula/src/wx-console/wxbmainframe.h index f3d8fbfb48..90b4a0756f 100644 --- a/bacula/src/wx-console/wxbmainframe.h +++ b/bacula/src/wx-console/wxbmainframe.h @@ -7,21 +7,18 @@ * Version $Id$ */ /* - Copyright (C) 2004 Kern Sibbald and John Walker + Copyright (C) 2004-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. + version 2 as amended with additional clauses defined in the + file LICENSE in the main source directory. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + the file LICENSE for additional details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef WXBMAINFRAME_H @@ -62,13 +59,13 @@ class wxbPrintObject: public wxObject { wxString str; int status; wxbPrintObject(wxString str, int status): wxObject() { - this->str = str; - this->status = status; + this->str = str; + this->status = status; } wxbPrintObject(const wxbPrintObject& pe) { - this->str = pe.str; - this->status = pe.status; + this->str = pe.str; + this->status = pe.status; } }; diff --git a/bacula/src/wx-console/wxbrestorepanel.cpp b/bacula/src/wx-console/wxbrestorepanel.cpp index 97d37dc156..cbbf55894b 100644 --- a/bacula/src/wx-console/wxbrestorepanel.cpp +++ b/bacula/src/wx-console/wxbrestorepanel.cpp @@ -7,7 +7,7 @@ * Version $Id$ */ /* - Copyright (C) 2004-2005 Kern Sibbald + Copyright (C) 2004-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -50,22 +50,15 @@ Select parameter to modify (1-11): */ #include "bacula.h" - #include "wxbrestorepanel.h" - #include "wxbmainframe.h" - #include "csprint.h" - #include #include - #include - #include "unmarked.xpm" #include "marked.xpm" #include "partmarked.xpm" - #include /* A macro named Yield is defined under MinGW */ @@ -196,7 +189,8 @@ END_EVENT_TABLE() /* * wxbRestorePanel constructor */ -wxbRestorePanel::wxbRestorePanel(wxWindow* parent): wxbPanel(parent) { +wxbRestorePanel::wxbRestorePanel(wxWindow* parent): wxbPanel(parent) +{ //pendingEvents = new wxbEventList(); //EVTQUEUE //processing = false; //EVTQUEUE SetWorking(false); @@ -374,7 +368,8 @@ wxbRestorePanel::wxbRestorePanel(wxWindow* parent): wxbPanel(parent) { /* * wxbRestorePanel destructor */ -wxbRestorePanel::~wxbRestorePanel() { +wxbRestorePanel::~wxbRestorePanel() +{ delete imagelist; } @@ -382,17 +377,18 @@ wxbRestorePanel::~wxbRestorePanel() { wxbPanel overloadings ----------------------------------------------------------------------------*/ -wxString wxbRestorePanel::GetTitle() { +wxString wxbRestorePanel::GetTitle() +{ return _("Restore"); } -void wxbRestorePanel::EnablePanel(bool enable) { +void wxbRestorePanel::EnablePanel(bool enable) +{ if (enable) { if (status == disabled) { SetStatus(activable); } - } - else { + } else { SetStatus(disabled); } } @@ -402,7 +398,8 @@ void wxbRestorePanel::EnablePanel(bool enable) { ----------------------------------------------------------------------------*/ /* The main button has been clicked */ -void wxbRestorePanel::CmdStart() { +void wxbRestorePanel::CmdStart() +{ unsigned int i; if (status == activable) { wxbMainFrame::GetInstance()->SetStatusText(_("Getting parameters list.")); @@ -1399,7 +1396,8 @@ void wxbRestorePanel::CmdMark(wxTreeItemId treeitem, long* listitems, int listsi ----------------------------------------------------------------------------*/ /* Run a dir command, and waits until result is fully received. */ -void wxbRestorePanel::UpdateTreeItem(wxTreeItemId item, bool updatelist, bool recurse) { +void wxbRestorePanel::UpdateTreeItem(wxTreeItemId item, bool updatelist, bool recurse) +{ // this->updatelist = updatelist; wxbDataTokenizer* dt; @@ -1491,7 +1489,8 @@ void wxbRestorePanel::UpdateTreeItem(wxTreeItemId item, bool updatelist, bool re } /* Parse .dir command results, returns true if the result has been stored in entry, false otherwise. */ -int wxbRestorePanel::ParseList(wxString line, wxbDirEntry* entry) { +int wxbRestorePanel::ParseList(wxString line, wxbDirEntry* entry) +{ /* See ls_output in dird/ua_tree.c */ //-rw-r-----,1,root,root,41575,2005-10-18 18:21:36, ,/usr/var/bacula/working/bacula.sql @@ -1536,7 +1535,7 @@ int wxbRestorePanel::ParseList(wxString line, wxbDirEntry* entry) { if (!tkz.HasMoreTokens()) return false; - entry->fullname = tkz.GetNextToken(); + entry->fullname = tkz.GetString(); /* Get only the filename (cut path by finding the last '/') */ if (entry->fullname.GetChar(entry->fullname.Length()-1) == '/') { @@ -1552,7 +1551,8 @@ int wxbRestorePanel::ParseList(wxString line, wxbDirEntry* entry) { } /* Sets a list item state, and update its parents and children if it is a directory */ -void wxbRestorePanel::SetListItemState(long listitem, int newstate) { +void wxbRestorePanel::SetListItemState(long listitem, int newstate) +{ wxbTreeItemData* itemdata = (wxbTreeItemData*)list->GetItemData(listitem); wxTreeItemId treeitem; diff --git a/bacula/src/wx-console/wxbrestorepanel.h b/bacula/src/wx-console/wxbrestorepanel.h index 007a7b25a1..57dc2cd827 100644 --- a/bacula/src/wx-console/wxbrestorepanel.h +++ b/bacula/src/wx-console/wxbrestorepanel.h @@ -7,7 +7,7 @@ * Version $Id$ */ /* - Copyright (C) 2004-2005 Kern Sibbald + Copyright (C) 2004-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/bacula/src/wx-console/wxbtableparser.cpp b/bacula/src/wx-console/wxbtableparser.cpp index 3857fdfcc2..622b170320 100644 --- a/bacula/src/wx-console/wxbtableparser.cpp +++ b/bacula/src/wx-console/wxbtableparser.cpp @@ -14,7 +14,7 @@ * Version $Id$ */ /* - Copyright (C) 2004-2005 Kern Sibbald + Copyright (C) 2004-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/bacula/src/wx-console/wxbtableparser.h b/bacula/src/wx-console/wxbtableparser.h index 1e2b8cb208..8726d0415b 100644 --- a/bacula/src/wx-console/wxbtableparser.h +++ b/bacula/src/wx-console/wxbtableparser.h @@ -14,21 +14,18 @@ * Version $Id$ */ /* - Copyright (C) 2004 Kern Sibbald and John Walker + Copyright (C) 2000-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. + version 2 as amended with additional clauses defined in the + file LICENSE in the main source directory. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + the file LICENSE for additional details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef WXBTABLEPARSER_H diff --git a/bacula/src/wx-console/wxbtreectrl.cpp b/bacula/src/wx-console/wxbtreectrl.cpp index e6b4fc113c..b972e9e1ae 100644 --- a/bacula/src/wx-console/wxbtreectrl.cpp +++ b/bacula/src/wx-console/wxbtreectrl.cpp @@ -8,7 +8,7 @@ * Version $Id$ */ /* - Copyright (C) 2004-2005 Kern Sibbald + Copyright (C) 2004-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/bacula/src/wx-console/wxbtreectrl.h b/bacula/src/wx-console/wxbtreectrl.h index c1b3ebd6ec..f3dcfcee13 100644 --- a/bacula/src/wx-console/wxbtreectrl.h +++ b/bacula/src/wx-console/wxbtreectrl.h @@ -8,21 +8,18 @@ * Version $Id$ */ /* - Copyright (C) 2004 Kern Sibbald and John Walker + Copyright (C) 2004-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. + version 2 as amended with additional clauses defined in the + file LICENSE in the main source directory. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + the file LICENSE for additional details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef WXBTREECTRL_H @@ -57,9 +54,9 @@ typedef void (wxEvtHandler::*wxTreeMarkedEventFunction)(wxbTreeMarkedEvent&); #define EVT_TREE_MARKED_EVENT(id, fn) \ DECLARE_EVENT_TABLE_ENTRY( \ - wxbTREE_MARKED_EVENT, id, wxID_ANY, \ - (wxObjectEventFunction)(wxEventFunction)(wxTreeMarkedEventFunction)&fn, \ - (wxObject *) NULL \ + wxbTREE_MARKED_EVENT, id, wxID_ANY, \ + (wxObjectEventFunction)(wxEventFunction)(wxTreeMarkedEventFunction)&fn, \ + (wxObject *) NULL \ ), /* Customized tree, which transmit double clicks on images */ diff --git a/bacula/src/wx-console/wxbutils.cpp b/bacula/src/wx-console/wxbutils.cpp index 7af8e1a8bf..dbcd3b61cd 100644 --- a/bacula/src/wx-console/wxbutils.cpp +++ b/bacula/src/wx-console/wxbutils.cpp @@ -7,7 +7,7 @@ * Version $Id$ */ /* - Copyright (C) 2004-2005 Kern Sibbald + Copyright (C) 2004-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/bacula/src/wx-console/wxbutils.h b/bacula/src/wx-console/wxbutils.h index f7cb4ed609..b7819a39c8 100644 --- a/bacula/src/wx-console/wxbutils.h +++ b/bacula/src/wx-console/wxbutils.h @@ -8,21 +8,18 @@ * Version $Id$ */ /* - Copyright (C) 2004 Kern Sibbald and John Walker + Copyright (C) 2004-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. + version 2 as amended with additional clauses defined in the + file LICENSE in the main source directory. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + the file LICENSE for additional details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef WXBUTILS_H diff --git a/bacula/technotes-1.39 b/bacula/technotes-1.39 index 60433e77e0..ab1c6345f7 100644 --- a/bacula/technotes-1.39 +++ b/bacula/technotes-1.39 @@ -1,6 +1,14 @@ Technical notes on version 1.39 General: +25Aug06 +kes wx-console crashes because of differences between Bacula and wxWidgets + malloc()/free(). Tweek wx-console to use bmalloc()/bfree() for Bacula + calls. +kes correct improper indenting in wx-console/console_conf.c +kes update wx-console header copyrights +kes Fix bug #658 where wx-console mangles file/directory names containing + commas. 24Aug06 kes Add Media.Enabled flag to client backups for dotcmds.c kes Enforce Media.Enabled=1 for a current restore to work.