/*
- * "$Id: mime.c 9750 2011-05-06 22:53:53Z mike $"
+ * MIME database file routines for CUPS.
*
- * MIME database file routines for CUPS.
+ * Copyright 2007-2014 by Apple Inc.
+ * Copyright 1997-2006 by Easy Software Products, all rights reserved.
*
- * Copyright 2007-2012 by Apple Inc.
- * Copyright 1997-2006 by Easy Software Products, all rights reserved.
- *
- * 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/".
- *
- * Contents:
- *
- * mimeDelete() - Delete (free) a MIME database.
- * mimeDeleteFilter() - Delete a filter from the MIME database.
- * mimeDeleteType() - Delete a type from the MIME database.
- * _mimeError() - Show an error message.
- * mimeFirstFilter() - Get the first filter in the MIME database.
- * mimeFirstType() - Get the first type in the MIME database.
- * mimeLoad() - Create a new MIME database from disk.
- * mimeLoadFilters() - Load filter definitions from disk.
- * mimeLoadTypes() - Load type definitions from disk.
- * mimeNew() - Create a new, empty MIME database.
- * mimeNextFilter() - Get the next filter in the MIME database.
- * mimeNextType() - Get the next type in the MIME database.
- * mimeNumFilters() - Get the number of filters in a MIME database.
- * mimeNumTypes() - Get the number of types in a MIME database.
- * mimeSetErrorCallback() - Set the callback for error messages.
- * mime_add_fcache() - Add a filter to the filter cache.
- * mime_compare_fcache() - Compare two filter cache entries.
- * mime_delete_fcache() - Free all memory used by the filter cache.
- * mime_delete_rules() - Free all memory for the given rule tree.
- * mime_load_convs() - Load a xyz.convs file.
- * mime_load_types() - Load a xyz.types file.
+ * Licensed under Apache License v2.0. See the file "LICENSE" for more information.
*/
/*
if (rules->child != NULL)
mime_delete_rules(rules->child);
+ if (rules->op == MIME_MAGIC_REGEX)
+ regfree(&(rules->value.rev));
+
free(rules);
rules = next;
}
while (*lineptr != '/' && *lineptr != '\n' && *lineptr != '\0' &&
(temp - super + 1) < MIME_MAX_SUPER)
- *temp++ = tolower(*lineptr++ & 255);
+ *temp++ = (char)tolower(*lineptr++ & 255);
*temp = '\0';
while (*lineptr != ' ' && *lineptr != '\t' && *lineptr != '\n' &&
*lineptr != '\0' && (temp - type + 1) < MIME_MAX_TYPE)
- *temp++ = tolower(*lineptr++ & 255);
+ *temp++ = (char)tolower(*lineptr++ & 255);
*temp = '\0';
while (*lineptr != '/' && *lineptr != '\n' && *lineptr != '\0' &&
(temp - super + 1) < MIME_MAX_SUPER)
- *temp++ = tolower(*lineptr++ & 255);
+ *temp++ = (char)tolower(*lineptr++ & 255);
*temp = '\0';
while (*lineptr != ' ' && *lineptr != '\t' && *lineptr != '\n' &&
*lineptr != '\0' && (temp - type + 1) < MIME_MAX_TYPE)
- *temp++ = tolower(*lineptr++ & 255);
+ *temp++ = (char)tolower(*lineptr++ & 255);
*temp = '\0';
const char *filename) /* I - Types file to load */
{
cups_file_t *fp; /* Types file */
- int linelen; /* Length of line */
+ size_t linelen; /* Length of line */
char line[32768], /* Input line from file */
*lineptr, /* Current position in line */
super[MIME_MAX_SUPER], /* Super-type name */
while (*lineptr != '/' && *lineptr != '\n' && *lineptr != '\0' &&
(temp - super + 1) < MIME_MAX_SUPER)
- *temp++ = tolower(*lineptr++ & 255);
+ *temp++ = (char)tolower(*lineptr++ & 255);
*temp = '\0';
while (*lineptr != ' ' && *lineptr != '\t' && *lineptr != '\n' &&
*lineptr != '\0' && (temp - type + 1) < MIME_MAX_TYPE)
- *temp++ = tolower(*lineptr++ & 255);
+ *temp++ = (char)tolower(*lineptr++ & 255);
*temp = '\0';
cupsFileClose(fp);
}
-
-
-/*
- * End of "$Id: mime.c 9750 2011-05-06 22:53:53Z mike $".
- */