[exim-cvs] Tidying and compiler-silencing

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Exim Git Commits Mailing List
Date:  
À: exim-cvs
Sujet: [exim-cvs] Tidying and compiler-silencing
Gitweb: https://git.exim.org/exim.git/commitdiff/13c7874e0a41d696ecf55774d62ea7d11778414f
Commit:     13c7874e0a41d696ecf55774d62ea7d11778414f
Parent:     be4bdb96db7556f34c5f298f1c473d53f3700bd9
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Sun Sep 16 20:50:04 2018 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Sun Sep 16 20:50:04 2018 +0100


    Tidying and compiler-silencing
---
 src/src/auths/auth-spa.c               |  2 +-
 src/src/deliver.c                      |  4 ++-
 src/src/exim_dbutil.c                  |  6 ++---
 src/src/expand.c                       |  4 ++-
 src/src/globals.c                      |  2 --
 src/src/mime.c                         | 17 ++++++------
 src/src/retry.c                        | 17 ++++++------
 src/src/routers/rf_get_munge_headers.c |  5 ++--
 src/src/smtp_in.c                      |  2 ++
 src/src/tod.c                          | 48 ++++++++++++++++++----------------
 src/src/transports/smtp.c              |  2 ++
 11 files changed, 59 insertions(+), 50 deletions(-)


diff --git a/src/src/auths/auth-spa.c b/src/src/auths/auth-spa.c
index 6bc3d1f..d2c95c3 100644
--- a/src/src/auths/auth-spa.c
+++ b/src/src/auths/auth-spa.c
@@ -1220,7 +1220,7 @@ char versionString[] = "libntlm version 0.21";

#define spa_bytes_add(ptr, header, buf, count) \
{ \
-if (buf != NULL && count) \
+if (buf != NULL && count != 0) /* we hate -Wint-in-bool-contex */ \
{ \
SSVAL(&ptr->header.len,0,count); \
SSVAL(&ptr->header.maxlen,0,count); \
diff --git a/src/src/deliver.c b/src/src/deliver.c
index 0a0ed8a..1f60042 100644
--- a/src/src/deliver.c
+++ b/src/src/deliver.c
@@ -1095,7 +1095,7 @@ static uschar buf[sizeof("0.000s")];
if (diff->tv_sec >= 5 || !LOGGING(millisec))
return readconf_printtime((int)diff->tv_sec);

-sprintf(CS buf, "%d.%03ds", (int)diff->tv_sec, (int)diff->tv_usec/1000);
+sprintf(CS buf, "%u.%03us", (uint)diff->tv_sec, (uint)diff->tv_usec/1000);
return buf;
}

@@ -8597,6 +8597,7 @@ else
   }
 return;        /* compiler quietening; control does not reach here. */


+#ifdef SUPPORT_TLS
 fail:
   log_write(0,
     LOG_MAIN | (exec_type == CEE_EXEC_EXIT ? LOG_PANIC : LOG_PANIC_DIE),
@@ -8606,6 +8607,7 @@ fail:
   Note: this must be _exit(), not exit(). */


_exit(EX_EXECFAILED);
+#endif
}

/* vi: aw ai sw=2
diff --git a/src/src/exim_dbutil.c b/src/src/exim_dbutil.c
index e04f9ae..491a453 100644
--- a/src/src/exim_dbutil.c
+++ b/src/src/exim_dbutil.c
@@ -260,7 +260,7 @@ ensures that Exim has exclusive use of the database before it even tries to
open it. If there is a database, there should be a lock file in existence. */

snprintf(CS dirname, sizeof(dirname), "%s/db", spool_directory);
-snprintf(CS filename, sizeof(filename), "%s/%.200s.lockfile", dirname, name);
+snprintf(CS filename, sizeof(filename), "%.54s/%.200s.lockfile", dirname, name);

dbblock->lockfd = Uopen(filename, flags, 0);
if (dbblock->lockfd < 0)
@@ -296,10 +296,10 @@ if (rc < 0)
/* At this point we have an opened and locked separate lock file, that is,
exclusive access to the database, so we can go ahead and open it. */

