]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Fix warning reported by new GCC
authorEric Bollengier <eric@baculasystems.com>
Wed, 22 Feb 2023 08:14:24 +0000 (09:14 +0100)
committerEric Bollengier <eric@baculasystems.com>
Tue, 2 May 2023 07:07:18 +0000 (09:07 +0200)
bacula/src/dird/ua_dotcmds.c
bacula/src/filed/fd_plugins.c
bacula/src/lib/smartall.c
bacula/src/stored/dircmd.c
bacula/src/stored/fd_cmds.c

index 13d3728f0b0066b86d1f1af2755a2f89f999f522..9a4080806b2730cc24af949329e2063c36a178eb 100644 (file)
@@ -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
index f13126a8775260546116c0df2244f3abf2f98252..16fa7076b86a8419fa3091c49181399b7e503bce 100644 (file)
@@ -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);
index df315c3dbb502723486d1b0119cf95b4ae12e8eb..59eebfa714616ada993cb00050b353bef07253a7 100644 (file)
@@ -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);
index c48b4f8ae09b3c721d357bb2b6a0e2b5080479e2..46b6f121dfceae28a3231da690fca6d58c8162a9 100644 (file)
@@ -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},
index bcbc535a97e8a2b462d1f2b632439c2c152a28af..7b9df03000138641ef4f3d12a30bbd5948faa5d9 100644 (file)
@@ -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},