]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Mirror 1.1.x changes.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Wed, 20 Aug 2003 15:54:39 +0000 (15:54 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Wed, 20 Aug 2003 15:54:39 +0000 (15:54 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/branches/branch-1.2@3871 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES-1.1.txt
cups/ppd.c

index 695f5b3a1c7a305d90e6c3ad90e54693c3febc86..d97c2722724db88e3933b31d844cec5bd8c59f14 100644 (file)
@@ -3,6 +3,9 @@ CHANGES-1.1.txt
 
 CHANGES IN CUPS V1.1.20rc1
 
+       - ppdOpen() did not correctly check for "*PPD-Adobe-4."
+         on the first line of a PPD file. This caused incorrect
+         PASS results for some PPD files (STR #233)
        - cupsEncodeOptions() did not allow boolean options to
          use "yes" and "on" for true values (STR #227)
        - The pstops filter only sent the TBCP exit sequence if
index 3887ce24cf2feac500560a814baed4fcf87f1eaf..db056fdbc97f5dbca928182a4e307caf450a023a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: ppd.c,v 1.51.2.59 2003/08/20 14:29:31 mike Exp $"
+ * "$Id: ppd.c,v 1.51.2.60 2003/08/20 15:54:39 mike Exp $"
  *
  *   PPD file routines for the Common UNIX Printing System (CUPS).
  *
@@ -132,7 +132,7 @@ static ppd_group_t  *ppd_get_group(ppd_file_t *ppd, const char *name,
                                       const char *text);
 static ppd_option_t    *ppd_get_option(ppd_group_t *group, const char *name);
 static int             ppd_read(FILE *fp, char *keyword, char *option,
-                                char *text, char **string);
+                                char *text, char **string, int ignoreblank);
 
 
 /*
@@ -467,7 +467,9 @@ ppdOpen(FILE *fp)                   /* I - File to read from */
   * Grab the first line and make sure it reads '*PPD-Adobe: "major.minor"'...
   */
 
-  mask = ppd_read(fp, keyword, name, text, &string);
+  mask = ppd_read(fp, keyword, name, text, &string, 0);
+
+  DEBUG_printf(("mask=%x, keyword=\"%s\"...\n", mask, keyword));
 
   if (mask == 0 ||
       strcmp(keyword, "PPD-Adobe") != 0 ||
@@ -477,7 +479,7 @@ ppdOpen(FILE *fp)                   /* I - File to read from */
     * Either this is not a PPD file, or it is not a 4.x PPD file.
     */
 
-    if (ppd_status != PPD_OK)
+    if (ppd_status == PPD_OK)
       ppd_status = PPD_MISSING_PPDADOBE4;
 
     ppd_free(string);
@@ -527,7 +529,7 @@ ppdOpen(FILE *fp)                   /* I - File to read from */
   choice     = NULL;
   ui_keyword = 0;
 
-  while ((mask = ppd_read(fp, keyword, name, text, &string)) != 0)
+  while ((mask = ppd_read(fp, keyword, name, text, &string, 1)) != 0)
   {
 #ifdef DEBUG
     printf("mask = %x, keyword = \"%s\"", mask, keyword);
@@ -2554,7 +2556,8 @@ ppd_read(FILE *fp,                        /* I - File to read from */
          char *keyword,                        /* O - Keyword from line */
         char *option,                  /* O - Option from line */
          char *text,                   /* O - Human-readable text from line */
-        char **string)                 /* O - Code/string data */
+        char **string,                 /* O - Code/string data */
+         int  ignoreblank)             /* I - Ignore blank lines? */
 {
   int          ch,                     /* Character from file */
                col,                    /* Column in line */
@@ -2620,8 +2623,8 @@ ppd_read(FILE *fp,                        /* I - File to read from */
            ungetc(ch, fp);
        }
 
-       if (lineptr == line)            /* Skip blank lines */
-          continue;
+       if (lineptr == line && ignoreblank)
+          continue;                    /* Skip blank lines */
 
        ch = '\n';
 
@@ -2790,7 +2793,7 @@ ppd_read(FILE *fp,                        /* I - File to read from */
 
     *lineptr = '\0';
 
-/*    DEBUG_printf(("LINE = \"%s\"\n", line));*/
+    DEBUG_printf(("LINE = \"%s\"\n", line));
 
     if (ch == EOF && lineptr == line)
       return (0);
@@ -2807,9 +2810,10 @@ ppd_read(FILE *fp,                       /* I - File to read from */
     text[0]    = '\0';
     *string    = NULL;
 
-    if (!line[0] ||                    /* Blank line */
-        strncmp(line, "*%", 2) == 0 || /* Comment line */
-        strcmp(line, "*End") == 0)     /* End of multi-line string */
+    if ((!line[0] ||                   /* Blank line */
+         strncmp(line, "*%", 2) == 0 ||        /* Comment line */
+         strcmp(line, "*End") == 0) && /* End of multi-line string */
+        ignoreblank)                   /* Ignore these? */
     {
       startline = ppd_line + 1;
       continue;
@@ -2852,8 +2856,10 @@ ppd_read(FILE *fp,                       /* I - File to read from */
         ppd_status = PPD_MISSING_ASTERISK;
         return (0);
       }
-      else
+      else if (ignoreblank)
         continue;
+      else
+        return (0);
     }
 
    /*
@@ -3007,5 +3013,5 @@ ppd_read(FILE *fp,                        /* I - File to read from */
 
 
 /*
- * End of "$Id: ppd.c,v 1.51.2.59 2003/08/20 14:29:31 mike Exp $".
+ * End of "$Id: ppd.c,v 1.51.2.60 2003/08/20 15:54:39 mike Exp $".
  */