]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Make httpAssembleURI public API.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Tue, 8 Jan 2013 14:22:22 +0000 (14:22 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Tue, 8 Jan 2013 14:22:22 +0000 (14:22 +0000)
Some more cleanup for other functions that got promoted and for internal API
that should never be called outside CUPS.

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@10783 7a7537e8-13f0-0310-91df-b6672ffda945

backend/ipp.c
cups/http-addr.c
cups/http-private.h
cups/http-support.c
cups/http.c
cups/http.h
cups/versioning.h

index c69ec07c9b8655b5390edc6d7f725e03451dd869..4fcedecee5d67e325fa7346831e1f5f4184a0706 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   IPP backend for CUPS.
  *
- *   Copyright 2007-2012 by Apple Inc.
+ *   Copyright 2007-2013 by Apple Inc.
  *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  *   These coded instructions, statements, and computer programs are the
index 7e8318f897d1c2c07001b2ce620e5257aa33a277..e3dba9e9aba346e660d11ce5041c2b0469131320 100644 (file)
@@ -383,7 +383,6 @@ httpAddrPort(http_addr_t *addr)             /* I - Address */
 }
 
 /* For OS X 10.8 and earlier */
-extern int _httpAddrPort(http_addr_t *addr);
 int _httpAddrPort(http_addr_t *addr) { return (httpAddrPort(addr)); }
 
 
index 606f5d1043a91ac3d963d58f4feb80e68f0798ed..7e006e59c2275ad76900c6d9594d9abfc74434c1 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   Private HTTP definitions for CUPS.
  *
- *   Copyright 2007-2012 by Apple Inc.
+ *   Copyright 2007-2013 by Apple Inc.
  *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -393,14 +393,18 @@ extern void       _cups_freeifaddrs(struct ifaddrs *addrs);
  */
 
 #define                        _httpAddrFamily(addrp) (addrp)->addr.sa_family
