From: msweet Date: Wed, 15 Oct 2008 21:06:58 +0000 (+0000) Subject: Merge CUPS 1.4svn-r8058 (tentative CUPS 1.4b1) X-Git-Tag: release-1.6.3~133 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fcups.git;a=commitdiff_plain;h=6e8b116d7f9487b7ffec4be46bbbffd3dd13b863 Merge CUPS 1.4svn-r8058 (tentative CUPS 1.4b1) git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@1016 a1ca3aef-8c08-0410-bb20-df032aa958be --- diff --git a/backend/ipp.c b/backend/ipp.c index 6ca8a5be3..a1e83c923 100644 --- a/backend/ipp.c +++ b/backend/ipp.c @@ -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."); diff --git a/cgi-bin/ipp-var.c b/cgi-bin/ipp-var.c index 7b24fe53d..604b86469 100644 --- a/cgi-bin/ipp-var.c +++ b/cgi-bin/ipp-var.c @@ -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... diff --git a/cups/attr.c b/cups/attr.c index aabd0ee75..903e4970d 100644 --- a/cups/attr.c +++ b/cups/attr.c @@ -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... */ diff --git a/cups/ppd.c b/cups/ppd.c index 01eae8d82..065be64b4 100644 --- a/cups/ppd.c +++ b/cups/ppd.c @@ -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)); } diff --git a/cups/test.ppd b/cups/test.ppd index 183f8fae1..35743b0a2 100644 --- a/cups/test.ppd +++ b/cups/test.ppd @@ -50,6 +50,10 @@ *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: "" diff --git a/cups/testppd.c b/cups/testppd.c index 023b680c3..b16052ece 100644 --- a/cups/testppd.c +++ b/cups/testppd.c @@ -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); diff --git a/data/Makefile b/data/Makefile index c206c2e1a..e0a85eb37 100644 --- a/data/Makefile +++ b/data/Makefile @@ -72,7 +72,7 @@ CHARSETS = \ DATAFILES = \ HPGLprolog \ psglyphs \ - testprint.ps + testprint PPDCFILES = \ epson.h \ diff --git a/data/testprint.ps b/data/testprint similarity index 64% rename from data/testprint.ps rename to data/testprint index b2a9c8a46..1a8270ddb 100644 --- a/data/testprint.ps +++ b/data/testprint @@ -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 diff --git a/filter/bannertops.c b/filter/bannertops.c index 119ca047d..ab27adec0 100644 --- a/filter/bannertops.c +++ b/filter/bannertops.c @@ -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); diff --git a/packaging/cups.list.in b/packaging/cups.list.in index ff313594d..5678d4d89 100644 --- a/packaging/cups.list.in +++ b/packaging/cups.list.in @@ -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