//
// "$Id$"
//
-// PPD file compiler definitions for the CUPS PPD Compiler.
+// PPD file compiler definitions for the CUPS PPD Compiler.
//
-// Copyright 2007 by Apple Inc.
-// Copyright 2002-2006 by Easy Software Products.
+// Copyright 2007-2014 by Apple Inc.
+// Copyright 2002-2006 by Easy Software Products.
//
-// These coded instructions, statements, and computer programs are the
-// property of Apple Inc. and are protected by Federal copyright
-// law. Distribution and use rights are outlined in the file "LICENSE.txt"
-// which should have been included with this file. If this file is
-// file is missing or damaged, see the license at "http://www.cups.org/".
-//
-// Contents:
-//
-// ppdcDriver::ppdcDriver() - Create a new printer driver.
-// ppdcDriver::~ppdcDriver() - Destroy a printer driver.
-// ppdcDriver::find_attr() - Find an attribute.
-// ppdcDriver::find_group() - Find a group.
-// ppdcDriver::find_option() - Find an option.
-// ppdcDriver::set_default_size() - Set the default size name.
-// ppdcDriver::set_manufacturer() - Set the manufacturer name.
-// ppdcDriver::set_model_name() - Set the model name.
-// ppdcDriver::set_pc_file_name() - Set the PC filename.
-// ppdcDriver::set_version() - Set the version string.
-// ppdcDriver::write_ppd_file() - Write a PPD file...
+// These coded instructions, statements, and computer programs are the
+// property of Apple Inc. and are protected by Federal copyright
+// law. Distribution and use rights are outlined in the file "LICENSE.txt"
+// which should have been included with this file. If this file is
+// file is missing or damaged, see the license at "http://www.cups.org/".
//
//
// Include necessary headers...
//
-#include "ppdc.h"
-#include <cups/cups.h>
+#include "ppdc-private.h"
//
//
ppdcDriver::ppdcDriver(ppdcDriver *d) // I - Printer driver template
+ : ppdcShared()
{
ppdcGroup *g; // Current group
+ PPDC_NEW;
+
if (d)
{
// Bump the use count of any strings we inherit...
if (d->manufacturer)
- d->manufacturer->get();
+ d->manufacturer->retain();
if (d->version)
- d->version->get();
+ d->version->retain();
if (d->default_font)
- d->default_font->get();
+ d->default_font->retain();
if (d->default_size)
- d->default_size->get();
+ d->default_size->retain();
if (d->custom_size_code)
- d->custom_size_code->get();
+ d->custom_size_code->retain();
// Copy all of the data from the driver template...
copyright = new ppdcArray(d->copyright);
manufacturer = d->manufacturer;
model_name = 0;
+ file_name = 0;
pc_file_name = 0;
type = d->type;
version = d->version;
copyright = new ppdcArray();
manufacturer = 0;
model_name = 0;
+ file_name = 0;
pc_file_name = 0;
version = 0;
type = PPDC_DRIVER_CUSTOM;
ppdcDriver::~ppdcDriver()
{
- delete copyright;
+ PPDC_DELETE;
+
+ copyright->release();
if (manufacturer)
manufacturer->release();
if (model_name)
model_name->release();
+ if (file_name)
+ file_name->release();
if (pc_file_name)
pc_file_name->release();
if (version)
if (custom_size_code)
custom_size_code->release();
- delete attrs;
- delete constraints;
- delete filters;
- delete fonts;
- delete groups;
- delete profiles;
- delete sizes;
+ attrs->release();
+ constraints->release();
+ filters->release();
+ fonts->release();
+ groups->release();
+ profiles->release();
+ sizes->release();
}
for (a = (ppdcAttr *)attrs->first(); a; a = (ppdcAttr *)attrs->next())
if (!strcmp(a->name->value, k) &&
((!s && (!a->selector->value || !a->selector->value[0])) ||
- (!s && !a->selector->value && !strcmp(a->selector->value, s))))
+ (s && a->selector->value && !strcmp(a->selector->value, s))))
return (a);
return (NULL);
for (g = (ppdcGroup *)groups->first(); g; g = (ppdcGroup *)groups->next())
- if (!strcasecmp(n, g->name->value))
+ if (!_cups_strcasecmp(n, g->name->value))
return (g);
return (0);
ppdcOption * // O - Matching option or NULL
ppdcDriver::find_option(const char *n) // I - Option name
+{
+ return (find_option_group(n, (ppdcGroup **)0));
+}
+
+
+//
+// 'ppdcDriver::find_option_group()' - Find an option and its group.
+//
+
+ppdcOption * // O - Matching option or NULL
+ppdcDriver::find_option_group(
+ const char *n, // I - Option name
+ ppdcGroup **mg) // O - Matching group or NULL
{
ppdcGroup *g; // Current group
ppdcOption *o; // Current option
for (g = (ppdcGroup *)groups->first(); g; g = (ppdcGroup *)groups->next())
for (o = (ppdcOption *)g->options->first(); o; o = (ppdcOption *)g->options->next())
- if (!strcasecmp(n, o->name->value))
+ if (!_cups_strcasecmp(n, o->name->value))
+ {
+ if (mg)
+ *mg = g;
+
return (o);
+ }
+
+ if (mg)
+ *mg = (ppdcGroup *)0;
return (0);
}
//
void
-ppdcDriver::set_custom_size_code(const char *c)
- // I - CustomPageSize code
+ppdcDriver::set_custom_size_code(
+ const char *c) // I - CustomPageSize code
{
if (custom_size_code)
custom_size_code->release();
//
void
-ppdcDriver::set_default_font(ppdcFont *f)
- // I - Font
+ppdcDriver::set_default_font(
+ ppdcFont *f) // I - Font
{
if (default_font)
default_font->release();
if (f)
{
- f->name->get();
+ f->name->retain();
default_font = f->name;
}
else
//
void
-ppdcDriver::set_default_size(ppdcMediaSize *m)
- // I - Media size
+ppdcDriver::set_default_size(
+ ppdcMediaSize *m) // I - Media size
{
if (default_size)
default_size->release();
if (m)
{
- m->name->get();
+ m->name->retain();
default_size = m->name;
}
else
}
+//
+// 'ppdcDriver::set_file_name()' - Set the full filename.
+//
+
+void
+ppdcDriver::set_file_name(const char *f)// I - Filename
+{
+ if (file_name)
+ file_name->release();
+
+ file_name = new ppdcString(f);
+}
+
+
//
// 'ppdcDriver::set_manufacturer()' - Set the manufacturer name.
//
void
-ppdcDriver::set_manufacturer(const char *m)
- // I - Model name
+ppdcDriver::set_manufacturer(
+ const char *m) // I - Model name
{
if (manufacturer)
manufacturer->release();
//
void
-ppdcDriver::set_model_name(const char *m)
- // I - Model name
+ppdcDriver::set_model_name(
+ const char *m) // I - Model name
{
if (model_name)
model_name->release();
//
void
-ppdcDriver::set_pc_file_name(const char *f)
- // I - Filename
+ppdcDriver::set_pc_file_name(
+ const char *f) // I - Filename
{
if (pc_file_name)
pc_file_name->release();
ppdcLineEnding le) // I - Line endings to use
{
bool delete_cat; // Delete the catalog when we are done?
- char query[42]; // Query attribute
+ char query[42], // Query attribute
+ custom[42]; // Custom attribute
ppdcString *s; // Copyright string
ppdcGroup *g; // Current group
ppdcOption *o; // Current option
// Write the standard header stuff...
cupsFilePrintf(fp, "*PPD-Adobe: \"4.3\"%s", lf);
- cupsFilePrintf(fp, "*%% PPD file for %s with CUPS.%s", model_name->value, lf);
+ cupsFilePrintf(fp, "*%%%%%%%% PPD file for %s with CUPS.%s",
+ model_name->value, lf);
cupsFilePrintf(fp,
- "*%% Created by the CUPS PPD Compiler " CUPS_SVERSION ".%s",
- lf);
+ "*%%%%%%%% Created by the CUPS PPD Compiler " CUPS_SVERSION
+ ".%s", lf);
for (s = (ppdcString *)copyright->first();
s;
s = (ppdcString *)copyright->next())
cupsFilePrintf(fp, "*Product: \"%s\"%s", a->value->value, lf);
}
else
- {
- cupsFilePrintf(fp, "*Product: \"(ESP Ghostscript)\"%s", lf);
- cupsFilePrintf(fp, "*Product: \"(GPL Ghostscript)\"%s", lf);
- cupsFilePrintf(fp, "*Product: \"(GNU Ghostscript)\"%s", lf);
- }
+ cupsFilePrintf(fp, "*Product: \"(%s)\"%s", model_name->value, lf);
cupsFilePrintf(fp, "*Manufacturer: \"%s\"%s",
catalog->find_message(manufacturer->value), lf);
if ((a = find_attr("ModelName", NULL)) != NULL)
cupsFilePrintf(fp, "*ModelName: \"%s\"%s",
catalog->find_message(a->value->value), lf);
- else if (strncasecmp(model_name->value, manufacturer->value,
+ else if (_cups_strncasecmp(model_name->value, manufacturer->value,
strlen(manufacturer->value)))
cupsFilePrintf(fp, "*ModelName: \"%s %s\"%s",
catalog->find_message(manufacturer->value),
if ((a = find_attr("ShortNickName", NULL)) != NULL)
cupsFilePrintf(fp, "*ShortNickName: \"%s\"%s",
catalog->find_message(a->value->value), lf);
- else if (strncasecmp(model_name->value, manufacturer->value,
+ else if (_cups_strncasecmp(model_name->value, manufacturer->value,
strlen(manufacturer->value)))
cupsFilePrintf(fp, "*ShortNickName: \"%s %s\"%s",
catalog->find_message(manufacturer->value),
if ((a = find_attr("NickName", NULL)) != NULL)
cupsFilePrintf(fp, "*NickName: \"%s\"%s",
catalog->find_message(a->value->value), lf);
- else if (strncasecmp(model_name->value, manufacturer->value,
+ else if (_cups_strncasecmp(model_name->value, manufacturer->value,
strlen(manufacturer->value)))
cupsFilePrintf(fp, "*NickName: \"%s %s, %s\"%s",
catalog->find_message(manufacturer->value),
cupsFilePrintf(fp, "*PSVersion: \"%s\"%s", a->value->value, lf);
}
else
- {
- cupsFilePrintf(fp, "*PSVersion: \"(3010.000) 705\"%s", lf);
- cupsFilePrintf(fp, "*PSVersion: \"(3010.000) 707\"%s", lf);
- cupsFilePrintf(fp, "*PSVersion: \"(3010.000) 815\"%s", lf);
- cupsFilePrintf(fp, "*PSVersion: \"(3010.000) 853\"%s", lf);
- }
+ cupsFilePrintf(fp, "*PSVersion: \"(3010.000) 0\"%s", lf);
if ((a = find_attr("LanguageLevel", NULL)) != NULL)
cupsFilePrintf(fp, "*LanguageLevel: \"%s\"%s", a->value->value, lf);
else if (type != PPDC_DRIVER_PS)
cupsFilePrintf(fp, "*TTRasterizer: Type42%s", lf);
+ struct lconv *loc = localeconv();
+
if (attrs->count)
{
// Write driver-defined attributes...
!strcmp(a->name->value, "ModelName") ||
!strcmp(a->name->value, "NickName") ||
!strcmp(a->name->value, "ShortNickName") ||
- !strcmp(a->name->value, "cupsVersion") ||
- a->name->value[0] == '?')
+ !strcmp(a->name->value, "cupsVersion"))
+ continue;
+
+ if (a->name->value[0] == '?' &&
+ (find_option(a->name->value + 1) ||
+ !strcmp(a->name->value, "?ImageableArea") ||
+ !strcmp(a->name->value, "?PageRegion") ||
+ !strcmp(a->name->value, "?PageSize") ||
+ !strcmp(a->name->value, "?PaperDimension")))
+ continue;
+
+ if (!strncmp(a->name->value, "Custom", 6) &&
+ find_option(a->name->value + 6))
+ continue;
+
+ if (!strncmp(a->name->value, "ParamCustom", 11) &&
+ find_option(a->name->value + 11))
continue;
if (!a->selector->value || !a->selector->value[0])
{
cupsFilePrintf(fp, ": \"%s\"%s", a->value->value, lf);
- if (strchr(a->value->value, '\n'))
+ if (strchr(a->value->value, '\n') || strchr(a->value->value, '\r'))
cupsFilePrintf(fp, "*End%s", lf);
}
else
for (p = (ppdcProfile *)profiles->first();
p;
p = (ppdcProfile *)profiles->next())
+ {
+ char density[255], gamma[255], profile[9][255];
+
+ _cupsStrFormatd(density, density + sizeof(density), p->density, loc);
+ _cupsStrFormatd(gamma, gamma + sizeof(gamma), p->gamma, loc);
+
+ for (int i = 0; i < 9; i ++)
+ _cupsStrFormatd(profile[i], profile[i] + sizeof(profile[0]),
+ p->profile[i], loc);
+
cupsFilePrintf(fp,
- "*cupsColorProfile %s/%s: \"%.3f %.3f %.3f %.3f %.3f %.3f "
- "%.3f %.3f %.3f %.3f %.3f\"%s",
- p->resolution->value, p->media_type->value,
- p->density, p->gamma,
- p->profile[0], p->profile[1],
- p->profile[2], p->profile[3],
- p->profile[4], p->profile[5],
- p->profile[6], p->profile[7],
- p->profile[8], lf);
+ "*cupsColorProfile %s/%s: \"%s %s %s %s %s %s %s %s %s %s "
+ "%s\"%s", p->resolution->value, p->media_type->value,
+ density, gamma, profile[0], profile[1], profile[2],
+ profile[3], profile[4], profile[5], profile[6], profile[7],
+ profile[8], lf);
+ }
}
if (locales)
if (locatalog->messages->count == 0)
{
// No, skip this one...
- fprintf(stderr, "ppdc: No message catalog provided for locale %s!\n",
- locale->value);
+ _cupsLangPrintf(stderr,
+ _("ppdc: No message catalog provided for locale "
+ "%s."), locale->value);
continue;
}
// First constrain 1 against 2...
if (!strncmp(cn->option1->value, "*Custom", 7) ||
!strncmp(cn->option2->value, "*Custom", 7))
- cupsFilePrintf(fp, "*NonUIConstraints: ");
+ cupsFilePuts(fp, "*NonUIConstraints: ");
else
- cupsFilePrintf(fp, "*UIConstraints: ");
+ cupsFilePuts(fp, "*UIConstraints: ");
if (cn->option1->value[0] != '*')
cupsFilePutChar(fp, '*');
- cupsFilePrintf(fp, cn->option1->value);
+ cupsFilePuts(fp, cn->option1->value);
if (cn->choice1->value)
cupsFilePrintf(fp, " %s", cn->choice1->value);
if (cn->option2->value[0] != '*')
cupsFilePutChar(fp, '*');
- cupsFilePrintf(fp, cn->option2->value);
+ cupsFilePuts(fp, cn->option2->value);
if (cn->choice2->value)
cupsFilePrintf(fp, " %s", cn->choice2->value);
- cupsFilePrintf(fp, "%s", lf);
+ cupsFilePuts(fp, lf);
// Then constrain 2 against 1...
if (!strncmp(cn->option1->value, "*Custom", 7) ||
!strncmp(cn->option2->value, "*Custom", 7))
- cupsFilePrintf(fp, "*NonUIConstraints: ");
+ cupsFilePuts(fp, "*NonUIConstraints: ");
else
- cupsFilePrintf(fp, "*UIConstraints: ");
+ cupsFilePuts(fp, "*UIConstraints: ");
if (cn->option2->value[0] != '*')
cupsFilePutChar(fp, '*');
- cupsFilePrintf(fp, cn->option2->value);
+ cupsFilePuts(fp, cn->option2->value);
if (cn->choice2->value)
cupsFilePrintf(fp, " %s", cn->choice2->value);
if (cn->option1->value[0] != '*')
cupsFilePutChar(fp, '*');
- cupsFilePrintf(fp, cn->option1->value);
+ cupsFilePuts(fp, cn->option1->value);
if (cn->choice1->value)
cupsFilePrintf(fp, " %s", cn->choice1->value);
cupsFilePrintf(fp, "*DefaultImageableArea: %s%s",
default_size ? default_size->value : "Letter", lf);
+ char left[255], right[255], bottom[255], top[255];
+
for (m = (ppdcMediaSize *)sizes->first();
m;
m = (ppdcMediaSize *)sizes->next())
- cupsFilePrintf(fp, "*ImageableArea %s/%s: \"%.2f %.2f %.2f %.2f\"%s",
+ {
+ _cupsStrFormatd(left, left + sizeof(left), m->left, loc);
+ _cupsStrFormatd(bottom, bottom + sizeof(bottom), m->bottom, loc);
+ _cupsStrFormatd(right, right + sizeof(right), m->width - m->right, loc);
+ _cupsStrFormatd(top, top + sizeof(top), m->length - m->top, loc);
+
+ cupsFilePrintf(fp, "*ImageableArea %s/%s: \"%s %s %s %s\"%s",
m->name->value, catalog->find_message(m->text->value),
- m->left, m->bottom, m->width - m->right, m->length - m->top,
- lf);
+ left, bottom, right, top, lf);
+ }
if ((a = find_attr("?ImageableArea", NULL)) != NULL)
{
cupsFilePrintf(fp, "*DefaultPaperDimension: %s%s",
default_size ? default_size->value : "Letter", lf);
+ char width[255], length[255];
+
for (m = (ppdcMediaSize *)sizes->first();
m;
m = (ppdcMediaSize *)sizes->next())
- cupsFilePrintf(fp, "*PaperDimension %s/%s: \"%.2f %.2f\"%s",
+ {
+ _cupsStrFormatd(width, width + sizeof(width), m->width, loc);
+ _cupsStrFormatd(length, length + sizeof(length), m->length, loc);
+
+ cupsFilePrintf(fp, "*PaperDimension %s/%s: \"%s %s\"%s",
m->name->value, catalog->find_message(m->text->value),
- m->width, m->length, lf);
+ width, length, lf);
+ }
if ((a = find_attr("?PaperDimension", NULL)) != NULL)
{
// Custom size support...
if (variable_paper_size)
{
- cupsFilePrintf(fp, "*MaxMediaWidth: \"%.2f\"%s", max_width, lf);
- cupsFilePrintf(fp, "*MaxMediaHeight: \"%.2f\"%s", max_length, lf);
- cupsFilePrintf(fp, "*HWMargins: %.2f %.2f %.2f %.2f\n",
- left_margin, bottom_margin, right_margin, top_margin);
+ _cupsStrFormatd(width, width + sizeof(width), max_width, loc);
+ _cupsStrFormatd(length, length + sizeof(length), max_length, loc);
+
+ _cupsStrFormatd(left, left + sizeof(left), left_margin, loc);
+ _cupsStrFormatd(bottom, bottom + sizeof(bottom), bottom_margin, loc);
+ _cupsStrFormatd(right, right + sizeof(right), right_margin, loc);
+ _cupsStrFormatd(top, top + sizeof(top), top_margin, loc);
+
+ cupsFilePrintf(fp, "*MaxMediaWidth: \"%s\"%s", width, lf);
+ cupsFilePrintf(fp, "*MaxMediaHeight: \"%s\"%s", length, lf);
+ cupsFilePrintf(fp, "*HWMargins: %s %s %s %s%s", left, bottom, right, top,
+ lf);
if (custom_size_code && custom_size_code->value)
{
cupsFilePrintf(fp, "*ParamCustomPageSize Width: %s%s", a->value->value,
lf);
else
- cupsFilePrintf(fp, "*ParamCustomPageSize Width: 1 points %.2f %.2f%s",
- min_width, max_width, lf);
+ {
+ char width0[255];
+
+ _cupsStrFormatd(width0, width0 + sizeof(width0), min_width, loc);
+ _cupsStrFormatd(width, width + sizeof(width), max_width, loc);
+
+ cupsFilePrintf(fp, "*ParamCustomPageSize Width: 1 points %s %s%s",
+ width0, width, lf);
+ }
if ((a = find_attr("ParamCustomPageSize", "Height")) != NULL)
cupsFilePrintf(fp, "*ParamCustomPageSize Height: %s%s", a->value->value,
lf);
else
- cupsFilePrintf(fp, "*ParamCustomPageSize Height: 2 points %.2f %.2f%s",
- min_length, max_length, lf);
+ {
+ char length0[255];
+
+ _cupsStrFormatd(length0, length0 + sizeof(length0), min_length, loc);
+ _cupsStrFormatd(length, length + sizeof(length), max_length, loc);
+
+ cupsFilePrintf(fp, "*ParamCustomPageSize Height: 2 points %s %s%s",
+ length0, length, lf);
+ }
if ((a = find_attr("ParamCustomPageSize", "WidthOffset")) != NULL)
cupsFilePrintf(fp, "*ParamCustomPageSize WidthOffset: %s%s",
cupsFilePrintf(fp, "*ParamCustomPageSize Orientation: 5 int 0 0%s", lf);
}
- if (type != PPDC_DRIVER_PS && !find_attr("RequiresPageRegion", NULL))
- cupsFilePrintf(fp, "*RequiresPageRegion All: True%s", lf);
-
// All other options...
for (g = (ppdcGroup *)groups->first(); g; g = (ppdcGroup *)groups->next())
{
if (!g->options->count)
continue;
- if (strcasecmp(g->name->value, "General"))
+ if (_cups_strcasecmp(g->name->value, "General"))
cupsFilePrintf(fp, "*OpenGroup: %s/%s%s", g->name->value,
catalog->find_message(g->text->value), lf);
if (!o->choices->count)
continue;
- if (!o->text->value || !strcmp(o->name->value, o->text->value))
- cupsFilePrintf(fp, "*OpenUI *%s: ", o->name->value);
+ if (o->section == PPDC_SECTION_JCL)
+ {
+ if (!o->text->value)
+ cupsFilePrintf(fp, "*JCLOpenUI *%s/%s: ", o->name->value,
+ catalog->find_message(o->name->value));
+ else
+ cupsFilePrintf(fp, "*JCLOpenUI *%s/%s: ", o->name->value,
+ catalog->find_message(o->text->value));
+ }
+ else if (!o->text->value)
+ cupsFilePrintf(fp, "*OpenUI *%s/%s: ", o->name->value,
+ catalog->find_message(o->name->value));
else
cupsFilePrintf(fp, "*OpenUI *%s/%s: ", o->name->value,
catalog->find_message(o->text->value));
break;
}
- cupsFilePrintf(fp, "*OrderDependency: %.1f ", o->order);
+ char order[255];
+ _cupsStrFormatd(order, order + sizeof(order), o->order, loc);
+
+ cupsFilePrintf(fp, "*OrderDependency: %s ", order);
switch (o->section)
{
default :
c = (ppdcChoice *)o->choices->next())
{
// Write this choice...
- if (!c->text->value || !strcmp(c->name->value, c->text->value))
- cupsFilePrintf(fp, "*%s %s: \"%s\"%s", o->name->value, c->name->value,
+ if (!c->text->value)
+ cupsFilePrintf(fp, "*%s %s/%s: \"%s\"%s", o->name->value,
+ c->name->value, catalog->find_message(c->name->value),
c->code->value, lf);
else
cupsFilePrintf(fp, "*%s %s/%s: \"%s\"%s", o->name->value,
if ((a = find_attr(query, NULL)) != NULL)
{
- cupsFilePrintf(fp, "*%s: \"%s\"\n", query, a->value->value);
+ cupsFilePrintf(fp, "*%s: \"%s\"%s", query, a->value->value, lf);
if (strchr(a->value->value, '\n') ||
strchr(a->value->value, '\r'))
}
cupsFilePrintf(fp, "*CloseUI: *%s%s", o->name->value, lf);
+
+ snprintf(custom, sizeof(custom), "Custom%s", o->name->value);
+ if ((a = find_attr(custom, "True")) != NULL)
+ {
+ // Output custom option information...
+ cupsFilePrintf(fp, "*%s True: \"%s\"%s", custom, a->value->value, lf);
+ if (strchr(a->value->value, '\n') || strchr(a->value->value, '\r'))
+ cupsFilePrintf(fp, "*End%s", lf);
+
+ snprintf(custom, sizeof(custom), "ParamCustom%s", o->name->value);
+ for (a = (ppdcAttr *)attrs->first(); a; a = (ppdcAttr *)attrs->next())
+ {
+ if (strcmp(a->name->value, custom))
+ continue;
+
+ if (!a->selector->value || !a->selector->value[0])
+ cupsFilePrintf(fp, "*%s", a->name->value);
+ else if (!a->text->value || !a->text->value[0])
+ cupsFilePrintf(fp, "*%s %s/%s", a->name->value, a->selector->value,
+ catalog->find_message(a->selector->value));
+ else
+ cupsFilePrintf(fp, "*%s %s/%s", a->name->value, a->selector->value,
+ catalog->find_message(a->text->value));
+
+ cupsFilePrintf(fp, ": %s%s", a->value->value, lf);
+ }
+ }
}
- if (strcasecmp(g->name->value, "General"))
+ if (_cups_strcasecmp(g->name->value, "General"))
cupsFilePrintf(fp, "*CloseGroup: %s%s", g->name->value, lf);
}
cupsFilePrintf(fp, "*%s.Translation ModelName/%s: \"\"%s",
locale->value,
locatalog->find_message(a->value->value), lf);
- else if (strncasecmp(model_name->value, manufacturer->value,
+ else if (_cups_strncasecmp(model_name->value, manufacturer->value,
strlen(manufacturer->value)))
cupsFilePrintf(fp, "*%s.Translation ModelName/%s %s: \"\"%s",
locale->value,
cupsFilePrintf(fp, "*%s.Translation ShortNickName/%s: \"\"%s",
locale->value,
locatalog->find_message(a->value->value), lf);
- else if (strncasecmp(model_name->value, manufacturer->value,
+ else if (_cups_strncasecmp(model_name->value, manufacturer->value,
strlen(manufacturer->value)))
cupsFilePrintf(fp, "*%s.Translation ShortNickName/%s %s: \"\"%s",
locale->value,
cupsFilePrintf(fp, "*%s.Translation NickName/%s: \"\"%s",
locale->value,
locatalog->find_message(a->value->value), lf);
- else if (strncasecmp(model_name->value, manufacturer->value,
+ else if (_cups_strncasecmp(model_name->value, manufacturer->value,
strlen(manufacturer->value)))
cupsFilePrintf(fp, "*%s.Translation NickName/%s %s, %s: \"\"%s",
locale->value,
if (!g->options->count)
continue;
- if (strcasecmp(g->name->value, "General"))
+ if (_cups_strcasecmp(g->name->value, "General"))
cupsFilePrintf(fp, "*%s.Translation %s/%s: \"\"%s", locale->value,
g->name->value,
locatalog->find_message(g->text->value), lf);
// Finally the localizable attributes...
for (a = (ppdcAttr *)attrs->first(); a; a = (ppdcAttr *)attrs->next())
{
- if ((!a->text || !a->text->value || !a->text->value[0]) &&
- strncmp(a->name->value, "Custom", 6) &&
- strncmp(a->name->value, "ParamCustom", 11))
- continue;
-
- if (strcmp(a->name->value, "APCustomColorMatchingName") &&
+ if (!a->localizable &&
+ (!a->text || !a->text->value || !a->text->value[0]) &&
+ strcmp(a->name->value, "APCustomColorMatchingName") &&
strcmp(a->name->value, "APPrinterPreset") &&
strcmp(a->name->value, "cupsICCProfile") &&
strcmp(a->name->value, "cupsIPPReason") &&
+ strcmp(a->name->value, "cupsMarkerName") &&
strncmp(a->name->value, "Custom", 6) &&
strncmp(a->name->value, "ParamCustom", 11))
- continue;
+ continue;
cupsFilePrintf(fp, "*%s.%s %s/%s: \"%s\"%s", locale->value,
a->name->value, a->selector->value,
locatalog->find_message(a->text && a->text->value ?
a->text->value : a->name->value),
- !strcmp(a->name->value, "cupsIPPReason") ?
+ ((a->localizable && a->value->value[0]) ||
+ !strcmp(a->name->value, "cupsIPPReason")) ?
locatalog->find_message(a->value->value) : "",
lf);
}
fn->status == PPDC_FONT_ROM ? "ROM" : "Disk", lf);
cupsFilePrintf(fp, "*%% End of %s, %05d bytes.%s", pc_file_name->value,
- (int)(cupsFileTell(fp) + 25 + strlen(pc_file_name->value)),
+ (int)((size_t)cupsFileTell(fp) + 25 + strlen(pc_file_name->value)),
lf);
if (delete_cat)
- delete catalog;
+ catalog->release();
return (0);
}