/*
- * "$Id: mark.c 177 2006-06-21 00:20:03Z jlovell $"
+ * "$Id: mark.c 6187 2007-01-10 16:20:42Z mike $"
*
* Option marking routines for the Common UNIX Printing System (CUPS).
*
- * Copyright 1997-2006 by Easy Software Products, all rights reserved.
+ * Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
int /* O - Number of conflicts found */
ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
{
- int i, j, k, /* Looping variables */
+ int i, j, /* Looping variables */
conflicts; /* Number of conflicts */
ppd_const_t *c; /* Current constraint */
- ppd_group_t *g, *sg; /* Groups */
ppd_option_t *o1, *o2; /* Options */
ppd_choice_t *c1, *c2; /* Choices */
- if (ppd == NULL)
+ if (!ppd)
return (0);
/*
conflicts = 0;
- for (i = ppd->num_groups, g = ppd->groups; i > 0; i --, g ++)
- {
- for (j = g->num_options, o1 = g->options; j > 0; j --, o1 ++)
- o1->conflicted = 0;
-
- for (j = g->num_subgroups, sg = g->subgroups; j > 0; j --, sg ++)
- for (k = sg->num_options, o1 = sg->options; k > 0; k --, o1 ++)
- o1->conflicted = 0;
- }
+ for (o1 = ppdFirstOption(ppd); o1; o1 = ppdNextOption(ppd))
+ o1->conflicted = 0;
/*
* Loop through all of the UI constraints and flag any options
o1 = ppdFindOption(ppd, c->option1);
- if (o1 == NULL)
+ if (!o1)
continue;
- else if (c->choice1[0] != '\0')
+ else if (c->choice1[0])
{
/*
* This constraint maps to a specific choice.
if (c1->marked)
break;
- if (j == 0 ||
- strcasecmp(c1->choice, "None") == 0 ||
- strcasecmp(c1->choice, "Off") == 0 ||
- strcasecmp(c1->choice, "False") == 0)
+ if (!j ||
+ !strcasecmp(c1->choice, "None") ||
+ !strcasecmp(c1->choice, "Off") ||
+ !strcasecmp(c1->choice, "False"))
c1 = NULL;
}
o2 = ppdFindOption(ppd, c->option2);
- if (o2 == NULL)
+ if (!o2)
continue;
- else if (c->choice2[0] != '\0')
+ else if (c->choice2[0])
{
/*
* This constraint maps to a specific choice.
if (c2->marked)
break;
- if (j == 0 ||
- strcasecmp(c2->choice, "None") == 0 ||
- strcasecmp(c2->choice, "Off") == 0 ||
- strcasecmp(c2->choice, "False") == 0)
+ if (!j ||
+ !strcasecmp(c2->choice, "None") ||
+ !strcasecmp(c2->choice, "Off") ||
+ !strcasecmp(c2->choice, "False"))
c2 = NULL;
}
* If both options are marked then there is a conflict...
*/
- if (c1 != NULL && c1->marked &&
- c2 != NULL && c2->marked)
+ if (c1 && c1->marked && c2 && c2->marked)
{
DEBUG_printf(("%s->%s conflicts with %s->%s (%s %s %s %s)\n",
o1->keyword, c1->choice, o2->keyword, c2->choice,
ppd_cparam_t *cparam; /* Custom parameter */
char *units; /* Custom points units */
+
if ((coption = ppdFindCustomOption(ppd, option)) != NULL)
{
if ((cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params)) == NULL)
case PPD_CUSTOM_CURVE :
case PPD_CUSTOM_INVCURVE :
case PPD_CUSTOM_REAL :
- cparam->current.custom_real = _cupsStrScand(choice + 7, NULL,
- loc);
+ cparam->current.custom_real = (float)_cupsStrScand(choice + 7,
+ NULL, loc);
break;
case PPD_CUSTOM_POINTS :
- cparam->current.custom_points = _cupsStrScand(choice + 7,
- &units, loc);
+ cparam->current.custom_points = (float)_cupsStrScand(choice + 7,
+ &units,
+ loc);
if (units)
{
if (!strcasecmp(units, "cm"))
- cparam->current.custom_points *= 72.0 / 2.54;
+ cparam->current.custom_points *= 72.0f / 2.54f;
else if (!strcasecmp(units, "mm"))
- cparam->current.custom_points *= 72.0 / 25.4;
+ cparam->current.custom_points *= 72.0f / 25.4f;
else if (!strcasecmp(units, "m"))
- cparam->current.custom_points *= 72.0 / 0.0254;
+ cparam->current.custom_points *= 72.0f / 0.0254f;
else if (!strcasecmp(units, "in"))
- cparam->current.custom_points *= 72.0;
+ cparam->current.custom_points *= 72.0f;
else if (!strcasecmp(units, "ft"))
- cparam->current.custom_points *= 12 * 72.0;
+ cparam->current.custom_points *= 12.0f * 72.0f;
}
break;
}
}
}
+
+ /*
+ * Make sure that we keep the option marked below...
+ */
+
+ choice = "Custom";
}
else if (choice[0] == '{')
{
case PPD_CUSTOM_CURVE :
case PPD_CUSTOM_INVCURVE :
case PPD_CUSTOM_REAL :
- cparam->current.custom_real = _cupsStrScand(val->value, NULL,
- loc);
+ cparam->current.custom_real = (float)_cupsStrScand(val->value,
+ NULL, loc);
break;
case PPD_CUSTOM_POINTS :
- cparam->current.custom_points = _cupsStrScand(val->value, &units,
- loc);
+ cparam->current.custom_points = (float)_cupsStrScand(val->value,
+ &units,
+ loc);
if (units)
{
if (!strcasecmp(units, "cm"))
- cparam->current.custom_points *= 72.0 / 2.54;
+ cparam->current.custom_points *= 72.0f / 2.54f;
else if (!strcasecmp(units, "mm"))
- cparam->current.custom_points *= 72.0 / 25.4;
+ cparam->current.custom_points *= 72.0f / 25.4f;
else if (!strcasecmp(units, "m"))
- cparam->current.custom_points *= 72.0 / 0.0254;
+ cparam->current.custom_points *= 72.0f / 0.0254f;
else if (!strcasecmp(units, "in"))
- cparam->current.custom_points *= 72.0;
+ cparam->current.custom_points *= 72.0f;
else if (!strcasecmp(units, "ft"))
- cparam->current.custom_points *= 12 * 72.0;
+ cparam->current.custom_points *= 12.0f * 72.0f;
}
break;
/*
- * End of "$Id: mark.c 177 2006-06-21 00:20:03Z jlovell $".
+ * End of "$Id: mark.c 6187 2007-01-10 16:20:42Z mike $".
*/