[exim-cvs] Testsuite: compiler quietening

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Exim Git Commits Mailing List
Datum:  
To: exim-cvs
Betreff: [exim-cvs] Testsuite: compiler quietening
Gitweb: http://git.exim.org/exim.git/commitdiff/e265af1fe6fe0260965aab6fbb18481046cbcf42
Commit:     e265af1fe6fe0260965aab6fbb18481046cbcf42
Parent:     74377a628b6e2c85973aa741c4233726d4d8c0df
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Wed Oct 29 12:57:55 2014 +0000
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Wed Oct 29 12:57:55 2014 +0000


    Testsuite: compiler quietening
---
 test/src/client.c    |   14 +++++++-------
 test/src/fakens.c    |   25 +++++++++++++------------
 test/src/mtpscript.c |   24 ++++++++++++++----------
 3 files changed, 34 insertions(+), 29 deletions(-)


diff --git a/test/src/client.c b/test/src/client.c
index 7b7d9de..50897a1 100644
--- a/test/src/client.c
+++ b/test/src/client.c
@@ -248,7 +248,7 @@ int
tls_start(int sock, SSL **ssl, SSL_CTX *ctx)
{
int rc;
-static const char *sid_ctx = "exim";
+static const unsigned char *sid_ctx = "exim";

RAND_load_file("client.c", -1); /* Not *very* random! */

@@ -981,8 +981,8 @@ int rc;

     /* Shutdown TLS */


-    if (strcmp(outbuffer, "stoptls") == 0 ||
-        strcmp(outbuffer, "STOPTLS") == 0)
+    if (strcmp(CS outbuffer, "stoptls") == 0 ||
+        strcmp(CS outbuffer, "STOPTLS") == 0)
       {
       if (!tls_active)
         {
@@ -1009,14 +1009,14 @@ int rc;


     /* Remember that we sent STARTTLS */


-    sent_starttls = (strcmp(outbuffer, "starttls") == 0 ||
-                     strcmp(outbuffer, "STARTTLS") == 0);
+    sent_starttls = (strcmp(CS outbuffer, "starttls") == 0 ||
+                     strcmp(CS outbuffer, "STARTTLS") == 0);


     /* Fudge: if the command is "starttls_wait", we send the starttls bit,
     but we haven't set the flag, so that there is no negotiation. This is for
     testing the server's timeout. */


-    if (strcmp(outbuffer, "starttls_wait") == 0)
+    if (strcmp(CS outbuffer, "starttls_wait") == 0)
       {
       outbuffer[8] = 0;
       n = 8;
@@ -1035,7 +1035,7 @@ int rc;
       n--;
       }


-    while ((escape = strstr(outbuffer, "\\n")) != NULL)
+    while ((escape = US strstr(CS outbuffer, "\\n")) != NULL)
       {
       *escape = '\n';
       memmove(escape + 1, escape + 2,  (n + 2) - (escape - outbuffer) - 2);
diff --git a/test/src/fakens.c b/test/src/fakens.c
index fd3604a..ff0f1d4 100644
--- a/test/src/fakens.c
+++ b/test/src/fakens.c
@@ -57,6 +57,7 @@ as such then the response will have the "AD" bit set. */
 #include <ctype.h>
 #include <stdarg.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <netdb.h>
 #include <errno.h>
@@ -156,7 +157,7 @@ uschar *yield;
 char buffer[256];
 va_list ap;
 va_start(ap, format);
-vsprintf(buffer, format, ap);
+vsprintf(buffer, CS format, ap);
 va_end(ap);
 yield = (uschar *)malloc(Ustrlen(buffer) + 1);
 Ustrcpy(yield, buffer);
@@ -420,7 +421,7 @@ while (fgets(CS buffer, sizeof(buffer), f) != NULL)


     case ns_t_mx:
     pk = shortfield(&p, pk);
-    if (ep[-1] != '.') sprintf(ep, "%s.", zone);
+    if (ep[-1] != '.') sprintf(US ep, "%s.", zone);
     pk = packname(p, pk);
     plen = Ustrlen(p);
     break;
@@ -464,7 +465,7 @@ while (fgets(CS buffer, sizeof(buffer), f) != NULL)
     case ns_t_cname:
     case ns_t_ns:
     case ns_t_ptr:
-    if (ep[-1] != '.') sprintf(ep, "%s.", zone);
+    if (ep[-1] != '.') sprintf(US ep, "%s.", zone);
     pk = packname(p, pk);
     plen = Ustrlen(p);
     break;
@@ -515,7 +516,7 @@ if (argc != 4)


/* Find the zones */

-(void)sprintf(buffer, "%s/../dnszones", argv[1]);
+(void)sprintf(US buffer, "%s/../dnszones", argv[1]);

d = opendir(CCS buffer);
if (d == NULL)
@@ -527,20 +528,20 @@ if (d == NULL)

 while ((de = readdir(d)) != NULL)
   {
-  uschar *name = de->d_name;
+  uschar *name = US de->d_name;
   if (Ustrncmp(name, "qualify.", 8) == 0)
     {
-    qualify = fcopystring("%s", name + 7);
+    qualify = fcopystring(US "%s", name + 7);
     continue;
     }
   if (Ustrncmp(name, "db.", 3) != 0) continue;
   if (Ustrncmp(name + 3, "ip4.", 4) == 0)
-    zones[zonecount].zone = fcopystring("%s.in-addr.arpa", name + 6);
+    zones[zonecount].zone = fcopystring(US "%s.in-addr.arpa", name + 6);
   else if (Ustrncmp(name + 3, "ip6.", 4) == 0)
-    zones[zonecount].zone = fcopystring("%s.ip6.arpa", name + 6);
+    zones[zonecount].zone = fcopystring(US "%s.ip6.arpa", name + 6);
   else
-    zones[zonecount].zone = fcopystring("%s", name + 2);
-  zones[zonecount++].zonefile = fcopystring("%s", name);
+    zones[zonecount].zone = fcopystring(US "%s", name + 2);
+  zones[zonecount++].zonefile = fcopystring(US "%s", name);
   }
 (void)closedir(d);


@@ -586,7 +587,7 @@ if (zonefile == NULL)
return PASS_ON;
}

-(void)sprintf(buffer, "%s/../dnszones/%s", argv[1], zonefile);
+(void)sprintf(US buffer, "%s/../dnszones/%s", argv[1], zonefile);

/* Initialize the start of the response packet. We don't have to fake up
everything, because we know that Exim will look only at the answer and
@@ -597,7 +598,7 @@ pk += 12;

/* Open the zone file. */

-f = fopen(buffer, "r");
+f = fopen(US buffer, "r");
if (f == NULL)
{
fprintf(stderr, "fakens: failed to open %s: %s\n", buffer, strerror(errno));
diff --git a/test/src/mtpscript.c b/test/src/mtpscript.c
index 2acfa28..a595194 100644
--- a/test/src/mtpscript.c
+++ b/test/src/mtpscript.c
@@ -19,6 +19,10 @@ complicated version that does it over a socket. */
#include <errno.h>
#include <unistd.h>

+#ifndef CS
+# define CS (char *)
+#endif
+

static FILE *log;

@@ -86,9 +90,9 @@ signal(SIGALRM, sigalrm_handler);

/* Read the script, and do what it says. */

-while (fgets(sbuffer, sizeof(sbuffer), script) != NULL)
+while (fgets(CS sbuffer, sizeof(sbuffer), script) != NULL)
{
- int n = (int)strlen(sbuffer);
+ int n = (int)strlen(CS sbuffer);
while (n > 0 && isspace(sbuffer[n-1])) n--;
sbuffer[n] = 0;

@@ -107,9 +111,9 @@ while (fgets(sbuffer, sizeof(sbuffer), script) != NULL)
before continuing. Do not write this to the log, as it may not get
written at the right place in a log that's being shared. */

-  else if (strncmp(sbuffer, "*sleep ", 7) == 0)
+  else if (strncmp(CS sbuffer, "*sleep ", 7) == 0)
     {
-    sleep(atoi(sbuffer+7));
+    sleep(atoi(CS sbuffer+7));
     }


/* Otherwise the script line is the start of an input line we are expecting
@@ -119,7 +123,7 @@ while (fgets(sbuffer, sizeof(sbuffer), script) != NULL)

   else
     {
-    int data = strcmp(sbuffer, ".") == 0;
+    int data = strcmp(CS sbuffer, ".") == 0;


     fprintf(log, "%s\n", sbuffer);
     fflush(log);
@@ -130,23 +134,23 @@ while (fgets(sbuffer, sizeof(sbuffer), script) != NULL)
       {
       int n;
       alarm(5);
-      if (fgets(ibuffer, sizeof(ibuffer), stdin) == NULL)
+      if (fgets(CS ibuffer, sizeof(ibuffer), stdin) == NULL)
         {
         fprintf(log, "%sxpected EOF read from client\n",
-          (strncmp(sbuffer, "*eof", 4) == 0)? "E" : "Une");
+          (strncmp(CS sbuffer, "*eof", 4) == 0)? "E" : "Une");
         goto END_OFF;
         }
       alarm(0);
-      n = (int)strlen(ibuffer);
+      n = (int)strlen(CS ibuffer);
       while (n > 0 && isspace(ibuffer[n-1])) n--;
       ibuffer[n] = 0;
       fprintf(log, "<<< %s\n", ibuffer);
-      if (!data || strcmp(ibuffer, ".") == 0) break;
+      if (!data || strcmp(CS ibuffer, ".") == 0) break;
       }


     /* Check received what was expected */


-    if (strncmp(sbuffer, ibuffer, (int)strlen(sbuffer)) != 0)
+    if (strncmp(CS sbuffer, CS ibuffer, (int)strlen(CS sbuffer)) != 0)
       {
       fprintf(log, "Comparison failed - bailing out\n");
       goto END_OFF;