diff --git a/cups/debug-private.h b/cups/debug-private.h index 461bdadc0c..eccebcd2bf 100644 --- a/cups/debug-private.h +++ b/cups/debug-private.h @@ -1,10 +1,11 @@ /* * Private debugging macros for CUPS. * - * Copyright 2007-2012 by Apple Inc. - * Copyright 1997-2005 by Easy Software Products. + * Copyright © 2007-2018 by Apple Inc. + * Copyright © 1997-2005 by Easy Software Products. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ #ifndef _CUPS_DEBUG_PRIVATE_H_ @@ -61,15 +62,6 @@ extern "C" { */ # ifdef DEBUG -# ifdef WIN32 -# ifdef LIBCUPS2_EXPORTS -# define DLLExport __declspec(dllexport) -# else -# define DLLExport -# endif /* LIBCUPS2_EXPORTS */ -# else -# define DLLExport -# endif /* WIN32 */ # define DEBUG_puts(x) _cups_debug_puts(x) # define DEBUG_printf(x) _cups_debug_printf x # define DEBUG_set(logfile,level,filter) _cups_debug_set(logfile,level,filter,1) @@ -85,16 +77,13 @@ extern "C" { * Prototypes... */ -extern int _cups_debug_fd; -extern int _cups_debug_level; -extern void DLLExport _cups_debug_printf(const char *format, ...) - __attribute__ ((__format__ (__printf__, 1, 2))); -extern void DLLExport _cups_debug_puts(const char *s); -extern void DLLExport _cups_debug_set(const char *logfile, - const char *level, const char *filter, - int force); +extern int _cups_debug_fd _CUPS_PRIVATE; +extern int _cups_debug_level _CUPS_PRIVATE; +extern void _cups_debug_printf(const char *format, ...) _CUPS_FORMAT(1,2) _CUPS_PUBLIC; +extern void _cups_debug_puts(const char *s) _CUPS_PUBLIC; +extern void _cups_debug_set(const char *logfile, const char *level, const char *filter, int force) _CUPS_PUBLIC; # ifdef WIN32 -extern int _cups_gettimeofday(struct timeval *tv, void *tz); +extern int _cups_gettimeofday(struct timeval *tv, void *tz) _CUPS_PRIVATE; # define gettimeofday(a,b) _cups_gettimeofday(a, b) # endif /* WIN32 */ diff --git a/cups/debug.c b/cups/debug.c index d2069271a0..a52fbd1031 100644 --- a/cups/debug.c +++ b/cups/debug.c @@ -77,7 +77,7 @@ debug_thread_id(void) * '_cups_debug_printf()' - Write a formatted line to the log. */ -void DLLExport +void _cups_debug_printf(const char *format, /* I - Printf-style format string */ ...) /* I - Additional arguments as needed */ { @@ -162,7 +162,7 @@ _cups_debug_printf(const char *format, /* I - Printf-style format string */ * '_cups_debug_puts()' - Write a single line to the log. */ -void DLLExport +void _cups_debug_puts(const char *s) /* I - String to output */ { struct timeval curtime; /* Current time */ @@ -242,7 +242,7 @@ _cups_debug_puts(const char *s) /* I - String to output */ * '_cups_debug_set()' - Enable or disable debug logging. */ -void DLLExport +void _cups_debug_set(const char *logfile, /* I - Log file or NULL */ const char *level, /* I - Log level or NULL */ const char *filter, /* I - Filter string or NULL */ diff --git a/cups/file.h b/cups/file.h index ed4bed705d..43137b1fc0 100644 --- a/cups/file.h +++ b/cups/file.h @@ -6,10 +6,11 @@ * our own file functions allows us to provide transparent support of * different line endings, gzip'd print files, PPD files, etc. * - * Copyright 2007-2017 by Apple Inc. - * Copyright 1997-2007 by Easy Software Products, all rights reserved. + * Copyright © 2007-2018 by Apple Inc. + * Copyright © 1997-2007 by Easy Software Products, all rights reserved. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ #ifndef _CUPS_FILE_H_ @@ -61,34 +62,22 @@ typedef struct _cups_file_s cups_file_t;/**** CUPS file type ****/ extern int cupsFileClose(cups_file_t *fp) _CUPS_API_1_2; extern int cupsFileCompression(cups_file_t *fp) _CUPS_API_1_2; extern int cupsFileEOF(cups_file_t *fp) _CUPS_API_1_2; -extern const char *cupsFileFind(const char *filename, const char *path, - int executable, char *buffer, - int bufsize) _CUPS_API_1_2; +extern const char *cupsFileFind(const char *filename, const char *path, int executable, char *buffer, int bufsize) _CUPS_API_1_2; extern int cupsFileFlush(cups_file_t *fp) _CUPS_API_1_2; extern int cupsFileGetChar(cups_file_t *fp) _CUPS_API_1_2; -extern char *cupsFileGetConf(cups_file_t *fp, char *buf, - size_t buflen, char **value, - int *linenum) _CUPS_API_1_2; -extern size_t cupsFileGetLine(cups_file_t *fp, char *buf, - size_t buflen) _CUPS_API_1_2; -extern char *cupsFileGets(cups_file_t *fp, char *buf, size_t buflen) - _CUPS_API_1_2; +extern char *cupsFileGetConf(cups_file_t *fp, char *buf, size_t buflen, char **value, int *linenum) _CUPS_API_1_2; +extern size_t cupsFileGetLine(cups_file_t *fp, char *buf, size_t buflen) _CUPS_API_1_2; +extern char *cupsFileGets(cups_file_t *fp, char *buf, size_t buflen) _CUPS_API_1_2; extern int cupsFileLock(cups_file_t *fp, int block) _CUPS_API_1_2; extern int cupsFileNumber(cups_file_t *fp) _CUPS_API_1_2; -extern cups_file_t *cupsFileOpen(const char *filename, const char *mode) - _CUPS_API_1_2; +extern cups_file_t *cupsFileOpen(const char *filename, const char *mode) _CUPS_API_1_2; extern cups_file_t *cupsFileOpenFd(int fd, const char *mode) _CUPS_API_1_2; extern int cupsFilePeekChar(cups_file_t *fp) _CUPS_API_1_2; -extern int cupsFilePrintf(cups_file_t *fp, const char *format, ...) - __attribute__((__format__ (__printf__, 2, 3))) - _CUPS_API_1_2; +extern int cupsFilePrintf(cups_file_t *fp, const char *format, ...) _CUPS_FORMAT(2, 3) _CUPS_API_1_2; extern int cupsFilePutChar(cups_file_t *fp, int c) _CUPS_API_1_2; -extern ssize_t cupsFilePutConf(cups_file_t *fp, const char *directive, - const char *value) _CUPS_API_1_4; -extern int cupsFilePuts(cups_file_t *fp, const char *s) - _CUPS_API_1_2; -extern ssize_t cupsFileRead(cups_file_t *fp, char *buf, size_t bytes) - _CUPS_API_1_2; +extern ssize_t cupsFilePutConf(cups_file_t *fp, const char *directive, const char *value) _CUPS_API_1_4; +extern int cupsFilePuts(cups_file_t *fp, const char *s) _CUPS_API_1_2; +extern ssize_t cupsFileRead(cups_file_t *fp, char *buf, size_t bytes) _CUPS_API_1_2; extern off_t cupsFileRewind(cups_file_t *fp) _CUPS_API_1_2; extern off_t cupsFileSeek(cups_file_t *fp, off_t pos) _CUPS_API_1_2; extern cups_file_t *cupsFileStderr(void) _CUPS_API_1_2; @@ -96,8 +85,7 @@ extern cups_file_t *cupsFileStdin(void) _CUPS_API_1_2; extern cups_file_t *cupsFileStdout(void) _CUPS_API_1_2; extern off_t cupsFileTell(cups_file_t *fp) _CUPS_API_1_2; extern int cupsFileUnlock(cups_file_t *fp) _CUPS_API_1_2; -extern ssize_t cupsFileWrite(cups_file_t *fp, const char *buf, - size_t bytes) _CUPS_API_1_2; +extern ssize_t cupsFileWrite(cups_file_t *fp, const char *buf, size_t bytes) _CUPS_API_1_2; # ifdef __cplusplus diff --git a/cups/http.h b/cups/http.h index 0cb26eb344..50083cb0dd 100644 --- a/cups/http.h +++ b/cups/http.h @@ -1,10 +1,11 @@ /* * Hyper-Text Transport Protocol definitions for CUPS. * - * Copyright 2007-2017 by Apple Inc. - * Copyright 1997-2007 by Easy Software Products, all rights reserved. + * Copyright © 2007-2018 by Apple Inc. + * Copyright © 1997-2007 by Easy Software Products, all rights reserved. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ #ifndef _CUPS_HTTP_H_ @@ -448,53 +449,43 @@ typedef int (*http_timeout_cb_t)(http_t *http, void *user_data); * Prototypes... */ -extern void httpBlocking(http_t *http, int b); -extern int httpCheck(http_t *http); -extern void httpClearFields(http_t *http); -extern void httpClose(http_t *http); -extern http_t *httpConnect(const char *host, int port) - _CUPS_DEPRECATED_1_7_MSG("Use httpConnect2 instead."); -extern http_t *httpConnectEncrypt(const char *host, int port, - http_encryption_t encryption) - _CUPS_DEPRECATED_1_7_MSG("Use httpConnect2 instead."); -extern int httpDelete(http_t *http, const char *uri); -extern int httpEncryption(http_t *http, http_encryption_t e); -extern int httpError(http_t *http); -extern void httpFlush(http_t *http); -extern int httpGet(http_t *http, const char *uri); -extern char *httpGets(char *line, int length, http_t *http); -extern const char *httpGetDateString(time_t t); -extern time_t httpGetDateTime(const char *s); -extern const char *httpGetField(http_t *http, http_field_t field); -extern struct hostent *httpGetHostByName(const char *name); -extern char *httpGetSubField(http_t *http, http_field_t field, - const char *name, char *value); -extern int httpHead(http_t *http, const char *uri); -extern void httpInitialize(void); -extern int httpOptions(http_t *http, const char *uri); -extern int httpPost(http_t *http, const char *uri); -extern int httpPrintf(http_t *http, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))); -extern int httpPut(http_t *http, const char *uri); +extern void httpBlocking(http_t *http, int b) _CUPS_PUBLIC; +extern int httpCheck(http_t *http) _CUPS_PUBLIC; +extern void httpClearFields(http_t *http) _CUPS_PUBLIC; +extern void httpClose(http_t *http) _CUPS_PUBLIC; +extern http_t *httpConnect(const char *host, int port) _CUPS_DEPRECATED_1_7_MSG("Use httpConnect2 instead."); +extern http_t *httpConnectEncrypt(const char *host, int port, http_encryption_t encryption) _CUPS_DEPRECATED_1_7_MSG("Use httpConnect2 instead."); +extern int httpDelete(http_t *http, const char *uri) _CUPS_PUBLIC; +extern int httpEncryption(http_t *http, http_encryption_t e) _CUPS_PUBLIC; +extern int httpError(http_t *http) _CUPS_PUBLIC; +extern void httpFlush(http_t *http) _CUPS_PUBLIC; +extern int httpGet(http_t *http, const char *uri) _CUPS_PUBLIC; +extern char *httpGets(char *line, int length, http_t *http) _CUPS_PUBLIC; +extern const char *httpGetDateString(time_t t) _CUPS_PUBLIC; +extern time_t httpGetDateTime(const char *s) _CUPS_PUBLIC; +extern const char *httpGetField(http_t *http, http_field_t field) _CUPS_PUBLIC; +extern struct hostent *httpGetHostByName(const char *name) _CUPS_PUBLIC; +extern char *httpGetSubField(http_t *http, http_field_t field, const char *name, char *value) _CUPS_PUBLIC; +extern int httpHead(http_t *http, const char *uri) _CUPS_PUBLIC; +extern void httpInitialize(void) _CUPS_PUBLIC; +extern int httpOptions(http_t *http, const char *uri) _CUPS_PUBLIC; +extern int httpPost(http_t *http, const char *uri) _CUPS_PUBLIC; +extern int httpPrintf(http_t *http, const char *format, ...) _CUPS_FORMAT(2, 3) _CUPS_PUBLIC; +extern int httpPut(http_t *http, const char *uri) _CUPS_PUBLIC; extern int httpRead(http_t *http, char *buffer, int length) _CUPS_DEPRECATED_MSG("Use httpRead2 instead."); extern int httpReconnect(http_t *http) _CUPS_DEPRECATED_1_6_MSG("Use httpReconnect2 instead."); -extern void httpSeparate(const char *uri, char *method, - char *username, char *host, int *port, - char *resource) _CUPS_DEPRECATED_MSG("Use httpSeparateURI instead."); -extern void httpSetField(http_t *http, http_field_t field, - const char *value); -extern const char *httpStatus(http_status_t status); -extern int httpTrace(http_t *http, const char *uri); -extern http_status_t httpUpdate(http_t *http); +extern void httpSeparate(const char *uri, char *method, char *username, char *host, int *port, char *resource) _CUPS_DEPRECATED_1_2_MSG("Use httpSeparateURI instead."); +extern void httpSetField(http_t *http, http_field_t field, const char *value) _CUPS_PUBLIC; +extern const char *httpStatus(http_status_t status) _CUPS_PUBLIC; +extern int httpTrace(http_t *http, const char *uri) _CUPS_PUBLIC; +extern http_status_t httpUpdate(http_t *http) _CUPS_PUBLIC; extern int httpWrite(http_t *http, const char *buffer, int length) _CUPS_DEPRECATED_MSG("Use httpWrite2 instead."); extern char *httpEncode64(char *out, const char *in) _CUPS_DEPRECATED_MSG("Use httpEncode64_2 instead."); extern char *httpDecode64(char *out, const char *in) _CUPS_DEPRECATED_MSG("Use httpDecode64_2 instead."); -extern int httpGetLength(http_t *http) _CUPS_DEPRECATED_MSG("Use httpGetLength2 instead."); -extern char *httpMD5(const char *, const char *, const char *, - char [33]) _CUPS_DEPRECATED_MSG("Use cupsDoAuth or cupsHashData instead."); -extern char *httpMD5Final(const char *, const char *, const char *, - char [33]) _CUPS_DEPRECATED_MSG("Use cupsDoAuth or cupsHashData instead."); -extern char *httpMD5String(const unsigned char *, char [33]) _CUPS_DEPRECATED_MSG("Use cupsHashString instead."); +extern int httpGetLength(http_t *http) _CUPS_DEPRECATED_1_2_MSG("Use httpGetLength2 instead."); +extern char *httpMD5(const char *, const char *, const char *, char [33]) _CUPS_DEPRECATED_MSG("Use cupsDoAuth or cupsHashData instead."); +extern char *httpMD5Final(const char *, const char *, const char *, char [33]) _CUPS_DEPRECATED_2_2_MSG("Use cupsDoAuth or cupsHashData instead."); +extern char *httpMD5String(const unsigned char *, char [33]) _CUPS_DEPRECATED_2_2_MSG("Use cupsHashString instead."); /**** New in CUPS 1.1.19 ****/ extern void httpClearCookie(http_t *http) _CUPS_API_1_1_19; @@ -504,40 +495,21 @@ extern int httpWait(http_t *http, int msec) _CUPS_API_1_1_19; /**** New in CUPS 1.1.21 ****/ extern char *httpDecode64_2(char *out, int *outlen, const char *in) _CUPS_API_1_1_21; -extern char *httpEncode64_2(char *out, int outlen, const char *in, - int inlen) _CUPS_API_1_1_21; -extern void httpSeparate2(const char *uri, - char *method, int methodlen, - char *username, int usernamelen, - char *host, int hostlen, int *port, - char *resource, int resourcelen) _CUPS_DEPRECATED_MSG("Use httpSeparateURI instead."); +extern char *httpEncode64_2(char *out, int outlen, const char *in, int inlen) _CUPS_API_1_1_21; +extern void httpSeparate2(const char *uri, char *method, int methodlen, char *username, int usernamelen, char *host, int hostlen, int *port, char *resource, int resourcelen) _CUPS_DEPRECATED_1_2_MSG("Use httpSeparateURI instead."); /**** New in CUPS 1.2/macOS 10.5 ****/ extern int httpAddrAny(const http_addr_t *addr) _CUPS_API_1_2; extern http_addrlist_t *httpAddrConnect(http_addrlist_t *addrlist, int *sock) _CUPS_API_1_2; -extern int httpAddrEqual(const http_addr_t *addr1, - const http_addr_t *addr2) _CUPS_API_1_2; +extern int httpAddrEqual(const http_addr_t *addr1, const http_addr_t *addr2) _CUPS_API_1_2; extern void httpAddrFreeList(http_addrlist_t *addrlist) _CUPS_API_1_2; -extern http_addrlist_t *httpAddrGetList(const char *hostname, int family, - const char *service) _CUPS_API_1_2; +extern http_addrlist_t *httpAddrGetList(const char *hostname, int family, const char *service) _CUPS_API_1_2; extern int httpAddrLength(const http_addr_t *addr) _CUPS_API_1_2; extern int httpAddrLocalhost(const http_addr_t *addr) _CUPS_API_1_2; -extern char *httpAddrLookup(const http_addr_t *addr, - char *name, int namelen) _CUPS_API_1_2; -extern char *httpAddrString(const http_addr_t *addr, - char *s, int slen) _CUPS_API_1_2; -extern http_uri_status_t httpAssembleURI(http_uri_coding_t encoding, - char *uri, int urilen, - const char *scheme, - const char *username, - const char *host, int port, - const char *resource) _CUPS_API_1_2; -extern http_uri_status_t httpAssembleURIf(http_uri_coding_t encoding, - char *uri, int urilen, - const char *scheme, - const char *username, - const char *host, int port, - const char *resourcef, ...) _CUPS_API_1_2; +extern char *httpAddrLookup(const http_addr_t *addr, char *name, int namelen) _CUPS_API_1_2; +extern char *httpAddrString(const http_addr_t *addr, char *s, int slen) _CUPS_API_1_2; +extern http_uri_status_t httpAssembleURI(http_uri_coding_t encoding, char *uri, int urilen, const char *scheme, const char *username, const char *host, int port, const char *resource) _CUPS_API_1_2; +extern http_uri_status_t httpAssembleURIf(http_uri_coding_t encoding, char *uri, int urilen, const char *scheme, const char *username, const char *host, int port, const char *resourcef, ...) _CUPS_FORMAT(8, 9) _CUPS_API_1_2; extern int httpFlushWrite(http_t *http) _CUPS_API_1_2; extern int httpGetBlocking(http_t *http) _CUPS_API_1_2; extern const char *httpGetDateString2(time_t t, char *s, int slen) _CUPS_API_1_2; @@ -545,76 +517,44 @@ extern int httpGetFd(http_t *http) _CUPS_API_1_2; extern const char *httpGetHostname(http_t *http, char *s, int slen) _CUPS_API_1_2; extern off_t httpGetLength2(http_t *http) _CUPS_API_1_2; extern http_status_t httpGetStatus(http_t *http) _CUPS_API_1_2; -extern char *httpGetSubField2(http_t *http, http_field_t field, - const char *name, char *value, - int valuelen) _CUPS_API_1_2; +extern char *httpGetSubField2(http_t *http, http_field_t field, const char *name, char *value, int valuelen) _CUPS_API_1_2; extern ssize_t httpRead2(http_t *http, char *buffer, size_t length) _CUPS_API_1_2; -extern http_uri_status_t httpSeparateURI(http_uri_coding_t decoding, - const char *uri, - char *scheme, int schemelen, - char *username, int usernamelen, - char *host, int hostlen, int *port, - char *resource, int resourcelen) _CUPS_API_1_2; +extern http_uri_status_t httpSeparateURI(http_uri_coding_t decoding, const char *uri, char *scheme, int schemelen, char *username, int usernamelen, char *host, int hostlen, int *port, char *resource, int resourcelen) _CUPS_API_1_2; extern void httpSetExpect(http_t *http, http_status_t expect) _CUPS_API_1_2; extern void httpSetLength(http_t *http, size_t length) _CUPS_API_1_2; -extern ssize_t httpWrite2(http_t *http, const char *buffer, - size_t length) _CUPS_API_1_2; +extern ssize_t httpWrite2(http_t *http, const char *buffer, size_t length) _CUPS_API_1_2; /**** New in CUPS 1.3/macOS 10.5 ****/ extern char *httpGetAuthString(http_t *http) _CUPS_API_1_3; -extern void httpSetAuthString(http_t *http, const char *scheme, - const char *data) _CUPS_API_1_3; +extern void httpSetAuthString(http_t *http, const char *scheme, const char *data) _CUPS_API_1_3; /**** New in CUPS 1.5/macOS 10.7 ****/ -extern int httpAddCredential(cups_array_t *credentials, - const void *data, size_t datalen) - _CUPS_API_1_5; -extern int httpCopyCredentials(http_t *http, - cups_array_t **credentials) - _CUPS_API_1_5; +extern int httpAddCredential(cups_array_t *credentials, const void *data, size_t datalen) _CUPS_API_1_5; +extern int httpCopyCredentials(http_t *http, cups_array_t **credentials) _CUPS_API_1_5; extern void httpFreeCredentials(cups_array_t *certs) _CUPS_API_1_5; -extern int httpSetCredentials(http_t *http, cups_array_t *certs) - _CUPS_API_1_5; -extern void httpSetTimeout(http_t *http, double timeout, - http_timeout_cb_t cb, void *user_data) - _CUPS_API_1_5; +extern int httpSetCredentials(http_t *http, cups_array_t *certs) _CUPS_API_1_5; +extern void httpSetTimeout(http_t *http, double timeout, http_timeout_cb_t cb, void *user_data) _CUPS_API_1_5; /**** New in CUPS 1.6/macOS 10.8 ****/ -extern http_addrlist_t *httpAddrConnect2(http_addrlist_t *addrlist, int *sock, - int msec, int *cancel) - _CUPS_API_1_6; +extern http_addrlist_t *httpAddrConnect2(http_addrlist_t *addrlist, int *sock, int msec, int *cancel) _CUPS_API_1_6; extern http_state_t httpGetState(http_t *http) _CUPS_API_1_6; extern http_version_t httpGetVersion(http_t *http) _CUPS_API_1_6; -extern int httpReconnect2(http_t *http, int msec, int *cancel) - _CUPS_API_1_6; +extern int httpReconnect2(http_t *http, int msec, int *cancel) _CUPS_API_1_6; /**** New in CUPS 1.7/macOS 10.9 ****/ -extern http_t *httpAcceptConnection(int fd, int blocking) - _CUPS_API_1_7; +extern http_t *httpAcceptConnection(int fd, int blocking) _CUPS_API_1_7; 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 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, - int blocking, int msec, int *cancel) - _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, int blocking, int msec, int *cancel) _CUPS_API_1_7; extern const char *httpGetContentEncoding(http_t *http) _CUPS_API_1_7; extern http_status_t httpGetExpect(http_t *http) _CUPS_API_1_7; -extern ssize_t httpPeek(http_t *http, char *buffer, size_t length) - _CUPS_API_1_7; -extern http_state_t httpReadRequest(http_t *http, char *resource, - size_t resourcelen) _CUPS_API_1_7; -extern void httpSetDefaultField(http_t *http, http_field_t field, - const char *value) _CUPS_API_1_7; -extern http_state_t httpWriteResponse(http_t *http, - http_status_t status) _CUPS_API_1_7; +extern ssize_t httpPeek(http_t *http, char *buffer, size_t length) _CUPS_API_1_7; +extern http_state_t httpReadRequest(http_t *http, char *resource, size_t resourcelen) _CUPS_API_1_7; +extern void httpSetDefaultField(http_t *http, http_field_t field, const char *value) _CUPS_API_1_7; +extern http_state_t httpWriteResponse(http_t *http, http_status_t status) _CUPS_API_1_7; /* New in CUPS 2.0/macOS 10.10 */ extern int httpAddrClose(http_addr_t *addr, int fd) _CUPS_API_2_0; diff --git a/cups/ipp-private.h b/cups/ipp-private.h index 66ed11b6d9..280d496294 100644 --- a/cups/ipp-private.h +++ b/cups/ipp-private.h @@ -202,7 +202,7 @@ extern int _ippFileReadToken(_ipp_file_t *f, char *token, size_t tokensize); /* ipp-vars.c */ extern void _ippVarsDeinit(_ipp_vars_t *v); -extern void _ippVarsExpand(_ipp_vars_t *v, char *dst, const char *src, size_t dstsize) __attribute__((nonnull(1,2,3))); +extern void _ippVarsExpand(_ipp_vars_t *v, char *dst, const char *src, size_t dstsize) _CUPS_NONNULL(1,2,3); extern const char *_ippVarsGet(_ipp_vars_t *v, const char *name); extern void _ippVarsInit(_ipp_vars_t *v, _ipp_fattr_cb_t attrcb, _ipp_ferror_cb_t errorcb, _ipp_ftoken_cb_t tokencb); extern const char *_ippVarsPasswordCB(const char *prompt, http_t *http, const char *method, const char *resource, void *user_data); diff --git a/cups/language-private.h b/cups/language-private.h index fb42a6b951..5828ceb299 100644 --- a/cups/language-private.h +++ b/cups/language-private.h @@ -1,10 +1,11 @@ /* * Private localization support for CUPS. * - * Copyright 2007-2017 by Apple Inc. - * Copyright 1997-2006 by Easy Software Products. + * Copyright © 2007-2018 by Apple Inc. + * Copyright © 1997-2006 by Easy Software Products. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ #ifndef _CUPS_LANGUAGE_PRIVATE_H_ @@ -62,16 +63,11 @@ extern const char *_cupsAppleLocale(CFStringRef languageName, char *locale, size # endif /* __APPLE__ */ extern void _cupsCharmapFlush(void); extern const char *_cupsEncodingName(cups_encoding_t encoding); -extern void _cupsLangPrintError(const char *prefix, - const char *message); -extern int _cupsLangPrintFilter(FILE *fp, const char *prefix, - const char *message, ...) - __attribute__ ((__format__ (__printf__, 3, 4))); -extern int _cupsLangPrintf(FILE *fp, const char *message, ...) - __attribute__ ((__format__ (__printf__, 2, 3))); +extern void _cupsLangPrintError(const char *prefix, const char *message); +extern int _cupsLangPrintFilter(FILE *fp, const char *prefix, const char *message, ...) _CUPS_FORMAT(3, 4); +extern int _cupsLangPrintf(FILE *fp, const char *message, ...) _CUPS_FORMAT(2, 3); extern int _cupsLangPuts(FILE *fp, const char *message); -extern const char *_cupsLangString(cups_lang_t *lang, - const char *message); +extern const char *_cupsLangString(cups_lang_t *lang, const char *message); extern void _cupsMessageFree(cups_array_t *a); extern cups_array_t *_cupsMessageLoad(const char *filename, int flags); extern const char *_cupsMessageLookup(cups_array_t *a, const char *m); diff --git a/cups/raster-private.h b/cups/raster-private.h index 19cf295e67..a776714e03 100644 --- a/cups/raster-private.h +++ b/cups/raster-private.h @@ -1,10 +1,11 @@ /* * Private image library definitions for CUPS. * - * Copyright 2007-2015 by Apple Inc. - * Copyright 1993-2006 by Easy Software Products. + * Copyright © 2007-2018 by Apple Inc. + * Copyright © 1993-2006 by Easy Software Products. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ #ifndef _CUPS_RASTER_PRIVATE_H_ @@ -43,12 +44,9 @@ * Prototypes... */ -extern int _cupsRasterExecPS(cups_page_header2_t *h, - int *preferred_bits, - const char *code) - __attribute__((nonnull(3))); -extern void _cupsRasterAddError(const char *f, ...) - __attribute__((__format__(__printf__, 1, 2))); +extern int _cupsRasterExecPS(cups_page_header2_t *h, int *preferred_bits, + const char *code) _CUPS_NONNULL(3); +extern void _cupsRasterAddError(const char *f, ...) _CUPS_FORMAT(1,2); extern void _cupsRasterClearError(void); #endif /* !_CUPS_RASTER_PRIVATE_H_ */ diff --git a/cups/string-private.h b/cups/string-private.h index 3e58cac51e..0b0f5fce49 100644 --- a/cups/string-private.h +++ b/cups/string-private.h @@ -1,10 +1,11 @@ /* * Private string definitions for CUPS. * - * Copyright 2007-2015 by Apple Inc. - * Copyright 1997-2006 by Easy Software Products. + * Copyright © 2007-2018 by Apple Inc. + * Copyright © 1997-2006 by Easy Software Products. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ #ifndef _CUPS_STRING_PRIVATE_H_ @@ -169,8 +170,7 @@ extern size_t _cups_strlcpy(char *, const char *, size_t); # endif /* !HAVE_STRLCPY */ # ifndef HAVE_SNPRINTF -extern int _cups_snprintf(char *, size_t, const char *, ...) - __attribute__ ((__format__ (__printf__, 3, 4))); +extern int _cups_snprintf(char *, size_t, const char *, ...) _CUPS_FORMAT(3, 4); # define snprintf _cups_snprintf # endif /* !HAVE_SNPRINTF */ diff --git a/cups/versioning.h b/cups/versioning.h index 1b86813b61..12328d688a 100644 --- a/cups/versioning.h +++ b/cups/versioning.h @@ -11,87 +11,37 @@ # define _CUPS_VERSIONING_H_ /* - * This header defines several constants - _CUPS_DEPRECATED, - * _CUPS_DEPRECATED_MSG, _CUPS_INTERNAL_MSG, _CUPS_API_major_minor, and - * _CUPS_API_major_minor_patch - which add compiler-specific attributes that - * flag functions that are deprecated, added in particular releases, or internal - * to CUPS. + * This header defines several macros that add compiler-specific attributes for + * functions: * - * On macOS, 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 - * provided by the compiler. + * - _CUPS_API_major_minor[_patch]: Specifies when an API became available by + * CUPS version. + * - _CUPS_DEPRECATED: Function is deprecated with no replacement. + * - _CUPS_DEPRECATED_MSG("message"): Function is deprecated and has a + * replacement. + * - _CUPS_FORMAT(format-index, additional-args-index): Function has a + * printf-style format argument followed by zero or more additional + * arguments. Indices start at 1. + * - _CUPS_INTERNAL_MSG("msg"): Function is + * - _CUPS_NONNULL((arg list)): Specifies the comma-separated argument indices + * are assumed non-NULL. Indices start at 1. + * - _CUPS_PRIVATE: Specifies the function is private to CUPS. + * - _CUPS_PUBLIC: Specifies the function is public API. */ -# if defined(__APPLE__) && !defined(_CUPS_SOURCE) && !TARGET_OS_IOS -# include -# ifndef AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER -# define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER __attribute__((unavailable)) -# endif /* !AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER */ -# ifndef AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER -# define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER __attribute__((unavailable)) -# endif /* !AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER */ -# ifndef AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER -# define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER __attribute__((unavailable)) -# endif /* !AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER */ -# ifndef AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER -# define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER __attribute__((unavailable)) -# endif /* !AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER */ -# ifndef AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER -# define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER __attribute__((unavailable)) -# endif /* !AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER */ -# ifndef AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER -# define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER __attribute__((unavailable)) -# endif /* !AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER */ -# ifndef AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER -# define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER __attribute__((unavailable)) -# endif /* !AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER */ -# ifndef AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER -# define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER __attribute__((unavailable)) -# endif /* !AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER */ -# ifndef AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER -# define AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER __attribute__((unavailable)) -# endif /* !AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER */ -# ifndef AVAILABLE_MAC_OS_X_VERSION_10_13_AND_LATER -# define AVAILABLE_MAC_OS_X_VERSION_10_13_AND_LATER __attribute__((unavailable)) -# endif /* !AVAILABLE_MAC_OS_X_VERSION_10_13_AND_LATER */ -# define _CUPS_API_1_1_19 AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER -# define _CUPS_API_1_1_20 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER -# define _CUPS_API_1_1_21 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER -# define _CUPS_API_1_2 AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER -# define _CUPS_API_1_3 AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER -# define _CUPS_API_1_4 AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER -# define _CUPS_API_1_5 AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER -# define _CUPS_API_1_6 AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER -# define _CUPS_API_1_7 AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER -# define _CUPS_API_2_0 AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER -# define _CUPS_API_2_2 AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER -# define _CUPS_API_2_2_4 AVAILABLE_MAC_OS_X_VERSION_10_13_AND_LATER -# define _CUPS_API_2_2_7 -# define _CUPS_API_2_3 -# else -# define _CUPS_API_1_1_19 -# define _CUPS_API_1_1_20 -# define _CUPS_API_1_1_21 -# define _CUPS_API_1_2 -# define _CUPS_API_1_3 -# define _CUPS_API_1_4 -# define _CUPS_API_1_5 -# define _CUPS_API_1_6 -# define _CUPS_API_1_7 -# define _CUPS_API_2_0 -# define _CUPS_API_2_2 -# define _CUPS_API_2_2_4 -# define _CUPS_API_2_2_7 -# define _CUPS_API_2_3 -# endif /* __APPLE__ && !_CUPS_SOURCE */ - /* - * With GCC and Clang we can mark old APIs as "deprecated" or "unavailable" with - * messages so you get warnings/errors are compile-time... + * Determine which compiler is being used and what annotation features are + * available... */ +# ifdef __APPLE__ +# include +# endif /* __APPLE__ */ + # ifdef __has_extension /* Clang */ # define _CUPS_HAS_DEPRECATED +# define _CUPS_HAS_FORMAT +# define _CUPS_HAS_VISIBILITY # if __has_extension(attribute_deprecated_with_message) # define _CUPS_HAS_DEPRECATED_WITH_MESSAGE # endif @@ -101,6 +51,8 @@ # elif defined(__GNUC__) /* GCC and compatible */ # if __GNUC__ >= 3 /* GCC 3.0 or higher */ # define _CUPS_HAS_DEPRECATED +# define _CUPS_HAS_FORMAT +# define _CUPS_HAS_VISIBILITY # endif /* __GNUC__ >= 3 */ # if __GNUC__ >= 5 /* GCC 5.x */ # define _CUPS_HAS_DEPRECATED_WITH_MESSAGE @@ -110,59 +62,173 @@ # endif /* __GNUC__ >= 5 */ # endif /* __has_extension */ + +/* + * Define _CUPS_PRIVATE and _CUPS_PUBLIC visibilty macros for private/public + * functions... + */ + +# ifdef _CUPS_HAS_VISIBILITY +# define _CUPS_PRIVATE __attribute__ ((visibility("hidden"))) +# define _CUPS_PUBLIC __attribute__ ((visibility("default"))) +# elif defined(WIN32) && defined(LIBCUPS2_EXPORTS) +# define _CUPS_PRIVATE +# define _CUPS_PUBLIC __declspec(dllexport) +# else +# define _CUPS_PRIVATE +# define _CUPS_PUBLIC +# endif /* _CUPS_HAS_VISIBILITY */ + + +/* + * Define _CUPS_API_major_minor[_patch] availability macros for CUPS. + * + * Note: Using any of the _CUPS_API macros automatically adds _CUPS_PUBLIC. + */ + +# if defined(__APPLE__) && !defined(_CUPS_SOURCE) && !TARGET_OS_IOS +/* + * On Apple operating systems, the _CUPS_API_* constants are defined using the + * API_ macros in . + * + * On iOS, we don't actually have libcups available directly, but the supplied + * libcups_static target in the Xcode project supports building on iOS 11.0 and + * later. + */ +# define _CUPS_API_1_1_19 API_AVAILABLE(macos(10.3), ios(11.0)) _CUPS_PUBLIC +# define _CUPS_API_1_1_20 API_AVAILABLE(macos(10.4), ios(11.0)) _CUPS_PUBLIC +# define _CUPS_API_1_1_21 API_AVAILABLE(macos(10.4), ios(11.0)) _CUPS_PUBLIC +# define _CUPS_API_1_2 API_AVAILABLE(macos(10.5), ios(11.0)) _CUPS_PUBLIC +# define _CUPS_API_1_3 API_AVAILABLE(macos(10.5), ios(11.0)) _CUPS_PUBLIC +# define _CUPS_API_1_4 API_AVAILABLE(macos(10.6), ios(11.0)) _CUPS_PUBLIC +# define _CUPS_API_1_5 API_AVAILABLE(macos(10.7), ios(11.0)) _CUPS_PUBLIC +# define _CUPS_API_1_6 API_AVAILABLE(macos(10.8), ios(11.0)) _CUPS_PUBLIC +# define _CUPS_API_1_7 API_AVAILABLE(macos(10.9), ios(11.0)) _CUPS_PUBLIC +# define _CUPS_API_2_0 API_AVAILABLE(macos(10.10), ios(11.0)) _CUPS_PUBLIC +# define _CUPS_API_2_2 API_AVAILABLE(macos(10.12), ios(11.0)) _CUPS_PUBLIC +# define _CUPS_API_2_2_4 API_AVAILABLE(macos(10.13), ios(11.0)) _CUPS_PUBLIC +# define _CUPS_API_2_2_7 API_AVAILABLE(macos(10.14), ios(11.0)) _CUPS_PUBLIC +# define _CUPS_API_2_3 _CUPS_PUBLIC +# else +# define _CUPS_API_1_1_19 _CUPS_PUBLIC +# define _CUPS_API_1_1_20 _CUPS_PUBLIC +# define _CUPS_API_1_1_21 _CUPS_PUBLIC +# define _CUPS_API_1_2 _CUPS_PUBLIC +# define _CUPS_API_1_3 _CUPS_PUBLIC +# define _CUPS_API_1_4 _CUPS_PUBLIC +# define _CUPS_API_1_5 _CUPS_PUBLIC +# define _CUPS_API_1_6 _CUPS_PUBLIC +# define _CUPS_API_1_7 _CUPS_PUBLIC +# define _CUPS_API_2_0 _CUPS_PUBLIC +# define _CUPS_API_2_2 _CUPS_PUBLIC +# define _CUPS_API_2_2_4 _CUPS_PUBLIC +# define _CUPS_API_2_2_7 _CUPS_PUBLIC +# define _CUPS_API_2_3 _CUPS_PUBLIC +# endif /* __APPLE__ && !_CUPS_SOURCE */ + + +/* + * Define _CUPS_DEPRECATED and _CUPS_INTERNAL macros to mark old APIs as + * "deprecated" or "unavailable" with messages so you get warnings/errors are + * compile-time... + * + * Note: Using any of the _CUPS_DEPRECATED macros automatically adds + * _CUPS_PUBLIC. + */ + # 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) -# define _CUPS_DEPRECATED_1_6_MSG(m) -# define _CUPS_DEPRECATED_1_7_MSG(m) -# define _CUPS_INTERNAL_MSG(m) +# define _CUPS_DEPRECATED _CUPS_PUBLIC +# define _CUPS_DEPRECATED_MSG(m) _CUPS_PUBLIC +# define _CUPS_DEPRECATED_1_2_MSG(m) _CUPS_PUBLIC +# define _CUPS_DEPRECATED_1_6_MSG(m) _CUPS_PUBLIC +# define _CUPS_DEPRECATED_1_7_MSG(m) _CUPS_PUBLIC +# define _CUPS_DEPRECATED_2_2_MSG(m) _CUPS_PUBLIC +# elif defined(__APPLE__) + /* + * Compiler supports the unavailable attribute, so use it when the code + * wants to exclude the use of deprecated API. + */ +# define _CUPS_DEPRECATED __attribute__ ((unavailable)) _CUPS_PUBLIC +# define _CUPS_DEPRECATED_MSG(m) __attribute__ ((unavailable(m))) _CUPS_PUBLIC +# define _CUPS_DEPRECATED_1_2_MSG(m) API_DEPRECATED(m, macos(10.2,10.5)) API_UNAVAILABLE(ios) _CUPS_PUBLIC +# define _CUPS_DEPRECATED_1_6_MSG(m) API_DEPRECATED(m, macos(10.2,10.8)) API_UNAVAILABLE(ios) _CUPS_PUBLIC +# define _CUPS_DEPRECATED_1_7_MSG(m) API_DEPRECATED(m, macos(10.2,10.9)) API_UNAVAILABLE(ios) _CUPS_PUBLIC +# define _CUPS_DEPRECATED_2_2_MSG(m) API_DEPRECATED(m, macos(10.2,10.12)) API_UNAVAILABLE(ios) _CUPS_PUBLIC # elif defined(_CUPS_HAS_UNAVAILABLE_WITH_MESSAGE) && defined(_CUPS_NO_DEPRECATED) /* * Compiler supports the unavailable 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_DEPRECATED_1_6_MSG(m) __attribute__ ((unavailable(m))) -# define _CUPS_DEPRECATED_1_7_MSG(m) __attribute__ ((unavailable(m))) -# define _CUPS_INTERNAL_MSG(m) __attribute__ ((unavailable(m))) +# define _CUPS_DEPRECATED __attribute__ ((unavailable)) _CUPS_PUBLIC +# define _CUPS_DEPRECATED_MSG(m) __attribute__ ((unavailable(m))) _CUPS_PUBLIC +# define _CUPS_DEPRECATED_1_2_MSG(m) __attribute__ ((unavailable(m))) _CUPS_PUBLIC +# define _CUPS_DEPRECATED_1_6_MSG(m) __attribute__ ((unavailable(m))) _CUPS_PUBLIC +# define _CUPS_DEPRECATED_1_7_MSG(m) __attribute__ ((unavailable(m))) _CUPS_PUBLIC +# define _CUPS_DEPRECATED_2_2_MSG(m) __attribute__ ((unavailable(m))) _CUPS_PUBLIC # else /* * Compiler supports the deprecated attribute, so use it. */ -# define _CUPS_DEPRECATED __attribute__ ((deprecated)) +# define _CUPS_DEPRECATED __attribute__ ((deprecated)) _CUPS_PUBLIC # ifdef _CUPS_HAS_DEPRECATED_WITH_MESSAGE -# define _CUPS_DEPRECATED_MSG(m) __attribute__ ((deprecated(m))) +# define _CUPS_DEPRECATED_MSG(m) __attribute__ ((deprecated(m))) _CUPS_PUBLIC +# define _CUPS_DEPRECATED_1_2_MSG(m) __attribute__ ((deprecated(m))) _CUPS_PUBLIC +# define _CUPS_DEPRECATED_1_6_MSG(m) __attribute__ ((deprecated(m))) _CUPS_PUBLIC +# define _CUPS_DEPRECATED_1_7_MSG(m) __attribute__ ((deprecated(m))) _CUPS_PUBLIC +# define _CUPS_DEPRECATED_2_2_MSG(m) __attribute__ ((deprecated(m))) _CUPS_PUBLIC # else -# define _CUPS_DEPRECATED_MSG(m) __attribute__ ((deprecated)) +# define _CUPS_DEPRECATED_MSG(m) __attribute__ ((deprecated)) _CUPS_PUBLIC +# define _CUPS_DEPRECATED_1_2_MSG(m) __attribute__ ((deprecated)) _CUPS_PUBLIC +# define _CUPS_DEPRECATED_1_6_MSG(m) __attribute__ ((deprecated)) _CUPS_PUBLIC +# define _CUPS_DEPRECATED_1_7_MSG(m) __attribute__ ((deprecated)) _CUPS_PUBLIC +# define _CUPS_DEPRECATED_2_2_MSG(m) __attribute__ ((deprecated)) _CUPS_PUBLIC # endif /* _CUPS_HAS_DEPRECATED_WITH_MESSAGE */ -# if defined(MAC_OS_X_VERSION_10_8) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8 -# define _CUPS_DEPRECATED_1_6_MSG(m) _CUPS_DEPRECATED_MSG(m) -# else -# define _CUPS_DEPRECATED_1_6_MSG(m) -# endif /* MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_8 */ -# if defined(MAC_OS_X_VERSION_10_9) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9 -# define _CUPS_DEPRECATED_1_7_MSG(m) _CUPS_DEPRECATED_MSG(m) -# else -# define _CUPS_DEPRECATED_1_7_MSG(m) -# endif /* MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_9 */ -# 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) -# endif /* !__GNUC__ */ + +/* + * Define _CUPS_FORMAT macro for printf-style functions... + */ + +# ifdef _CUPS_HAS_FORMAT +# define _CUPS_FORMAT(a,b) __attribute__ ((__format__(__printf__, a,b))) +# else +# define _CUPS_FORMAT(a,b) +# endif /* _CUPS_HAS_FORMAT */ + + +/* + * Define _CUPS_INTERNAL_MSG macro for private APIs that have (historical) + * public visibility. + * + * Note: Using the _CUPS_INTERNAL_MSG macro automatically adds _CUPS_PUBLIC. + */ + +# ifdef _CUPS_SOURCE +# define _CUPS_INTERNAL_MSG(m) _CUPS_PUBLIC +# elif defined(_CUPS_HAS_UNAVAILABLE_WITH_MESSAGE) +# define _CUPS_INTERNAL_MSG(m) __attribute__ ((unavailable(m))) _CUPS_PUBLIC +# elif defined(_CUPS_HAS_DEPRECATED_WITH_MESSAGE) +# define _CUPS_INTERNAL_MSG(m) __attribute__ ((deprecated(m))) _CUPS_PUBLIC +# else +# define _CUPS_INTERNAL_MSG(m) __attribute__ ((deprecated)) _CUPS_PUBLIC +# endif /* _CUPS_SOURCE */ + + +/* + * Define _CUPS_NONNULL macro for functions that don't expect non-null + * arguments... + */ + +# ifdef _CUPS_HAS_NONNULL +# define _CUPS_NONNULL(...) __attribute__ ((nonnull(__VA_ARGS__))) +# else +# define _CUPS_NONNULL(...) +# endif /* _CUPS_HAS_FORMAT */ + #endif /* !_CUPS_VERSIONING_H_ */ diff --git a/scheduler/conf.h b/scheduler/conf.h index 3a5fe105db..b4e14eed99 100644 --- a/scheduler/conf.h +++ b/scheduler/conf.h @@ -1,10 +1,11 @@ /* * Configuration file definitions for the CUPS scheduler. * - * Copyright 2007-2016 by Apple Inc. - * Copyright 1997-2007 by Easy Software Products, all rights reserved. + * Copyright © 2007-2018 by Apple Inc. + * Copyright © 1997-2007 by Easy Software Products, all rights reserved. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ @@ -275,20 +276,14 @@ extern int cupsdCheckProgram(const char *filename, cupsd_printer_t *p); extern int cupsdDefaultAuthType(void); extern void cupsdFreeAliases(cups_array_t *aliases); extern char *cupsdGetDateTime(struct timeval *t, cupsd_time_t format); -extern int cupsdLogClient(cupsd_client_t *con, int level, - const char *message, ...) - __attribute__((__format__(__printf__, 3, 4))); -extern void cupsdLogFCMessage(void *context, _cups_fc_result_t result, - const char *message); +extern int cupsdLogClient(cupsd_client_t *con, int level, const char *message, ...) _CUPS_FORMAT(3, 4); +extern void cupsdLogFCMessage(void *context, _cups_fc_result_t result, const char *message); #ifdef HAVE_GSSAPI -extern int cupsdLogGSSMessage(int level, OM_uint32 major_status, - OM_uint32 minor_status, - const char *message, ...); +extern int cupsdLogGSSMessage(int level, OM_uint32 major_status, OM_uint32 minor_status, const char *message, ...) _CUPS_FORMAT(4, 5); #endif /* HAVE_GSSAPI */ extern int cupsdLogJob(cupsd_job_t *job, int level, const char *message, - ...) __attribute__((__format__(__printf__, 3, 4))); -extern int cupsdLogMessage(int level, const char *message, ...) - __attribute__ ((__format__ (__printf__, 2, 3))); + ...) _CUPS_FORMAT(3, 4); +extern int cupsdLogMessage(int level, const char *message, ...) _CUPS_FORMAT(2, 3); extern int cupsdLogPage(cupsd_job_t *job, const char *page); extern int cupsdLogRequest(cupsd_client_t *con, http_status_t code); extern int cupsdReadConfiguration(void); diff --git a/scheduler/cupsd.h b/scheduler/cupsd.h index 3e6c97c5d0..c0174fae71 100644 --- a/scheduler/cupsd.h +++ b/scheduler/cupsd.h @@ -1,7 +1,7 @@ /* * Main header file for the CUPS scheduler. * - * Copyright © 2007-2016 by Apple Inc. + * Copyright © 2007-2018 by Apple Inc. * Copyright © 1997-2007 by Easy Software Products, all rights reserved. * * Licensed under Apache License v2.0. See the file "LICENSE" for more @@ -168,8 +168,7 @@ VAR int OnDemand VALUE(0); extern void cupsdInitEnv(void); extern int cupsdLoadEnv(char *envp[], int envmax); extern void cupsdSetEnv(const char *name, const char *value); -extern void cupsdSetEnvf(const char *name, const char *value, ...) - __attribute__ ((__format__ (__printf__, 2, 3))); +extern void cupsdSetEnvf(const char *name, const char *value, ...) _CUPS_FORMAT(2, 3); extern void cupsdUpdateEnv(void); /* file.c */ diff --git a/scheduler/mime-private.h b/scheduler/mime-private.h index 57768e95ef..9ca5dc95f2 100644 --- a/scheduler/mime-private.h +++ b/scheduler/mime-private.h @@ -1,9 +1,10 @@ /* * Private MIME type/conversion database definitions for CUPS. * - * Copyright 2011 by Apple Inc. + * Copyright © 2011-2018 by Apple Inc. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ #ifndef _CUPS_MIME_PRIVATE_H_ @@ -25,8 +26,7 @@ extern "C" { * Prototypes... */ -extern void _mimeError(mime_t *mime, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))); +extern void _mimeError(mime_t *mime, const char *format, ...) _CUPS_FORMAT(2, 3); # ifdef __cplusplus diff --git a/xcode/CUPS.xcodeproj/project.pbxproj b/xcode/CUPS.xcodeproj/project.pbxproj index c103327a6a..0bda75679c 100644 --- a/xcode/CUPS.xcodeproj/project.pbxproj +++ b/xcode/CUPS.xcodeproj/project.pbxproj @@ -3594,7 +3594,6 @@ 72E65BAF18DC799B00097E89 /* cups-opsys.m4 */ = {isa = PBXFileReference; lastKnownFileType = text; name = "cups-opsys.m4"; path = "../config-scripts/cups-opsys.m4"; sourceTree = ""; }; 72E65BB018DC799B00097E89 /* cups-pam.m4 */ = {isa = PBXFileReference; lastKnownFileType = text; name = "cups-pam.m4"; path = "../config-scripts/cups-pam.m4"; sourceTree = ""; }; 72E65BB118DC799B00097E89 /* cups-poll.m4 */ = {isa = PBXFileReference; lastKnownFileType = text; name = "cups-poll.m4"; path = "../config-scripts/cups-poll.m4"; sourceTree = ""; }; - 72E65BB218DC799B00097E89 /* cups-scripting.m4 */ = {isa = PBXFileReference; lastKnownFileType = text; name = "cups-scripting.m4"; path = "../config-scripts/cups-scripting.m4"; sourceTree = ""; }; 72E65BB318DC799B00097E89 /* cups-sharedlibs.m4 */ = {isa = PBXFileReference; lastKnownFileType = text; name = "cups-sharedlibs.m4"; path = "../config-scripts/cups-sharedlibs.m4"; sourceTree = ""; }; 72E65BB418DC799B00097E89 /* cups-ssl.m4 */ = {isa = PBXFileReference; lastKnownFileType = text; name = "cups-ssl.m4"; path = "../config-scripts/cups-ssl.m4"; sourceTree = ""; }; 72E65BB518DC799B00097E89 /* cups-threads.m4 */ = {isa = PBXFileReference; lastKnownFileType = text; name = "cups-threads.m4"; path = "../config-scripts/cups-threads.m4"; sourceTree = ""; }; @@ -5268,7 +5267,6 @@ 72E65BAF18DC799B00097E89 /* cups-opsys.m4 */, 72E65BB018DC799B00097E89 /* cups-pam.m4 */, 72E65BB118DC799B00097E89 /* cups-poll.m4 */, - 72E65BB218DC799B00097E89 /* cups-scripting.m4 */, 72E65BB318DC799B00097E89 /* cups-sharedlibs.m4 */, 72E65BB418DC799B00097E89 /* cups-ssl.m4 */, 72E65BB518DC799B00097E89 /* cups-threads.m4 */,