summaryrefslogtreecommitdiff
path: root/monitor
diff options
context:
space:
mode:
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>2014-02-06 18:33:34 +0000
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>2014-02-06 18:33:34 +0000
commit7e86f2f686334cb3db458b4585dfce9c1b712bc4 (patch)
tree88b4a0536faefcada96437e7cddd3a36cfdee0a4 /monitor
parentb1564baed9db112cb1334027f1d141877d88fcf4 (diff)
downloadcups-7e86f2f686334cb3db458b4585dfce9c1b712bc4.tar.gz
Full sweep of all Clang warnings, plus some bug fixes for incorrect memcpy usage.
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@11558 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'monitor')
-rw-r--r--monitor/bcp.c45
-rw-r--r--monitor/tbcp.c45
2 files changed, 38 insertions, 52 deletions
diff --git a/monitor/bcp.c b/monitor/bcp.c
index 2354d102d..885805243 100644
--- a/monitor/bcp.c
+++ b/monitor/bcp.c
@@ -1,24 +1,18 @@
/*
* "$Id$"
*
- * TBCP port monitor for CUPS.
+ * TBCP port monitor for CUPS.
*
- * Copyright 2007-2010 by Apple Inc.
- * Copyright 1993-2006 by Easy Software Products.
+ * Copyright 2007-2014 by Apple Inc.
+ * Copyright 1993-2006 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/".
+ * 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:
- *
- * main() - Main entry...
- * psgets() - Get a line from a file.
- * pswrite() - Write data from a file.
+ * This file is subject to the Apple OS-Developed Software exception.
*/
/*
@@ -34,7 +28,7 @@
*/
static char *psgets(char *buf, size_t *bytes, FILE *fp);
-static size_t pswrite(const char *buf, size_t bytes, FILE *fp);
+static ssize_t pswrite(const char *buf, size_t bytes);
/*
@@ -151,7 +145,7 @@ main(int argc, /* I - Number of command-line args */
if (psgets(line, &linelen, fp) == NULL)
break;
}
- while (pswrite(line, linelen, stdout) > 0);
+ while (pswrite(line, linelen) > 0);
fflush(stdout);
}
@@ -184,7 +178,7 @@ psgets(char *buf, /* I - Buffer to read into */
bufptr = buf;
ch = EOF;
- while ((bufptr - buf) < len)
+ while ((size_t)(bufptr - buf) < len)
{
if ((ch = getc(fp)) == EOF)
break;
@@ -209,7 +203,7 @@ psgets(char *buf, /* I - Buffer to read into */
else if (ch == '\n')
break;
else
- *bufptr++ = ch;
+ *bufptr++ = (char)ch;
}
/*
@@ -218,8 +212,8 @@ psgets(char *buf, /* I - Buffer to read into */
if (ch == '\n' || ch == '\r')
{
- if ((bufptr - buf) < len)
- *bufptr++ = ch;
+ if ((size_t)(bufptr - buf) < len)
+ *bufptr++ = (char)ch;
else
ungetc(ch, fp);
}
@@ -229,7 +223,7 @@ psgets(char *buf, /* I - Buffer to read into */
*/
*bufptr = '\0';
- *bytes = bufptr - buf;
+ *bytes = (size_t)(bufptr - buf);
if (ch == EOF && bufptr == buf)
return (NULL);
@@ -242,10 +236,9 @@ psgets(char *buf, /* I - Buffer to read into */
* 'pswrite()' - Write data from a file.
*/
-static size_t /* O - Number of bytes written */
+static ssize_t /* O - Number of bytes written */
pswrite(const char *buf, /* I - Buffer to write */
- size_t bytes, /* I - Bytes to write */
- FILE *fp) /* I - File to write to */
+ size_t bytes) /* I - Bytes to write */
{
size_t count; /* Remaining bytes */
@@ -283,7 +276,7 @@ pswrite(const char *buf, /* I - Buffer to write */
break;
}
- return (bytes);
+ return ((ssize_t)bytes);
}
diff --git a/monitor/tbcp.c b/monitor/tbcp.c
index 9ed1e00e7..e37635a70 100644
--- a/monitor/tbcp.c
+++ b/monitor/tbcp.c
@@ -1,24 +1,18 @@
/*
* "$Id$"
*
- * TBCP port monitor for CUPS.
+ * TBCP port monitor for CUPS.
*
- * Copyright 2007-2012 by Apple Inc.
- * Copyright 1993-2006 by Easy Software Products.
+ * Copyright 2007-2014 by Apple Inc.
+ * Copyright 1993-2006 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/".
+ * 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:
- *
- * main() - Main entry...
- * psgets() - Get a line from a file.
- * pswrite() - Write data from a file.
+ * This file is subject to the Apple OS-Developed Software exception.
*/
/*
@@ -34,7 +28,7 @@
*/
static char *psgets(char *buf, size_t *bytes, FILE *fp);
-static size_t pswrite(const char *buf, size_t bytes, FILE *fp);
+static ssize_t pswrite(const char *buf, size_t bytes);
/*
@@ -135,7 +129,7 @@ main(int argc, /* I - Number of command-line args */
* Loop until we see end-of-file...
*/
- while (pswrite(line, linelen, stdout) > 0)
+ while (pswrite(line, linelen) > 0)
{
linelen = sizeof(line);
if (psgets(line, &linelen, fp) == NULL)
@@ -173,7 +167,7 @@ psgets(char *buf, /* I - Buffer to read into */
bufptr = buf;
ch = EOF;
- while ((bufptr - buf) < len)
+ while ((size_t)(bufptr - buf) < len)
{
if ((ch = getc(fp)) == EOF)
break;
@@ -198,7 +192,7 @@ psgets(char *buf, /* I - Buffer to read into */
else if (ch == '\n')
break;
else
- *bufptr++ = ch;
+ *bufptr++ = (char)ch;
}
/*
@@ -207,8 +201,8 @@ psgets(char *buf, /* I - Buffer to read into */
if (ch == '\n' || ch == '\r')
{
- if ((bufptr - buf) < len)
- *bufptr++ = ch;
+ if ((size_t)(bufptr - buf) < len)
+ *bufptr++ = (char)ch;
else
ungetc(ch, fp);
}
@@ -218,7 +212,7 @@ psgets(char *buf, /* I - Buffer to read into */
*/
*bufptr = '\0';
- *bytes = bufptr - buf;
+ *bytes = (size_t)(bufptr - buf);
if (ch == EOF && bufptr == buf)
return (NULL);
@@ -231,10 +225,9 @@ psgets(char *buf, /* I - Buffer to read into */
* 'pswrite()' - Write data from a file.
*/
-static size_t /* O - Number of bytes written */
+static ssize_t /* O - Number of bytes written */
pswrite(const char *buf, /* I - Buffer to write */
- size_t bytes, /* I - Bytes to write */
- FILE *fp) /* I - File to write to */
+ size_t bytes) /* I - Bytes to write */
{
size_t count; /* Remaining bytes */
@@ -273,7 +266,7 @@ pswrite(const char *buf, /* I - Buffer to write */
break;
}
- return (bytes);
+ return ((ssize_t)bytes);
}