]> 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 72bd4bde28240c7834d3bbb730a59c115d7ad3c8..3382d483d89693a1637cd6559efc8d7af676269a 100644 (file)
@@ -1,25 +1,16 @@
 /*
- * "$Id: http-support.c 5360 2006-03-30 17:02:17Z mike $"
+ * "$Id: http-support.c 6649 2007-07-11 21:46:42Z mike $"
  *
  *   HTTP support routines for the Common UNIX Printing System (CUPS) scheduler.
  *
- *   Copyright 1997-2006 by Easy Software Products, all rights reserved.
+ *   Copyright 2007 by Apple Inc.
+ *   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
- *   copyright law.  Distribution and use rights are outlined in the file
- *   "LICENSE.txt" which should have been included with this file.  If this
- *   file is missing or damaged please contact Easy Software Products
- *   at:
- *
- *       Attn: CUPS Licensing Information
- *       Easy Software Products
- *       44141 Airport View Drive, Suite 204
- *       Hollywood, Maryland 20636 USA
- *
- *       Voice: (301) 373-9600
- *       EMail: cups-info@cups.org
- *         WWW: http://www.cups.org
+ *   property of Apple Inc. and are protected by Federal copyright
+ *   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
+ *   which should have been included with this file.  If this file is
+ *   file is missing or damaged, see the license at "http://www.cups.org/".
  *
  *   This file is subject to the Apple OS-Developed Software exception.
  *
@@ -149,7 +140,7 @@ httpAssembleURI(
   if (!ptr)
     goto assemble_overflow;
 
-  if (!strcmp(scheme, "mailto:"))
+  if (!strcmp(scheme, "mailto"))
   {
    /*
     * mailto: only has :, no //...
@@ -549,7 +540,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 +586,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 +607,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 +1103,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 +1318,5 @@ http_copy_encode(char       *dst, /* O - Destination buffer */
 
 
 /*
- * End of "$Id: http-support.c 5360 2006-03-30 17:02:17Z mike $".
+ * End of "$Id: http-support.c 6649 2007-07-11 21:46:42Z mike $".
  */