/*
- * "$Id: banners.c 5947 2006-09-12 13:58:22Z mike $"
+ * Banner routines for the CUPS scheduler.
*
- * Banner routines for the Common UNIX Printing System (CUPS).
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1997-2006 by Easy Software Products.
*
- * Copyright 1997-2006 by Easy Software Products.
- *
- * These coded instructions, statements, and computer programs are the
- * property of Easy Software Products 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 missing or damaged please contact Easy Software Products
- * at:
- *
- * Attn: CUPS Licensing Information
- * Easy Software Products
- * 44141 Airport View Drive, Suite 204
- * Hollywood, Maryland 20636 USA
- *
- * Voice: (301) 373-9600
- * EMail: cups-info@cups.org
- * WWW: http://www.cups.org
- *
- * Contents:
- *
- * cupsdFindBanner() - Find a named banner.
- * cupsdLoadBanners() - Load all available banner files...
- * add_banner() - Add a banner to the array.
- * compare_banners() - Compare two banners.
- * free_banners() - Free all banners.
+ * Licensed under Apache License v2.0. See the file "LICENSE" for more information.
*/
/*
if ((filetype = mimeFileType(MimeDatabase, filename, NULL, NULL)) == NULL)
{
cupsdLogMessage(CUPSD_LOG_WARN,
- "add_banner: Banner \"%s\" (\"%s\") is of an unknown file type - skipping!",
- name, filename);
+ "add_banner: Banner \"%s\" (\"%s\") is of an unknown file "
+ "type - skipping!", name, filename);
return;
}
* Allocate memory...
*/
- temp = calloc(1, sizeof(cupsd_banner_t));
+ if ((temp = calloc(1, sizeof(cupsd_banner_t))) == NULL)
+ {
+ cupsdLogMessage(CUPSD_LOG_WARN,
+ "add_banner: Unable to allocate memory for banner \"%s\" - "
+ "skipping!", name);
+ return;
+ }
/*
* Copy the new banner data over...
*/
- temp->name = strdup(name);
+ if ((temp->name = strdup(name)) == NULL)
+ {
+ cupsdLogMessage(CUPSD_LOG_WARN,
+ "add_banner: Unable to allocate memory for banner \"%s\" - "
+ "skipping!", name);
+ free(temp);
+ return;
+ }
+
temp->filetype = filetype;
cupsArrayAdd(Banners, temp);
const cupsd_banner_t *b0, /* I - First banner */
const cupsd_banner_t *b1) /* I - Second banner */
{
- return (strcasecmp(b0->name, b1->name));
+ return (_cups_strcasecmp(b0->name, b1->name));
}
cupsArrayDelete(Banners);
Banners = NULL;
}
-
-
-/*
- * End of "$Id: banners.c 5947 2006-09-12 13:58:22Z mike $".
- */