tidying
authorJeremy Harris <jgh146exb@wizmail.org>
Sat, 16 Sep 2017 15:03:32 +0000 (16:03 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Sat, 16 Sep 2017 15:17:33 +0000 (16:17 +0100)
src/src/deliver.c
src/src/pdkim/pdkim.c
src/src/pdkim/pdkim.h
src/src/pdkim/signing.c
src/src/utf8.c

index a8012804d16913809e0dd8289333c289f2682a63..c91f26e8163f6176e17ddc66774b27d2f0243706 100644 (file)
@@ -3291,11 +3291,9 @@ address_item *addrlist = p->addrlist;
 address_item *addr = p->addr;
 pid_t pid = p->pid;
 int fd = p->fd;
-int required = PIPE_HEADER_SIZE; /* size including id, subid and length */
 
 uschar *msg = p->msg;
 BOOL done = p->done;
-BOOL finished = FALSE;
 
 /* Loop through all items, reading from the pipe when necessary. The pipe
 used to be non-blocking. But I do not see a reason for using non-blocking I/O
@@ -3327,12 +3325,14 @@ while (!done)
   size_t required = PIPE_HEADER_SIZE; /* first the pipehaeder, later the data */
   ssize_t got;
 
-  DEBUG(D_deliver) debug_printf("expect %d bytes (pipeheader) from transport process %d\n", required, pid);
+  DEBUG(D_deliver) debug_printf(
+    "expect %lu bytes (pipeheader) from tpt process %d\n", (ulong)required, pid);
 
   /* We require(!) all the PIPE_HEADER_SIZE bytes here, as we know,
   they're written in a timely manner, so waiting for the write shouldn't hurt a lot.
   If we get less, we can assume the subprocess do be done and do not expect any further
   information from it. */
+
   got = readn(fd, pipeheader, required);
   if (got != required)
     {
@@ -3345,13 +3345,14 @@ while (!done)
 
   pipeheader[PIPE_HEADER_SIZE] = '\0';
   DEBUG(D_deliver)
-    debug_printf("got %d bytes (pipeheader) from transport process %d\n", got, pid);
+    debug_printf("got %ld bytes (pipeheader) from transport process %d\n",
+      (long) got, pid);
 
   {
   /* If we can't decode the pipeheader, the subprocess seems to have a
   problem, we do not expect any furher information from it. */
   char *endc;
-  required = strtol(pipeheader+2, &endc, 10);
+  required = Ustrtol(pipeheader+2, &endc, 10);
   if (*endc)
     {
     msg = string_sprintf("failed to read pipe "
@@ -3363,7 +3364,8 @@ while (!done)
   }
 
   DEBUG(D_deliver)
-    debug_printf("expect %d bytes (pipedata) from transport process %d\n", required, pid);
+    debug_printf("expect %lu bytes (pipedata) from transport process %d\n",
+      (ulong)required, pid);
 
   /* Same as above, the transport process will write the bytes announced
   in a timely manner, so we can just wait for the bytes, getting less than expected
@@ -4120,20 +4122,21 @@ if (size > BIG_BUFFER_SIZE-1)
   size = BIG_BUFFER_SIZE;
   }
 
-/* Should we check that we do not write more than PIPE_BUF? What whould
+/* Should we check that we do not write more than PIPE_BUF? What would
 that help? */
 
 /* convert size to human readable string prepended by id and subid */
-if (PIPE_HEADER_SIZE != snprintf(CS pipe_header, PIPE_HEADER_SIZE+1, "%c%c%05d", id, subid, size))
+if (PIPE_HEADER_SIZE != snprintf(CS pipe_header, PIPE_HEADER_SIZE+1, "%c%c%05ld",
+    id, subid, (long)size))
   log_write(0, LOG_MAIN|LOG_PANIC_DIE, "header snprintf failed\n");
 
-DEBUG(D_deliver) debug_printf("header write id:%c,subid:%c,size:%d,final:%s\n",
-                                 id, subid, size, pipe_header);
+DEBUG(D_deliver) debug_printf("header write id:%c,subid:%c,size:%ld,final:%s\n",
+                                 id, subid, (long)size, pipe_header);
 
 if ((ret = writev(fd, iov, 2)) != total_len)
-  log_write(0, LOG_MAIN|LOG_PANIC_DIE, "Failed writing transport result to pipe (%d of %d bytes): %s",
-    ret, total_len,
-    ret == -1 ? strerror(errno) : "short write");
+  log_write(0, LOG_MAIN|LOG_PANIC_DIE,
+    "Failed writing transport result to pipe (%ld of %ld bytes): %s",
+    (long)ret, (long)total_len, ret == -1 ? strerror(errno) : "short write");
 }
 
 /*************************************************
index f107a594833eca677d797941dccf77ffe0530472..695288162740d0598e7f4caab42c7110908ef38d 100644 (file)
@@ -699,7 +699,7 @@ if (sig->canon_body == PDKIM_CANON_RELAXED)
   if (!relaxed_data)
     {
     BOOL seen_wsp = FALSE;
-    const char *p;
+    const uschar * p;
     int q = 0;
 
     /* We want to be able to free this else we allocate
@@ -875,7 +875,7 @@ for (sig = ctx->sig; sig; sig = sig->next)
   if (sig->canon_body == PDKIM_CANON_RELAXED)
     {
     /* Lines with just spaces need to be buffered too */
-    char * cp = line.data;
+    uschar * cp = line.data;
     char c;
 
     while ((c = *cp))
index a350e6b7e5a8046291be3746c54c495ed39048cc..e82f26c05a40d9e376369e63a9a24807c8ee3fda 100644 (file)
@@ -262,7 +262,7 @@ typedef struct pdkim_ctx {
   uschar    *cur_header;
   int        cur_header_size;
   int        cur_header_len;
-  char      *linebuf;
+  uschar    *linebuf;
   int        linebuf_offset;
   int        num_headers;
   pdkim_stringlist *headers; /* Raw headers for verification         */
index 5f270bfd4e5ad588388f03c90df3086216ed3df3..e8cb297ca1cb03c94c582ef5bdf15ddb61c8219e 100644 (file)
@@ -609,7 +609,7 @@ exim_dkim_signing_init(uschar * privkey_pem, es_ctx * sign_ctx)
 BIO * bp = BIO_new_mem_buf(privkey_pem, -1);
 
 if (!(sign_ctx->key = PEM_read_bio_PrivateKey(bp, NULL, NULL, NULL)))
-  return ERR_error_string(ERR_get_error(), NULL);
+  return US ERR_error_string(ERR_get_error(), NULL);
 return NULL;
 }
 
@@ -656,7 +656,7 @@ if (  (ctx = EVP_PKEY_CTX_new(sign_ctx->key, NULL))
   }
 
 if (ctx) EVP_PKEY_CTX_free(ctx);
-return ERR_error_string(ERR_get_error(), NULL);
+return US ERR_error_string(ERR_get_error(), NULL);
 }
 
 
@@ -673,7 +673,7 @@ const uschar * s = pubkey_der->data;
 
 if ((verify_ctx->key = d2i_PUBKEY(NULL, &s, pubkey_der->len)))
   return NULL;
-return ERR_error_string(ERR_get_error(), NULL);
+return US ERR_error_string(ERR_get_error(), NULL);
 }
 
 
@@ -706,7 +706,7 @@ if (  (ctx = EVP_PKEY_CTX_new(verify_ctx->key, NULL))
   { EVP_PKEY_CTX_free(ctx); return NULL; }
 
 if (ctx) EVP_PKEY_CTX_free(ctx);
-return ERR_error_string(ERR_get_error(), NULL);
+return US ERR_error_string(ERR_get_error(), NULL);
 }
 
 
index 255383051ba010d5939bf3d5dc678af4e5bcbb70..4647785b9da36fdb2492c15618568e85bf60cf91 100644 (file)
@@ -68,7 +68,7 @@ any mixed-case annotation.  This does not really matter for a domain. */
     break;
     }
   }
-if ((rc = idn2_lookup_u8(CCS s, &s1, IDN2_NFC_INPUT)) != IDN2_OK)
+if ((rc = idn2_lookup_u8((const uint8_t *) s, &s1, IDN2_NFC_INPUT)) != IDN2_OK)
   {
   if (err) *err = US idn2_strerror(rc);
   return NULL;