-sprintf(CS filename, "%s/%s", dirname, name);
+snprintf(CS filename, sizeof(filename), "%s/%s", dirname, name);
EXIM_DBOPEN(filename, dirname, flags, 0, &(dbblock->dbptr));

-if (dbblock->dbptr == NULL)
+if (!dbblock->dbptr)
   {
   printf("** Failed to open DBM file %s for %s:\n   %s%s\n", filename,
     read_only? "reading" : "writing", strerror(errno),
diff --git a/src/src/expand.c b/src/src/expand.c
index b3e918e..cd753ef 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -4957,7 +4957,7 @@ while (*s != 0)
           sockun.sun_family = AF_UNIX;
           sprintf(sockun.sun_path, "%.*s", (int)(sizeof(sockun.sun_path)-1),
             sub_arg[0]);
-      server_name = sockun.sun_path;
+      server_name = US sockun.sun_path;


           sigalrm_seen = FALSE;
           alarm(timeout);
@@ -6372,7 +6372,9 @@ while (*s != 0)
     int c;
     uschar *arg = NULL;
     uschar *sub;
+#ifdef SUPPORT_TLS
     var_entry *vp = NULL;
+#endif


     /* Owing to an historical mis-design, an underscore may be part of the
     operator name, or it may introduce arguments.  We therefore first scan the
diff --git a/src/src/globals.c b/src/src/globals.c
index d834373..340c451 100644
--- a/src/src/globals.c
+++ b/src/src/globals.c
@@ -315,7 +315,6 @@ struct global_flags f =
     .really_exim            = TRUE,
     .receive_call_bombout   = FALSE,
     .recipients_discarded   = FALSE,
-/* BOOL    rfc821_domains         = FALSE;  <<< on the way out */
     .running_in_test_harness = FALSE,


     .search_find_defer      = FALSE,
@@ -325,7 +324,6 @@ struct global_flags f =
     .sender_local           = FALSE,
     .sender_name_forced     = FALSE,
     .sender_set_untrusted   = FALSE,
-/* BOOL    sender_verified_responded = FALSE; /* never used? */
     .smtp_authenticated     = FALSE,
     .smtp_in_pipelining_advertised = FALSE,
     .smtp_in_pipelining_used = FALSE,
diff --git a/src/src/mime.c b/src/src/mime.c
index 47e742b..5dcbaa4 100644
--- a/src/src/mime.c
+++ b/src/src/mime.c
@@ -338,17 +338,16 @@ while(!done)
     if ( ((c == '\t') || (c == ' ')) && (header_value_mode == 1) )
       continue;


-      /* we have hit a non-whitespace char, start copying value data */
-      header_value_mode = 2;
+    /* we have hit a non-whitespace char, start copying value data */
+    header_value_mode = 2;


-      if (c == '"')       /* flip "quoted" mode */
-        header_value_mode = header_value_mode==2 ? 3 : 2;
+    if (c == '"')       /* flip "quoted" mode */
+      header_value_mode = header_value_mode==2 ? 3 : 2;


-      /* leave value mode on unquoted ';' */
-      if (header_value_mode == 2 && c == ';') {
-        header_value_mode = 0;
-      };
-      /* -------------------------------- */
+    /* leave value mode on unquoted ';' */
+    if (header_value_mode == 2 && c == ';')
+      header_value_mode = 0;
+    /* -------------------------------- */
     }
   else
     {
diff --git a/src/src/retry.c b/src/src/retry.c
index a040c33..0a2f126 100644
--- a/src/src/retry.c
+++ b/src/src/retry.c
@@ -888,16 +888,17 @@ for (i = 0; i < 3; i++)
         for (;; addr = addr->next)
           {
           setflag(addr, af_retry_timedout);
-          addr->message = (addr->message == NULL)? US"retry timeout exceeded" :
-            string_sprintf("%s: retry timeout exceeded", addr->message);
-          addr->user_message = (addr->user_message == NULL)?
-            US"retry timeout exceeded" :
-            string_sprintf("%s: retry timeout exceeded", addr->user_message);
+          addr->message = addr->message
+            ? string_sprintf("%s: retry timeout exceeded", addr->message)
+        : US"retry timeout exceeded";
+          addr->user_message = addr->user_message
+        ? string_sprintf("%s: retry timeout exceeded", addr->user_message)
+        : US"retry timeout exceeded";
           log_write(0, LOG_MAIN, "** %s%s%s%s: retry timeout exceeded",
             addr->address,
-           (addr->parent == NULL)? US"" : US" <",
-           (addr->parent == NULL)? US"" : addr->parent->address,
-           (addr->parent == NULL)? US"" : US">");
+            addr->parent ? US" <" : US"",
+            addr->parent ? addr->parent->address : US"",
+            addr->parent ? US">" : US"");


           if (addr == endaddr) break;
           }
diff --git a/src/src/routers/rf_get_munge_headers.c b/src/src/routers/rf_get_munge_headers.c
index 7f81e65..f08b55a 100644
--- a/src/src/routers/rf_get_munge_headers.c
+++ b/src/src/routers/rf_get_munge_headers.c
@@ -109,8 +109,9 @@ if (rblock->remove_headers)
       }
     else if (*s)
       g = string_append_listele(g, ':', s);
