break;
}
+ if (left > right)
+ {
+ temp1 = left;
+ left = right;
+ right = temp1;
+ }
+
+ if (bottom > top)
+ {
+ temp1 = bottom;
+ bottom = top;
+ top = temp1;
+ }
+
h->PageSize[0] = (unsigned)(h->cupsPageSize[0] *
h->cupsBorderlessScalingFactor);
h->PageSize[1] = (unsigned)(h->cupsPageSize[1] *
* Compute the bitmap parameters...
*/
- h->cupsWidth = (int)((right - left) * h->cupsBorderlessScalingFactor *
+ h->cupsWidth = (unsigned)((right - left) * h->cupsBorderlessScalingFactor *
h->HWResolution[0] / 72.0f + 0.5f);
- h->cupsHeight = (int)((top - bottom) * h->cupsBorderlessScalingFactor *
+ h->cupsHeight = (unsigned)((top - bottom) * h->cupsBorderlessScalingFactor *
h->HWResolution[1] / 72.0f + 0.5f);
switch (h->cupsColorSpace)
int *preferred_bits,/* O - Preferred bits per color */
const char *code) /* I - PS code to execute */
{
+ int error = 0; /* Error condition? */
_cups_ps_stack_t *st; /* PostScript value stack */
_cups_ps_obj_t *obj; /* Object from top of stack */
char *codecopy, /* Copy of code */
DEBUG_printf(("_cupsRasterExecPS(h=%p, preferred_bits=%p, code=\"%s\")\n",
- h, preferred_bits, code ? code : "(null)"));
+ h, preferred_bits, code));
/*
* Copy the PostScript code and create a stack...
case CUPS_PS_OTHER :
_cupsRasterAddError("Unknown operator \"%s\"!\n", obj->value.other);
+ error = 1;
DEBUG_printf(("_cupsRasterExecPS: Unknown operator \"%s\"!\n",
obj->value.other));
break;
}
- if (obj && obj->type == CUPS_PS_OTHER)
+ if (error)
break;
}
st->alloc_objs += 32;
- if ((temp = realloc(st->objs, st->alloc_objs *
+ if ((temp = realloc(st->objs, (size_t)st->alloc_objs *
sizeof(_cups_ps_obj_t))) == NULL)
return (NULL);
s = -s;
- if ((temp = calloc(s, sizeof(_cups_ps_obj_t))) == NULL)
+ if ((temp = calloc((size_t)s, sizeof(_cups_ps_obj_t))) == NULL)
return (-1);
- memcpy(temp, st->objs + n, s * sizeof(_cups_ps_obj_t));
- memmove(st->objs + n, st->objs + n + s, (c - s) * sizeof(_cups_ps_obj_t));
- memcpy(st->objs + n + c - s, temp, s * sizeof(_cups_ps_obj_t));
+ memcpy(temp, st->objs + n, (size_t)s * sizeof(_cups_ps_obj_t));
+ memmove(st->objs + n, st->objs + n + s, (size_t)(c - s) * sizeof(_cups_ps_obj_t));
+ memcpy(st->objs + n + c - s, temp, (size_t)s * sizeof(_cups_ps_obj_t));
}
else
{
* Shift up...
*/
- if ((temp = calloc(s, sizeof(_cups_ps_obj_t))) == NULL)
+ if ((temp = calloc((size_t)s, sizeof(_cups_ps_obj_t))) == NULL)
return (-1);
- memcpy(temp, st->objs + n + c - s, s * sizeof(_cups_ps_obj_t));
- memmove(st->objs + n + s, st->objs + n,
- (c - s) * sizeof(_cups_ps_obj_t));
- memcpy(st->objs + n, temp, s * sizeof(_cups_ps_obj_t));
+ memcpy(temp, st->objs + n + c - s, (size_t)s * sizeof(_cups_ps_obj_t));
+ memmove(st->objs + n + s, st->objs + n, (size_t)(c - s) * sizeof(_cups_ps_obj_t));
+ memcpy(st->objs + n, temp, (size_t)s * sizeof(_cups_ps_obj_t));
}
free(temp);
ch = (ch << 3) + *cur - '0';
}
- *valptr++ = ch;
+ *valptr++ = (char)ch;
}
else if (*cur == '\r')
{
ch |= tolower(*cur) - 'a' + 10;
}
- *valptr++ = ch;
+ *valptr++ = (char)ch;
}
if (*cur != '>')