]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/http-support.c
Load cups into easysw/current.
[thirdparty/cups.git] / cups / http-support.c
index 674e0db2c79cc62f3f8cc8e873a1b651a5feb0e8..7750b208eb4a889f06ef796e7de8d66bc17acb79 100644 (file)
@@ -1,9 +1,9 @@
 /*
- * "$Id: http-support.c 177 2006-06-21 00:20:03Z jlovell $"
+ * "$Id: http-support.c 6304 2007-02-22 22:06:23Z mike $"
  *
  *   HTTP support routines for the Common UNIX Printing System (CUPS) scheduler.
  *
- *   Copyright 1997-2006 by Easy Software Products, all rights reserved.
+ *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  *   These coded instructions, statements, and computer programs are the
  *   property of Easy Software Products and are protected by Federal
@@ -149,7 +149,7 @@ httpAssembleURI(
   if (!ptr)
     goto assemble_overflow;
 
-  if (!strcmp(scheme, "mailto:"))
+  if (!strcmp(scheme, "mailto"))
   {
    /*
     * mailto: only has :, no //...
@@ -549,7 +549,7 @@ char *                                      /* O - Encoded string */
 httpEncode64(char       *out,          /* I - String to write to */
              const char *in)           /* I - String to read from */
 {
-  return (httpEncode64_2(out, 512, in, strlen(in)));
+  return (httpEncode64_2(out, 512, in, (int)strlen(in)));
 }
 
 
@@ -595,8 +595,14 @@ httpEncode64_2(char       *out,            /* I - String to write to */
 
     if (outptr < outend)
       *outptr ++ = base64[(in[0] & 255) >> 2];
+
     if (outptr < outend)
-      *outptr ++ = base64[(((in[0] & 255) << 4) | ((in[1] & 255) >> 4)) & 63];
+    {
+      if (inlen > 1)
+        *outptr ++ = base64[(((in[0] & 255) << 4) | ((in[1] & 255) >> 4)) & 63];
+      else
+        *outptr ++ = base64[((in[0] & 255) << 4) & 63];
+    }
 
     in ++;
     inlen --;
@@ -610,7 +616,12 @@ httpEncode64_2(char       *out,            /* I - String to write to */
     }
 
     if (outptr < outend)
-      *outptr ++ = base64[(((in[0] & 255) << 2) | ((in[1] & 255) >> 6)) & 63];
+    {
+      if (inlen > 1)
+        *outptr ++ = base64[(((in[0] & 255) << 2) | ((in[1] & 255) >> 6)) & 63];
+      else
+        *outptr ++ = base64[((in[0] & 255) << 2) & 63];
+    }
 
     in ++;
     inlen --;
@@ -1101,7 +1112,7 @@ httpSeparateURI(
 
       char *resptr = resource + strlen(resource);
 
-      uri = http_copy_decode(resptr, uri, resourcelen - (resptr - resource),
+      uri = http_copy_decode(resptr, uri, resourcelen - (int)(resptr - resource),
                              NULL, decoding & HTTP_URI_CODING_QUERY);
     }
   }
@@ -1316,5 +1327,5 @@ http_copy_encode(char       *dst, /* O - Destination buffer */
 
 
 /*
- * End of "$Id: http-support.c 177 2006-06-21 00:20:03Z jlovell $".
+ * End of "$Id: http-support.c 6304 2007-02-22 22:06:23Z mike $".
  */