]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/mime.c
Fix source file header text duplication text duplication.
[thirdparty/cups.git] / scheduler / mime.c
index 60272cf8add1b8541bbe07d3c30b46b391e0f3ad..103e7e54b3dec82dcb65df60d44c8030113fbbe8 100644 (file)
@@ -1,40 +1,14 @@
 /*
- * "$Id$"
+ * 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-2013 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.
+ * 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
+ * missing or damaged, see the license at "http://www.cups.org/".
  */
 
 /*
@@ -659,6 +633,9 @@ mime_delete_rules(mime_magic_t *rules)      /* I - Rules to free */
     if (rules->child != NULL)
       mime_delete_rules(rules->child);
 
+    if (rules->op == MIME_MAGIC_REGEX)
+      regfree(&(rules->value.rev));
+
     free(rules);
     rules = next;
   }
@@ -741,7 +718,7 @@ mime_load_convs(
 
     while (*lineptr != '/' && *lineptr != '\n' && *lineptr != '\0' &&
            (temp - super + 1) < MIME_MAX_SUPER)
-      *temp++ = tolower(*lineptr++ & 255);
+      *temp++ = (char)tolower(*lineptr++ & 255);
 
     *temp = '\0';
 
@@ -753,7 +730,7 @@ mime_load_convs(
 
     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';
 
@@ -814,7 +791,7 @@ mime_load_convs(
 
     while (*lineptr != '/' && *lineptr != '\n' && *lineptr != '\0' &&
            (temp - super + 1) < MIME_MAX_SUPER)
-      *temp++ = tolower(*lineptr++ & 255);
+      *temp++ = (char)tolower(*lineptr++ & 255);
 
     *temp = '\0';
 
@@ -826,7 +803,7 @@ mime_load_convs(
 
     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';
 
@@ -865,7 +842,7 @@ mime_load_types(mime_t     *mime,   /* I - MIME database */
                 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 */
@@ -927,7 +904,7 @@ mime_load_types(mime_t     *mime,   /* I - MIME database */
 
     while (*lineptr != '/' && *lineptr != '\n' && *lineptr != '\0' &&
            (temp - super + 1) < MIME_MAX_SUPER)
-      *temp++ = tolower(*lineptr++ & 255);
+      *temp++ = (char)tolower(*lineptr++ & 255);
 
     *temp = '\0';
 
@@ -939,7 +916,7 @@ mime_load_types(mime_t     *mime,   /* I - MIME database */
 
     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';
 
@@ -953,8 +930,3 @@ mime_load_types(mime_t     *mime,   /* I - MIME database */
 
   cupsFileClose(fp);
 }
-
-
-/*
- * End of "$Id$".
- */