+extern int             _httpAddrPort(http_addr_t *addr)
+                                     _CUPS_INTERNAL_MSG("Use httpAddrPort instead.");
 extern void            _httpAddrSetPort(http_addr_t *addr, int port);
 extern char            *_httpAssembleUUID(const char *server, int port,
                                           const char *name, int number,
-                                          char *buffer, size_t bufsize);
+                                          char *buffer, size_t bufsize)
+                                          _CUPS_INTERNAL_MSG("Use httpAssembleUUID instead.");
 extern http_t          *_httpCreate(const char *host, int port,
                                     http_addrlist_t *addrlist, int family,
                                     http_encryption_t encryption,
-                                    int blocking, _http_mode_t mode);
+                                    int blocking, _http_mode_t mode)
+                                    _CUPS_INTERNAL_MSG("Use httpConnect2 or httpAccept instead.");
 extern http_tls_credentials_t
                        _httpCreateCredentials(cups_array_t *credentials);
 extern char            *_httpDecodeURI(char *dst, const char *src,
@@ -409,6 +413,8 @@ extern void         _httpDisconnect(http_t *http);
 extern char            *_httpEncodeURI(char *dst, const char *src,
                                        size_t dstsize);
 extern void            _httpFreeCredentials(http_tls_credentials_t credentials);
+extern ssize_t         _httpPeek(http_t *http, char *buffer, size_t length)
+                                 _CUPS_INTERNAL_MSG("Use httpPeek instead.");
 extern const char      *_httpResolveURI(const char *uri, char *resolved_uri,
                                         size_t resolved_size, int options,
                                         int (*cb)(void *context),
index 49e082706d91060e92552ec7c950df24f84ef778..294021f11dd462b3ad4b3d99c3dc398012d3e6f3 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   HTTP support routines for CUPS.
  *
- *   Copyright 2007-2012 by Apple Inc.
+ *   Copyright 2007-2013 by Apple Inc.
  *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -20,7 +20,8 @@
  *                         components.
  *   httpAssembleURIf()   - Assemble a uniform resource identifier from its
  *                         components with a formatted resource.
- *   _httpAssembleUUID()  - Make a UUID URI conforming to RFC 4122.
+ *   httpAssembleUUID()   - Assemble a name-based UUID URN conforming to RFC
+ *                          4122.
  *   httpDecode64()      - Base64-decode a string.
  *   httpDecode64_2()    - Base64-decode a string.
  *   httpEncode64()      - Base64-encode a string.
@@ -466,18 +467,22 @@ httpAssembleURIf(
 
 
 /*
- * '_httpAssembleUUID()' - Make a UUID URI conforming to RFC 4122.
+ * 'httpAssembleUUID()' - Assemble a name-based UUID URN conforming to RFC 4122.
+ *
+ * This function creates a unique 128-bit identifying number using the server
+ * name, port number, random data, and optionally an object name and/or object
+ * number.  The result is formatted as a UUID URN as defined in RFC 4122.
  *
  * The buffer needs to be at least 46 bytes in size.
  */
 
 char *                                 /* I - UUID string */
-_httpAssembleUUID(const char *server,  /* I - Server name */
-                  int        port,     /* I - Port number */
-                 const char *name,     /* I - Object name or NULL */
-                  int        number,   /* I - Object number or 0 */
-                 char       *buffer,   /* I - String buffer */
-                 size_t     bufsize)   /* I - Size of buffer */
+httpAssembleUUID(const char *server,   /* I - Server name */
+                int        port,       /* I - Port number */
+                const char *name,      /* I - Object name or NULL */
+                int        number,     /* I - Object number or 0 */
+                char       *buffer,    /* I - String buffer */
+                size_t     bufsize)    /* I - Size of buffer */
 {
   char                 data[1024];     /* Source string for MD5 */
   _cups_md5_state_t    md5state;       /* MD5 state */
@@ -514,6 +519,13 @@ _httpAssembleUUID(const char *server,      /* I - Server name */
   return (buffer);
 }
 
+/* For OS X 10.8 and earlier */
+char *_httpAssembleUUID(const char *server, int port, const char *name,
+                       int number, char *buffer, size_t bufsize)
+{
+  return (httpAssembleUUID(server, port, name, number, buffer, bufsize));
+}
+
 
 /*
  * 'httpDecode64()' - Base64-decode a string.
index ab8fd532d566b38ececc5a91d4a4811f26bea36d..8b30e4fb2c94c18520f146470fc634c0be3801d3 100644 (file)
@@ -2190,7 +2190,6 @@ httpPeek(http_t *http,                    /* I - Connection to server */
 }
 
 /* For OS X 10.8 and earlier */
-extern ssize_t _httpPeek(http_t *http, char *buffer, size_t length);
 ssize_t _httpPeek(http_t *http, char *buffer, size_t length)
 { return (httpPeek(http, buffer, length)); }
 
index 7ee213eb08e22bfcf6a661713978997b98182e9b..dc9c6671ebc473152a98589f3431a874156642ee 100644 (file)
@@ -591,6 +591,10 @@ extern http_addrlist_t     *httpAddrCopyList(http_addrlist_t *src) _CUPS_API_1_7;
 extern int             httpAddrListen(http_addr_t *addr, int port)
                                       _CUPS_API_1_7;
 extern int             httpAddrPort(http_addr_t *addr) _CUPS_API_1_7;
+extern char            *httpAssembleUUID(const char *server, int port,
+                                         const char *name, int number,
+                                         char *buffer, size_t bufsize)
+                                         _CUPS_API_1_7;
 extern http_t          *httpConnect2(const char *host, int port,
                                      http_addrlist_t *addrlist,
                                      int family, http_encryption_t encryption,
index 808a10c2eb456a8b920e517069dea45262437e17..a9aab7246e441e8cafe9c64f162ba309537f914a 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   API versioning definitions for CUPS.
  *
- *   Copyright 2007-2012 by Apple Inc.
+ *   Copyright 2007-2013 by Apple Inc.
  *
  *   These coded instructions, statements, and computer programs are the
  *   property of Apple Inc. and are protected by Federal copyright
 
 /*
  * This header defines several constants - _CUPS_DEPRECATED,
- * _CUPS_API_1_1, _CUPS_API_1_1_19, _CUPS_API_1_1_20, _CUPS_API_1_1_21,
- * _CUPS_API_1_2, _CUPS_API_1_3, _CUPS_API_1_4, _CUPS_API_1_5, _CUPS_API_1_6,
- * and _CUPS_API_1_7 - which add compiler-specific attributes that flag
- * functions that are deprecated or added in particular releases.
+ * _CUPS_DEPRECATED_MSG, _CUPS_INTERNAL_MSG, _CUPS_API_1_1, _CUPS_API_1_1_19,
+ * _CUPS_API_1_1_20, _CUPS_API_1_1_21, _CUPS_API_1_2, _CUPS_API_1_3,
+ * _CUPS_API_1_4, _CUPS_API_1_5, _CUPS_API_1_6, and _CUPS_API_1_7 - which add
+ * compiler-specific attributes that flag functions that are deprecated, added
+ * in particular releases, or internal to CUPS.
  *
  * On OS X, the _CUPS_API_* constants are defined based on the values of
  * the MAC_OS_X_VERSION_MIN_ALLOWED and MAC_OS_X_VERSION_MAX_ALLOWED constants
 #  endif /* __APPLE__ && !_CUPS_SOURCE */
 
 /*
- * With GCC 3.0 and higher, we can mark old APIs "deprecated" so you get
- * a warning at compile-time.
+ * With GCC and Clang we can mark old APIs as "deprecated" or "unavailable" with
+ * messages so you get warnings/errors are compile-time...
  */
 
-#  if defined(__GNUC__) && __GNUC__ > 2
-#    ifndef __has_extension
-#      define __has_extension(x) 0
-#    endif /* !__has_extension */
-#    if __has_extension(attribute_unavailable_with_message) && defined(_CUPS_NO_DEPRECATED)
-#      define _CUPS_DEPRECATED __attribute__ ((unavailable))
-#      define _CUPS_DEPRECATED_MSG(m) __attribute__ ((unavailable(m)))
-#    elif !defined(_CUPS_SOURCE) || defined(_CUPS_NO_DEPRECATED)
-#      define _CUPS_DEPRECATED __attribute__ ((deprecated))
-#      define _CUPS_DEPRECATED_MSG(m) __attribute__ ((deprecated(m)))
-#    else
-#      define _CUPS_DEPRECATED
-#      define _CUPS_DEPRECATED_MSG(m)
-#    endif /* !_CUPS_SOURCE || _CUPS_NO_DEPRECATED */
-#  else
+#  ifdef __has_extension               /* Clang */
+#    define _CUPS_HAS_DEPRECATED
+#    if __has_extension(attribute_deprecated_with_message)
+#      define _CUPS_HAS_DEPRECATED_WITH_MESSAGE
+#    endif
+#    if __has_extension(attribute_unavailable_with_message)
+#      define _CUPS_HAS_UNAVAILABLE_WITH_MESSAGE
+#    endif
+#  elif defined(__GNUC__)              /* GCC and compatible */
+#    if __GNUC__ >= 3                  /* GCC 3.0 or higher */
+#      define _CUPS_HAS_DEPRECATED
+#    endif /* __GNUC__ >= 3 */
+#    if __GNUC__ >= 5                  /* GCC 5.x */
+#      define _CUPS_HAS_DEPRECATED_WITH_MESSAGE
+#    elif __GNUC__ == 4 && __GNUC_MINOR__ >= 5
+                                       /* GCC 4.5 or higher */
+#      define _CUPS_HAS_DEPRECATED_WITH_MESSAGE
+#    endif /* __GNUC__ >= 5 */
+#  endif /* __has_extension */
+
+#  if !defined(_CUPS_HAS_DEPRECATED) || (defined(_CUPS_SOURCE) && !defined(_CUPS_NO_DEPRECATED))
+    /*
+     * Don't mark functions deprecated if the compiler doesn't support it
+     * or we are building CUPS source that doesn't care.
+     */
 #    define _CUPS_DEPRECATED
 #    define _CUPS_DEPRECATED_MSG(m)
-#  endif /* __GNUC__ && __GNUC__ > 2 */
+#    define _CUPS_INTERNAL_MSG(m)
+#  elif defined(_CUPS_HAS_UNAVAILABLE_WITH_MESSAGE) && defined(_CUPS_NO_DEPRECATED)
+    /*
+     * Compiler supports the unsupported attribute, so use it when the code
+     * wants to exclude the use of deprecated API.
+     */
+#    define _CUPS_DEPRECATED __attribute__ ((unavailable))
+#    define _CUPS_DEPRECATED_MSG(m) __attribute__ ((unavailable(m)))
+#    define _CUPS_INTERNAL_MSG(m) __attribute__ ((unavailable(m)))
+#  else
+    /*
+     * Compiler supports the deprecated attribute, so use it.
+     */
+#    define _CUPS_DEPRECATED __attribute__ ((deprecated))
+#    ifdef _CUPS_HAS_DEPRECATED_WITH_MESSAGE
+#      define _CUPS_DEPRECATED_MSG(m) __attribute__ ((deprecated(m)))
+#    else
+#      define _CUPS_DEPRECATED_MSG(m) __attribute__ ((deprecated))
+#    endif /* _CUPS_HAS_DEPRECATED_WITH_MESSAGE */
+#    ifdef _CUPS_SOURCE
+#      define _CUPS_INTERNAL_MSG(m)
+#    elif defined(_CUPS_HAS_UNAVAILABLE_WITH_MESSAGE)
+#      define _CUPS_INTERNAL_MSG(m) __attribute__ ((unavailable(m)))
+#    elif defined(_CUPS_HAS_DEPRECATED_WITH_MESSAGE)
+#      define _CUPS_INTERNAL_MSG(m) __attribute__ ((deprecated(m)))
+#    else
+#      define _CUPS_INTERNAL_MSG(m) __attribute__ ((deprecated))
+#    endif /* _CUPS_SOURCE */
+#  endif /* !_CUPS_HAS_DEPRECATED || (_CUPS_SOURCE && !_CUPS_NO_DEPRECATED) */
 
 #  ifndef __GNUC__
 #    define __attribute__(x)