Choice Keyword 'Custom' is Not Localized Properly #3106

Closed
michaelrsweet opened this Issue Feb 18, 2009 · 5 comments

Comments

Projects
None yet
1 participant
Collaborator

michaelrsweet commented Feb 18, 2009

Version: 1.3-current
CUPS.org User: chulbert

The ppdLocalize() method assumes that a choice keyword of 'Custom' indicates that custom options are in use. It therefore attempts to localize that choice by looking up the *CustomOption attribute. However, a PPD author might also use the keyword 'Custom' directly. In those cases the choice should be localized in the same manner as other choices.

I have attached a patch. While I am unhappy about using ppdFindCustomOption() I did not see a less expensive way to determine whether the keyword 'Custom' indicates a regular choice or a custom parameter.

Collaborator

michaelrsweet commented Feb 20, 2009

CUPS.org User: mike

Fixed in Subversion repository.

Collaborator

michaelrsweet commented Feb 20, 2009

CUPS.org User: mike

and the CUPS 1.3 patch...

Collaborator

michaelrsweet commented Feb 20, 2009

"patch.txt":

Index: localize.c

--- localize.c (revision 8363)
+++ localize.c (working copy)
@@ -113,7 +113,8 @@
k > 0;
k --, choice ++)
{

  •    if (strcmp(choice->choice, "Custom"))
    
  •    if (strcmp(choice->choice, "Custom") || 
    
  •            (!strcmp(choice-.choice, "Custom") && ppdFindCustomOption(ppd, option->keyword) == NULL))
    
    locattr = ppd_localized_attr(ppd, option->keyword, choice->choice,
    ll_CC, ll);
    else
Collaborator

michaelrsweet commented Feb 20, 2009

"str3106.patch":

Index: cups/localize.c

--- cups/localize.c (revision 8369)
+++ cups/localize.c (working copy)
@@ -115,7 +115,8 @@
k > 0;
k --, choice ++)
{

  •    if (strcmp(choice->choice, "Custom"))
    
  •    if (strcmp(choice->choice, "Custom") ||
    
  •   !ppdFindCustomOption(ppd, option->keyword))
    
    locattr = _ppdLocalizedAttr(ppd, option->keyword, choice->choice,
    ll_CC);
    else
Collaborator

michaelrsweet commented Feb 20, 2009

"str3106-1.3.patch":

Index: cups/localize.c

--- cups/localize.c (revision 8372)
+++ cups/localize.c (working copy)
@@ -113,7 +113,8 @@
k > 0;
k --, choice ++)
{

  •    if (strcmp(choice->choice, "Custom"))
    
  •    if (strcmp(choice->choice, "Custom") ||
    
  •   !ppdFindCustomOption(ppd, option->keyword))
    
    locattr = ppd_localized_attr(ppd, option->keyword, choice->choice,
    ll_CC, ll);
    else

michaelrsweet added this to the Stable milestone Mar 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment