]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/backchannel.c
Fix missing header in ippeveps.c, add .gz to man pages in RPM spec file (Red
[thirdparty/cups.git] / cups / backchannel.c
index 496b1f7683efe63068474845e2022a362b2df887..916c31433706890c20b2017fe1b18435983d705d 100644 (file)
@@ -1,24 +1,10 @@
 /*
- * "$Id: backchannel.c 7616 2008-05-28 00:34:13Z mike $"
+ * Backchannel functions for CUPS.
  *
- *   Backchannel functions for CUPS.
+ * Copyright 2007-2014 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products.
  *
- *   Copyright 2007-2010 by Apple Inc.
- *   Copyright 1997-2007 by Easy Software Products.
- *
- *   These coded instructions, statements, and computer programs are the
- *   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.
- *
- * Contents:
- *
- *   cupsBackChannelRead()  - Read data from the backchannel.
- *   cupsBackChannelWrite() - Write data to the backchannel.
- *   cups_setup()           - Setup select() 
+ * Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
  */
 
 /*
  */
 
 #include "cups.h"
+#include "sidechannel.h"
 #include <errno.h>
-#ifdef WIN32
+#ifdef _WIN32
 #  include <io.h>
 #  include <fcntl.h>
 #else
 #  include <sys/time.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 
 /*
@@ -50,7 +37,7 @@ static void   cups_setup(fd_set *set, struct timeval *tval,
  * parameter controls how many seconds to wait for the data - use 0.0 to
  * return immediately if there is no data, -1.0 to wait for data indefinitely.
  *
- * @since CUPS 1.2/Mac OS X 10.5@
+ * @since CUPS 1.2/macOS 10.5@
  */
 
 ssize_t                                        /* O - Bytes read or -1 on error */
@@ -85,11 +72,11 @@ cupsBackChannelRead(char   *buffer, /* I - Buffer to read into */
   * Read bytes from the pipe...
   */
 
-#ifdef WIN32
+#ifdef _WIN32
   return ((ssize_t)_read(3, buffer, (unsigned)bytes));
 #else
   return (read(3, buffer, bytes));
-#endif /* WIN32 */
+#endif /* _WIN32 */
 }
 
 
@@ -101,7 +88,7 @@ cupsBackChannelRead(char   *buffer,  /* I - Buffer to read into */
  * 0.0 to return immediately if the data cannot be written, -1.0 to wait
  * indefinitely.
  *
- * @since CUPS 1.2/Mac OS X 10.5@
+ * @since CUPS 1.2/macOS 10.5@
  */
 
 ssize_t                                        /* O - Bytes written or -1 on error */
@@ -147,11 +134,11 @@ cupsBackChannelWrite(
     * Write bytes to the pipe...
     */
 
-#ifdef WIN32
+#ifdef _WIN32
     count = (ssize_t)_write(3, buffer, (unsigned)(bytes - total));
 #else
     count = write(3, buffer, bytes - total);
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
     if (count < 0)
     {
@@ -169,7 +156,7 @@ cupsBackChannelWrite(
       */
 
       buffer += count;
-      total  += count;
+      total  += (size_t)count;
     }
   }
 
@@ -178,7 +165,7 @@ cupsBackChannelWrite(
 
 
 /*
- * 'cups_setup()' - Setup select() 
+ * 'cups_setup()' - Setup select()
  */
 
 static void
@@ -192,8 +179,3 @@ cups_setup(fd_set         *set,             /* I - Set for select() */
   FD_ZERO(set);
   FD_SET(3, set);
 }
-
-
-/*
- * End of "$Id: backchannel.c 7616 2008-05-28 00:34:13Z mike $".
- */