-    if (g)
-      *remove_headers = g->s;
+
+  if (g)
+    *remove_headers = g->s;
   }


return OK;
diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c
index 55272a9..cb64698 100644
--- a/src/src/smtp_in.c
+++ b/src/src/smtp_in.c
@@ -2367,6 +2367,7 @@ return done - 2; /* Convert yield values */



+#ifdef SUPPORT_TLS
static BOOL
smtp_log_tls_fail(uschar * errstr)
{
@@ -2378,6 +2379,7 @@ if (Ustrncmp(conn_info, US"SMTP ", 5) == 0) conn_info += 5;
log_write(0, LOG_MAIN, "TLS error on %s %s", conn_info, errstr);
return FALSE;
}
+#endif



diff --git a/src/src/tod.c b/src/src/tod.c
index b0d3ac9..9088fc6 100644
--- a/src/src/tod.c
+++ b/src/src/tod.c
@@ -72,9 +72,9 @@ switch(type)

   case tod_zulu:
     t = gmtime(&now.tv_sec);
-    (void) sprintf(CS timebuf, "%04d%02d%02d%02d%02d%02dZ",
-      1900 + t->tm_year, 1 + t->tm_mon, t->tm_mday, t->tm_hour, t->tm_min,
-      t->tm_sec);
+    (void) sprintf(CS timebuf, "%04u%02u%02u%02u%02u%02uZ",
+      1900 + (uint)t->tm_year, 1 + (uint)t->tm_mon, (uint)t->tm_mday, (uint)t->tm_hour, (uint)t->tm_min,
+      (uint)t->tm_sec);
     return timebuf;
   }


@@ -91,14 +91,15 @@ switch(type)
   case tod_log_bare:          /* Format used in logging without timezone */
 #ifndef COMPILE_UTILITY
     if (LOGGING(millisec))
-      sprintf(CS timebuf, "%04d-%02d-%02d %02d:%02d:%02d.%03d",
-      1900 + t->tm_year, 1 + t->tm_mon, t->tm_mday,
-      t->tm_hour, t->tm_min, t->tm_sec, (int)(now.tv_usec/1000));
+      sprintf(CS timebuf, "%04u-%02u-%02u %02u:%02u:%02u.%03u",
+    1900 + (uint)t->tm_year, 1 + (uint)t->tm_mon, (uint)t->tm_mday,
+    (uint)t->tm_hour, (uint)t->tm_min, (uint)t->tm_sec,
+    (uint)(now.tv_usec/1000));
     else
 #endif
-      sprintf(CS timebuf, "%04d-%02d-%02d %02d:%02d:%02d",
-      1900 + t->tm_year, 1 + t->tm_mon, t->tm_mday,
-      t->tm_hour, t->tm_min, t->tm_sec);
+      sprintf(CS timebuf, "%04u-%02u-%02u %02u:%02u:%02u",
+    1900 + (uint)t->tm_year, 1 + (uint)t->tm_mon, (uint)t->tm_mday,
+    (uint)t->tm_hour, (uint)t->tm_min, (uint)t->tm_sec);


     break;


@@ -108,20 +109,21 @@ switch(type)
 #ifdef TESTING_LOG_DATESTAMP
   case tod_log_datestamp_daily:
   case tod_log_datestamp_monthly:
