summaryrefslogtreecommitdiff
path: root/cups/options.c
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 /cups/options.c
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 'cups/options.c')
-rw-r--r--cups/options.c39
1 files changed, 13 insertions, 26 deletions
diff --git a/cups/options.c b/cups/options.c
index 14b88c959..073edaee9 100644
--- a/cups/options.c
+++ b/cups/options.c
@@ -1,29 +1,18 @@
/*
* "$Id$"
*
- * Option routines for CUPS.
+ * Option routines for CUPS.
*
- * Copyright 2007-2012 by Apple Inc.
- * Copyright 1997-2007 by Easy Software Products.
+ * Copyright 2007-2014 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/".
+ * 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:
- *
- * cupsAddOption() - Add an option to an option array.
- * cupsFreeOptions() - Free all memory used by options.
- * cupsGetOption() - Get an option value.
- * cupsParseOptions() - Parse options from a command-line argument.
- * cupsRemoveOption() - Remove an option from an option array.
- * _cupsGet1284Values() - Get 1284 device ID keys and values.
- * cups_compare_options() - Compare two options.
- * cups_find_option() - Find an option using a binary search.
+ * This file is subject to the Apple OS-Developed Software exception.
*/
/*
@@ -99,10 +88,9 @@ cupsAddOption(const char *name, /* I - Name of option */
if (num_options == 0)
temp = (cups_option_t *)malloc(sizeof(cups_option_t));
else
- temp = (cups_option_t *)realloc(*options, sizeof(cups_option_t) *
- (num_options + 1));
+ temp = (cups_option_t *)realloc(*options, sizeof(cups_option_t) * (size_t)(num_options + 1));
- if (temp == NULL)
+ if (!temp)
{
DEBUG_puts("3cupsAddOption: Unable to expand option array, returning 0");
return (0);
@@ -114,8 +102,7 @@ cupsAddOption(const char *name, /* I - Name of option */
{
DEBUG_printf(("4cupsAddOption: Shifting %d options...",
(int)(num_options - insert)));
- memmove(temp + insert + 1, temp + insert,
- (num_options - insert) * sizeof(cups_option_t));
+ memmove(temp + insert + 1, temp + insert, (size_t)(num_options - insert) * sizeof(cups_option_t));
}
temp += insert;
@@ -487,7 +474,7 @@ cupsRemoveOption(
_cupsStrFree(option->value);
if (i > 0)
- memmove(option, option + 1, i * sizeof(cups_option_t));
+ memmove(option, option + 1, (size_t)i * sizeof(cups_option_t));
}
/*