Skip to content

Commit 50dd893

Browse files
committed
ppdLoadAttributes(): Apply cfIEEE1284NormalizeMakeModel() to NickName
The PPD's NickName sometimes contains manufacturer and model, sometimes only the model, not the manufacturer. And manufacturer names can be completely missing or messy. By using cfIEEE1284NormalizeMakeModel() we clean this up and have clear manufacturer names, for better answers print clients and correct application of quirk rules, especially by the ppdFilterPDFToPS() filter function. Improved solution for Pull Request #21.
1 parent 6bc2deb commit 50dd893

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

ppd/ppd-ipp.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,10 +1383,13 @@ ppdLoadAttributes(
13831383
printer_input_tray, (int)strlen(printer_input_tray));
13841384
}
13851385

1386-
// printer-make-andXS-model
1387-
char make_model[128]; // Manufacturer and Model value
1388-
1389-
snprintf(make_model, sizeof(make_model), "%s %s", ppd->manufacturer, ppd->nickname);
1386+
// printer-make-and-model
1387+
char make_model[256]; // Manufacturer and Model value
1388+
if (cfIEEE1284NormalizeMakeModel(ppd->nickname, ppd->manufacturer,
1389+
CF_IEEE1284_NORMALIZE_HUMAN,
1390+
NULL, make_model, sizeof(make_model),
1391+
NULL, NULL, NULL) == NULL)
1392+
snprintf(make_model, sizeof(make_model), "%s", ppd->nickname);
13901393
ippAddString(attrs, IPP_TAG_PRINTER, IPP_TAG_TEXT, "printer-make-and-model",
13911394
NULL, make_model);
13921395

ppd/ppd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
# include <cups/raster.h>
2626
# include <cupsfilters/log.h>
2727
# include <cupsfilters/driver.h>
28+
# include <cupsfilters/ieee1284.h>
2829

2930

3031
//

0 commit comments

Comments
 (0)