]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Remove dependency on zlib headers outside of libcups.
authorMichael R Sweet <michael.r.sweet@gmail.com>
Wed, 17 Oct 2018 15:31:45 +0000 (11:31 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Wed, 17 Oct 2018 15:31:45 +0000 (11:31 -0400)
cups/file-private.h
cups/file.c
cups/http-private.h
cups/http.c
cups/language-private.h
scheduler/cups-deviced.c
test/ipptool.c

index afa438bee892a9b237e8c33421a8e9e9d5a7b801..bb6f2130cca0e6ac03f8a17d6142bdd056150ded 100644 (file)
@@ -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_PRIVATE_H_
@@ -25,9 +26,6 @@
 #  include <stdarg.h>
 #  include <fcntl.h>
 
-#  ifdef HAVE_LIBZ
-#    include <zlib.h>
-#  endif /* HAVE_LIBZ */
 #  ifdef _WIN32
 #    include <io.h>
 #    include <sys/locking.h>
@@ -82,43 +80,13 @@ typedef enum                                /**** _cupsFileCheck file type values ****/
 typedef void (*_cups_fc_func_t)(void *context, _cups_fc_result_t result,
                                const char *message);
 
-struct _cups_file_s                    /**** CUPS file structure... ****/
-
-{
-  int          fd;                     /* File descriptor */
-  char         mode,                   /* Mode ('r' or 'w') */
-               compressed,             /* Compression used? */
-               is_stdio,               /* stdin/out/err? */
-               eof,                    /* End of file? */
-               buf[4096],              /* Buffer */
-               *ptr,                   /* Pointer into buffer */
-               *end;                   /* End of buffer data */
-  off_t                pos,                    /* Position in file */
-               bufpos;                 /* File position for start of buffer */
-
-#ifdef HAVE_LIBZ
-  z_stream     stream;                 /* (De)compression stream */
-  Bytef                cbuf[4096];             /* (De)compression buffer */
-  uLong                crc;                    /* (De)compression CRC */
-#endif /* HAVE_LIBZ */
-
-  char         *printf_buffer;         /* cupsFilePrintf buffer */
-  size_t       printf_size;            /* Size of cupsFilePrintf buffer */
-};
-
-
 /*
  * Prototypes...
  */
 
-extern _cups_fc_result_t       _cupsFileCheck(const char *filename,
-                                              _cups_fc_filetype_t filetype,
-                                              int dorootchecks,
-                                              _cups_fc_func_t cb,
-                                              void *context) _CUPS_PRIVATE;
-extern void                    _cupsFileCheckFilter(void *context,
-                                                    _cups_fc_result_t result,
-                                                    const char *message) _CUPS_PRIVATE;
+extern _cups_fc_result_t       _cupsFileCheck(const char *filename, _cups_fc_filetype_t filetype, int dorootchecks, _cups_fc_func_t cb, void *context) _CUPS_PRIVATE;
+extern void                    _cupsFileCheckFilter(void *context, _cups_fc_result_t result, const char *message) _CUPS_PRIVATE;
+extern int                     _cupsFilePeekAhead(cups_file_t *fp, int ch);
 
 #  ifdef __cplusplus
 }
index 5356d5ce67f10b726988fd09c2085bb617e9c000..759f6dc5d74fcc22a06d62e510fff8ed6ae5dd9e 100644 (file)
@@ -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.
  */
 
 /*
 #include <sys/stat.h>
 #include <sys/types.h>
 
+#  ifdef HAVE_LIBZ
+#    include <zlib.h>
+#  endif /* HAVE_LIBZ */
+
+
+/*
+ * Internal structures...
+ */
+
+struct _cups_file_s                    /**** CUPS file structure... ****/
+
+{
+  int          fd;                     /* File descriptor */
+  char         mode,                   /* Mode ('r' or 'w') */
+               compressed,             /* Compression used? */
+               is_stdio,               /* stdin/out/err? */
+               eof,                    /* End of file? */
+               buf[4096],              /* Buffer */
+               *ptr,                   /* Pointer into buffer */
+               *end;                   /* End of buffer data */
+  off_t                pos,                    /* Position in file */
+               bufpos;                 /* File position for start of buffer */
+
+#ifdef HAVE_LIBZ
+  z_stream     stream;                 /* (De)compression stream */
+  Bytef                cbuf[4096];             /* (De)compression buffer */
+  uLong                crc;                    /* (De)compression CRC */
+#endif /* HAVE_LIBZ */
+
+  char         *printf_buffer;         /* cupsFilePrintf buffer */
+  size_t       printf_size;            /* Size of cupsFilePrintf buffer */
+};
+
 
 /*
  * Local functions...
@@ -1257,6 +1291,18 @@ cupsFileOpenFd(int        fd,            /* I - File descriptor */
 }
 
 
