From: Eric Bollengier Date: Wed, 22 Feb 2023 08:14:24 +0000 (+0100) Subject: Fix warning reported by new GCC X-Git-Tag: Release-13.0.3~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d4c6cc2fed4b7e5cbbbddf2e24dd125d9dcbc145;p=thirdparty%2Fbacula.git Fix warning reported by new GCC --- diff --git a/bacula/src/dird/ua_dotcmds.c b/bacula/src/dird/ua_dotcmds.c index 13d3728f0..9a4080806 100644 --- a/bacula/src/dird/ua_dotcmds.c +++ b/bacula/src/dird/ua_dotcmds.c @@ -96,8 +96,8 @@ static bool dot_help_cmd(UAContext *ua, const char *cmd); static bool dot_add_events(UAContext *ua, const char *cmd); static int one_handler(void *ctx, int num_field, char **row); -struct cmdstruct { const char *key; bool (*func)(UAContext *ua, const char *cmd); const char *help;const bool use_in_rs;}; -static struct cmdstruct commands[] = { /* help */ /* can be used in runscript */ +struct dcmd_struct { const char *key; bool (*func)(UAContext *ua, const char *cmd); const char *help;const bool use_in_rs;}; +static struct dcmd_struct commands[] = { /* help */ /* can be used in runscript */ { NT_(".api"), api_cmd, NULL, false}, { NT_(".backups"), backupscmd, NULL, false}, { NT_(".clients"), clientscmd, NULL, true}, @@ -149,7 +149,7 @@ static struct cmdstruct commands[] = { /* help */ /* can be used in runscript * { NT_(".query"), dot_querycmd, NULL, false}, { NT_(".tags"), tagscmd, NULL, false} }; -#define comsize ((int)(sizeof(commands)/sizeof(struct cmdstruct))) +#define comsize ((int)(sizeof(commands)/sizeof(struct dcmd_struct))) /* * Execute a command from the UA diff --git a/bacula/src/filed/fd_plugins.c b/bacula/src/filed/fd_plugins.c index f13126a87..16fa7076b 100644 --- a/bacula/src/filed/fd_plugins.c +++ b/bacula/src/filed/fd_plugins.c @@ -39,9 +39,9 @@ const char *plugin_type = "-fd.dll"; const char *plugin_type = "-fd.so"; #endif -extern bool save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level); +extern int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level); extern bool check_changes(JCR *jcr, FF_PKT *ff_pkt); -extern int metadata_save(JCR *jcr, const plugin_metadata *plug_meta); +extern bool metadata_save(JCR *jcr, const plugin_metadata *plug_meta); /* Function pointers to be set here */ extern DLL_IMP_EXP int (*plugin_bopen)(BFILE *bfd, const char *fname, uint64_t flags, mode_t mode); diff --git a/bacula/src/lib/smartall.c b/bacula/src/lib/smartall.c index df315c3db..59eebfa71 100644 --- a/bacula/src/lib/smartall.c +++ b/bacula/src/lib/smartall.c @@ -76,7 +76,7 @@ extern char my_name[]; /* daemon name */ /* Memory allocation control structures and storage. */ -struct abufhead { +struct sm_abufhead { struct b_queue abq; /* Links on allocated queue */ uint32_t ablen; /* Buffer length in bytes */ const char *abfname; /* File name pointer */ @@ -91,7 +91,7 @@ static struct b_queue abqueue = { /* Allocated buffer queue */ static bool bufimode = false; /* Buffers not tracked when True */ -#define HEAD_SIZE BALIGN(sizeof(struct abufhead)) +#define HEAD_SIZE BALIGN(sizeof(struct sm_abufhead)) /* SMALLOC -- Allocate buffer, enqueing on the orphaned buffer @@ -116,7 +116,7 @@ static void *smalloc(const char *fname, int lineno, unsigned int nbytes) nbytes += HEAD_SIZE + 1; if ((buf = (char *)malloc(nbytes)) != NULL) { - struct abufhead *head = (struct abufhead *)buf; + struct sm_abufhead *head = (struct sm_abufhead *)buf; P(mutex); /* Enqueue buffer on allocated list */ qinsert(&abqueue, (struct b_queue *) buf); @@ -154,9 +154,9 @@ void sm_new_owner(const char *fname, int lineno, char *buf) { buf -= HEAD_SIZE; /* Decrement to header */ P(mutex); - ((struct abufhead *)buf)->abfname = bufimode ? NULL : fname; - ((struct abufhead *)buf)->ablineno = (uint32_t) lineno; - ((struct abufhead *)buf)->abin_use = true; + ((struct sm_abufhead *)buf)->abfname = bufimode ? NULL : fname; + ((struct sm_abufhead *)buf)->ablineno = (uint32_t) lineno; + ((struct sm_abufhead *)buf)->abin_use = true; V(mutex); return; } @@ -165,7 +165,7 @@ void sm_new_owner(const char *fname, int lineno, char *buf) void sm_get_owner(int64_t dbglvl, char *buf) { /* Decrement to header */ - struct abufhead *h = (struct abufhead *) (buf - HEAD_SIZE); + struct sm_abufhead *h = (struct sm_abufhead *) (buf - HEAD_SIZE); Dmsg3(dbglvl, "%p from %s:%d\n", buf + HEAD_SIZE, NPRT(h->abfname), @@ -189,7 +189,7 @@ void sm_free(const char *file, int line, void *fp) cp -= HEAD_SIZE; qp = (struct b_queue *)cp; - struct abufhead *head = (struct abufhead *)cp; + struct sm_abufhead *head = (struct sm_abufhead *)cp; P(mutex); Dmsg4(DT_MEMORY|1050, "sm_free %d at %p from %s:%d\n", @@ -314,7 +314,7 @@ void *sm_realloc(const char *fname, int lineno, void *ptr, unsigned int size) /* If the old and new sizes are the same, be a nice guy and just return the buffer passed in. */ cp -= HEAD_SIZE; - struct abufhead *head = (struct abufhead *)cp; + struct sm_abufhead *head = (struct sm_abufhead *)cp; osize = head->ablen - (HEAD_SIZE + 1); if (size == osize) { return ptr; @@ -392,13 +392,13 @@ void actuallyfree(void *cp) */ void sm_dump(bool bufdump, bool in_use) { - struct abufhead *ap; + struct sm_abufhead *ap; P(mutex); - ap = (struct abufhead *)abqueue.qnext; + ap = (struct sm_abufhead *)abqueue.qnext; - while (ap != (struct abufhead *) &abqueue) { + while (ap != (struct sm_abufhead *) &abqueue) { if ((ap == NULL) || (ap->abq.qnext->qprev != (struct b_queue *) ap) || @@ -439,7 +439,7 @@ void sm_dump(bool bufdump, bool in_use) Pmsg1(0, "%s\n", errmsg); } } - ap = (struct abufhead *) ap->abq.qnext; + ap = (struct sm_abufhead *) ap->abq.qnext; } V(mutex); } @@ -458,12 +458,12 @@ void sm_check(const char *fname, int lineno, bool bufdump) /* SM_CHECK_RTN -- Check the buffers and return 1 if OK otherwise 0 */ int sm_check_rtn(const char *fname, int lineno, bool bufdump) { - struct abufhead *ap; + struct sm_abufhead *ap; int bad, badbuf = 0; P(mutex); - ap = (struct abufhead *) abqueue.qnext; - while (ap != (struct abufhead *)&abqueue) { + ap = (struct sm_abufhead *) abqueue.qnext; + while (ap != (struct sm_abufhead *)&abqueue) { bad = 0; if (ap != NULL) { if (ap->abq.qnext->qprev != (struct b_queue *)ap) { @@ -472,7 +472,7 @@ int sm_check_rtn(const char *fname, int lineno, bool bufdump) if (ap->abq.qprev->qnext != (struct b_queue *)ap) { bad |= 0x2; } - if (((unsigned char *) ap)[((struct abufhead *)ap)->ablen - 1] != + if (((unsigned char *) ap)[((struct sm_abufhead *)ap)->ablen - 1] != ((((intptr_t) ap) & 0xFF) ^ 0xC5)) { bad |= 0x4; } @@ -536,7 +536,7 @@ int sm_check_rtn(const char *fname, int lineno, bool bufdump) } } } - ap = (struct abufhead *)ap->abq.qnext; + ap = (struct sm_abufhead *)ap->abq.qnext; } get_out: V(mutex); diff --git a/bacula/src/stored/dircmd.c b/bacula/src/stored/dircmd.c index c48b4f8ae..46b6f121d 100644 --- a/bacula/src/stored/dircmd.c +++ b/bacula/src/stored/dircmd.c @@ -107,7 +107,7 @@ static char OKstore[] = "2000 OK storage\n"; /* Commands received from director that need scanning */ static char storaddr[] = "storage address=%s port=%d ssl=%d Job=%127s Authentication=%127s"; -struct s_cmds { +struct dir_cmds { const char *cmd; bool (*func)(JCR *jcr); bool monitoraccess; /* set if monitors can access this cmd */ @@ -116,7 +116,7 @@ struct s_cmds { /* * The following are the recognized commands from the Director. */ -static struct s_cmds cmds[] = { +static struct dir_cmds cmds[] = { {"JobId=", job_cmd, 0}, /* start Job */ {"autochanger", changer_cmd, 0}, {"bootstrap", bootstrap_cmd, 0}, diff --git a/bacula/src/stored/fd_cmds.c b/bacula/src/stored/fd_cmds.c index bcbc535a9..7b9df0300 100644 --- a/bacula/src/stored/fd_cmds.c +++ b/bacula/src/stored/fd_cmds.c @@ -62,7 +62,7 @@ static bool sd_testnetwork_cmd(JCR *jcr); /* Exported function */ bool get_bootstrap_file(JCR *jcr, BSOCK *bs); -struct s_cmds { +struct fd_cmds { const char *cmd; bool (*func)(JCR *jcr); }; @@ -70,7 +70,7 @@ struct s_cmds { /* * The following are the recognized commands from the File daemon */ -static struct s_cmds fd_cmds[] = { +static struct fd_cmds fd_cmds[] = { {"append open", append_open_session}, {"append data", append_data_cmd}, {"append end", append_end_session},