From a552bd55af6aada7475c8d2e68e82d3b4d47ee1d Mon Sep 17 00:00:00 2001 From: msweet Date: Wed, 14 Aug 2013 20:33:42 +0000 Subject: [PATCH] Removed some duplicate size definitions for some ISO sizes that were causing problems () git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@11239 a1ca3aef-8c08-0410-bb20-df032aa958be --- CHANGES-1.6.txt | 2 ++ cups/libcups2.def | 1 + cups/pwg-media.c | 17 ++++++++++++++--- cups/pwg-private.h | 1 + cups/testpwg.c | 41 ++++++++++++++++++++++++++++++++++++----- 5 files changed, 54 insertions(+), 8 deletions(-) diff --git a/CHANGES-1.6.txt b/CHANGES-1.6.txt index 0f00d314b..23e142297 100644 --- a/CHANGES-1.6.txt +++ b/CHANGES-1.6.txt @@ -3,6 +3,8 @@ CHANGES-1.6.txt CHANGES IN CUPS V1.6.4 + - Removed some duplicate size definitions for some ISO sizes that were + causing problems () - The IPP backend did not add the "last-document" attribute () - Added a SyncOnClose directive to cups-files.conf to force cupsd to diff --git a/cups/libcups2.def b/cups/libcups2.def index 8745d9e14..ea525c150 100644 --- a/cups/libcups2.def +++ b/cups/libcups2.def @@ -61,6 +61,7 @@ _ppdNormalizeMakeAndModel _ppdOpen _ppdOpenFile _ppdParseOptions +_pwgMediaTable cupsAddDest cupsAddOption cupsAdminCreateWindowsPPD diff --git a/cups/pwg-media.c b/cups/pwg-media.c index 264ca7135..87ed7b724 100644 --- a/cups/pwg-media.c +++ b/cups/pwg-media.c @@ -24,6 +24,7 @@ * name. * pwgMediaForSize() - Get the PWG media size for the given * dimensions. + * _pwgMediaTable() - Return the internal media size table. * pwg_compare_legacy() - Compare two sizes using the legacy names. * pwg_compare_ppd() - Compare two sizes using the PPD names. * pwg_compare_pwg() - Compare two sizes using the PWG names. @@ -233,13 +234,11 @@ static pwg_media_t const cups_pwg_media[] = _PWG_MEDIA_MM("prc_4_110x208mm", NULL, "EnvPRC4", 110, 208), _PWG_MEDIA_MM("prc_8_120x309mm", NULL, "EnvPRC8", 120, 309), _PWG_MEDIA_MM("prc_6_120x320mm", NULL, NULL, 120, 320), - _PWG_MEDIA_MM("prc_3_125x176mm", NULL, "EnvPRC3", 125, 176), _PWG_MEDIA_MM("prc_16k_146x215mm", NULL, "PRC16K", 146, 215), _PWG_MEDIA_MM("prc_7_160x230mm", NULL, "EnvPRC7", 160, 230), _PWG_MEDIA_MM("om_juuro-ku-kai_198x275mm", NULL, NULL, 198, 275), _PWG_MEDIA_MM("om_pa-kai_267x389mm", NULL, NULL, 267, 389), _PWG_MEDIA_MM("om_dai-pa-kai_275x395mm", NULL, NULL, 275, 395), - _PWG_MEDIA_MM("prc_10_324x458mm", NULL, "EnvPRC10", 324, 458), /* Chinese Standard Sheet Media Inch Sizes */ _PWG_MEDIA_IN("roc_16k_7.75x10.75in", NULL, "roc16k", 7.75, 10.75), @@ -251,7 +250,6 @@ static pwg_media_t const cups_pwg_media[] = /* Other Metric Standard Sheet Media Sizes */ _PWG_MEDIA_MM("om_small-photo_100x150mm", NULL, "om_small-photo", 100, 150), _PWG_MEDIA_MM("om_italian_110x230mm", NULL, "EnvItalian", 110, 230), - _PWG_MEDIA_MM("om_postfix_114x229mm", NULL, NULL, 114, 229), _PWG_MEDIA_MM("om_large-photo_200x300", NULL, "om_large-photo", 200, 300), _PWG_MEDIA_MM("om_folio_210x330mm", "folio", "Folio", 210, 330), _PWG_MEDIA_MM("om_folio-sp_215x315mm", NULL, "FolioSP", 215, 315), @@ -1003,6 +1001,19 @@ pwg_media_t *_pwgMediaForSize(int width, int length) { return (pwgMediaForSize(width, length)); } +/* + * '_pwgMediaTable()' - Return the internal media size table. + */ + +const pwg_media_t * /* O - Pointer to first entry */ +_pwgMediaTable(size_t *num_media) /* O - Number of entries */ +{ + *num_media = sizeof(cups_pwg_media) / sizeof(cups_pwg_media[0]); + + return (cups_pwg_media); +} + + /* * 'pwg_compare_legacy()' - Compare two sizes using the legacy names. */ diff --git a/cups/pwg-private.h b/cups/pwg-private.h index ad097bf53..d012e308f 100644 --- a/cups/pwg-private.h +++ b/cups/pwg-private.h @@ -65,6 +65,7 @@ extern pwg_media_t *_pwgMediaForPWG(const char *pwg) _CUPS_INTERNAL_MSG("Use pwgMediaForPWG instead."); extern pwg_media_t *_pwgMediaForSize(int width, int length) _CUPS_INTERNAL_MSG("Use pwgMediaForSize instead."); +extern const pwg_media_t *_pwgMediaTable(size_t *num_media); # ifdef __cplusplus } diff --git a/cups/testpwg.c b/cups/testpwg.c index 58f6f73e4..dfa9f402a 100644 --- a/cups/testpwg.c +++ b/cups/testpwg.c @@ -45,11 +45,15 @@ int /* O - Exit status */ main(int argc, /* I - Number of command-line args */ char *argv[]) /* I - Command-line arguments */ { - int status; /* Status of tests (0 = success, 1 = fail) */ - const char *ppdfile; /* PPD filename */ - ppd_file_t *ppd; /* PPD file */ - _ppd_cache_t *pc; /* PPD cache and PWG mapping data */ - pwg_media_t *pwgmedia; /* PWG media size */ + int status; /* Status of tests (0 = success, 1 = fail) */ + const char *ppdfile; /* PPD filename */ + ppd_file_t *ppd; /* PPD file */ + _ppd_cache_t *pc; /* PPD cache and PWG mapping data */ + const pwg_media_t *pwgmedia; /* PWG media size */ + size_t i, /* Looping var */ + num_media; /* Number of media sizes */ + const pwg_media_t *mediatable; /* Media size table */ + int dupmedia = 0; /* Duplicate media sizes? */ status = 0; @@ -302,6 +306,33 @@ main(int argc, /* I - Number of command-line args */ else printf("PASS (%s)\n", pwgmedia->pwg); + fputs("Duplicate size test: ", stdout); + for (mediatable = _pwgMediaTable(&num_media); + num_media > 1; + num_media --, mediatable ++) + { + for (i = num_media - 1, pwgmedia = mediatable + 1; i > 0; i --, pwgmedia ++) + { + if (pwgmedia->width == mediatable->width && + pwgmedia->length == mediatable->length) + { + if (!dupmedia) + { + dupmedia = 1; + status ++; + puts("FAIL"); + } + + printf(" %s and %s have the same dimensions (%dx%d)\n", + pwgmedia->pwg, mediatable->pwg, pwgmedia->width, + pwgmedia->length); + } + } + } + if (!dupmedia) + puts("PASS"); + + return (status); } -- 2.39.2