+/*
+ * '_cupsFilePeekAhead()' - See if the requested character is buffered up.
+ */
+
+int                                    /* O - 1 if present, 0 otherwise */
+_cupsFilePeekAhead(cups_file_t *fp,    /* I - CUPS file */
+                   int         ch)     /* I - Character */
+{
+  return (fp && fp->ptr && memchr(fp->ptr, ch, (size_t)(fp->end - fp->ptr)));
+}
+
+
 /*
  * 'cupsFilePeekChar()' - Peek at the next character from a file.
  *
index 05936ad61cfe5cbadc9d7076107f5cf2b8b5768d..6c073ac9708040c2def21c8699c495be688990ea 100644 (file)
@@ -102,10 +102,6 @@ typedef int socklen_t;
 #    endif /* HAVE_GETIFADDRS */
 #  endif /* !_WIN32 */
 
-#  ifdef HAVE_LIBZ
-#    include <zlib.h>
-#  endif /* HAVE_LIBZ */
-
 
 /*
  * C++ magic...
@@ -303,8 +299,8 @@ struct _http_s                              /**** HTTP connection structure ****/
   _http_mode_t         mode;           /* _HTTP_MODE_CLIENT or _HTTP_MODE_SERVER */
 #  ifdef HAVE_LIBZ
   _http_coding_t       coding;         /* _HTTP_CODING_xxx */
-  z_stream             stream;         /* (De)compression stream */
-  Bytef                        *sbuffer;       /* (De)compression buffer */
+  void                 *stream;        /* (De)compression stream */
+  unsigned char                *sbuffer;       /* (De)compression buffer */
 #  endif /* HAVE_LIBZ */
 
   /**** New in CUPS 2.2.9 ****/
index 794a213b2f030de9a386f65a0e72781ff16d30d4..734f9027a97581190678c18d76e6a03d1d9c7f75 100644 (file)
@@ -28,6 +28,9 @@
 #ifdef HAVE_POLL
 #  include <poll.h>
 #endif /* HAVE_POLL */
+#  ifdef HAVE_LIBZ
+#    include <zlib.h>
+#  endif /* HAVE_LIBZ */
 
 
 /*
@@ -1675,7 +1678,7 @@ httpPeek(http_t *http,                    /* I - HTTP connection */
 #ifdef HAVE_LIBZ
   if (http->used == 0 &&
       (http->coding == _HTTP_CODING_IDENTITY ||
-       (http->coding >= _HTTP_CODING_GUNZIP && http->stream.avail_in == 0)))
+       (http->coding >= _HTTP_CODING_GUNZIP && ((z_stream *)http->stream)->avail_in == 0)))
 #else
   if (http->used == 0)
 #endif /* HAVE_LIBZ */