-    sprintf(CS timebuf, "%04d%02d%02d%02d%02d",
-      1900 + t->tm_year, 1 + t->tm_mon, t->tm_mday, t->tm_hour, t->tm_min);
+    sprintf(CS timebuf, "%04u%02u%02u%02u%02u",
+      1900 + (uint)t->tm_year, 1 + (uint)t->tm_mon, (uint)t->tm_mday,
+      (uint)t->tm_hour, (uint)t->tm_min);
     break;


 #else
   case tod_log_datestamp_daily:
-    sprintf(CS timebuf, "%04d%02d%02d",
-      1900 + t->tm_year, 1 + t->tm_mon, t->tm_mday);
+    sprintf(CS timebuf, "%04u%02u%02u",
+      1900 + (uint)t->tm_year, 1 + (uint)t->tm_mon, (uint)t->tm_mday);
     break;


   case tod_log_datestamp_monthly:
 #ifndef COMPILE_UTILITY
-    sprintf(CS timebuf, "%04d%02d",
-      1900 + t->tm_year, 1 + t->tm_mon);
+    sprintf(CS timebuf, "%04u%02u",
+      1900 + (uint)t->tm_year, 1 + (uint)t->tm_mon);
 #endif
     break;
 #endif
@@ -169,16 +171,16 @@ switch(type)
 #ifndef COMPILE_UTILITY
       if (LOGGING(millisec))
         (void) sprintf(CS timebuf,
-          "%04d-%02d-%02d %02d:%02d:%02d.%03d %+03d%02d",
-          1900 + local.tm_year, 1 + local.tm_mon, local.tm_mday,
-          local.tm_hour, local.tm_min, local.tm_sec, (int)(now.tv_usec/1000),
+          "%04u-%02u-%02u %02u:%02u:%02u.%03u %+03d%02d",
+          1900 + (uint)local.tm_year, 1 + (uint)local.tm_mon, (uint)local.tm_mday,
+          (uint)local.tm_hour, (uint)local.tm_min, (uint)local.tm_sec, (uint)(now.tv_usec/1000),
           diff_hour, diff_min);
       else
 #endif
         (void) sprintf(CS timebuf,
-          "%04d-%02d-%02d %02d:%02d:%02d %+03d%02d",
-          1900 + local.tm_year, 1 + local.tm_mon, local.tm_mday,
-          local.tm_hour, local.tm_min, local.tm_sec,
+          "%04u-%02u-%02u %02u:%02u:%02u %+03d%02d",
+          1900 + (uint)local.tm_year, 1 + (uint)local.tm_mon, (uint)local.tm_mday,
+          (uint)local.tm_hour, (uint)local.tm_min, (uint)local.tm_sec,
           diff_hour, diff_min);
       break;


@@ -192,7 +194,7 @@ switch(type)
     case tod_mbx:
         {
         int len;
-        (void) sprintf(CS timebuf, "%02d-", local.tm_mday);
+        (void) sprintf(CS timebuf, "%02u-", (uint)local.tm_mday);
         len = Ustrlen(timebuf);
         len += Ustrftime(timebuf + len, sizeof(timebuf) - len, "%b-%Y %H:%M:%S",
           &local);
@@ -207,7 +209,7 @@ switch(type)
     default:
         {
         int len = Ustrftime(timebuf, sizeof(timebuf), "%a, ", &local);
-        (void) sprintf(CS timebuf + len, "%02d ", local.tm_mday);
+        (void) sprintf(CS timebuf + len, "%02u ", (uint)local.tm_mday);
         len += Ustrlen(timebuf + len);
         len += Ustrftime(timebuf + len, sizeof(timebuf) - len, "%b %Y %H:%M:%S",
           &local);
diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c
index 703ee56..aac47aa 100644
--- a/src/src/transports/smtp.c
+++ b/src/src/transports/smtp.c
@@ -3638,7 +3638,9 @@ if (sx.completed_addr && sx.ok && sx.send_quit)


     if (sx.ok)
       {
+#ifdef SUPPORT_TLS
       int pfd[2];
+#endif
       int socket_fd = sx.cctx.sock;