]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Merge CUPS 1.4svn-r8058 (tentative CUPS 1.4b1)
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Wed, 15 Oct 2008 21:06:58 +0000 (21:06 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Wed, 15 Oct 2008 21:06:58 +0000 (21:06 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@1016 a1ca3aef-8c08-0410-bb20-df032aa958be

backend/ipp.c
cgi-bin/ipp-var.c
cups/attr.c
cups/ppd.c
cups/test.ppd
cups/testppd.c
data/Makefile
data/testprint [moved from data/testprint.ps with 64% similarity]
filter/bannertops.c
packaging/cups.list.in

index 6ca8a5be3f375866b0c19a1e368343825106145d..a1e83c923cd12021b55c1d7af8dcc4dce29034ba 100644 (file)
@@ -1648,6 +1648,7 @@ report_printer_state(ipp_t *ipp,  /* I - IPP response */
     else if (!strncmp(reason, "media-jam", 9))
       message = _("Media jam!");
     else if (!strncmp(reason, "moving-to-paused", 16) ||
+             !strncmp(reason, "offline", 7) ||
              !strncmp(reason, "paused", 6) ||
             !strncmp(reason, "shutdown", 8))
       message = _("Printer offline.");
index 7b24fe53d1d92afa484a1081e1d6cab3fb3a394c..604b864696f8d594aa1391e5691318c15f71a7e6 100644 (file)
@@ -690,7 +690,7 @@ cgiPrintTestPage(http_t     *http,  /* I - Connection to server */
   if ((datadir = getenv("CUPS_DATADIR")) == NULL)
     datadir = CUPS_DATADIR;
 
-  snprintf(filename, sizeof(filename), "%s/data/testprint.ps", datadir);
+  snprintf(filename, sizeof(filename), "%s/data/testprint", datadir);
 
  /*
   * Point to the printer/class...
index aabd0ee75116a33e5fd84228f098a7397e4812f7..903e4970d7ddd0149d0a63f691c50a2cff751bf0 100644 (file)
@@ -42,7 +42,6 @@ ppdFindAttr(ppd_file_t *ppd,          /* I - PPD file data */
 {
   ppd_attr_t   key,                    /* Search key */
                *attr;                  /* Current attribute */
-  int          diff;                   /* Current difference */
 
 
   DEBUG_printf(("ppdFindAttr(ppd=%p, name=\"%s\", spec=\"%s\")\n", ppd,
@@ -61,39 +60,25 @@ ppdFindAttr(ppd_file_t *ppd,                /* I - PPD file data */
 
   memset(&key, 0, sizeof(key));
   strlcpy(key.name, name, sizeof(key.name));
-  if (spec)
-    strlcpy(key.spec, spec, sizeof(key.spec));
 
  /*
   * Return the first matching attribute, if any...
   */
 
   if ((attr = (ppd_attr_t *)cupsArrayFind(ppd->sorted_attrs, &key)) != NULL)
-    return (attr);
-  else if (spec)
-    return (NULL);
-
- /*
-  * No match found, loop through the sorted attributes to see if we can
-  * find a "wildcard" match for the attribute...
-  */
-
-  for (attr = (ppd_attr_t *)cupsArrayFirst(ppd->sorted_attrs);
-       attr;
-       attr = (ppd_attr_t *)cupsArrayNext(ppd->sorted_attrs))
   {
-    if ((diff = strcasecmp(attr->name, name)) == 0)
-      break;
-
-    if (diff > 0)
+    if (spec)
     {
      /*
-      * All remaining attributes are > than the one we are trying to find...
+      * Loop until we find the first matching attribute for "spec"...
       */
 
-      cupsArrayIndex(ppd->sorted_attrs, cupsArrayCount(ppd->sorted_attrs));
-
-      return (NULL);
+      while (attr && strcasecmp(spec, attr->spec))
+      {
+        if ((attr = (ppd_attr_t *)cupsArrayNext(ppd->sorted_attrs)) != NULL &&
+           strcasecmp(attr->name, name))
+         attr = NULL;
+      }
     }
   }
 
@@ -119,32 +104,34 @@ ppdFindNextAttr(ppd_file_t *ppd,  /* I - PPD file data */
   * Range check input...
   */
 
-  if (!ppd || !name || ppd->num_attrs == 0 ||
-      !cupsArrayCurrent(ppd->sorted_attrs))
+  if (!ppd || !name || ppd->num_attrs == 0)
     return (NULL);
 
  /*
   * See if there are more attributes to return...
   */
 
-  if ((attr = (ppd_attr_t *)cupsArrayNext(ppd->sorted_attrs)) == NULL)
-    return (NULL);
-
- /*
-  * Check the next attribute to see if it is a match...
-  */
-
-  if (strcasecmp(attr->name, name) || (spec && strcasecmp(attr->spec, spec)))
+  while ((attr = (ppd_attr_t *)cupsArrayNext(ppd->sorted_attrs)) != NULL)
   {
    /*
-    * Nope, reset the current pointer to the end of the array...
+    * Check the next attribute to see if it is a match...
     */
 
-    cupsArrayIndex(ppd->sorted_attrs, cupsArrayCount(ppd->sorted_attrs));
+    if (strcasecmp(attr->name, name))
+    {
+     /*
+      * Nope, reset the current pointer to the end of the array...
+      */
 
-    return (NULL);
+      cupsArrayIndex(ppd->sorted_attrs, cupsArrayCount(ppd->sorted_attrs));
+
+      return (NULL);
+    }
+
+    if (!spec || !strcasecmp(attr->spec, spec))
+      break;
   }
-  
+
  /*
   * Return the next attribute's value...
   */
index 01eae8d82f6b017030c985a0e919539d1661ea81..065be64b4ae37d16050c355c251b1ab3121bd8a1 100644 (file)
@@ -2231,13 +2231,7 @@ static int                               /* O - Result of comparison */
 ppd_compare_attrs(ppd_attr_t *a,       /* I - First attribute */
                   ppd_attr_t *b)       /* I - Second attribute */
 {
-  int  ret;                            /* Result of comparison */
-
-
-  if ((ret = strcasecmp(a->name, b->name)) != 0)
-    return (ret);
-  else
-    return (strcasecmp(a->spec, b->spec));
+  return (strcasecmp(a->name, b->name));
 }
 
 
index 183f8fae112abf8c6ed832db9cad4e70fbbc80bd..35743b0a22fe5ac528d71973dc2937d2ad412755 100644 (file)
 *UIConstraints: "*Duplex *InstalledDuplexer False"
 *UIConstraints: "*InstalledDuplexer False *Duplex"
 
+*% These attributes test ppdFindAttr/ppdFindNext...
+*cupsTest Foo/I Love Foo: ""
+*cupsTest Bar/I Love Bar: ""
+
 *% For PageSize, we have put all of the translations in-line...
 *OpenUI *PageSize/Page Size: PickOne
 *fr.Translation PageSize/French Page Size: ""
index 023b680c35bba3690800648c997cde5fa6d01de3..b16052ece75a576d5ba21be88b5a41794634f863 100644 (file)
@@ -117,6 +117,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
   cups_option_t        *options;               /* Options */
   ppd_size_t   minsize,                /* Minimum size */
                maxsize;                /* Maximum size */
+  ppd_attr_t   *attr;                  /* Current attribute */
 
 
   status = 0;
@@ -158,6 +159,57 @@ main(int  argc,                            /* I - Number of command-line arguments */
       printf("FAIL (%s on line %d)\n", ppdErrorString(err), line);
     }
 
+    fputs("ppdFindAttr(wildcard): ", stdout);
+    if ((attr = ppdFindAttr(ppd, "cupsTest", NULL)) == NULL)
+    {
+      status ++;
+      puts("FAIL (not found)");
+    }
+    else if (strcmp(attr->name, "cupsTest") || strcmp(attr->spec, "Foo"))
+    {
+      status ++;
+      printf("FAIL (got \"%s %s\")\n", attr->name, attr->spec);
+    }
+    else
+      puts("PASS");
+
+    fputs("ppdFindNextAttr(wildcard): ", stdout);
+    if ((attr = ppdFindNextAttr(ppd, "cupsTest", NULL)) == NULL)
+    {
+      status ++;
+      puts("FAIL (not found)");
+    }
+    else if (strcmp(attr->name, "cupsTest") || strcmp(attr->spec, "Bar"))
+    {
+      status ++;
+      printf("FAIL (got \"%s %s\")\n", attr->name, attr->spec);
+    }
+    else
+      puts("PASS");
+
+    fputs("ppdFindAttr(Foo): ", stdout);
+    if ((attr = ppdFindAttr(ppd, "cupsTest", "Foo")) == NULL)
+    {
+      status ++;
+      puts("FAIL (not found)");
+    }
+    else if (strcmp(attr->name, "cupsTest") || strcmp(attr->spec, "Foo"))
+    {
+      status ++;
+      printf("FAIL (got \"%s %s\")\n", attr->name, attr->spec);
+    }
+    else
+      puts("PASS");
+
+    fputs("ppdFindNextAttr(Foo): ", stdout);
+    if ((attr = ppdFindNextAttr(ppd, "cupsTest", "Foo")) != NULL)
+    {
+      status ++;
+      printf("FAIL (got \"%s %s\")\n", attr->name, attr->spec);
+    }
+    else
+      puts("PASS");
+
     fputs("ppdMarkDefaults: ", stdout);
     ppdMarkDefaults(ppd);
 
index c206c2e1a8d15a9a2b8df34e191e6553efc4e688..e0a85eb37096d67c4324ba7c42228536c0343566 100644 (file)
@@ -72,7 +72,7 @@ CHARSETS =    \
 DATAFILES =    \
                HPGLprolog \
                psglyphs \
-               testprint.ps
+               testprint
 
 PPDCFILES =    \
                epson.h \
similarity index 64%
rename from data/testprint.ps
rename to data/testprint
index b2a9c8a46bc9fb0ad496a4c28c48e1e7351a9ec8..1a8270ddb2f71dfa6f31b220452d064fc6b870c1 100644 (file)
@@ -1,6 +1,4 @@
 #CUPS-BANNER
-# While this file has a .ps extension, it is really just a special banner
-# page - we are retaining the original filename for backwards-compatibility.
 Show printer-name printer-info printer-location printer-make-and-model printer-driver-name printer-driver-version paper-size imageable-area
 Header Printer Test Page
 Footer Printer Test Page
index 119ca047d7b25574a09dcc543acf46293f69e413..ab27adec01a876bc37bd0541e4f8795fe418e2af 100644 (file)
@@ -925,7 +925,6 @@ write_banner(banner_file_t *banner, /* I - Banner file */
         num_rows   = cupsImageGetHeight(image);
        line       = malloc(depth * num_cols + 3);
         temp_width = num_cols * images_height / num_rows;
-       out_offset = 0;
 
         printf("gsave %.1f %.1f translate %.3f %.3f scale\n", x, y,
               temp_width / num_cols, images_height / num_rows);
index ff313594dab2d7f792e9630897868eeea79b159c..5678d4d89997a2932390fcac4c602e01d4571e8d 100644 (file)
@@ -543,7 +543,7 @@ f 0644 root sys $DATADIR/charsets/utf-8 data/utf-8
 d 0755 root sys $DATADIR/data -
 f 0644 root sys $DATADIR/data/HPGLprolog data/HPGLprolog
 f 0644 root sys $DATADIR/data/psglyphs data/psglyphs
-f 0644 root sys $DATADIR/data/testprint.ps data/testprint.ps
+f 0644 root sys $DATADIR/data/testprint data/testprint
 
 d 0755 root sys $DATADIR/drv -
 f 0644 root sys $DATADIR/drv/sample.drv ppdc/sample.drv