Import Upstream version 4.92
[hcoop/debian/exim4.git] / src / auths / xtextencode.c
index 7cdfe32..2c00c4a 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) University of Cambridge 1995 - 2009 */
+/* Copyright (c) University of Cambridge 1995 - 2018 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 #include "../exim.h"
@@ -28,7 +28,7 @@ uschar *
 auth_xtextencode(uschar *clear, int len)
 {
 uschar *code;
-uschar *p = (uschar *)clear;
+uschar *p = US clear;
 uschar *pp;
 int c = len;
 int count = 1;
@@ -42,17 +42,13 @@ while (c -- > 0)
 
 pp = code = store_get(count);
 
-p = (uschar *)clear;
+p = US clear;
 c = len;
 while (c-- > 0)
-  {
   if ((x = *p++) < 33 || x > 127 || x == '+' || x == '=')
-    {
-    sprintf(CS pp, "+%.02x", x);   /* There's always room */
-    pp += 3;
-    }
-  else *pp++ = x;
-  }
+    pp += sprintf(CS pp, "+%.02x", x);   /* There's always room */
+  else
+    *pp++ = x;
 
 *pp = 0;
 return code;