@@ -1724,16 +1727,16 @@ httpPeek(http_t *http,                  /* I - HTTP connection */
     int                zerr;                   /* Decompressor error */
     z_stream   stream;                 /* Copy of decompressor stream */
 
-    if (http->used > 0 && http->stream.avail_in < HTTP_MAX_BUFFER)
+    if (http->used > 0 && ((z_stream *)http->stream)->avail_in < HTTP_MAX_BUFFER)
     {
-      size_t buflen = buflen = HTTP_MAX_BUFFER - http->stream.avail_in;
+      size_t buflen = buflen = HTTP_MAX_BUFFER - ((z_stream *)http->stream)->avail_in;
                                        /* Number of bytes to copy */
 
-      if (http->stream.avail_in > 0 &&
-         http->stream.next_in > http->sbuffer)
-        memmove(http->sbuffer, http->stream.next_in, http->stream.avail_in);
+      if (((z_stream *)http->stream)->avail_in > 0 &&
+         ((z_stream *)http->stream)->next_in > http->sbuffer)
+        memmove(http->sbuffer, ((z_stream *)http->stream)->next_in, ((z_stream *)http->stream)->avail_in);
 
-      http->stream.next_in = http->sbuffer;
+      ((z_stream *)http->stream)->next_in = http->sbuffer;
 
       if (buflen > (size_t)http->data_remaining)
         buflen = (size_t)http->data_remaining;
@@ -1744,8 +1747,8 @@ httpPeek(http_t *http,                    /* I - HTTP connection */
       DEBUG_printf(("1httpPeek: Copying %d more bytes of data into "
                    "decompression buffer.", (int)buflen));
 
-      memcpy(http->sbuffer + http->stream.avail_in, http->buffer, buflen);
-      http->stream.avail_in += buflen;
+      memcpy(http->sbuffer + ((z_stream *)http->stream)->avail_in, http->buffer, buflen);
+      ((z_stream *)http->stream)->avail_in += buflen;
       http->used            -= (int)buflen;
       http->data_remaining  -= (off_t)buflen;
 
@@ -1754,9 +1757,9 @@ httpPeek(http_t *http,                    /* I - HTTP connection */
     }
 
     DEBUG_printf(("2httpPeek: length=%d, avail_in=%d", (int)length,
-                  (int)http->stream.avail_in));
+                  (int)((z_stream *)http->stream)->avail_in));
 
-    if (inflateCopy(&stream, &(http->stream)) != Z_OK)
+    if (inflateCopy(&stream, (z_stream *)http->stream) != Z_OK)
     {
       DEBUG_puts("2httpPeek: Unable to copy decompressor stream.");
       http->error = ENOMEM;
@@ -1773,14 +1776,14 @@ httpPeek(http_t *http,                  /* I - HTTP connection */
     {
       DEBUG_printf(("2httpPeek: zerr=%d", zerr));
 #ifdef DEBUG
-      http_debug_hex("2httpPeek", (char *)http->sbuffer, (int)http->stream.avail_in);
+      http_debug_hex("2httpPeek", (char *)http->sbuffer, (int)((z_stream *)http->stream)->avail_in);
 #endif /* DEBUG */
 
       http->error = EIO;
       return (-1);
     }
 
-    bytes = (ssize_t)(length - http->stream.avail_out);
+    bytes = (ssize_t)(length - ((z_stream *)http->stream)->avail_out);
 
 #  else
     DEBUG_puts("2httpPeek: No inflateCopy on this platform, httpPeek does not "
@@ -1947,31 +1950,31 @@ httpRead2(http_t *http,                 /* I - HTTP connection */
   {
     do
     {
-      if (http->stream.avail_in > 0)
+      if (((z_stream *)http->stream)->avail_in > 0)
       {
        int     zerr;                   /* Decompressor error */
 
        DEBUG_printf(("2httpRead2: avail_in=%d, avail_out=%d",
-                     (int)http->stream.avail_in, (int)length));
+                     (int)((z_stream *)http->stream)->avail_in, (int)length));
 
-       http->stream.next_out  = (Bytef *)buffer;
-       http->stream.avail_out = (uInt)length;
+       ((z_stream *)http->stream)->next_out  = (Bytef *)buffer;
+       ((z_stream *)http->stream)->avail_out = (uInt)length;
 
-       if ((zerr = inflate(&(http->stream), Z_SYNC_FLUSH)) < Z_OK)
+       if ((zerr = inflate((z_stream *)http->stream, Z_SYNC_FLUSH)) < Z_OK)
        {
          DEBUG_printf(("2httpRead2: zerr=%d", zerr));
 #ifdef DEBUG
-          http_debug_hex("2httpRead2", (char *)http->sbuffer, (int)http->stream.avail_in);
+          http_debug_hex("2httpRead2", (char *)http->sbuffer, (int)((z_stream *)http->stream)->avail_in);
 #endif /* DEBUG */
 
          http->error = EIO;
          return (-1);
        }
 
-       bytes = (ssize_t)(length - http->stream.avail_out);
+       bytes = (ssize_t)(length - ((z_stream *)http->stream)->avail_out);
 
        DEBUG_printf(("2httpRead2: avail_in=%d, avail_out=%d, bytes=%d",
-                     http->stream.avail_in, http->stream.avail_out,
+                     ((z_stream *)http->stream)->avail_in, ((z_stream *)http->stream)->avail_out,
                      (int)bytes));
       }
       else
@@ -1979,16 +1982,16 @@ httpRead2(http_t *http,                 /* I - HTTP connection */
 
       if (bytes == 0)
       {
-        ssize_t buflen = HTTP_MAX_BUFFER - (ssize_t)http->stream.avail_in;
+        ssize_t buflen = HTTP_MAX_BUFFER - (ssize_t)((z_stream *)http->stream)->avail_in;
                                        /* Additional bytes for buffer */
 
         if (buflen > 0)
         {
-          if (http->stream.avail_in > 0 &&
-              http->stream.next_in > http->sbuffer)
-            memmove(http->sbuffer, http->stream.next_in, http->stream.avail_in);
+          if (((z_stream *)http->stream)->avail_in > 0 &&
+              ((z_stream *)http->stream)->next_in > http->sbuffer)
+            memmove(http->sbuffer, ((z_stream *)http->stream)->next_in, ((z_stream *)http->stream)->avail_in);
 
-         http->stream.next_in = http->sbuffer;
+         ((z_stream *)http->stream)->next_in = http->sbuffer;
 
           DEBUG_printf(("1httpRead2: Reading up to %d more bytes of data into "
                         "decompression buffer.", (int)buflen));
@@ -1998,10 +2001,10 @@ httpRead2(http_t *http,                 /* I - HTTP connection */
            if (buflen > http->data_remaining)
              buflen = (ssize_t)http->data_remaining;
 
-           bytes = http_read_buffered(http, (char *)http->sbuffer + http->stream.avail_in, (size_t)buflen);
+           bytes = http_read_buffered(http, (char *)http->sbuffer + ((z_stream *)http->stream)->avail_in, (size_t)buflen);
           }
           else if (http->data_encoding == HTTP_ENCODING_CHUNKED)
-            bytes = http_read_chunk(http, (char *)http->sbuffer + http->stream.avail_in, (size_t)buflen);
+            bytes = http_read_chunk(http, (char *)http->sbuffer + ((z_stream *)http->stream)->avail_in, (size_t)buflen);
           else
             bytes = 0;
 
@@ -2014,7 +2017,7 @@ httpRead2(http_t *http,                   /* I - HTTP connection */
                         "decompression buffer.", CUPS_LLCAST bytes));
 
           http->data_remaining  -= bytes;
-          http->stream.avail_in += (uInt)bytes;
+          ((z_stream *)http->stream)->avail_in += (uInt)bytes;
 
          if (http->data_remaining <= 0 &&
              http->data_encoding == HTTP_ENCODING_CHUNKED)
@@ -2093,7 +2096,7 @@ httpRead2(http_t *http,                   /* I - HTTP connection */
   if (
 #ifdef HAVE_LIBZ
       (http->coding == _HTTP_CODING_IDENTITY ||
-       (http->coding >= _HTTP_CODING_GUNZIP && http->stream.avail_in == 0)) &&
+       (http->coding >= _HTTP_CODING_GUNZIP && ((z_stream *)http->stream)->avail_in == 0)) &&
 #endif /* HAVE_LIBZ */
       ((http->data_remaining <= 0 &&
         http->data_encoding == HTTP_ENCODING_LENGTH) ||
@@ -3074,7 +3077,7 @@ httpWait(http_t *http,                    /* I - HTTP connection */
   }
 
 #ifdef HAVE_LIBZ
-  if (http->coding >= _HTTP_CODING_GUNZIP && http->stream.avail_in > 0)
+  if (http->coding >= _HTTP_CODING_GUNZIP && ((z_stream *)http->stream)->avail_in > 0)
   {
     DEBUG_puts("3httpWait: Returning 1 since there is buffered data ready.");
     return (1);
@@ -3170,17 +3173,17 @@ httpWrite2(http_t     *http,            /* I - HTTP connection */
       size_t   slen;                   /* Bytes to write */
       ssize_t  sret;                   /* Bytes written */
 
-      http->stream.next_in   = (Bytef *)buffer;
-      http->stream.avail_in  = (uInt)length;
+      ((z_stream *)http->stream)->next_in   = (Bytef *)buffer;
+      ((z_stream *)http->stream)->avail_in  = (uInt)length;
 
-      while (deflate(&(http->stream), Z_NO_FLUSH) == Z_OK)
+      while (deflate((z_stream *)http->stream, Z_NO_FLUSH) == Z_OK)
       {
-        DEBUG_printf(("1httpWrite2: avail_out=%d", http->stream.avail_out));
+        DEBUG_printf(("1httpWrite2: avail_out=%d", ((z_stream *)http->stream)->avail_out));
 
-        if (http->stream.avail_out > 0)
+        if (((z_stream *)http->stream)->avail_out > 0)
          continue;
 
-       slen = _HTTP_MAX_SBUFFER - http->stream.avail_out;
+       slen = _HTTP_MAX_SBUFFER - ((z_stream *)http->stream)->avail_out;
 
         DEBUG_printf(("1httpWrite2: Writing intermediate chunk, len=%d", (int)slen));
 
@@ -3197,8 +3200,8 @@ httpWrite2(http_t     *http,              /* I - HTTP connection */
          return (-1);
        }
 
-       http->stream.next_out  = (Bytef *)http->sbuffer;
-       http->stream.avail_out = (uInt)_HTTP_MAX_SBUFFER;
+       ((z_stream *)http->stream)->next_out  = (Bytef *)http->sbuffer;
+       ((z_stream *)http->stream)->avail_out = (uInt)_HTTP_MAX_SBUFFER;
       }
 
       bytes = (ssize_t)length;
@@ -3687,13 +3690,13 @@ http_content_coding_finish(
   {
     case _HTTP_CODING_DEFLATE :
     case _HTTP_CODING_GZIP :
-        http->stream.next_in  = dummy;
-        http->stream.avail_in = 0;
+        ((z_stream *)http->stream)->next_in  = dummy;
+        ((z_stream *)http->stream)->avail_in = 0;
 
         do
         {
-          zerr  = deflate(&(http->stream), Z_FINISH);
-         bytes = _HTTP_MAX_SBUFFER - http->stream.avail_out;
+          zerr  = deflate((z_stream *)http->stream, Z_FINISH);
+         bytes = _HTTP_MAX_SBUFFER - ((z_stream *)http->stream)->avail_out;
 
           if (bytes > 0)
          {
@@ -3705,15 +3708,18 @@ http_content_coding_finish(
              http_write(http, (char *)http->sbuffer, bytes);
           }
 
-          http->stream.next_out  = (Bytef *)http->sbuffer;
-          http->stream.avail_out = (uInt)_HTTP_MAX_SBUFFER;
+          ((z_stream *)http->stream)->next_out  = (Bytef *)http->sbuffer;
+          ((z_stream *)http->stream)->avail_out = (uInt)_HTTP_MAX_SBUFFER;
        }
         while (zerr == Z_OK);
 
-        deflateEnd(&(http->stream));
+        deflateEnd((z_stream *)http->stream);
 
         free(http->sbuffer);
+        free(http->stream);
+
         http->sbuffer = NULL;
+        http->stream  = NULL;
 
         if (http->wused)
           httpFlushWrite(http);
@@ -3721,9 +3727,13 @@ http_content_coding_finish(
 
     case _HTTP_CODING_INFLATE :
     case _HTTP_CODING_GUNZIP :
-        inflateEnd(&(http->stream));
+        inflateEnd((z_stream *)http->stream);
+
         free(http->sbuffer);
+        free(http->stream);
+
         http->sbuffer = NULL;
+        http->stream  = NULL;
         break;
 
     default :
@@ -3793,8 +3803,6 @@ http_content_coding_start(
     return;
   }
 
-  memset(&(http->stream), 0, sizeof(http->stream));
-
   switch (coding)
   {
     case _HTTP_CODING_DEFLATE :
@@ -3815,18 +3823,30 @@ http_content_coding_start(
         * documentation.
         */
 
-        if ((zerr = deflateInit2(&(http->stream), Z_DEFAULT_COMPRESSION,
-                                 Z_DEFLATED,
-                                coding == _HTTP_CODING_DEFLATE ? -11 : 27, 7,
-                                Z_DEFAULT_STRATEGY)) < Z_OK)
+       if ((http->stream = calloc(1, sizeof(z_stream))) == NULL)
+       {
+          free(http->sbuffer);
+
+          http->sbuffer = NULL;
+          http->status  = HTTP_STATUS_ERROR;
+          http->error   = errno;
+          return;
+       }
+
+        if ((zerr = deflateInit2((z_stream *)http->stream, Z_DEFAULT_COMPRESSION, Z_DEFLATED, coding == _HTTP_CODING_DEFLATE ? -11 : 27, 7, Z_DEFAULT_STRATEGY)) < Z_OK)
         {
-          http->status = HTTP_STATUS_ERROR;
-          http->error  = zerr == Z_MEM_ERROR ? ENOMEM : EINVAL;
+          free(http->sbuffer);
+          free(http->stream);
+
+          http->sbuffer = NULL;
+          http->stream  = NULL;
+          http->status  = HTTP_STATUS_ERROR;
+          http->error   = zerr == Z_MEM_ERROR ? ENOMEM : EINVAL;
           return;
         }
 
-       http->stream.next_out  = (Bytef *)http->sbuffer;
-       http->stream.avail_out = (uInt)_HTTP_MAX_SBUFFER;
+       ((z_stream *)http->stream)->next_out  = (Bytef *)http->sbuffer;
+       ((z_stream *)http->stream)->avail_out = (uInt)_HTTP_MAX_SBUFFER;
         break;
 
     case _HTTP_CODING_INFLATE :
@@ -3843,19 +3863,30 @@ http_content_coding_start(
         * -15 is raw inflate, 31 is gunzip, per ZLIB documentation.
         */
 
-        if ((zerr = inflateInit2(&(http->stream),
-                                 coding == _HTTP_CODING_INFLATE ? -15 : 31))
-               < Z_OK)
+       if ((http->stream = calloc(1, sizeof(z_stream))) == NULL)
+       {
+          free(http->sbuffer);
+
+          http->sbuffer = NULL;
+          http->status  = HTTP_STATUS_ERROR;
+          http->error   = errno;
+          return;
+       }
+
+        if ((zerr = inflateInit2((z_stream *)http->stream, coding == _HTTP_CODING_INFLATE ? -15 : 31)) < Z_OK)
         {
           free(http->sbuffer);
+          free(http->stream);
+
           http->sbuffer = NULL;
+          http->stream  = NULL;
           http->status  = HTTP_STATUS_ERROR;
           http->error   = zerr == Z_MEM_ERROR ? ENOMEM : EINVAL;
           return;
         }
 
-        http->stream.avail_in = 0;
-        http->stream.next_in  = http->sbuffer;
+        ((z_stream *)http->stream)->avail_in = 0;
+        ((z_stream *)http->stream)->next_in  = http->sbuffer;
         break;
 
     default :
index 20879cb2e840b20e06777961aa4e0716cc359c89..285ad19f8ad07e31bf8a94b01186b79d93e7b13e 100644 (file)
@@ -15,6 +15,7 @@
  * Include necessary headers...
  */
 
+#  include "config.h"
 #  include <stdio.h>
 #  include <cups/transcode.h>
 #  ifdef __APPLE__
index 85ecda167a5425dcf97974f882bad7a9163062b0..77703b98330bbf8f985871033c4dc3aa929d3b9a 100644 (file)
@@ -1,10 +1,11 @@
 /*
  * Device scanning mini-daemon for CUPS.
  *
- * Copyright 2007-2014 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.
  */
 
 /*
@@ -308,7 +309,7 @@ main(int  argc,                             /* I - Number of command-line args */
              break;
            }
          }
-         while (bpipe->ptr && memchr(bpipe->ptr, '\n', (size_t)(bpipe->end - bpipe->ptr)));
+         while (_cupsFilePeekAhead(bpipe, '\n'));
         }
     }
 
index 8d7630df2ac206fa6660af64b543307387fdd9c5..1e59fa96e92448572d619099a3b93ccca799c47f 100644 (file)
@@ -13,7 +13,6 @@
  */
 
 #include <cups/cups-private.h>
-#include <cups/file-private.h>
 #include <regex.h>
 #include <sys/stat.h>
 #ifdef _WIN32