idx
int64 | func_before
string | Vulnerability Classification
string | vul
int64 | func_after
string | patch
string | CWE ID
string | lines_before
string | lines_after
string |
|---|---|---|---|---|---|---|---|---|
1,300
|
static RELOC_PTRS_WITH(dc_pattern_reloc_ptrs, gx_device_color *cptr)
{
gx_color_tile *tile = cptr->colors.pattern.p_tile;
if (tile != 0) {
uint index = tile->index;
RELOC_TYPED_OFFSET_PTR(gx_device_color, colors.pattern.p_tile, index);
}
RELOC_USING(st_dc_pure_masked, vptr, size);
}
|
Exec Code
| 0
|
static RELOC_PTRS_WITH(dc_pattern_reloc_ptrs, gx_device_color *cptr)
{
gx_color_tile *tile = cptr->colors.pattern.p_tile;
if (tile != 0) {
uint index = tile->index;
RELOC_TYPED_OFFSET_PTR(gx_device_color, colors.pattern.p_tile, index);
}
RELOC_USING(st_dc_pure_masked, vptr, size);
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,301
|
static RELOC_PTRS_WITH(dc_masked_reloc_ptrs, gx_device_color *cptr)
{
gx_color_tile *mask = cptr->mask.m_tile;
RELOC_SUPER(gx_device_color, st_client_color, ccolor);
if (mask != 0) {
uint index = mask->index;
RELOC_TYPED_OFFSET_PTR(gx_device_color, mask.m_tile, index);
}
}
|
Exec Code
| 0
|
static RELOC_PTRS_WITH(dc_masked_reloc_ptrs, gx_device_color *cptr)
{
gx_color_tile *mask = cptr->mask.m_tile;
RELOC_SUPER(gx_device_color, st_client_color, ccolor);
if (mask != 0) {
uint index = mask->index;
RELOC_TYPED_OFFSET_PTR(gx_device_color, mask.m_tile, index);
}
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,302
|
static RELOC_PTRS_WITH(dc_colored_masked_reloc_ptrs, gx_device_color *cptr)
{
RELOC_SUPER(gx_device_color, st_client_color, ccolor);
if (cptr->colors.colored.c_ht != 0) {
RELOC_PTR(gx_device_color, colors.colored.c_ht);
}
}
|
Exec Code
| 0
|
static RELOC_PTRS_WITH(dc_colored_masked_reloc_ptrs, gx_device_color *cptr)
{
RELOC_SUPER(gx_device_color, st_client_color, ccolor);
if (cptr->colors.colored.c_ht != 0) {
RELOC_PTR(gx_device_color, colors.colored.c_ht);
}
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,303
|
static RELOC_PTRS_WITH(dc_devn_masked_reloc_ptrs, gx_device_color *cptr)
{
RELOC_SUPER(gx_device_color, st_client_color, ccolor);
(void)cptr; /* Avoid unused warning */
}
|
Exec Code
| 0
|
static RELOC_PTRS_WITH(dc_devn_masked_reloc_ptrs, gx_device_color *cptr)
{
RELOC_SUPER(gx_device_color, st_client_color, ccolor);
(void)cptr; /* Avoid unused warning */
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,304
|
bitmap_paint(gs_image_enum * pen, gs_data_image_t * pim,
const gs_depth_bitmap * pbitmap, gs_gstate * pgs)
{
uint raster = pbitmap->raster;
uint nbytes = (pim->Width * pbitmap->pix_depth + 7) >> 3;
uint used;
const byte *dp = pbitmap->data;
int n;
int code = 0, code1;
if (nbytes == raster)
code = gs_image_next(pen, dp, nbytes * pim->Height, &used);
else
for (n = pim->Height; n > 0 && code >= 0; dp += raster, --n)
code = gs_image_next(pen, dp, nbytes, &used);
code1 = gs_image_cleanup_and_free_enum(pen, pgs);
if (code >= 0 && code1 < 0)
code = code1;
return code;
}
|
Exec Code
| 0
|
bitmap_paint(gs_image_enum * pen, gs_data_image_t * pim,
const gs_depth_bitmap * pbitmap, gs_gstate * pgs)
{
uint raster = pbitmap->raster;
uint nbytes = (pim->Width * pbitmap->pix_depth + 7) >> 3;
uint used;
const byte *dp = pbitmap->data;
int n;
int code = 0, code1;
if (nbytes == raster)
code = gs_image_next(pen, dp, nbytes * pim->Height, &used);
else
for (n = pim->Height; n > 0 && code >= 0; dp += raster, --n)
code = gs_image_next(pen, dp, nbytes, &used);
code1 = gs_image_cleanup_and_free_enum(pen, pgs);
if (code >= 0 && code1 < 0)
code = code1;
return code;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,305
|
clamp_pattern_bbox(gs_pattern1_instance_t * pinst, gs_rect * pbbox,
int width, int height, const gs_matrix * pmat)
{
double xstep = pinst->templat.XStep;
double ystep = pinst->templat.YStep;
double xmin = pbbox->q.x;
double xmax = pbbox->p.x;
double ymin = pbbox->q.y;
double ymax = pbbox->p.y;
int ixpat, iypat, iystart;
double xpat, ypat;
double xlower, xupper, ylower, yupper;
double xdev, ydev;
gs_rect dev_page, pat_page;
gs_point dev_pat_origin, dev_step;
int code;
double xepsilon = FLT_EPSILON * width;
double yepsilon = FLT_EPSILON * height;
/*
* Scan across the page. We determine the region to be scanned
* by working in the pattern coordinate space. This is logically
* simpler since XStep and YStep are on axis in the pattern space.
*/
/* But, since we are starting below bottom left, and 'incrementing' by
* xstep and ystep, make sure they are not negative, or we will be in
* a very long loop indeed.
*/
if (xstep < 0)
xstep *= -1;
if (ystep < 0)
ystep *= -1;
/*
* Convert the page dimensions from device coordinates into the
* pattern coordinate frame.
*/
dev_page.p.x = dev_page.p.y = 0;
dev_page.q.x = width;
dev_page.q.y = height;
code = gs_bbox_transform_inverse(&dev_page, pmat, &pat_page);
if (code < 0)
return code;
/*
* Determine the location of the pattern origin in device coordinates.
*/
gs_point_transform(0.0, 0.0, pmat, &dev_pat_origin);
/*
* Determine our starting point. We start with a postion that puts the
* pattern below and to the left of the page (in pattern space) and scan
* until the pattern is above and right of the page.
*/
ixpat = (int) floor((pat_page.p.x - pinst->templat.BBox.q.x) / xstep);
iystart = (int) floor((pat_page.p.y - pinst->templat.BBox.q.y) / ystep);
/* Now do the scan */
for (; ; ixpat++) {
xpat = ixpat * xstep;
for (iypat = iystart; ; iypat++) {
ypat = iypat * ystep;
/*
* Calculate the shift in the pattern's location.
*/
gs_point_transform(xpat, ypat, pmat, &dev_step);
xdev = dev_step.x - dev_pat_origin.x;
ydev = dev_step.y - dev_pat_origin.y;
/*
* Check if the pattern bounding box intersects the page.
*/
xlower = (xdev + pbbox->p.x > 0) ? pbbox->p.x : -xdev;
xupper = (xdev + pbbox->q.x < width) ? pbbox->q.x : -xdev + width;
ylower = (ydev + pbbox->p.y > 0) ? pbbox->p.y : -ydev;
yupper = (ydev + pbbox->q.y < height) ? pbbox->q.y : -ydev + height;
/* The use of floating point in these calculations causes us
* problems. Values which go through the calculation without ever
* being 'large' retain more accuracy in the lower bits than ones
* which momentarily become large. This is seen in bug 694528
* where a y value of 0.00017... becomes either 0 when 8000 is
* first added to it, then subtracted. This can lead to yupper
* and ylower being different.
*
* The "fix" implemented here is to amend the following test to
* ensure that the region found is larger that 'epsilon'. The
* epsilon values are calculated to reflect the floating point
* innacuracies at the appropriate range.
*/
if (xlower + xepsilon < xupper && ylower + yepsilon < yupper) {
/*
* The pattern intersects the page. Expand required area if
* needed.
*/
if (xlower < xmin)
xmin = xlower;
if (xupper > xmax)
xmax = xupper;
if (ylower < ymin)
ymin = ylower;
if (yupper > ymax)
ymax = yupper;
}
if (ypat > pat_page.q.y - pinst->templat.BBox.p.y)
break;
}
if (xpat > pat_page.q.x - pinst->templat.BBox.p.x)
break;
}
/* Update the bounding box. */
if (xmin < xmax && ymin < ymax) {
pbbox->p.x = xmin;
pbbox->q.x = xmax;
pbbox->p.y = ymin;
pbbox->q.y = ymax;
} else {
/* The pattern is never on the page. Set bbox = 1, 1 */
pbbox->p.x = pbbox->p.y = 0;
pbbox->q.x = pbbox->q.y = 1;
}
return 0;
}
|
Exec Code
| 0
|
clamp_pattern_bbox(gs_pattern1_instance_t * pinst, gs_rect * pbbox,
int width, int height, const gs_matrix * pmat)
{
double xstep = pinst->templat.XStep;
double ystep = pinst->templat.YStep;
double xmin = pbbox->q.x;
double xmax = pbbox->p.x;
double ymin = pbbox->q.y;
double ymax = pbbox->p.y;
int ixpat, iypat, iystart;
double xpat, ypat;
double xlower, xupper, ylower, yupper;
double xdev, ydev;
gs_rect dev_page, pat_page;
gs_point dev_pat_origin, dev_step;
int code;
double xepsilon = FLT_EPSILON * width;
double yepsilon = FLT_EPSILON * height;
/*
* Scan across the page. We determine the region to be scanned
* by working in the pattern coordinate space. This is logically
* simpler since XStep and YStep are on axis in the pattern space.
*/
/* But, since we are starting below bottom left, and 'incrementing' by
* xstep and ystep, make sure they are not negative, or we will be in
* a very long loop indeed.
*/
if (xstep < 0)
xstep *= -1;
if (ystep < 0)
ystep *= -1;
/*
* Convert the page dimensions from device coordinates into the
* pattern coordinate frame.
*/
dev_page.p.x = dev_page.p.y = 0;
dev_page.q.x = width;
dev_page.q.y = height;
code = gs_bbox_transform_inverse(&dev_page, pmat, &pat_page);
if (code < 0)
return code;
/*
* Determine the location of the pattern origin in device coordinates.
*/
gs_point_transform(0.0, 0.0, pmat, &dev_pat_origin);
/*
* Determine our starting point. We start with a postion that puts the
* pattern below and to the left of the page (in pattern space) and scan
* until the pattern is above and right of the page.
*/
ixpat = (int) floor((pat_page.p.x - pinst->templat.BBox.q.x) / xstep);
iystart = (int) floor((pat_page.p.y - pinst->templat.BBox.q.y) / ystep);
/* Now do the scan */
for (; ; ixpat++) {
xpat = ixpat * xstep;
for (iypat = iystart; ; iypat++) {
ypat = iypat * ystep;
/*
* Calculate the shift in the pattern's location.
*/
gs_point_transform(xpat, ypat, pmat, &dev_step);
xdev = dev_step.x - dev_pat_origin.x;
ydev = dev_step.y - dev_pat_origin.y;
/*
* Check if the pattern bounding box intersects the page.
*/
xlower = (xdev + pbbox->p.x > 0) ? pbbox->p.x : -xdev;
xupper = (xdev + pbbox->q.x < width) ? pbbox->q.x : -xdev + width;
ylower = (ydev + pbbox->p.y > 0) ? pbbox->p.y : -ydev;
yupper = (ydev + pbbox->q.y < height) ? pbbox->q.y : -ydev + height;
/* The use of floating point in these calculations causes us
* problems. Values which go through the calculation without ever
* being 'large' retain more accuracy in the lower bits than ones
* which momentarily become large. This is seen in bug 694528
* where a y value of 0.00017... becomes either 0 when 8000 is
* first added to it, then subtracted. This can lead to yupper
* and ylower being different.
*
* The "fix" implemented here is to amend the following test to
* ensure that the region found is larger that 'epsilon'. The
* epsilon values are calculated to reflect the floating point
* innacuracies at the appropriate range.
*/
if (xlower + xepsilon < xupper && ylower + yepsilon < yupper) {
/*
* The pattern intersects the page. Expand required area if
* needed.
*/
if (xlower < xmin)
xmin = xlower;
if (xupper > xmax)
xmax = xupper;
if (ylower < ymin)
ymin = ylower;
if (yupper > ymax)
ymax = yupper;
}
if (ypat > pat_page.q.y - pinst->templat.BBox.p.y)
break;
}
if (xpat > pat_page.q.x - pinst->templat.BBox.p.x)
break;
}
/* Update the bounding box. */
if (xmin < xmax && ymin < ymax) {
pbbox->p.x = xmin;
pbbox->q.x = xmax;
pbbox->p.y = ymin;
pbbox->q.y = ymax;
} else {
/* The pattern is never on the page. Set bbox = 1, 1 */
pbbox->p.x = pbbox->p.y = 0;
pbbox->q.x = pbbox->q.y = 1;
}
return 0;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,306
|
compute_inst_matrix(gs_pattern1_instance_t * pinst, gs_gstate * saved,
gs_rect * pbbox, int width, int height)
{
float xx, xy, yx, yy, dx, dy, temp;
int code;
code = gs_bbox_transform(&pinst->templat.BBox, &ctm_only(saved), pbbox);
if (code < 0)
return code;
/*
* Adjust saved.ctm to map the bbox origin to pixels.
*/
dx = pbbox->p.x - floor(pbbox->p.x + 0.5);
dy = pbbox->p.y - floor(pbbox->p.y + 0.5);
pbbox->p.x -= dx;
pbbox->p.y -= dy;
pbbox->q.x -= dx;
pbbox->q.y -= dy;
if (saved->ctm.txy_fixed_valid) {
code = gx_translate_to_fixed(saved, float2fixed_rounded(saved->ctm.tx - dx),
float2fixed_rounded(saved->ctm.ty - dy));
} else { /* the ctm didn't fit in a fixed. Just adjust the float values */
saved->ctm.tx -= dx;
saved->ctm.ty -= dy;
/* not sure if this is needed for patterns, but lifted from gx_translate_to_fixed */
code = gx_path_translate(saved->path, float2fixed(-dx), float2fixed(-dy));
}
if (code < 0)
return code;
/* The stepping matrix : */
xx = pinst->templat.XStep * saved->ctm.xx;
xy = pinst->templat.XStep * saved->ctm.xy;
yx = pinst->templat.YStep * saved->ctm.yx;
yy = pinst->templat.YStep * saved->ctm.yy;
/* Adjust the stepping matrix so all coefficients are >= 0. */
if (xx == 0 || yy == 0) { /* We know that both xy and yx are non-zero. */
temp = xx, xx = yx, yx = temp;
temp = xy, xy = yy, yy = temp;
}
if (xx < 0)
xx = -xx, xy = -xy;
if (yy < 0)
yx = -yx, yy = -yy;
/* Now xx > 0, yy > 0. */
pinst->step_matrix.xx = xx;
pinst->step_matrix.xy = xy;
pinst->step_matrix.yx = yx;
pinst->step_matrix.yy = yy;
pinst->step_matrix.tx = saved->ctm.tx;
pinst->step_matrix.ty = saved->ctm.ty;
/*
* Some applications produce patterns that are larger than the page.
* If the bounding box for the pattern is larger than the page. clamp
* the pattern to the page size.
*/
if ((pbbox->q.x - pbbox->p.x > width || pbbox->q.y - pbbox->p.y > height))
code = clamp_pattern_bbox(pinst, pbbox, width,
height, &ctm_only(saved));
return code;
}
|
Exec Code
| 0
|
compute_inst_matrix(gs_pattern1_instance_t * pinst, gs_gstate * saved,
gs_rect * pbbox, int width, int height)
{
float xx, xy, yx, yy, dx, dy, temp;
int code;
code = gs_bbox_transform(&pinst->templat.BBox, &ctm_only(saved), pbbox);
if (code < 0)
return code;
/*
* Adjust saved.ctm to map the bbox origin to pixels.
*/
dx = pbbox->p.x - floor(pbbox->p.x + 0.5);
dy = pbbox->p.y - floor(pbbox->p.y + 0.5);
pbbox->p.x -= dx;
pbbox->p.y -= dy;
pbbox->q.x -= dx;
pbbox->q.y -= dy;
if (saved->ctm.txy_fixed_valid) {
code = gx_translate_to_fixed(saved, float2fixed_rounded(saved->ctm.tx - dx),
float2fixed_rounded(saved->ctm.ty - dy));
} else { /* the ctm didn't fit in a fixed. Just adjust the float values */
saved->ctm.tx -= dx;
saved->ctm.ty -= dy;
/* not sure if this is needed for patterns, but lifted from gx_translate_to_fixed */
code = gx_path_translate(saved->path, float2fixed(-dx), float2fixed(-dy));
}
if (code < 0)
return code;
/* The stepping matrix : */
xx = pinst->templat.XStep * saved->ctm.xx;
xy = pinst->templat.XStep * saved->ctm.xy;
yx = pinst->templat.YStep * saved->ctm.yx;
yy = pinst->templat.YStep * saved->ctm.yy;
/* Adjust the stepping matrix so all coefficients are >= 0. */
if (xx == 0 || yy == 0) { /* We know that both xy and yx are non-zero. */
temp = xx, xx = yx, yx = temp;
temp = xy, xy = yy, yy = temp;
}
if (xx < 0)
xx = -xx, xy = -xy;
if (yy < 0)
yx = -yx, yy = -yy;
/* Now xx > 0, yy > 0. */
pinst->step_matrix.xx = xx;
pinst->step_matrix.xy = xy;
pinst->step_matrix.yx = yx;
pinst->step_matrix.yy = yy;
pinst->step_matrix.tx = saved->ctm.tx;
pinst->step_matrix.ty = saved->ctm.ty;
/*
* Some applications produce patterns that are larger than the page.
* If the bounding box for the pattern is larger than the page. clamp
* the pattern to the page size.
*/
if ((pbbox->q.x - pbbox->p.x > width || pbbox->q.y - pbbox->p.y > height))
code = clamp_pattern_bbox(pinst, pbbox, width,
height, &ctm_only(saved));
return code;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,307
|
free_pixmap_pattern(
gs_memory_t * pmem,
void * pvpinst,
client_name_t cname
)
{
gs_pattern1_instance_t *pinst = (gs_pattern1_instance_t *)pvpinst;
pixmap_info *ppmap = pinst->templat.client_data;
ppmap->free_proc(pmem, pvpinst, cname);
gs_free_object(pmem, ppmap, cname);
}
|
Exec Code
| 0
|
free_pixmap_pattern(
gs_memory_t * pmem,
void * pvpinst,
client_name_t cname
)
{
gs_pattern1_instance_t *pinst = (gs_pattern1_instance_t *)pvpinst;
pixmap_info *ppmap = pinst->templat.client_data;
ppmap->free_proc(pmem, pvpinst, cname);
gs_free_object(pmem, ppmap, cname);
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,308
|
gs_cspace_build_Pattern1(gs_color_space ** ppcspace,
gs_color_space * pbase_cspace, gs_memory_t * pmem)
{
gs_color_space *pcspace = 0;
if (pbase_cspace != 0) {
if (gs_color_space_num_components(pbase_cspace) < 0) /* Pattern space */
return_error(gs_error_rangecheck);
}
pcspace = gs_cspace_alloc(pmem, &gs_color_space_type_Pattern);
if (pcspace == NULL)
return_error(gs_error_VMerror);
if (pbase_cspace != 0) {
pcspace->params.pattern.has_base_space = true;
/* reference to base space shifts from pgs to pcs with no net change */
pcspace->base_space = pbase_cspace;
} else
pcspace->params.pattern.has_base_space = false;
*ppcspace = pcspace;
return 0;
}
|
Exec Code
| 0
|
gs_cspace_build_Pattern1(gs_color_space ** ppcspace,
gs_color_space * pbase_cspace, gs_memory_t * pmem)
{
gs_color_space *pcspace = 0;
if (pbase_cspace != 0) {
if (gs_color_space_num_components(pbase_cspace) < 0) /* Pattern space */
return_error(gs_error_rangecheck);
}
pcspace = gs_cspace_alloc(pmem, &gs_color_space_type_Pattern);
if (pcspace == NULL)
return_error(gs_error_VMerror);
if (pbase_cspace != 0) {
pcspace->params.pattern.has_base_space = true;
/* reference to base space shifts from pgs to pcs with no net change */
pcspace->base_space = pbase_cspace;
} else
pcspace->params.pattern.has_base_space = false;
*ppcspace = pcspace;
return 0;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,309
|
gs_dc_get_pattern_id(const gx_device_color *pdevc)
{
if (!(gx_dc_is_pattern1_color(pdevc)))
return gs_no_id;
if (pdevc->colors.pattern.p_tile == NULL)
return gs_no_id;
return pdevc->colors.pattern.p_tile->id;
}
|
Exec Code
| 0
|
gs_dc_get_pattern_id(const gx_device_color *pdevc)
{
if (!(gx_dc_is_pattern1_color(pdevc)))
return gs_no_id;
if (pdevc->colors.pattern.p_tile == NULL)
return gs_no_id;
return pdevc->colors.pattern.p_tile->id;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,310
|
gs_getpattern(const gs_client_color * pcc)
{
const gs_pattern_instance_t *pinst = pcc->pattern;
return (pinst == 0 || pinst->type != &gs_pattern1_type ? 0 :
&((const gs_pattern1_instance_t *)pinst)->templat);
}
|
Exec Code
| 0
|
gs_getpattern(const gs_client_color * pcc)
{
const gs_pattern_instance_t *pinst = pcc->pattern;
return (pinst == 0 || pinst->type != &gs_pattern1_type ? 0 :
&((const gs_pattern1_instance_t *)pinst)->templat);
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,311
|
gs_makepixmappattern(
gs_client_color * pcc,
const gs_depth_bitmap * pbitmap,
bool mask,
const gs_matrix * pmat,
long id,
gs_color_space * pcspace,
uint white_index,
gs_gstate * pgs,
gs_memory_t * mem
)
{
gs_pattern1_template_t pat;
pixmap_info *ppmap;
gs_matrix mat, smat;
int code;
/* check that the data is legitimate */
if ((mask) || (pcspace == 0)) {
if (pbitmap->pix_depth != 1)
return_error(gs_error_rangecheck);
pcspace = 0;
} else if (gs_color_space_get_index(pcspace) != gs_color_space_index_Indexed)
return_error(gs_error_rangecheck);
if (pbitmap->num_comps != 1)
return_error(gs_error_rangecheck);
/* allocate and initialize a pixmap_info structure for the paint proc */
if (mem == 0)
mem = gs_gstate_memory(pgs);
ppmap = gs_alloc_struct(mem,
pixmap_info,
&st_pixmap_info,
"makepximappattern"
);
if (ppmap == 0)
return_error(gs_error_VMerror);
ppmap->bitmap = *pbitmap;
ppmap->pcspace = pcspace;
ppmap->white_index = white_index;
/* set up the client pattern structure */
gs_pattern1_init(&pat);
uid_set_UniqueID(&pat.uid, (id == no_UniqueID) ? gs_next_ids(mem, 1) : id);
pat.PaintType = (mask ? 2 : 1);
pat.TilingType = 1;
pat.BBox.p.x = 0;
pat.BBox.p.y = 0;
pat.BBox.q.x = pbitmap->size.x;
pat.BBox.q.y = pbitmap->size.y;
pat.XStep = (float)pbitmap->size.x;
pat.YStep = (float)pbitmap->size.y;
pat.PaintProc = (mask ? pixmap_remap_mask_pattern : pixmap_remap_image_pattern);
pat.client_data = ppmap;
/* set the ctm to be the identity */
gs_currentmatrix(pgs, &smat);
gs_make_identity(&mat);
gs_setmatrix(pgs, &mat);
/* build the pattern, restore the previous matrix */
if (pmat == NULL)
pmat = &mat;
if ((code = gs_makepattern(pcc, &pat, pmat, pgs, mem)) != 0)
gs_free_object(mem, ppmap, "makebitmappattern_xform");
else {
/*
* If this is not a masked pattern and if the white pixel index
* is outside of the representable range, we don't need to go to
* the trouble of accumulating a mask that will just be all 1s.
* Also, patterns that use transparency don't need a mask since
* the alpha plane of the transparency buffers will be used.
*/
gs_pattern1_instance_t *pinst =
(gs_pattern1_instance_t *)pcc->pattern;
if (!mask && (white_index >= (1 << pbitmap->pix_depth)))
pinst->uses_mask = false;
/* overwrite the free procedure for the pattern instance */
ppmap->free_proc = pinst->rc.free;
pinst->rc.free = free_pixmap_pattern;
/*
* Since the PaintProcs don't reference the saved color space or
* color, clear these so that there isn't an extra retained
* reference to the Pattern object.
*/
code = gs_setgray(pinst->saved, 0.0);
}
gs_setmatrix(pgs, &smat);
return code;
}
|
Exec Code
| 0
|
gs_makepixmappattern(
gs_client_color * pcc,
const gs_depth_bitmap * pbitmap,
bool mask,
const gs_matrix * pmat,
long id,
gs_color_space * pcspace,
uint white_index,
gs_gstate * pgs,
gs_memory_t * mem
)
{
gs_pattern1_template_t pat;
pixmap_info *ppmap;
gs_matrix mat, smat;
int code;
/* check that the data is legitimate */
if ((mask) || (pcspace == 0)) {
if (pbitmap->pix_depth != 1)
return_error(gs_error_rangecheck);
pcspace = 0;
} else if (gs_color_space_get_index(pcspace) != gs_color_space_index_Indexed)
return_error(gs_error_rangecheck);
if (pbitmap->num_comps != 1)
return_error(gs_error_rangecheck);
/* allocate and initialize a pixmap_info structure for the paint proc */
if (mem == 0)
mem = gs_gstate_memory(pgs);
ppmap = gs_alloc_struct(mem,
pixmap_info,
&st_pixmap_info,
"makepximappattern"
);
if (ppmap == 0)
return_error(gs_error_VMerror);
ppmap->bitmap = *pbitmap;
ppmap->pcspace = pcspace;
ppmap->white_index = white_index;
/* set up the client pattern structure */
gs_pattern1_init(&pat);
uid_set_UniqueID(&pat.uid, (id == no_UniqueID) ? gs_next_ids(mem, 1) : id);
pat.PaintType = (mask ? 2 : 1);
pat.TilingType = 1;
pat.BBox.p.x = 0;
pat.BBox.p.y = 0;
pat.BBox.q.x = pbitmap->size.x;
pat.BBox.q.y = pbitmap->size.y;
pat.XStep = (float)pbitmap->size.x;
pat.YStep = (float)pbitmap->size.y;
pat.PaintProc = (mask ? pixmap_remap_mask_pattern : pixmap_remap_image_pattern);
pat.client_data = ppmap;
/* set the ctm to be the identity */
gs_currentmatrix(pgs, &smat);
gs_make_identity(&mat);
gs_setmatrix(pgs, &mat);
/* build the pattern, restore the previous matrix */
if (pmat == NULL)
pmat = &mat;
if ((code = gs_makepattern(pcc, &pat, pmat, pgs, mem)) != 0)
gs_free_object(mem, ppmap, "makebitmappattern_xform");
else {
/*
* If this is not a masked pattern and if the white pixel index
* is outside of the representable range, we don't need to go to
* the trouble of accumulating a mask that will just be all 1s.
* Also, patterns that use transparency don't need a mask since
* the alpha plane of the transparency buffers will be used.
*/
gs_pattern1_instance_t *pinst =
(gs_pattern1_instance_t *)pcc->pattern;
if (!mask && (white_index >= (1 << pbitmap->pix_depth)))
pinst->uses_mask = false;
/* overwrite the free procedure for the pattern instance */
ppmap->free_proc = pinst->rc.free;
pinst->rc.free = free_pixmap_pattern;
/*
* Since the PaintProcs don't reference the saved color space or
* color, clear these so that there isn't an extra retained
* reference to the Pattern object.
*/
code = gs_setgray(pinst->saved, 0.0);
}
gs_setmatrix(pgs, &smat);
return code;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,312
|
gs_pattern1_get_pattern(const gs_pattern_instance_t *pinst)
{
return (const gs_pattern_template_t *)
&((const gs_pattern1_instance_t *)pinst)->templat;
}
|
Exec Code
| 0
|
gs_pattern1_get_pattern(const gs_pattern_instance_t *pinst)
{
return (const gs_pattern_template_t *)
&((const gs_pattern1_instance_t *)pinst)->templat;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,313
|
gs_pattern1_set_color(const gs_client_color * pcc, gs_gstate * pgs)
{
gs_pattern1_instance_t * pinst = (gs_pattern1_instance_t *)pcc->pattern;
gs_pattern1_template_t * ptmplt = &pinst->templat;
if (ptmplt->PaintType == 2) {
const gs_color_space *pcs = gs_currentcolorspace_inline(pgs);
pcs = pcs->base_space;
return pcs->type->set_overprint(pcs, pgs);
} else {
gs_overprint_params_t params;
params.retain_any_comps = false;
pgs->effective_overprint_mode = 0;
return gs_gstate_update_overprint(pgs, ¶ms);
}
}
|
Exec Code
| 0
|
gs_pattern1_set_color(const gs_client_color * pcc, gs_gstate * pgs)
{
gs_pattern1_instance_t * pinst = (gs_pattern1_instance_t *)pcc->pattern;
gs_pattern1_template_t * ptmplt = &pinst->templat;
if (ptmplt->PaintType == 2) {
const gs_color_space *pcs = gs_currentcolorspace_inline(pgs);
pcs = pcs->base_space;
return pcs->type->set_overprint(pcs, pgs);
} else {
gs_overprint_params_t params;
params.retain_any_comps = false;
pgs->effective_overprint_mode = 0;
return gs_gstate_update_overprint(pgs, ¶ms);
}
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,314
|
gs_pattern1_uses_base_space(const gs_pattern_template_t *ptemp)
{
return ((const gs_pattern1_template_t *)ptemp)->PaintType == 2;
}
|
Exec Code
| 0
|
gs_pattern1_uses_base_space(const gs_pattern_template_t *ptemp)
{
return ((const gs_pattern1_template_t *)ptemp)->PaintType == 2;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,315
|
gx_dc_binary_masked_equal(const gx_device_color * pdevc1,
const gx_device_color * pdevc2)
{
return (*gx_dc_type_ht_binary->equal) (pdevc1, pdevc2) &&
pdevc1->mask.id == pdevc2->mask.id;
}
|
Exec Code
| 0
|
gx_dc_binary_masked_equal(const gx_device_color * pdevc1,
const gx_device_color * pdevc2)
{
return (*gx_dc_type_ht_binary->equal) (pdevc1, pdevc2) &&
pdevc1->mask.id == pdevc2->mask.id;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,316
|
gx_dc_binary_masked_get_dev_halftone(const gx_device_color * pdevc)
{
return pdevc->colors.binary.b_ht;
}
|
Exec Code
| 0
|
gx_dc_binary_masked_get_dev_halftone(const gx_device_color * pdevc)
{
return pdevc->colors.binary.b_ht;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,317
|
gx_dc_binary_masked_load(gx_device_color * pdevc, const gs_gstate * pgs,
gx_device * dev, gs_color_select_t select)
{
int code = (*gx_dc_type_data_ht_binary.load) (pdevc, pgs, dev, select);
if (code < 0)
return code;
FINISH_PATTERN_LOAD
}
|
Exec Code
| 0
|
gx_dc_binary_masked_load(gx_device_color * pdevc, const gs_gstate * pgs,
gx_device * dev, gs_color_select_t select)
{
int code = (*gx_dc_type_data_ht_binary.load) (pdevc, pgs, dev, select);
if (code < 0)
return code;
FINISH_PATTERN_LOAD
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,318
|
gx_dc_colored_masked_equal(const gx_device_color * pdevc1,
const gx_device_color * pdevc2)
{
return (*gx_dc_type_ht_colored->equal) (pdevc1, pdevc2) &&
pdevc1->mask.id == pdevc2->mask.id;
}
|
Exec Code
| 0
|
gx_dc_colored_masked_equal(const gx_device_color * pdevc1,
const gx_device_color * pdevc2)
{
return (*gx_dc_type_ht_colored->equal) (pdevc1, pdevc2) &&
pdevc1->mask.id == pdevc2->mask.id;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,319
|
gx_dc_colored_masked_get_dev_halftone(const gx_device_color * pdevc)
{
return pdevc->colors.colored.c_ht;
}
|
Exec Code
| 0
|
gx_dc_colored_masked_get_dev_halftone(const gx_device_color * pdevc)
{
return pdevc->colors.colored.c_ht;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,320
|
gx_dc_devn_masked_equal(const gx_device_color * pdevc1,
const gx_device_color * pdevc2)
{
return (*gx_dc_type_devn->equal) (pdevc1, pdevc2) &&
pdevc1->mask.id == pdevc2->mask.id;
}
|
Exec Code
| 0
|
gx_dc_devn_masked_equal(const gx_device_color * pdevc1,
const gx_device_color * pdevc2)
{
return (*gx_dc_type_devn->equal) (pdevc1, pdevc2) &&
pdevc1->mask.id == pdevc2->mask.id;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,321
|
gx_dc_devn_masked_load(gx_device_color * pdevc, const gs_gstate * pgs,
gx_device * dev, gs_color_select_t select)
{
int code = (*gx_dc_type_data_devn.load) (pdevc, pgs, dev, select);
if (code < 0)
return code;
FINISH_PATTERN_LOAD
}
|
Exec Code
| 0
|
gx_dc_devn_masked_load(gx_device_color * pdevc, const gs_gstate * pgs,
gx_device * dev, gs_color_select_t select)
{
int code = (*gx_dc_type_data_devn.load) (pdevc, pgs, dev, select);
if (code < 0)
return code;
FINISH_PATTERN_LOAD
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,322
|
gx_dc_is_pattern1_color(const gx_device_color *pdevc)
{
return (pdevc->type == &gx_dc_pattern || pdevc->type == &gx_dc_pattern_trans);
}
|
Exec Code
| 0
|
gx_dc_is_pattern1_color(const gx_device_color *pdevc)
{
return (pdevc->type == &gx_dc_pattern || pdevc->type == &gx_dc_pattern_trans);
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,323
|
gx_dc_is_pattern1_color_clist_based(const gx_device_color *pdevc)
{
if (!(gx_dc_is_pattern1_color(pdevc)))
return false;
return gx_pattern_tile_is_clist(pdevc->colors.pattern.p_tile);
}
|
Exec Code
| 0
|
gx_dc_is_pattern1_color_clist_based(const gx_device_color *pdevc)
{
if (!(gx_dc_is_pattern1_color(pdevc)))
return false;
return gx_pattern_tile_is_clist(pdevc->colors.pattern.p_tile);
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,324
|
gx_dc_pattern_equal(const gx_device_color * pdevc1,
const gx_device_color * pdevc2)
{
return pdevc2->type == pdevc1->type &&
pdevc1->phase.x == pdevc2->phase.x &&
pdevc1->phase.y == pdevc2->phase.y &&
pdevc1->mask.id == pdevc2->mask.id;
}
|
Exec Code
| 0
|
gx_dc_pattern_equal(const gx_device_color * pdevc1,
const gx_device_color * pdevc2)
{
return pdevc2->type == pdevc1->type &&
pdevc1->phase.x == pdevc2->phase.x &&
pdevc1->phase.y == pdevc2->phase.y &&
pdevc1->mask.id == pdevc2->mask.id;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,325
|
gx_dc_pattern_get_dev_halftone(const gx_device_color * pdevc)
{
return 0;
}
|
Exec Code
| 0
|
gx_dc_pattern_get_dev_halftone(const gx_device_color * pdevc)
{
return 0;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,326
|
gx_dc_pattern_get_nonzero_comps(
const gx_device_color * pdevc_ignored,
const gx_device * dev_ignored,
gx_color_index * pcomp_bits_ignored )
{
return 1;
}
|
Exec Code
| 0
|
gx_dc_pattern_get_nonzero_comps(
const gx_device_color * pdevc_ignored,
const gx_device * dev_ignored,
gx_color_index * pcomp_bits_ignored )
{
return 1;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,327
|
gx_dc_pattern_load(gx_device_color * pdevc, const gs_gstate * pgs,
gx_device * dev, gs_color_select_t select)
{
int code = 0;
FINISH_PATTERN_LOAD
}
|
Exec Code
| 0
|
gx_dc_pattern_load(gx_device_color * pdevc, const gs_gstate * pgs,
gx_device * dev, gs_color_select_t select)
{
int code = 0;
FINISH_PATTERN_LOAD
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,328
|
gx_dc_pattern_read(
gx_device_color * pdevc,
const gs_gstate * pgs,
const gx_device_color * prior_devc,
const gx_device * dev,
int64_t offset,
const byte * data,
uint size,
gs_memory_t * mem )
{
gx_dc_serialized_tile_t buf;
int size_b, size_c = -1;
const byte *dp = data;
int left = size;
int64_t offset1 = offset;
gx_color_tile *ptile;
int code, l;
tile_trans_clist_info_t trans_info = { { { 0 } } };
int cache_space_needed;
if (offset == 0) {
pdevc->mask.id = gx_no_bitmap_id;
pdevc->mask.m_tile = NULL;
if (size == 0) {
/* Null pattern. */
pdevc->type = &gx_dc_pattern;
pdevc->colors.pattern.p_tile = NULL;
pdevc->mask.id = gs_no_id;
return 0;
}
if (size == sizeof(gs_id)) {
/* A special case for restoring a known (cached) pattern :
read the tile id only. */
gs_id id; /* Ensure data size == sizeof(gs_id). */
memcpy(&id, dp, sizeof(id));
pdevc->type = &gx_dc_pattern;
pdevc->mask.id = id; /* See gx_dc_pattern_load, gx_pattern_cache_lookup. */
return size;
}
if (sizeof(buf) > size) {
/* For a while we require the client to provide enough buffer size. */
return_error(gs_error_unregistered); /* Must not happen. */
}
memcpy(&buf, dp, sizeof(buf));
dp += sizeof(buf);
left -= sizeof(buf);
offset1 += sizeof(buf);
if ((buf.flags & TILE_USES_TRANSP) && !(buf.flags & TILE_IS_CLIST)){
if (sizeof(buf) + sizeof(tile_trans_clist_info_t) > size) {
return_error(gs_error_unregistered); /* Must not happen. */
}
memcpy(&trans_info, dp, sizeof(trans_info));
dp += sizeof(trans_info);
left -= sizeof(trans_info);
offset1 += sizeof(trans_info);
/* limit our upper bound to avoid int overflow */
cache_space_needed = trans_info.planestride > (0x7fffffff / 6) ? 0x7fff0000 :
trans_info.planestride * trans_info.n_chan;
} else {
/* the following works for raster or clist patterns */
cache_space_needed = buf.size_b + buf.size_c;
}
gx_pattern_cache_ensure_space((gs_gstate *)pgs, cache_space_needed);
code = gx_pattern_cache_get_entry((gs_gstate *)pgs, /* Break 'const'. */
buf.id, &ptile);
if (code < 0)
return code;
gx_pattern_cache_update_used((gs_gstate *)pgs, cache_space_needed);
ptile->bits_used = cache_space_needed;
pdevc->type = &gx_dc_pattern;
pdevc->colors.pattern.p_tile = ptile;
ptile->id = buf.id;
pdevc->mask.id = buf.id;
ptile->step_matrix = buf.step_matrix;
ptile->bbox = buf.bbox;
ptile->depth = buf.flags & TILE_DEPTH_MASK;
ptile->tiling_type = (buf.flags & TILE_TYPE_MASK)>>TILE_TYPE_SHIFT;
ptile->is_simple = !!(buf.flags & TILE_IS_SIMPLE);
ptile->has_overlap = !!(buf.flags & TILE_HAS_OVERLAP);
ptile->blending_mode = buf.blending_mode;
ptile->is_dummy = 0;
if (!(buf.flags & TILE_IS_CLIST)) {
if (buf.flags & TILE_USES_TRANSP){
/* Make a new ttrans object */
ptile->ttrans = new_pattern_trans_buff(mem);
/* trans_info was loaded above */
ptile->ttrans->height = trans_info.height;
ptile->ttrans->n_chan = trans_info.n_chan;
ptile->ttrans->has_tags = trans_info.has_tags;
ptile->ttrans->pdev14 = NULL;
ptile->ttrans->planestride = trans_info.planestride;
ptile->ttrans->rect.p.x = trans_info.rect.p.x;
ptile->ttrans->rect.p.y = trans_info.rect.p.y;
ptile->ttrans->rect.q.x = trans_info.rect.q.x;
ptile->ttrans->rect.q.y = trans_info.rect.q.y;
ptile->ttrans->rowstride = trans_info.rowstride;
ptile->ttrans->width = trans_info.width;
pdevc->type = &gx_dc_pattern_trans;
if_debug2m('v', pgs->memory,
"[v*] Reading trans tile from clist into cache, uid = %ld id = %ld \n",
ptile->uid.id, ptile->id);
code = gx_dc_pattern_read_trans_buff(ptile, offset1, dp, left, mem);
if (code < 0)
return code;
return code + sizeof(buf)+sizeof(trans_info);
} else {
code = gx_dc_pattern_read_raster(ptile, &buf, offset1, dp, left, mem);
if (code < 0)
return code;
return code + sizeof(buf);
}
}
/* Here is where we read back from the clist */
size_b = buf.size_b;
size_c = buf.size_c;
ptile->tbits.size.x = size_b; /* HACK: Use unrelated field for saving size_b between calls. */
ptile->tbits.size.y = size_c; /* HACK: Use unrelated field for saving size_c between calls. */
{
gs_gstate state;
gs_pattern1_instance_t inst;
memset(&state, 0, sizeof(state));
memset(&inst, 0, sizeof(inst));
/* NB: Currently PaintType 2 can't pass here. */
state.device = (gx_device *)dev; /* Break 'const'. */
inst.templat.PaintType = 1;
inst.size.x = buf.size.x;
inst.size.y = buf.size.y;
inst.saved = &state;
inst.is_clist = !!(buf.flags & TILE_IS_CLIST); /* tell gx_pattern_accum_alloc to use clist */
ptile->cdev = (gx_device_clist *)gx_pattern_accum_alloc(mem, mem,
&inst, "gx_dc_pattern_read");
if (ptile->cdev == NULL)
return_error(gs_error_VMerror);
ptile->cdev->common.page_uses_transparency = !!(buf.flags & TILE_USES_TRANSP);
code = dev_proc(&ptile->cdev->writer, open_device)((gx_device *)&ptile->cdev->writer);
if (code < 0)
return code;
}
} else {
ptile = pdevc->colors.pattern.p_tile;
if (ptile->ttrans != NULL)
return gx_dc_pattern_read_trans_buff(ptile, offset1, dp, left, mem);
if (ptile->cdev == NULL)
return gx_dc_pattern_read_raster(ptile, NULL, offset1, dp, left, mem);
size_b = ptile->tbits.size.x;
}
if (offset1 <= sizeof(buf) + size_b) {
l = min(left, size_b - (offset1 - sizeof(buf)));
code = clist_put_data(ptile->cdev, 0, offset1 - sizeof(buf), dp, l);
if (code < 0)
return code;
l = code;
left -= l;
offset1 += l;
dp += l;
ptile->cdev->common.page_bfile_end_pos = offset1 - sizeof(buf);
}
if (left > 0) {
l = left;
code = clist_put_data(ptile->cdev, 1, offset1 - sizeof(buf) - size_b, dp, l);
if (code < 0)
return code;
l = code;
left -= l;
}
return size - left;
}
|
Exec Code
| 0
|
gx_dc_pattern_read(
gx_device_color * pdevc,
const gs_gstate * pgs,
const gx_device_color * prior_devc,
const gx_device * dev,
int64_t offset,
const byte * data,
uint size,
gs_memory_t * mem )
{
gx_dc_serialized_tile_t buf;
int size_b, size_c = -1;
const byte *dp = data;
int left = size;
int64_t offset1 = offset;
gx_color_tile *ptile;
int code, l;
tile_trans_clist_info_t trans_info = { { { 0 } } };
int cache_space_needed;
if (offset == 0) {
pdevc->mask.id = gx_no_bitmap_id;
pdevc->mask.m_tile = NULL;
if (size == 0) {
/* Null pattern. */
pdevc->type = &gx_dc_pattern;
pdevc->colors.pattern.p_tile = NULL;
pdevc->mask.id = gs_no_id;
return 0;
}
if (size == sizeof(gs_id)) {
/* A special case for restoring a known (cached) pattern :
read the tile id only. */
gs_id id; /* Ensure data size == sizeof(gs_id). */
memcpy(&id, dp, sizeof(id));
pdevc->type = &gx_dc_pattern;
pdevc->mask.id = id; /* See gx_dc_pattern_load, gx_pattern_cache_lookup. */
return size;
}
if (sizeof(buf) > size) {
/* For a while we require the client to provide enough buffer size. */
return_error(gs_error_unregistered); /* Must not happen. */
}
memcpy(&buf, dp, sizeof(buf));
dp += sizeof(buf);
left -= sizeof(buf);
offset1 += sizeof(buf);
if ((buf.flags & TILE_USES_TRANSP) && !(buf.flags & TILE_IS_CLIST)){
if (sizeof(buf) + sizeof(tile_trans_clist_info_t) > size) {
return_error(gs_error_unregistered); /* Must not happen. */
}
memcpy(&trans_info, dp, sizeof(trans_info));
dp += sizeof(trans_info);
left -= sizeof(trans_info);
offset1 += sizeof(trans_info);
/* limit our upper bound to avoid int overflow */
cache_space_needed = trans_info.planestride > (0x7fffffff / 6) ? 0x7fff0000 :
trans_info.planestride * trans_info.n_chan;
} else {
/* the following works for raster or clist patterns */
cache_space_needed = buf.size_b + buf.size_c;
}
gx_pattern_cache_ensure_space((gs_gstate *)pgs, cache_space_needed);
code = gx_pattern_cache_get_entry((gs_gstate *)pgs, /* Break 'const'. */
buf.id, &ptile);
if (code < 0)
return code;
gx_pattern_cache_update_used((gs_gstate *)pgs, cache_space_needed);
ptile->bits_used = cache_space_needed;
pdevc->type = &gx_dc_pattern;
pdevc->colors.pattern.p_tile = ptile;
ptile->id = buf.id;
pdevc->mask.id = buf.id;
ptile->step_matrix = buf.step_matrix;
ptile->bbox = buf.bbox;
ptile->depth = buf.flags & TILE_DEPTH_MASK;
ptile->tiling_type = (buf.flags & TILE_TYPE_MASK)>>TILE_TYPE_SHIFT;
ptile->is_simple = !!(buf.flags & TILE_IS_SIMPLE);
ptile->has_overlap = !!(buf.flags & TILE_HAS_OVERLAP);
ptile->blending_mode = buf.blending_mode;
ptile->is_dummy = 0;
if (!(buf.flags & TILE_IS_CLIST)) {
if (buf.flags & TILE_USES_TRANSP){
/* Make a new ttrans object */
ptile->ttrans = new_pattern_trans_buff(mem);
/* trans_info was loaded above */
ptile->ttrans->height = trans_info.height;
ptile->ttrans->n_chan = trans_info.n_chan;
ptile->ttrans->has_tags = trans_info.has_tags;
ptile->ttrans->pdev14 = NULL;
ptile->ttrans->planestride = trans_info.planestride;
ptile->ttrans->rect.p.x = trans_info.rect.p.x;
ptile->ttrans->rect.p.y = trans_info.rect.p.y;
ptile->ttrans->rect.q.x = trans_info.rect.q.x;
ptile->ttrans->rect.q.y = trans_info.rect.q.y;
ptile->ttrans->rowstride = trans_info.rowstride;
ptile->ttrans->width = trans_info.width;
pdevc->type = &gx_dc_pattern_trans;
if_debug2m('v', pgs->memory,
"[v*] Reading trans tile from clist into cache, uid = %ld id = %ld \n",
ptile->uid.id, ptile->id);
code = gx_dc_pattern_read_trans_buff(ptile, offset1, dp, left, mem);
if (code < 0)
return code;
return code + sizeof(buf)+sizeof(trans_info);
} else {
code = gx_dc_pattern_read_raster(ptile, &buf, offset1, dp, left, mem);
if (code < 0)
return code;
return code + sizeof(buf);
}
}
/* Here is where we read back from the clist */
size_b = buf.size_b;
size_c = buf.size_c;
ptile->tbits.size.x = size_b; /* HACK: Use unrelated field for saving size_b between calls. */
ptile->tbits.size.y = size_c; /* HACK: Use unrelated field for saving size_c between calls. */
{
gs_gstate state;
gs_pattern1_instance_t inst;
memset(&state, 0, sizeof(state));
memset(&inst, 0, sizeof(inst));
/* NB: Currently PaintType 2 can't pass here. */
state.device = (gx_device *)dev; /* Break 'const'. */
inst.templat.PaintType = 1;
inst.size.x = buf.size.x;
inst.size.y = buf.size.y;
inst.saved = &state;
inst.is_clist = !!(buf.flags & TILE_IS_CLIST); /* tell gx_pattern_accum_alloc to use clist */
ptile->cdev = (gx_device_clist *)gx_pattern_accum_alloc(mem, mem,
&inst, "gx_dc_pattern_read");
if (ptile->cdev == NULL)
return_error(gs_error_VMerror);
ptile->cdev->common.page_uses_transparency = !!(buf.flags & TILE_USES_TRANSP);
code = dev_proc(&ptile->cdev->writer, open_device)((gx_device *)&ptile->cdev->writer);
if (code < 0)
return code;
}
} else {
ptile = pdevc->colors.pattern.p_tile;
if (ptile->ttrans != NULL)
return gx_dc_pattern_read_trans_buff(ptile, offset1, dp, left, mem);
if (ptile->cdev == NULL)
return gx_dc_pattern_read_raster(ptile, NULL, offset1, dp, left, mem);
size_b = ptile->tbits.size.x;
}
if (offset1 <= sizeof(buf) + size_b) {
l = min(left, size_b - (offset1 - sizeof(buf)));
code = clist_put_data(ptile->cdev, 0, offset1 - sizeof(buf), dp, l);
if (code < 0)
return code;
l = code;
left -= l;
offset1 += l;
dp += l;
ptile->cdev->common.page_bfile_end_pos = offset1 - sizeof(buf);
}
if (left > 0) {
l = left;
code = clist_put_data(ptile->cdev, 1, offset1 - sizeof(buf) - size_b, dp, l);
if (code < 0)
return code;
l = code;
left -= l;
}
return size - left;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,329
|
gx_dc_pattern_read_raster(gx_color_tile *ptile, const gx_dc_serialized_tile_t *buf,
int64_t offset, const byte *data, uint size, gs_memory_t *mem)
{
const byte *dp = data;
int left = size;
int64_t offset1 = offset;
int size_b, size_c;
if (buf != NULL) {
size_b = buf->size_b;
size_c = buf->size_c;
ptile->tbits.data = gs_alloc_bytes(mem, size_b - sizeof(gx_strip_bitmap), "gx_dc_pattern_read_raster");
if (ptile->tbits.data == NULL)
return_error(gs_error_VMerror);
if (size_c) {
ptile->tmask.data = gs_alloc_bytes(mem, size_c - sizeof(gx_strip_bitmap), "gx_dc_pattern_read_raster");
if (ptile->tmask.data == NULL)
return_error(gs_error_VMerror);
} else
ptile->tmask.data = NULL;
ptile->cdev = NULL;
} else {
size_b = gs_object_size(mem, ptile->tbits.data) + sizeof(gx_strip_bitmap);
size_c = ptile->tmask.data != NULL ? gs_object_size(mem, ptile->tmask.data) + sizeof(gx_strip_bitmap) : 0;
}
/* Read tbits : */
if (offset1 <= sizeof(gx_dc_serialized_tile_t) + sizeof(gx_strip_bitmap)) {
int l = min(sizeof(gx_strip_bitmap), left);
byte *save = ptile->tbits.data;
memcpy((byte*)&ptile->tbits + (offset1 - sizeof(gx_dc_serialized_tile_t)), dp, l);
ptile->tbits.data = save;
left -= l;
offset1 += l;
dp += l;
}
if (left == 0)
return size; /* we've consumed it all */
if (offset1 <= sizeof(gx_dc_serialized_tile_t) + size_b) {
int l = min(sizeof(gx_dc_serialized_tile_t) + size_b - offset1, left);
memcpy(ptile->tbits.data +
(offset1 - sizeof(gx_dc_serialized_tile_t) - sizeof(gx_strip_bitmap)), dp, l);
left -= l;
offset1 += l;
dp += l;
}
if (left == 0 || size_c == 0)
return size - left;
/* Read tmask : */
if (offset1 <= sizeof(gx_dc_serialized_tile_t) + size_b + sizeof(gx_strip_bitmap)) {
int l = min(sizeof(gx_dc_serialized_tile_t) + size_b + sizeof(gx_strip_bitmap) - offset1, left);
byte *save = ptile->tmask.data;
memcpy((byte*)&ptile->tmask + (offset1 - sizeof(gx_dc_serialized_tile_t) - size_b), dp, l);
ptile->tmask.data = save;
left -= l;
offset1 += l;
dp += l;
}
if (left == 0)
return size;
if (offset1 <= sizeof(gx_dc_serialized_tile_t) + size_b + size_c) {
int l = min(sizeof(gx_dc_serialized_tile_t) + size_b + size_c - offset1, left);
memcpy(ptile->tmask.data +
(offset1 - sizeof(gx_dc_serialized_tile_t) - size_b - sizeof(gx_strip_bitmap)), dp, l);
left -= l;
}
return size - left;
}
|
Exec Code
| 0
|
gx_dc_pattern_read_raster(gx_color_tile *ptile, const gx_dc_serialized_tile_t *buf,
int64_t offset, const byte *data, uint size, gs_memory_t *mem)
{
const byte *dp = data;
int left = size;
int64_t offset1 = offset;
int size_b, size_c;
if (buf != NULL) {
size_b = buf->size_b;
size_c = buf->size_c;
ptile->tbits.data = gs_alloc_bytes(mem, size_b - sizeof(gx_strip_bitmap), "gx_dc_pattern_read_raster");
if (ptile->tbits.data == NULL)
return_error(gs_error_VMerror);
if (size_c) {
ptile->tmask.data = gs_alloc_bytes(mem, size_c - sizeof(gx_strip_bitmap), "gx_dc_pattern_read_raster");
if (ptile->tmask.data == NULL)
return_error(gs_error_VMerror);
} else
ptile->tmask.data = NULL;
ptile->cdev = NULL;
} else {
size_b = gs_object_size(mem, ptile->tbits.data) + sizeof(gx_strip_bitmap);
size_c = ptile->tmask.data != NULL ? gs_object_size(mem, ptile->tmask.data) + sizeof(gx_strip_bitmap) : 0;
}
/* Read tbits : */
if (offset1 <= sizeof(gx_dc_serialized_tile_t) + sizeof(gx_strip_bitmap)) {
int l = min(sizeof(gx_strip_bitmap), left);
byte *save = ptile->tbits.data;
memcpy((byte*)&ptile->tbits + (offset1 - sizeof(gx_dc_serialized_tile_t)), dp, l);
ptile->tbits.data = save;
left -= l;
offset1 += l;
dp += l;
}
if (left == 0)
return size; /* we've consumed it all */
if (offset1 <= sizeof(gx_dc_serialized_tile_t) + size_b) {
int l = min(sizeof(gx_dc_serialized_tile_t) + size_b - offset1, left);
memcpy(ptile->tbits.data +
(offset1 - sizeof(gx_dc_serialized_tile_t) - sizeof(gx_strip_bitmap)), dp, l);
left -= l;
offset1 += l;
dp += l;
}
if (left == 0 || size_c == 0)
return size - left;
/* Read tmask : */
if (offset1 <= sizeof(gx_dc_serialized_tile_t) + size_b + sizeof(gx_strip_bitmap)) {
int l = min(sizeof(gx_dc_serialized_tile_t) + size_b + sizeof(gx_strip_bitmap) - offset1, left);
byte *save = ptile->tmask.data;
memcpy((byte*)&ptile->tmask + (offset1 - sizeof(gx_dc_serialized_tile_t) - size_b), dp, l);
ptile->tmask.data = save;
left -= l;
offset1 += l;
dp += l;
}
if (left == 0)
return size;
if (offset1 <= sizeof(gx_dc_serialized_tile_t) + size_b + size_c) {
int l = min(sizeof(gx_dc_serialized_tile_t) + size_b + size_c - offset1, left);
memcpy(ptile->tmask.data +
(offset1 - sizeof(gx_dc_serialized_tile_t) - size_b - sizeof(gx_strip_bitmap)), dp, l);
left -= l;
}
return size - left;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,330
|
gx_dc_pattern_save_dc(
const gx_device_color * pdevc,
gx_device_color_saved * psdc )
{
psdc->type = pdevc->type;
if (pdevc->ccolor_valid) {
psdc->colors.pattern.id = pdevc->ccolor.pattern->pattern_id;
psdc->colors.pattern.phase = pdevc->phase;
} else {
/* The client color has been changed to a non-pattern color,
but device color has not been created yet.
*/
psdc->colors.pattern.id = gs_no_id;
psdc->colors.pattern.phase.x = psdc->colors.pattern.phase.y = 0;
}
}
|
Exec Code
| 0
|
gx_dc_pattern_save_dc(
const gx_device_color * pdevc,
gx_device_color_saved * psdc )
{
psdc->type = pdevc->type;
if (pdevc->ccolor_valid) {
psdc->colors.pattern.id = pdevc->ccolor.pattern->pattern_id;
psdc->colors.pattern.phase = pdevc->phase;
} else {
/* The client color has been changed to a non-pattern color,
but device color has not been created yet.
*/
psdc->colors.pattern.id = gs_no_id;
psdc->colors.pattern.phase.x = psdc->colors.pattern.phase.y = 0;
}
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,331
|
gx_dc_pattern_trans_write_raster(gx_color_tile *ptile, int64_t offset, byte *data, uint *psize)
{
int size, size_h;
byte *dp = data;
int left = *psize;
int64_t offset1 = offset;
unsigned char *ptr;
size_h = sizeof(gx_dc_serialized_tile_t) + sizeof(tile_trans_clist_info_t);
/* Everything that we need to handle the transparent tile */
size = size_h + ptile->ttrans->n_chan * ptile->ttrans->planestride;
if (ptile->ttrans->has_tags)
size += ptile->ttrans->planestride;
/* data is sent with NULL if the clist writer just wanted the size */
if (data == NULL) {
*psize = size;
return 0;
}
if (offset1 == 0) { /* Serialize tile parameters: */
gx_dc_serialized_tile_t buf;
tile_trans_clist_info_t trans_info;
buf.id = ptile->id;
buf.size.x = 0; /* fixme: don't write with raster patterns. */
buf.size.y = 0; /* fixme: don't write with raster patterns. */
buf.size_b = size - size_h;
buf.size_c = 0;
buf.flags = ptile->depth
| TILE_USES_TRANSP
| (ptile->tiling_type<<TILE_TYPE_SHIFT)
| (ptile->is_simple ? TILE_IS_SIMPLE : 0)
| (ptile->has_overlap ? TILE_HAS_OVERLAP : 0);
buf.step_matrix = ptile->step_matrix;
buf.bbox = ptile->bbox;
buf.blending_mode = ptile->blending_mode;
if (sizeof(buf) > left) {
/* For a while we require the client to provide enough buffer size. */
return_error(gs_error_unregistered); /* Must not happen. */
}
memcpy(dp, &buf, sizeof(buf));
left -= sizeof(buf);
dp += sizeof(buf);
offset1 += sizeof(buf);
/* Do the transparency information now */
trans_info.height = ptile->ttrans->height;
trans_info.n_chan = ptile->ttrans->n_chan;
trans_info.has_tags = ptile->ttrans->has_tags;
trans_info.planestride = ptile->ttrans->planestride;
trans_info.rect.p.x = ptile->ttrans->rect.p.x;
trans_info.rect.p.y = ptile->ttrans->rect.p.y;
trans_info.rect.q.x = ptile->ttrans->rect.q.x;
trans_info.rect.q.y = ptile->ttrans->rect.q.y;
trans_info.rowstride = ptile->ttrans->rowstride;
trans_info.width = ptile->ttrans->width;
if (sizeof(trans_info) > left) {
return_error(gs_error_unregistered); /* Must not happen. */
}
memcpy(dp, &trans_info, sizeof(trans_info));
left -= sizeof(trans_info);
dp += sizeof(trans_info);
offset1 += sizeof(trans_info);
}
/* Now do the transparency tile data itself. Note that it may be split up
* in the writing stage if it is large. The size include n_chan + the tag
* plane if this buffer has_tags. */
/* check if we have written it all */
if (offset1 <= size) {
/* Get the most that we can write */
int u = min(size, left);
/* copy that amount */
ptr = ptile->ttrans->transbytes;
memcpy(dp, ptr + (offset1 - size_h), u);
}
return 0;
}
|
Exec Code
| 0
|
gx_dc_pattern_trans_write_raster(gx_color_tile *ptile, int64_t offset, byte *data, uint *psize)
{
int size, size_h;
byte *dp = data;
int left = *psize;
int64_t offset1 = offset;
unsigned char *ptr;
size_h = sizeof(gx_dc_serialized_tile_t) + sizeof(tile_trans_clist_info_t);
/* Everything that we need to handle the transparent tile */
size = size_h + ptile->ttrans->n_chan * ptile->ttrans->planestride;
if (ptile->ttrans->has_tags)
size += ptile->ttrans->planestride;
/* data is sent with NULL if the clist writer just wanted the size */
if (data == NULL) {
*psize = size;
return 0;
}
if (offset1 == 0) { /* Serialize tile parameters: */
gx_dc_serialized_tile_t buf;
tile_trans_clist_info_t trans_info;
buf.id = ptile->id;
buf.size.x = 0; /* fixme: don't write with raster patterns. */
buf.size.y = 0; /* fixme: don't write with raster patterns. */
buf.size_b = size - size_h;
buf.size_c = 0;
buf.flags = ptile->depth
| TILE_USES_TRANSP
| (ptile->tiling_type<<TILE_TYPE_SHIFT)
| (ptile->is_simple ? TILE_IS_SIMPLE : 0)
| (ptile->has_overlap ? TILE_HAS_OVERLAP : 0);
buf.step_matrix = ptile->step_matrix;
buf.bbox = ptile->bbox;
buf.blending_mode = ptile->blending_mode;
if (sizeof(buf) > left) {
/* For a while we require the client to provide enough buffer size. */
return_error(gs_error_unregistered); /* Must not happen. */
}
memcpy(dp, &buf, sizeof(buf));
left -= sizeof(buf);
dp += sizeof(buf);
offset1 += sizeof(buf);
/* Do the transparency information now */
trans_info.height = ptile->ttrans->height;
trans_info.n_chan = ptile->ttrans->n_chan;
trans_info.has_tags = ptile->ttrans->has_tags;
trans_info.planestride = ptile->ttrans->planestride;
trans_info.rect.p.x = ptile->ttrans->rect.p.x;
trans_info.rect.p.y = ptile->ttrans->rect.p.y;
trans_info.rect.q.x = ptile->ttrans->rect.q.x;
trans_info.rect.q.y = ptile->ttrans->rect.q.y;
trans_info.rowstride = ptile->ttrans->rowstride;
trans_info.width = ptile->ttrans->width;
if (sizeof(trans_info) > left) {
return_error(gs_error_unregistered); /* Must not happen. */
}
memcpy(dp, &trans_info, sizeof(trans_info));
left -= sizeof(trans_info);
dp += sizeof(trans_info);
offset1 += sizeof(trans_info);
}
/* Now do the transparency tile data itself. Note that it may be split up
* in the writing stage if it is large. The size include n_chan + the tag
* plane if this buffer has_tags. */
/* check if we have written it all */
if (offset1 <= size) {
/* Get the most that we can write */
int u = min(size, left);
/* copy that amount */
ptr = ptile->ttrans->transbytes;
memcpy(dp, ptr + (offset1 - size_h), u);
}
return 0;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,332
|
gx_dc_pattern_write(
const gx_device_color * pdevc,
const gx_device_color_saved * psdc,
const gx_device * dev,
int64_t offset,
byte * data,
uint * psize )
{
gx_color_tile *ptile = pdevc->colors.pattern.p_tile;
int size_b, size_c;
byte *dp = data;
int left = *psize;
int64_t offset1 = offset;
int code, l;
if (ptile == NULL)
return 0;
if (psdc->type == pdevc->type) {
if (psdc->colors.pattern.id == ptile->id) {
/* fixme : Do we need to check phase ? How ? */
return 1; /* Same as saved one, don't write. */
}
}
if (offset1 == 0 && left == sizeof(gs_id)) {
/* A special case for writing a known pattern :
Just write the tile id. */
gs_id id = ptile->id; /* Ensure sizeof(gs_id). */
if_debug2m('v', dev->memory,
"[v*] Writing trans tile ID into clist, uid = %ld id = %ld \n",
ptile->uid.id, ptile->id);
memcpy(dp, &ptile->id, sizeof(id));
*psize = sizeof(gs_id);
return 0;
}
/* Check if pattern has transparency object
If so then that is what we will stuff in
the clist */
if (ptile->ttrans != NULL) {
if_debug2m('v', dev->memory,
"[v*] Writing trans tile into clist, uid = %ld id = %ld \n",
ptile->uid.id, ptile->id);
return gx_dc_pattern_trans_write_raster(ptile, offset, data, psize);
}
if (ptile->cdev == NULL)
return gx_dc_pattern_write_raster(ptile, offset, data, psize, dev);
/* Here is where we write pattern-clist data */
size_b = clist_data_size(ptile->cdev, 0);
if (size_b < 0)
return_error(gs_error_unregistered);
size_c = clist_data_size(ptile->cdev, 1);
if (size_c < 0)
return_error(gs_error_unregistered);
if (data == NULL) {
*psize = sizeof(gx_dc_serialized_tile_t) + size_b + size_c;
return 0;
}
if (offset1 == 0) { /* Serialize tile parameters: */
gx_dc_serialized_tile_t buf;
buf.id = ptile->id;
buf.size.x = ptile->cdev->common.width;
buf.size.y = ptile->cdev->common.height;
buf.size_b = size_b;
buf.size_c = size_c;
buf.step_matrix = ptile->step_matrix;
buf.bbox = ptile->bbox;
buf.flags = ptile->depth
| TILE_IS_CLIST
| (ptile->tiling_type<<TILE_TYPE_SHIFT)
| (ptile->is_simple ? TILE_IS_SIMPLE : 0)
| (ptile->has_overlap ? TILE_HAS_OVERLAP : 0)
| (ptile->cdev->common.page_uses_transparency ? TILE_USES_TRANSP : 0);
buf.blending_mode = ptile->blending_mode; /* in case tile has transparency */
if (sizeof(buf) > left) {
/* For a while we require the client to provide enough buffer size. */
return_error(gs_error_unregistered); /* Must not happen. */
}
memcpy(dp, &buf, sizeof(gx_dc_serialized_tile_t));
left -= sizeof(buf);
dp += sizeof(buf);
offset1 += sizeof(buf);
}
if (offset1 <= sizeof(gx_dc_serialized_tile_t) + size_b) {
l = min(left, size_b - (offset1 - sizeof(gx_dc_serialized_tile_t)));
code = clist_get_data(ptile->cdev, 0, offset1 - sizeof(gx_dc_serialized_tile_t), dp, l);
if (code < 0)
return code;
left -= l;
offset1 += l;
dp += l;
}
if (left > 0) {
l = min(left, size_c - (offset1 - sizeof(gx_dc_serialized_tile_t) - size_b));
code = clist_get_data(ptile->cdev, 1, offset1 - sizeof(gx_dc_serialized_tile_t) - size_b, dp, l);
if (code < 0)
return code;
}
return 0;
}
|
Exec Code
| 0
|
gx_dc_pattern_write(
const gx_device_color * pdevc,
const gx_device_color_saved * psdc,
const gx_device * dev,
int64_t offset,
byte * data,
uint * psize )
{
gx_color_tile *ptile = pdevc->colors.pattern.p_tile;
int size_b, size_c;
byte *dp = data;
int left = *psize;
int64_t offset1 = offset;
int code, l;
if (ptile == NULL)
return 0;
if (psdc->type == pdevc->type) {
if (psdc->colors.pattern.id == ptile->id) {
/* fixme : Do we need to check phase ? How ? */
return 1; /* Same as saved one, don't write. */
}
}
if (offset1 == 0 && left == sizeof(gs_id)) {
/* A special case for writing a known pattern :
Just write the tile id. */
gs_id id = ptile->id; /* Ensure sizeof(gs_id). */
if_debug2m('v', dev->memory,
"[v*] Writing trans tile ID into clist, uid = %ld id = %ld \n",
ptile->uid.id, ptile->id);
memcpy(dp, &ptile->id, sizeof(id));
*psize = sizeof(gs_id);
return 0;
}
/* Check if pattern has transparency object
If so then that is what we will stuff in
the clist */
if (ptile->ttrans != NULL) {
if_debug2m('v', dev->memory,
"[v*] Writing trans tile into clist, uid = %ld id = %ld \n",
ptile->uid.id, ptile->id);
return gx_dc_pattern_trans_write_raster(ptile, offset, data, psize);
}
if (ptile->cdev == NULL)
return gx_dc_pattern_write_raster(ptile, offset, data, psize, dev);
/* Here is where we write pattern-clist data */
size_b = clist_data_size(ptile->cdev, 0);
if (size_b < 0)
return_error(gs_error_unregistered);
size_c = clist_data_size(ptile->cdev, 1);
if (size_c < 0)
return_error(gs_error_unregistered);
if (data == NULL) {
*psize = sizeof(gx_dc_serialized_tile_t) + size_b + size_c;
return 0;
}
if (offset1 == 0) { /* Serialize tile parameters: */
gx_dc_serialized_tile_t buf;
buf.id = ptile->id;
buf.size.x = ptile->cdev->common.width;
buf.size.y = ptile->cdev->common.height;
buf.size_b = size_b;
buf.size_c = size_c;
buf.step_matrix = ptile->step_matrix;
buf.bbox = ptile->bbox;
buf.flags = ptile->depth
| TILE_IS_CLIST
| (ptile->tiling_type<<TILE_TYPE_SHIFT)
| (ptile->is_simple ? TILE_IS_SIMPLE : 0)
| (ptile->has_overlap ? TILE_HAS_OVERLAP : 0)
| (ptile->cdev->common.page_uses_transparency ? TILE_USES_TRANSP : 0);
buf.blending_mode = ptile->blending_mode; /* in case tile has transparency */
if (sizeof(buf) > left) {
/* For a while we require the client to provide enough buffer size. */
return_error(gs_error_unregistered); /* Must not happen. */
}
memcpy(dp, &buf, sizeof(gx_dc_serialized_tile_t));
left -= sizeof(buf);
dp += sizeof(buf);
offset1 += sizeof(buf);
}
if (offset1 <= sizeof(gx_dc_serialized_tile_t) + size_b) {
l = min(left, size_b - (offset1 - sizeof(gx_dc_serialized_tile_t)));
code = clist_get_data(ptile->cdev, 0, offset1 - sizeof(gx_dc_serialized_tile_t), dp, l);
if (code < 0)
return code;
left -= l;
offset1 += l;
dp += l;
}
if (left > 0) {
l = min(left, size_c - (offset1 - sizeof(gx_dc_serialized_tile_t) - size_b));
code = clist_get_data(ptile->cdev, 1, offset1 - sizeof(gx_dc_serialized_tile_t) - size_b, dp, l);
if (code < 0)
return code;
}
return 0;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,333
|
gx_dc_pattern_write_raster(gx_color_tile *ptile, int64_t offset, byte *data,
uint *psize, const gx_device *dev)
{
int size_b, size_c;
byte *dp = data;
int left = *psize;
int64_t offset1 = offset;
size_b = sizeof(gx_strip_bitmap) +
ptile->tbits.size.y * ptile->tbits.raster * ptile->tbits.num_planes;
size_c = ptile->tmask.data ? sizeof(gx_strip_bitmap) + ptile->tmask.size.y * ptile->tmask.raster : 0;
if (data == NULL) {
*psize = sizeof(gx_dc_serialized_tile_t) + size_b + size_c;
return 0;
}
if (offset1 == 0) { /* Serialize tile parameters: */
#if defined(DEBUG) || defined(PACIFY_VALGRIND) || defined(MEMENTO)
gx_dc_serialized_tile_t buf = { 0 };
gx_strip_bitmap buf1 = { 0 };
#else
gx_dc_serialized_tile_t buf;
gx_strip_bitmap buf1;
#endif
buf.id = ptile->id;
buf.size.x = 0; /* fixme: don't write with raster patterns. */
buf.size.y = 0; /* fixme: don't write with raster patterns. */
buf.size_b = size_b;
buf.size_c = size_c;
buf.step_matrix = ptile->step_matrix;
buf.bbox = ptile->bbox;
buf.flags = ptile->depth
| (ptile->tiling_type<<TILE_TYPE_SHIFT)
| (ptile->is_simple ? TILE_IS_SIMPLE : 0)
| (ptile->has_overlap ? TILE_HAS_OVERLAP : 0);
if (sizeof(buf) > left) {
/* For a while we require the client to provide enough buffer size. */
return_error(gs_error_unregistered); /* Must not happen. */
}
memcpy(dp, &buf, sizeof(buf));
left -= sizeof(buf);
dp += sizeof(buf);
offset1 += sizeof(buf);
buf1 = ptile->tbits;
buf1.data = NULL; /* fixme: we don't need to write it actually. */
if (sizeof(buf1) > left) {
/* For a while we require the client to provide enough buffer size. */
return_error(gs_error_unregistered); /* Must not happen. */
}
memcpy(dp, &buf1, sizeof(buf1));
left -= sizeof(buf1);
dp += sizeof(buf1);
offset1 += sizeof(buf1);
}
if (offset1 <= sizeof(gx_dc_serialized_tile_t) + size_b) {
int l = min((size_b - sizeof(gx_strip_bitmap)) - (offset1 - sizeof(gx_dc_serialized_tile_t) - sizeof(gx_strip_bitmap)), left);
memcpy(dp, ptile->tbits.data + (offset1 - sizeof(gx_dc_serialized_tile_t) - sizeof(gx_strip_bitmap)), l);
left -= l;
dp += l;
offset1 += l;
}
if (left == 0)
return 0;
if (size_c == 0)
return 0;
if (offset1 <= sizeof(gx_dc_serialized_tile_t) + size_b + sizeof(gx_strip_bitmap)) {
gx_strip_bitmap buf;
if (left < sizeof(buf))
return_error(gs_error_unregistered); /* Not implemented yet because cmd_put_drawing_color provides a big buffer. */
buf = ptile->tmask;
buf.data = NULL; /* fixme: we don't need to write it actually. */
memcpy(dp, &buf, sizeof(buf));
left -= sizeof(buf);
dp += sizeof(buf);
offset1 += sizeof(buf);
}
if (offset1 <= sizeof(gx_dc_serialized_tile_t) + size_b + size_c) {
int l = min(size_c - sizeof(gx_strip_bitmap), left);
memcpy(dp, ptile->tmask.data + (offset1 - sizeof(gx_dc_serialized_tile_t) - size_b - sizeof(gx_strip_bitmap)), l);
}
return 0;
}
|
Exec Code
| 0
|
gx_dc_pattern_write_raster(gx_color_tile *ptile, int64_t offset, byte *data,
uint *psize, const gx_device *dev)
{
int size_b, size_c;
byte *dp = data;
int left = *psize;
int64_t offset1 = offset;
size_b = sizeof(gx_strip_bitmap) +
ptile->tbits.size.y * ptile->tbits.raster * ptile->tbits.num_planes;
size_c = ptile->tmask.data ? sizeof(gx_strip_bitmap) + ptile->tmask.size.y * ptile->tmask.raster : 0;
if (data == NULL) {
*psize = sizeof(gx_dc_serialized_tile_t) + size_b + size_c;
return 0;
}
if (offset1 == 0) { /* Serialize tile parameters: */
#if defined(DEBUG) || defined(PACIFY_VALGRIND) || defined(MEMENTO)
gx_dc_serialized_tile_t buf = { 0 };
gx_strip_bitmap buf1 = { 0 };
#else
gx_dc_serialized_tile_t buf;
gx_strip_bitmap buf1;
#endif
buf.id = ptile->id;
buf.size.x = 0; /* fixme: don't write with raster patterns. */
buf.size.y = 0; /* fixme: don't write with raster patterns. */
buf.size_b = size_b;
buf.size_c = size_c;
buf.step_matrix = ptile->step_matrix;
buf.bbox = ptile->bbox;
buf.flags = ptile->depth
| (ptile->tiling_type<<TILE_TYPE_SHIFT)
| (ptile->is_simple ? TILE_IS_SIMPLE : 0)
| (ptile->has_overlap ? TILE_HAS_OVERLAP : 0);
if (sizeof(buf) > left) {
/* For a while we require the client to provide enough buffer size. */
return_error(gs_error_unregistered); /* Must not happen. */
}
memcpy(dp, &buf, sizeof(buf));
left -= sizeof(buf);
dp += sizeof(buf);
offset1 += sizeof(buf);
buf1 = ptile->tbits;
buf1.data = NULL; /* fixme: we don't need to write it actually. */
if (sizeof(buf1) > left) {
/* For a while we require the client to provide enough buffer size. */
return_error(gs_error_unregistered); /* Must not happen. */
}
memcpy(dp, &buf1, sizeof(buf1));
left -= sizeof(buf1);
dp += sizeof(buf1);
offset1 += sizeof(buf1);
}
if (offset1 <= sizeof(gx_dc_serialized_tile_t) + size_b) {
int l = min((size_b - sizeof(gx_strip_bitmap)) - (offset1 - sizeof(gx_dc_serialized_tile_t) - sizeof(gx_strip_bitmap)), left);
memcpy(dp, ptile->tbits.data + (offset1 - sizeof(gx_dc_serialized_tile_t) - sizeof(gx_strip_bitmap)), l);
left -= l;
dp += l;
offset1 += l;
}
if (left == 0)
return 0;
if (size_c == 0)
return 0;
if (offset1 <= sizeof(gx_dc_serialized_tile_t) + size_b + sizeof(gx_strip_bitmap)) {
gx_strip_bitmap buf;
if (left < sizeof(buf))
return_error(gs_error_unregistered); /* Not implemented yet because cmd_put_drawing_color provides a big buffer. */
buf = ptile->tmask;
buf.data = NULL; /* fixme: we don't need to write it actually. */
memcpy(dp, &buf, sizeof(buf));
left -= sizeof(buf);
dp += sizeof(buf);
offset1 += sizeof(buf);
}
if (offset1 <= sizeof(gx_dc_serialized_tile_t) + size_b + size_c) {
int l = min(size_c - sizeof(gx_strip_bitmap), left);
memcpy(dp, ptile->tmask.data + (offset1 - sizeof(gx_dc_serialized_tile_t) - size_b - sizeof(gx_strip_bitmap)), l);
}
return 0;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,334
|
gx_dc_pure_masked_equal(const gx_device_color * pdevc1,
const gx_device_color * pdevc2)
{
return (*gx_dc_type_pure->equal) (pdevc1, pdevc2) &&
pdevc1->mask.id == pdevc2->mask.id;
}
|
Exec Code
| 0
|
gx_dc_pure_masked_equal(const gx_device_color * pdevc1,
const gx_device_color * pdevc2)
{
return (*gx_dc_type_pure->equal) (pdevc1, pdevc2) &&
pdevc1->mask.id == pdevc2->mask.id;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,335
|
gx_dc_pure_masked_get_dev_halftone(const gx_device_color * pdevc)
{
return 0;
}
|
Exec Code
| 0
|
gx_dc_pure_masked_get_dev_halftone(const gx_device_color * pdevc)
{
return 0;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,336
|
gx_dc_pure_masked_load(gx_device_color * pdevc, const gs_gstate * pgs,
gx_device * dev, gs_color_select_t select)
{
int code = (*gx_dc_type_data_pure.load) (pdevc, pgs, dev, select);
if (code < 0)
return code;
FINISH_PATTERN_LOAD
}
|
Exec Code
| 0
|
gx_dc_pure_masked_load(gx_device_color * pdevc, const gs_gstate * pgs,
gx_device * dev, gs_color_select_t select)
{
int code = (*gx_dc_type_data_pure.load) (pdevc, pgs, dev, select);
if (code < 0)
return code;
FINISH_PATTERN_LOAD
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,337
|
gx_pattern1_clist_has_trans(const gx_device_color *pdevc)
{
if (pdevc->colors.pattern.p_tile != NULL &&
pdevc->colors.pattern.p_tile->cdev != NULL) {
return pdevc->colors.pattern.p_tile->cdev->common.page_uses_transparency;
} else {
return 0;
}
}
|
Exec Code
| 0
|
gx_pattern1_clist_has_trans(const gx_device_color *pdevc)
{
if (pdevc->colors.pattern.p_tile != NULL &&
pdevc->colors.pattern.p_tile->cdev != NULL) {
return pdevc->colors.pattern.p_tile->cdev->common.page_uses_transparency;
} else {
return 0;
}
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,338
|
gx_pattern1_get_transptr(const gx_device_color *pdevc)
{
if (pdevc->colors.pattern.p_tile != NULL)
return pdevc->colors.pattern.p_tile->ttrans;
else
return NULL;
}
|
Exec Code
| 0
|
gx_pattern1_get_transptr(const gx_device_color *pdevc)
{
if (pdevc->colors.pattern.p_tile != NULL)
return pdevc->colors.pattern.p_tile->ttrans;
else
return NULL;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,339
|
gx_pattern_cache_lookup(gx_device_color * pdevc, const gs_gstate * pgs,
gx_device * dev, gs_color_select_t select)
{
gx_pattern_cache *pcache = pgs->pattern_cache;
gx_bitmap_id id = pdevc->mask.id;
if (id == gx_no_bitmap_id) {
color_set_null_pattern(pdevc);
return true;
}
if (pcache != 0) {
gx_color_tile *ctile = &pcache->tiles[id % pcache->num_tiles];
bool internal_accum = true;
if (pgs->have_pattern_streams) {
int code = dev_proc(dev, dev_spec_op)(dev, gxdso_pattern_load, NULL, id);
internal_accum = (code == 0);
if (code < 0)
return false;
}
if (ctile->id == id &&
ctile->is_dummy == !internal_accum
) {
int px = pgs->screen_phase[select].x;
int py = pgs->screen_phase[select].y;
if (gx_dc_is_pattern1_color(pdevc)) { /* colored */
pdevc->colors.pattern.p_tile = ctile;
# if 0 /* Debugged with Bug688308.ps and applying patterns after clist.
Bug688308.ps has a step_matrix much bigger than pattern bbox;
rep_width, rep_height can't be used as mod.
Would like to use step_matrix instead. */
color_set_phase_mod(pdevc, px, py,
ctile->tbits.rep_width,
ctile->tbits.rep_height);
# else
color_set_phase(pdevc, -px, -py);
# endif
}
pdevc->mask.m_tile =
(ctile->tmask.data == 0 ? (gx_color_tile *) 0 :
ctile);
pdevc->mask.m_phase.x = -px;
pdevc->mask.m_phase.y = -py;
return true;
}
}
return false;
}
|
Exec Code
| 0
|
gx_pattern_cache_lookup(gx_device_color * pdevc, const gs_gstate * pgs,
gx_device * dev, gs_color_select_t select)
{
gx_pattern_cache *pcache = pgs->pattern_cache;
gx_bitmap_id id = pdevc->mask.id;
if (id == gx_no_bitmap_id) {
color_set_null_pattern(pdevc);
return true;
}
if (pcache != 0) {
gx_color_tile *ctile = &pcache->tiles[id % pcache->num_tiles];
bool internal_accum = true;
if (pgs->have_pattern_streams) {
int code = dev_proc(dev, dev_spec_op)(dev, gxdso_pattern_load, NULL, id);
internal_accum = (code == 0);
if (code < 0)
return false;
}
if (ctile->id == id &&
ctile->is_dummy == !internal_accum
) {
int px = pgs->screen_phase[select].x;
int py = pgs->screen_phase[select].y;
if (gx_dc_is_pattern1_color(pdevc)) { /* colored */
pdevc->colors.pattern.p_tile = ctile;
# if 0 /* Debugged with Bug688308.ps and applying patterns after clist.
Bug688308.ps has a step_matrix much bigger than pattern bbox;
rep_width, rep_height can't be used as mod.
Would like to use step_matrix instead. */
color_set_phase_mod(pdevc, px, py,
ctile->tbits.rep_width,
ctile->tbits.rep_height);
# else
color_set_phase(pdevc, -px, -py);
# endif
}
pdevc->mask.m_tile =
(ctile->tmask.data == 0 ? (gx_color_tile *) 0 :
ctile);
pdevc->mask.m_phase.x = -px;
pdevc->mask.m_phase.y = -py;
return true;
}
}
return false;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,340
|
gx_pattern_procs_istrans(gx_device_color *pdevc)
{
return(pdevc->type == &gx_dc_pattern_trans);
}
|
Exec Code
| 0
|
gx_pattern_procs_istrans(gx_device_color *pdevc)
{
return(pdevc->type == &gx_dc_pattern_trans);
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,341
|
gx_set_pattern_procs_standard(gx_device_color *pdevc)
{
pdevc->type = &gx_dc_pattern;
return;
}
|
Exec Code
| 0
|
gx_set_pattern_procs_standard(gx_device_color *pdevc)
{
pdevc->type = &gx_dc_pattern;
return;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,342
|
gx_set_pattern_procs_trans(gx_device_color *pdevc)
{
pdevc->type = &gx_dc_pattern_trans;
return;
}
|
Exec Code
| 0
|
gx_set_pattern_procs_trans(gx_device_color *pdevc)
{
pdevc->type = &gx_dc_pattern_trans;
return;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,343
|
image_PaintProc(const gs_client_color * pcolor, gs_gstate * pgs)
{
const pixmap_info *ppmap = gs_getpattern(pcolor)->client_data;
const gs_depth_bitmap *pbitmap = &(ppmap->bitmap);
gs_image_enum *pen =
gs_image_enum_alloc(gs_gstate_memory(pgs), "image_PaintProc");
gs_color_space *pcspace;
gx_image_enum_common_t *pie;
/*
* If the image is transparent then we want to do image type4 processing.
* Otherwise we want to use image type 1 processing.
*/
int transparent = ppmap->white_index < (1 << (pbitmap->num_comps * pbitmap->pix_depth));
/*
* Note: gs_image1_t and gs_image4_t sre nearly identical structure
* definitions. From our point of view, the only significant difference
* is MaskColor in gs_image4_t. The fields are generally loaded using
* the gs_image1_t version of the union and then used for either type
* of image processing.
*/
union {
gs_image1_t i1;
gs_image4_t i4;
} image;
int code;
if (pen == 0)
return_error(gs_error_VMerror);
if (ppmap->pcspace == 0) {
pcspace = gs_cspace_new_DeviceGray(pgs->memory);
if (pcspace == NULL)
return_error(gs_error_VMerror);
} else
pcspace = ppmap->pcspace;
code = gs_gsave(pgs);
if (code < 0)
goto fail;
code = gs_setcolorspace(pgs, pcspace);
if (code < 0)
return code;
if (transparent)
gs_image4_t_init( (gs_image4_t *) &image, pcspace);
else
gs_image_t_init_adjust( (gs_image_t *) &image, pcspace, 0);
image.i1.Width = pbitmap->size.x;
image.i1.Height = pbitmap->size.y;
if (transparent) {
image.i4.MaskColor_is_range = false;
image.i4.MaskColor[0] = ppmap->white_index;
}
image.i1.Decode[0] = 0.0;
image.i1.Decode[1] = (float)((1 << pbitmap->pix_depth) - 1);
image.i1.BitsPerComponent = pbitmap->pix_depth;
/* backwards compatibility */
if (ppmap->pcspace == 0) {
image.i1.Decode[0] = 1.0;
image.i1.Decode[1] = 0.0;
}
if ( (code = gs_image_begin_typed( (const gs_image_common_t *)&image,
pgs,
false,
false,
&pie )) >= 0 &&
(code = gs_image_enum_init( pen,
pie,
(gs_data_image_t *)&image,
pgs )) >= 0 &&
(code = bitmap_paint(pen, (gs_data_image_t *) & image, pbitmap, pgs)) >= 0) {
return gs_grestore(pgs);
}
fail:
gs_free_object(gs_gstate_memory(pgs), pen, "image_PaintProc");
return code;
}
|
Exec Code
| 0
|
image_PaintProc(const gs_client_color * pcolor, gs_gstate * pgs)
{
const pixmap_info *ppmap = gs_getpattern(pcolor)->client_data;
const gs_depth_bitmap *pbitmap = &(ppmap->bitmap);
gs_image_enum *pen =
gs_image_enum_alloc(gs_gstate_memory(pgs), "image_PaintProc");
gs_color_space *pcspace;
gx_image_enum_common_t *pie;
/*
* If the image is transparent then we want to do image type4 processing.
* Otherwise we want to use image type 1 processing.
*/
int transparent = ppmap->white_index < (1 << (pbitmap->num_comps * pbitmap->pix_depth));
/*
* Note: gs_image1_t and gs_image4_t sre nearly identical structure
* definitions. From our point of view, the only significant difference
* is MaskColor in gs_image4_t. The fields are generally loaded using
* the gs_image1_t version of the union and then used for either type
* of image processing.
*/
union {
gs_image1_t i1;
gs_image4_t i4;
} image;
int code;
if (pen == 0)
return_error(gs_error_VMerror);
if (ppmap->pcspace == 0) {
pcspace = gs_cspace_new_DeviceGray(pgs->memory);
if (pcspace == NULL)
return_error(gs_error_VMerror);
} else
pcspace = ppmap->pcspace;
code = gs_gsave(pgs);
if (code < 0)
goto fail;
code = gs_setcolorspace(pgs, pcspace);
if (code < 0)
return code;
if (transparent)
gs_image4_t_init( (gs_image4_t *) &image, pcspace);
else
gs_image_t_init_adjust( (gs_image_t *) &image, pcspace, 0);
image.i1.Width = pbitmap->size.x;
image.i1.Height = pbitmap->size.y;
if (transparent) {
image.i4.MaskColor_is_range = false;
image.i4.MaskColor[0] = ppmap->white_index;
}
image.i1.Decode[0] = 0.0;
image.i1.Decode[1] = (float)((1 << pbitmap->pix_depth) - 1);
image.i1.BitsPerComponent = pbitmap->pix_depth;
/* backwards compatibility */
if (ppmap->pcspace == 0) {
image.i1.Decode[0] = 1.0;
image.i1.Decode[1] = 0.0;
}
if ( (code = gs_image_begin_typed( (const gs_image_common_t *)&image,
pgs,
false,
false,
&pie )) >= 0 &&
(code = gs_image_enum_init( pen,
pie,
(gs_data_image_t *)&image,
pgs )) >= 0 &&
(code = bitmap_paint(pen, (gs_data_image_t *) & image, pbitmap, pgs)) >= 0) {
return gs_grestore(pgs);
}
fail:
gs_free_object(gs_gstate_memory(pgs), pen, "image_PaintProc");
return code;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,344
|
mask_PaintProc(const gs_client_color * pcolor, gs_gstate * pgs)
{
const pixmap_info *ppmap = gs_getpattern(pcolor)->client_data;
const gs_depth_bitmap *pbitmap = &(ppmap->bitmap);
gs_image_enum *pen =
gs_image_enum_alloc(gs_gstate_memory(pgs), "mask_PaintProc");
gs_image1_t mask;
if (pen == 0)
return_error(gs_error_VMerror);
gs_image_t_init_mask(&mask, true);
mask.Width = pbitmap->size.x;
mask.Height = pbitmap->size.y;
gs_image_init(pen, &mask, false, false, pgs);
return bitmap_paint(pen, (gs_data_image_t *) & mask, pbitmap, pgs);
}
|
Exec Code
| 0
|
mask_PaintProc(const gs_client_color * pcolor, gs_gstate * pgs)
{
const pixmap_info *ppmap = gs_getpattern(pcolor)->client_data;
const gs_depth_bitmap *pbitmap = &(ppmap->bitmap);
gs_image_enum *pen =
gs_image_enum_alloc(gs_gstate_memory(pgs), "mask_PaintProc");
gs_image1_t mask;
if (pen == 0)
return_error(gs_error_VMerror);
gs_image_t_init_mask(&mask, true);
mask.Width = pbitmap->size.x;
mask.Height = pbitmap->size.y;
gs_image_init(pen, &mask, false, false, pgs);
return bitmap_paint(pen, (gs_data_image_t *) & mask, pbitmap, pgs);
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,345
|
int pixmap_high_level_pattern(gs_gstate * pgs)
{
gs_matrix m;
gs_rect bbox;
gs_fixed_rect clip_box;
int code;
gx_device_color *pdc = gs_currentdevicecolor_inline(pgs);
const gs_client_pattern *ppat = gs_getpattern(&pdc->ccolor);
gs_color_space *pcs;
gs_pattern1_instance_t *pinst =
(gs_pattern1_instance_t *)gs_currentcolor(pgs)->pattern;
const pixmap_info *ppmap = ppat->client_data;
code = gx_pattern_cache_add_dummy_entry(pgs, pinst, pgs->device->color_info.depth);
if (code < 0)
return code;
code = gs_gsave(pgs);
if (code < 0)
return code;
dev_proc(pgs->device, get_initial_matrix)(pgs->device, &m);
gs_setmatrix(pgs, &m);
code = gs_bbox_transform(&ppat->BBox, &ctm_only(pgs), &bbox);
if (code < 0) {
gs_grestore(pgs);
return code;
}
clip_box.p.x = float2fixed(bbox.p.x);
clip_box.p.y = float2fixed(bbox.p.y);
clip_box.q.x = float2fixed(bbox.q.x);
clip_box.q.y = float2fixed(bbox.q.y);
code = gx_clip_to_rectangle(pgs, &clip_box);
if (code < 0) {
gs_grestore(pgs);
return code;
}
{
pattern_accum_param_s param;
param.pinst = (void *)pinst;
param.graphics_state = (void *)pgs;
param.pinst_id = pinst->id;
code = dev_proc(pgs->device, dev_spec_op)(pgs->device,
gxdso_pattern_start_accum, ¶m, sizeof(pattern_accum_param_s));
}
if (code < 0) {
gs_grestore(pgs);
return code;
}
if (ppmap->pcspace != 0)
code = image_PaintProc(&pdc->ccolor, pgs);
else {
pcs = gs_cspace_new_DeviceGray(pgs->memory);
if (pcs == NULL)
return_error(gs_error_VMerror);
gs_setcolorspace(pgs, pcs);
code = mask_PaintProc(&pdc->ccolor, pgs);
}
if (code < 0)
return code;
code = gs_grestore(pgs);
if (code < 0)
return code;
{
pattern_accum_param_s param;
param.pinst = (void *)pinst;
param.graphics_state = (void *)pgs;
param.pinst_id = pinst->id;
code = dev_proc(pgs->device, dev_spec_op)(pgs->device,
gxdso_pattern_finish_accum, ¶m, sizeof(pattern_accum_param_s));
}
return code;
}
|
Exec Code
| 0
|
int pixmap_high_level_pattern(gs_gstate * pgs)
{
gs_matrix m;
gs_rect bbox;
gs_fixed_rect clip_box;
int code;
gx_device_color *pdc = gs_currentdevicecolor_inline(pgs);
const gs_client_pattern *ppat = gs_getpattern(&pdc->ccolor);
gs_color_space *pcs;
gs_pattern1_instance_t *pinst =
(gs_pattern1_instance_t *)gs_currentcolor(pgs)->pattern;
const pixmap_info *ppmap = ppat->client_data;
code = gx_pattern_cache_add_dummy_entry(pgs, pinst, pgs->device->color_info.depth);
if (code < 0)
return code;
code = gs_gsave(pgs);
if (code < 0)
return code;
dev_proc(pgs->device, get_initial_matrix)(pgs->device, &m);
gs_setmatrix(pgs, &m);
code = gs_bbox_transform(&ppat->BBox, &ctm_only(pgs), &bbox);
if (code < 0) {
gs_grestore(pgs);
return code;
}
clip_box.p.x = float2fixed(bbox.p.x);
clip_box.p.y = float2fixed(bbox.p.y);
clip_box.q.x = float2fixed(bbox.q.x);
clip_box.q.y = float2fixed(bbox.q.y);
code = gx_clip_to_rectangle(pgs, &clip_box);
if (code < 0) {
gs_grestore(pgs);
return code;
}
{
pattern_accum_param_s param;
param.pinst = (void *)pinst;
param.graphics_state = (void *)pgs;
param.pinst_id = pinst->id;
code = dev_proc(pgs->device, dev_spec_op)(pgs->device,
gxdso_pattern_start_accum, ¶m, sizeof(pattern_accum_param_s));
}
if (code < 0) {
gs_grestore(pgs);
return code;
}
if (ppmap->pcspace != 0)
code = image_PaintProc(&pdc->ccolor, pgs);
else {
pcs = gs_cspace_new_DeviceGray(pgs->memory);
if (pcs == NULL)
return_error(gs_error_VMerror);
gs_setcolorspace(pgs, pcs);
code = mask_PaintProc(&pdc->ccolor, pgs);
}
if (code < 0)
return code;
code = gs_grestore(pgs);
if (code < 0)
return code;
{
pattern_accum_param_s param;
param.pinst = (void *)pinst;
param.graphics_state = (void *)pgs;
param.pinst_id = pinst->id;
code = dev_proc(pgs->device, dev_spec_op)(pgs->device,
gxdso_pattern_finish_accum, ¶m, sizeof(pattern_accum_param_s));
}
return code;
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,346
|
static int pixmap_remap_image_pattern(const gs_client_color *pcc, gs_gstate *pgs)
{
const gs_client_pattern *ppat = gs_getpattern(pcc);
int code = 0;
/* pgs->device is the newly created pattern accumulator, but we want to test the device
* that is 'behind' that, the actual output device, so we use the one from
* the saved graphics state.
*/
if (pgs->have_pattern_streams)
code = dev_proc(pcc->pattern->saved->device, dev_spec_op)(pcc->pattern->saved->device,
gxdso_pattern_can_accum, (void *)ppat, ppat->uid.id);
if (code == 1) {
/* Device handles high-level patterns, so return 'remap'.
* This closes the internal accumulator device, as we no longer need
* it, and the error trickles back up to the PDL client. The client
* must then take action to start the device's accumulator, draw the
* pattern, close the device's accumulator and generate a cache entry.
* See px_high_level_pattern above.
*/
return_error(gs_error_Remap_Color);
} else {
return image_PaintProc(pcc, pgs);
}
}
|
Exec Code
| 0
|
static int pixmap_remap_image_pattern(const gs_client_color *pcc, gs_gstate *pgs)
{
const gs_client_pattern *ppat = gs_getpattern(pcc);
int code = 0;
/* pgs->device is the newly created pattern accumulator, but we want to test the device
* that is 'behind' that, the actual output device, so we use the one from
* the saved graphics state.
*/
if (pgs->have_pattern_streams)
code = dev_proc(pcc->pattern->saved->device, dev_spec_op)(pcc->pattern->saved->device,
gxdso_pattern_can_accum, (void *)ppat, ppat->uid.id);
if (code == 1) {
/* Device handles high-level patterns, so return 'remap'.
* This closes the internal accumulator device, as we no longer need
* it, and the error trickles back up to the PDL client. The client
* must then take action to start the device's accumulator, draw the
* pattern, close the device's accumulator and generate a cache entry.
* See px_high_level_pattern above.
*/
return_error(gs_error_Remap_Color);
} else {
return image_PaintProc(pcc, pgs);
}
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,347
|
static int pixmap_remap_mask_pattern(const gs_client_color *pcc, gs_gstate *pgs)
{
const gs_client_pattern *ppat = gs_getpattern(pcc);
int code = 0;
/* pgs->device is the newly created pattern accumulator, but we want to test the device
* that is 'behind' that, the actual output device, so we use the one from
* the saved graphics state.
*/
if (pgs->have_pattern_streams)
code = dev_proc(pcc->pattern->saved->device, dev_spec_op)(pcc->pattern->saved->device,
gxdso_pattern_can_accum, (void *)ppat, ppat->uid.id);
if (code == 1) {
/* Device handles high-level patterns, so return 'remap'.
* This closes the internal accumulator device, as we no longer need
* it, and the error trickles back up to the PDL client. The client
* must then take action to start the device's accumulator, draw the
* pattern, close the device's accumulator and generate a cache entry.
* See px_high_level_pattern above.
*/
return_error(gs_error_Remap_Color);
} else {
mask_PaintProc(pcc, pgs);
return 0;
}
}
|
Exec Code
| 0
|
static int pixmap_remap_mask_pattern(const gs_client_color *pcc, gs_gstate *pgs)
{
const gs_client_pattern *ppat = gs_getpattern(pcc);
int code = 0;
/* pgs->device is the newly created pattern accumulator, but we want to test the device
* that is 'behind' that, the actual output device, so we use the one from
* the saved graphics state.
*/
if (pgs->have_pattern_streams)
code = dev_proc(pcc->pattern->saved->device, dev_spec_op)(pcc->pattern->saved->device,
gxdso_pattern_can_accum, (void *)ppat, ppat->uid.id);
if (code == 1) {
/* Device handles high-level patterns, so return 'remap'.
* This closes the internal accumulator device, as we no longer need
* it, and the error trickles back up to the PDL client. The client
* must then take action to start the device's accumulator, draw the
* pattern, close the device's accumulator and generate a cache entry.
* See px_high_level_pattern above.
*/
return_error(gs_error_Remap_Color);
} else {
mask_PaintProc(pcc, pgs);
return 0;
}
}
|
@@ -50,7 +50,7 @@
/* GC descriptors */
private_st_pattern1_template();
-private_st_pattern1_instance();
+public_st_pattern1_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern1_instance_enum_ptrs) {
|
CWE-704
| null | null |
1,348
|
static RELOC_PTRS_BEGIN(pattern2_instance_reloc_ptrs) {
RELOC_PREFIX(st_pattern_instance);
RELOC_SUPER(gs_pattern2_instance_t, st_pattern2_template, templat);
} RELOC_PTRS_END
|
Exec Code
| 0
|
static RELOC_PTRS_BEGIN(pattern2_instance_reloc_ptrs) {
RELOC_PREFIX(st_pattern_instance);
RELOC_SUPER(gs_pattern2_instance_t, st_pattern2_template, templat);
} RELOC_PTRS_END
|
@@ -33,7 +33,7 @@
/* GC descriptors */
private_st_pattern2_template();
-private_st_pattern2_instance();
+public_st_pattern2_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern2_instance_enum_ptrs) {
@@ -206,10 +206,10 @@ gs_pattern2_set_color(const gs_client_color * pcc, gs_gstate * pgs)
pinst->saved->overprint_mode = pgs->overprint_mode;
pinst->saved->overprint = pgs->overprint;
-
+
num_comps = pgs->device->color_info.num_components;
for (k = 0; k < num_comps; k++) {
- pgs->color_component_map.color_map[k] =
+ pgs->color_component_map.color_map[k] =
pinst->saved->color_component_map.color_map[k];
}
code = pcs->type->set_overprint(pcs, pgs);
|
CWE-704
| null | null |
1,349
|
gs_pattern2_get_pattern(const gs_pattern_instance_t *pinst)
{
return (const gs_pattern_template_t *)
&((const gs_pattern2_instance_t *)pinst)->templat;
}
|
Exec Code
| 0
|
gs_pattern2_get_pattern(const gs_pattern_instance_t *pinst)
{
return (const gs_pattern_template_t *)
&((const gs_pattern2_instance_t *)pinst)->templat;
}
|
@@ -33,7 +33,7 @@
/* GC descriptors */
private_st_pattern2_template();
-private_st_pattern2_instance();
+public_st_pattern2_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern2_instance_enum_ptrs) {
@@ -206,10 +206,10 @@ gs_pattern2_set_color(const gs_client_color * pcc, gs_gstate * pgs)
pinst->saved->overprint_mode = pgs->overprint_mode;
pinst->saved->overprint = pgs->overprint;
-
+
num_comps = pgs->device->color_info.num_components;
for (k = 0; k < num_comps; k++) {
- pgs->color_component_map.color_map[k] =
+ pgs->color_component_map.color_map[k] =
pinst->saved->color_component_map.color_map[k];
}
code = pcs->type->set_overprint(pcs, pgs);
|
CWE-704
| null | null |
1,350
|
gs_pattern2_init(gs_pattern2_template_t * ppat)
{
gs_pattern_common_init((gs_pattern_template_t *)ppat, &gs_pattern2_type);
}
|
Exec Code
| 0
|
gs_pattern2_init(gs_pattern2_template_t * ppat)
{
gs_pattern_common_init((gs_pattern_template_t *)ppat, &gs_pattern2_type);
}
|
@@ -33,7 +33,7 @@
/* GC descriptors */
private_st_pattern2_template();
-private_st_pattern2_instance();
+public_st_pattern2_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern2_instance_enum_ptrs) {
@@ -206,10 +206,10 @@ gs_pattern2_set_color(const gs_client_color * pcc, gs_gstate * pgs)
pinst->saved->overprint_mode = pgs->overprint_mode;
pinst->saved->overprint = pgs->overprint;
-
+
num_comps = pgs->device->color_info.num_components;
for (k = 0; k < num_comps; k++) {
- pgs->color_component_map.color_map[k] =
+ pgs->color_component_map.color_map[k] =
pinst->saved->color_component_map.color_map[k];
}
code = pcs->type->set_overprint(pcs, pgs);
|
CWE-704
| null | null |
1,351
|
gs_pattern2_make_pattern(gs_client_color * pcc,
const gs_pattern_template_t * pcp,
const gs_matrix * pmat, gs_gstate * pgs,
gs_memory_t * mem)
{
const gs_pattern2_template_t *ptemp =
(const gs_pattern2_template_t *)pcp;
int code = gs_make_pattern_common(pcc, pcp, pmat, pgs, mem,
&st_pattern2_instance);
gs_pattern2_instance_t *pinst;
if (code < 0)
return code;
pinst = (gs_pattern2_instance_t *)pcc->pattern;
pinst->templat = *ptemp;
pinst->shfill = false;
return 0;
}
|
Exec Code
| 0
|
gs_pattern2_make_pattern(gs_client_color * pcc,
const gs_pattern_template_t * pcp,
const gs_matrix * pmat, gs_gstate * pgs,
gs_memory_t * mem)
{
const gs_pattern2_template_t *ptemp =
(const gs_pattern2_template_t *)pcp;
int code = gs_make_pattern_common(pcc, pcp, pmat, pgs, mem,
&st_pattern2_instance);
gs_pattern2_instance_t *pinst;
if (code < 0)
return code;
pinst = (gs_pattern2_instance_t *)pcc->pattern;
pinst->templat = *ptemp;
pinst->shfill = false;
return 0;
}
|
@@ -33,7 +33,7 @@
/* GC descriptors */
private_st_pattern2_template();
-private_st_pattern2_instance();
+public_st_pattern2_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern2_instance_enum_ptrs) {
@@ -206,10 +206,10 @@ gs_pattern2_set_color(const gs_client_color * pcc, gs_gstate * pgs)
pinst->saved->overprint_mode = pgs->overprint_mode;
pinst->saved->overprint = pgs->overprint;
-
+
num_comps = pgs->device->color_info.num_components;
for (k = 0; k < num_comps; k++) {
- pgs->color_component_map.color_map[k] =
+ pgs->color_component_map.color_map[k] =
pinst->saved->color_component_map.color_map[k];
}
code = pcs->type->set_overprint(pcs, pgs);
|
CWE-704
| null | null |
1,352
|
gs_pattern2_remap_color(const gs_client_color * pc, const gs_color_space * pcs,
gx_device_color * pdc, const gs_gstate * pgs,
gx_device * dev, gs_color_select_t select)
{
/* We don't do any actual color mapping now. */
pdc->type = &gx_dc_pattern2;
pdc->ccolor = *pc;
pdc->ccolor_valid = true;
return 0;
}
|
Exec Code
| 0
|
gs_pattern2_remap_color(const gs_client_color * pc, const gs_color_space * pcs,
gx_device_color * pdc, const gs_gstate * pgs,
gx_device * dev, gs_color_select_t select)
{
/* We don't do any actual color mapping now. */
pdc->type = &gx_dc_pattern2;
pdc->ccolor = *pc;
pdc->ccolor_valid = true;
return 0;
}
|
@@ -33,7 +33,7 @@
/* GC descriptors */
private_st_pattern2_template();
-private_st_pattern2_instance();
+public_st_pattern2_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern2_instance_enum_ptrs) {
@@ -206,10 +206,10 @@ gs_pattern2_set_color(const gs_client_color * pcc, gs_gstate * pgs)
pinst->saved->overprint_mode = pgs->overprint_mode;
pinst->saved->overprint = pgs->overprint;
-
+
num_comps = pgs->device->color_info.num_components;
for (k = 0; k < num_comps; k++) {
- pgs->color_component_map.color_map[k] =
+ pgs->color_component_map.color_map[k] =
pinst->saved->color_component_map.color_map[k];
}
code = pcs->type->set_overprint(pcs, pgs);
|
CWE-704
| null | null |
1,353
|
gs_pattern2_set_shfill(gs_client_color * pcc)
{
gs_pattern2_instance_t *pinst;
if (pcc->pattern->type != &gs_pattern2_type)
return_error(gs_error_unregistered); /* Must not happen. */
pinst = (gs_pattern2_instance_t *)pcc->pattern;
pinst->shfill = true;
return 0;
}
|
Exec Code
| 0
|
gs_pattern2_set_shfill(gs_client_color * pcc)
{
gs_pattern2_instance_t *pinst;
if (pcc->pattern->type != &gs_pattern2_type)
return_error(gs_error_unregistered); /* Must not happen. */
pinst = (gs_pattern2_instance_t *)pcc->pattern;
pinst->shfill = true;
return 0;
}
|
@@ -33,7 +33,7 @@
/* GC descriptors */
private_st_pattern2_template();
-private_st_pattern2_instance();
+public_st_pattern2_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern2_instance_enum_ptrs) {
@@ -206,10 +206,10 @@ gs_pattern2_set_color(const gs_client_color * pcc, gs_gstate * pgs)
pinst->saved->overprint_mode = pgs->overprint_mode;
pinst->saved->overprint = pgs->overprint;
-
+
num_comps = pgs->device->color_info.num_components;
for (k = 0; k < num_comps; k++) {
- pgs->color_component_map.color_map[k] =
+ pgs->color_component_map.color_map[k] =
pinst->saved->color_component_map.color_map[k];
}
code = pcs->type->set_overprint(pcs, pgs);
|
CWE-704
| null | null |
1,354
|
gs_pattern2_uses_base_space(const gs_pattern_template_t *ptemp)
{
return false;
}
|
Exec Code
| 0
|
gs_pattern2_uses_base_space(const gs_pattern_template_t *ptemp)
{
return false;
}
|
@@ -33,7 +33,7 @@
/* GC descriptors */
private_st_pattern2_template();
-private_st_pattern2_instance();
+public_st_pattern2_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern2_instance_enum_ptrs) {
@@ -206,10 +206,10 @@ gs_pattern2_set_color(const gs_client_color * pcc, gs_gstate * pgs)
pinst->saved->overprint_mode = pgs->overprint_mode;
pinst->saved->overprint = pgs->overprint;
-
+
num_comps = pgs->device->color_info.num_components;
for (k = 0; k < num_comps; k++) {
- pgs->color_component_map.color_map[k] =
+ pgs->color_component_map.color_map[k] =
pinst->saved->color_component_map.color_map[k];
}
code = pcs->type->set_overprint(pcs, pgs);
|
CWE-704
| null | null |
1,355
|
gx_dc_pattern2_can_overlap(const gx_device_color *pdevc)
{
gs_pattern2_instance_t * pinst;
if (pdevc->type != &gx_dc_pattern2)
return false;
pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
switch (pinst->templat.Shading->head.type) {
case 3: case 6: case 7:
return true;
default:
return false;
}
}
|
Exec Code
| 0
|
gx_dc_pattern2_can_overlap(const gx_device_color *pdevc)
{
gs_pattern2_instance_t * pinst;
if (pdevc->type != &gx_dc_pattern2)
return false;
pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
switch (pinst->templat.Shading->head.type) {
case 3: case 6: case 7:
return true;
default:
return false;
}
}
|
@@ -33,7 +33,7 @@
/* GC descriptors */
private_st_pattern2_template();
-private_st_pattern2_instance();
+public_st_pattern2_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern2_instance_enum_ptrs) {
@@ -206,10 +206,10 @@ gs_pattern2_set_color(const gs_client_color * pcc, gs_gstate * pgs)
pinst->saved->overprint_mode = pgs->overprint_mode;
pinst->saved->overprint = pgs->overprint;
-
+
num_comps = pgs->device->color_info.num_components;
for (k = 0; k < num_comps; k++) {
- pgs->color_component_map.color_map[k] =
+ pgs->color_component_map.color_map[k] =
pinst->saved->color_component_map.color_map[k];
}
code = pcs->type->set_overprint(pcs, pgs);
|
CWE-704
| null | null |
1,356
|
gx_dc_pattern2_clip_with_bbox(const gx_device_color * pdevc, gx_device * pdev,
gx_clip_path *cpath_local, const gx_clip_path **ppcpath1)
{
if (gx_dc_is_pattern2_color(pdevc) && gx_dc_pattern2_color_has_bbox(pdevc) &&
(*dev_proc(pdev, dev_spec_op))(pdev, gxdso_pattern_shading_area, NULL, 0) == 0) {
gs_pattern2_instance_t *pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
gx_path box_path;
gs_memory_t *mem = (*ppcpath1 != NULL ? (*ppcpath1)->path.memory : pdev->memory);
int code;
gx_path_init_local(&box_path, mem);
code = gx_dc_shading_path_add_box(&box_path, pdevc);
if (code != gs_error_limitcheck) {
/* Ignore huge BBox causing limitcheck - bug 689027. */
if (code >= 0) {
gx_cpath_init_local_shared(cpath_local, *ppcpath1, mem);
code = gx_cpath_intersect(cpath_local, &box_path, gx_rule_winding_number, (gs_gstate *)pinst->saved);
if (code < 0) {
gx_path_free(&box_path, "gx_default_fill_path(path_bbox)");
return code;
}
*ppcpath1 = cpath_local;
}
}
gx_path_free(&box_path, "gx_default_fill_path(path_bbox)");
}
return 0;
}
|
Exec Code
| 0
|
gx_dc_pattern2_clip_with_bbox(const gx_device_color * pdevc, gx_device * pdev,
gx_clip_path *cpath_local, const gx_clip_path **ppcpath1)
{
if (gx_dc_is_pattern2_color(pdevc) && gx_dc_pattern2_color_has_bbox(pdevc) &&
(*dev_proc(pdev, dev_spec_op))(pdev, gxdso_pattern_shading_area, NULL, 0) == 0) {
gs_pattern2_instance_t *pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
gx_path box_path;
gs_memory_t *mem = (*ppcpath1 != NULL ? (*ppcpath1)->path.memory : pdev->memory);
int code;
gx_path_init_local(&box_path, mem);
code = gx_dc_shading_path_add_box(&box_path, pdevc);
if (code != gs_error_limitcheck) {
/* Ignore huge BBox causing limitcheck - bug 689027. */
if (code >= 0) {
gx_cpath_init_local_shared(cpath_local, *ppcpath1, mem);
code = gx_cpath_intersect(cpath_local, &box_path, gx_rule_winding_number, (gs_gstate *)pinst->saved);
if (code < 0) {
gx_path_free(&box_path, "gx_default_fill_path(path_bbox)");
return code;
}
*ppcpath1 = cpath_local;
}
}
gx_path_free(&box_path, "gx_default_fill_path(path_bbox)");
}
return 0;
}
|
@@ -33,7 +33,7 @@
/* GC descriptors */
private_st_pattern2_template();
-private_st_pattern2_instance();
+public_st_pattern2_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern2_instance_enum_ptrs) {
@@ -206,10 +206,10 @@ gs_pattern2_set_color(const gs_client_color * pcc, gs_gstate * pgs)
pinst->saved->overprint_mode = pgs->overprint_mode;
pinst->saved->overprint = pgs->overprint;
-
+
num_comps = pgs->device->color_info.num_components;
for (k = 0; k < num_comps; k++) {
- pgs->color_component_map.color_map[k] =
+ pgs->color_component_map.color_map[k] =
pinst->saved->color_component_map.color_map[k];
}
code = pcs->type->set_overprint(pcs, pgs);
|
CWE-704
| null | null |
1,357
|
gx_dc_pattern2_clip_with_bbox_simple(const gx_device_color * pdevc, gx_device * pdev,
gx_clip_path *cpath_local)
{
int code = 0;
if (gx_dc_is_pattern2_color(pdevc) && gx_dc_pattern2_color_has_bbox(pdevc) &&
(*dev_proc(pdev, dev_spec_op))(pdev, gxdso_pattern_shading_area, NULL, 0) == 0) {
gs_pattern2_instance_t *pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
gx_path box_path;
gs_memory_t *mem = cpath_local->path.memory;
gx_path_init_local(&box_path, mem);
code = gx_dc_shading_path_add_box(&box_path, pdevc);
if (code == gs_error_limitcheck) {
/* Ignore huge BBox - bug 689027. */
code = 0;
} else if (code >= 0) {
code = gx_cpath_intersect(cpath_local, &box_path, gx_rule_winding_number, (gs_gstate *)pinst->saved);
}
gx_path_free(&box_path, "gx_default_fill_path(path_bbox)");
}
return code;
}
|
Exec Code
| 0
|
gx_dc_pattern2_clip_with_bbox_simple(const gx_device_color * pdevc, gx_device * pdev,
gx_clip_path *cpath_local)
{
int code = 0;
if (gx_dc_is_pattern2_color(pdevc) && gx_dc_pattern2_color_has_bbox(pdevc) &&
(*dev_proc(pdev, dev_spec_op))(pdev, gxdso_pattern_shading_area, NULL, 0) == 0) {
gs_pattern2_instance_t *pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
gx_path box_path;
gs_memory_t *mem = cpath_local->path.memory;
gx_path_init_local(&box_path, mem);
code = gx_dc_shading_path_add_box(&box_path, pdevc);
if (code == gs_error_limitcheck) {
/* Ignore huge BBox - bug 689027. */
code = 0;
} else if (code >= 0) {
code = gx_cpath_intersect(cpath_local, &box_path, gx_rule_winding_number, (gs_gstate *)pinst->saved);
}
gx_path_free(&box_path, "gx_default_fill_path(path_bbox)");
}
return code;
}
|
@@ -33,7 +33,7 @@
/* GC descriptors */
private_st_pattern2_template();
-private_st_pattern2_instance();
+public_st_pattern2_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern2_instance_enum_ptrs) {
@@ -206,10 +206,10 @@ gs_pattern2_set_color(const gs_client_color * pcc, gs_gstate * pgs)
pinst->saved->overprint_mode = pgs->overprint_mode;
pinst->saved->overprint = pgs->overprint;
-
+
num_comps = pgs->device->color_info.num_components;
for (k = 0; k < num_comps; k++) {
- pgs->color_component_map.color_map[k] =
+ pgs->color_component_map.color_map[k] =
pinst->saved->color_component_map.color_map[k];
}
code = pcs->type->set_overprint(pcs, pgs);
|
CWE-704
| null | null |
1,358
|
gx_dc_pattern2_color_has_bbox(const gx_device_color * pdevc)
{
gs_pattern2_instance_t *pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
const gs_shading_t *psh = pinst->templat.Shading;
return psh->params.have_BBox;
}
|
Exec Code
| 0
|
gx_dc_pattern2_color_has_bbox(const gx_device_color * pdevc)
{
gs_pattern2_instance_t *pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
const gs_shading_t *psh = pinst->templat.Shading;
return psh->params.have_BBox;
}
|
@@ -33,7 +33,7 @@
/* GC descriptors */
private_st_pattern2_template();
-private_st_pattern2_instance();
+public_st_pattern2_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern2_instance_enum_ptrs) {
@@ -206,10 +206,10 @@ gs_pattern2_set_color(const gs_client_color * pcc, gs_gstate * pgs)
pinst->saved->overprint_mode = pgs->overprint_mode;
pinst->saved->overprint = pgs->overprint;
-
+
num_comps = pgs->device->color_info.num_components;
for (k = 0; k < num_comps; k++) {
- pgs->color_component_map.color_map[k] =
+ pgs->color_component_map.color_map[k] =
pinst->saved->color_component_map.color_map[k];
}
code = pcs->type->set_overprint(pcs, pgs);
|
CWE-704
| null | null |
1,359
|
gx_dc_pattern2_equal(const gx_device_color * pdevc1,
const gx_device_color * pdevc2)
{
return pdevc2->type == pdevc1->type &&
pdevc1->ccolor.pattern == pdevc2->ccolor.pattern;
}
|
Exec Code
| 0
|
gx_dc_pattern2_equal(const gx_device_color * pdevc1,
const gx_device_color * pdevc2)
{
return pdevc2->type == pdevc1->type &&
pdevc1->ccolor.pattern == pdevc2->ccolor.pattern;
}
|
@@ -33,7 +33,7 @@
/* GC descriptors */
private_st_pattern2_template();
-private_st_pattern2_instance();
+public_st_pattern2_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern2_instance_enum_ptrs) {
@@ -206,10 +206,10 @@ gs_pattern2_set_color(const gs_client_color * pcc, gs_gstate * pgs)
pinst->saved->overprint_mode = pgs->overprint_mode;
pinst->saved->overprint = pgs->overprint;
-
+
num_comps = pgs->device->color_info.num_components;
for (k = 0; k < num_comps; k++) {
- pgs->color_component_map.color_map[k] =
+ pgs->color_component_map.color_map[k] =
pinst->saved->color_component_map.color_map[k];
}
code = pcs->type->set_overprint(pcs, pgs);
|
CWE-704
| null | null |
1,360
|
gx_dc_pattern2_fill_rectangle(const gx_device_color * pdevc, int x, int y,
int w, int h, gx_device * dev,
gs_logical_operation_t lop,
const gx_rop_source_t * source)
{
if (dev_proc(dev, dev_spec_op)(dev, gxdso_pattern_is_cpath_accum, NULL, 0)) {
/* Performing a conversion of imagemask into a clipping path.
Fall back to the device procedure. */
return dev_proc(dev, fill_rectangle)(dev, x, y, w, h, (gx_color_index)0/*any*/);
} else {
gs_fixed_rect rect;
gs_pattern2_instance_t *pinst =
(gs_pattern2_instance_t *)pdevc->ccolor.pattern;
rect.p.x = int2fixed(x);
rect.p.y = int2fixed(y);
rect.q.x = int2fixed(x + w);
rect.q.y = int2fixed(y + h);
return gs_shading_do_fill_rectangle(pinst->templat.Shading, &rect, dev,
(gs_gstate *)pinst->saved, !pinst->shfill);
}
}
|
Exec Code
| 0
|
gx_dc_pattern2_fill_rectangle(const gx_device_color * pdevc, int x, int y,
int w, int h, gx_device * dev,
gs_logical_operation_t lop,
const gx_rop_source_t * source)
{
if (dev_proc(dev, dev_spec_op)(dev, gxdso_pattern_is_cpath_accum, NULL, 0)) {
/* Performing a conversion of imagemask into a clipping path.
Fall back to the device procedure. */
return dev_proc(dev, fill_rectangle)(dev, x, y, w, h, (gx_color_index)0/*any*/);
} else {
gs_fixed_rect rect;
gs_pattern2_instance_t *pinst =
(gs_pattern2_instance_t *)pdevc->ccolor.pattern;
rect.p.x = int2fixed(x);
rect.p.y = int2fixed(y);
rect.q.x = int2fixed(x + w);
rect.q.y = int2fixed(y + h);
return gs_shading_do_fill_rectangle(pinst->templat.Shading, &rect, dev,
(gs_gstate *)pinst->saved, !pinst->shfill);
}
}
|
@@ -33,7 +33,7 @@
/* GC descriptors */
private_st_pattern2_template();
-private_st_pattern2_instance();
+public_st_pattern2_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern2_instance_enum_ptrs) {
@@ -206,10 +206,10 @@ gs_pattern2_set_color(const gs_client_color * pcc, gs_gstate * pgs)
pinst->saved->overprint_mode = pgs->overprint_mode;
pinst->saved->overprint = pgs->overprint;
-
+
num_comps = pgs->device->color_info.num_components;
for (k = 0; k < num_comps; k++) {
- pgs->color_component_map.color_map[k] =
+ pgs->color_component_map.color_map[k] =
pinst->saved->color_component_map.color_map[k];
}
code = pcs->type->set_overprint(pcs, pgs);
|
CWE-704
| null | null |
1,361
|
gx_dc_pattern2_get_color_space(const gx_device_color * pdevc)
{
gs_pattern2_instance_t *pinst =
(gs_pattern2_instance_t *)pdevc->ccolor.pattern;
const gs_shading_t *psh = pinst->templat.Shading;
return psh->params.ColorSpace;
}
|
Exec Code
| 0
|
gx_dc_pattern2_get_color_space(const gx_device_color * pdevc)
{
gs_pattern2_instance_t *pinst =
(gs_pattern2_instance_t *)pdevc->ccolor.pattern;
const gs_shading_t *psh = pinst->templat.Shading;
return psh->params.ColorSpace;
}
|
@@ -33,7 +33,7 @@
/* GC descriptors */
private_st_pattern2_template();
-private_st_pattern2_instance();
+public_st_pattern2_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern2_instance_enum_ptrs) {
@@ -206,10 +206,10 @@ gs_pattern2_set_color(const gs_client_color * pcc, gs_gstate * pgs)
pinst->saved->overprint_mode = pgs->overprint_mode;
pinst->saved->overprint = pgs->overprint;
-
+
num_comps = pgs->device->color_info.num_components;
for (k = 0; k < num_comps; k++) {
- pgs->color_component_map.color_map[k] =
+ pgs->color_component_map.color_map[k] =
pinst->saved->color_component_map.color_map[k];
}
code = pcs->type->set_overprint(pcs, pgs);
|
CWE-704
| null | null |
1,362
|
gx_dc_pattern2_get_dev_halftone(const gx_device_color * pdevc)
{
return ((gs_pattern2_instance_t *)pdevc->ccolor.pattern)->saved->dev_ht;
}
|
Exec Code
| 0
|
gx_dc_pattern2_get_dev_halftone(const gx_device_color * pdevc)
{
return ((gs_pattern2_instance_t *)pdevc->ccolor.pattern)->saved->dev_ht;
}
|
@@ -33,7 +33,7 @@
/* GC descriptors */
private_st_pattern2_template();
-private_st_pattern2_instance();
+public_st_pattern2_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern2_instance_enum_ptrs) {
@@ -206,10 +206,10 @@ gs_pattern2_set_color(const gs_client_color * pcc, gs_gstate * pgs)
pinst->saved->overprint_mode = pgs->overprint_mode;
pinst->saved->overprint = pgs->overprint;
-
+
num_comps = pgs->device->color_info.num_components;
for (k = 0; k < num_comps; k++) {
- pgs->color_component_map.color_map[k] =
+ pgs->color_component_map.color_map[k] =
pinst->saved->color_component_map.color_map[k];
}
code = pcs->type->set_overprint(pcs, pgs);
|
CWE-704
| null | null |
1,363
|
bool gx_dc_pattern2_has_background(const gx_device_color *pdevc)
{
gs_pattern2_instance_t * pinst;
const gs_shading_t *Shading;
if (pdevc->type != &gx_dc_pattern2)
return false;
pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
Shading = pinst->templat.Shading;
return !pinst->shfill && Shading->params.Background != NULL;
}
|
Exec Code
| 0
|
bool gx_dc_pattern2_has_background(const gx_device_color *pdevc)
{
gs_pattern2_instance_t * pinst;
const gs_shading_t *Shading;
if (pdevc->type != &gx_dc_pattern2)
return false;
pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
Shading = pinst->templat.Shading;
return !pinst->shfill && Shading->params.Background != NULL;
}
|
@@ -33,7 +33,7 @@
/* GC descriptors */
private_st_pattern2_template();
-private_st_pattern2_instance();
+public_st_pattern2_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern2_instance_enum_ptrs) {
@@ -206,10 +206,10 @@ gs_pattern2_set_color(const gs_client_color * pcc, gs_gstate * pgs)
pinst->saved->overprint_mode = pgs->overprint_mode;
pinst->saved->overprint = pgs->overprint;
-
+
num_comps = pgs->device->color_info.num_components;
for (k = 0; k < num_comps; k++) {
- pgs->color_component_map.color_map[k] =
+ pgs->color_component_map.color_map[k] =
pinst->saved->color_component_map.color_map[k];
}
code = pcs->type->set_overprint(pcs, pgs);
|
CWE-704
| null | null |
1,364
|
gx_dc_pattern2_load(gx_device_color *pdevc, const gs_gstate *ignore_pgs,
gx_device *ignore_dev, gs_color_select_t ignore_select)
{
return 0;
}
|
Exec Code
| 0
|
gx_dc_pattern2_load(gx_device_color *pdevc, const gs_gstate *ignore_pgs,
gx_device *ignore_dev, gs_color_select_t ignore_select)
{
return 0;
}
|
@@ -33,7 +33,7 @@
/* GC descriptors */
private_st_pattern2_template();
-private_st_pattern2_instance();
+public_st_pattern2_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern2_instance_enum_ptrs) {
@@ -206,10 +206,10 @@ gs_pattern2_set_color(const gs_client_color * pcc, gs_gstate * pgs)
pinst->saved->overprint_mode = pgs->overprint_mode;
pinst->saved->overprint = pgs->overprint;
-
+
num_comps = pgs->device->color_info.num_components;
for (k = 0; k < num_comps; k++) {
- pgs->color_component_map.color_map[k] =
+ pgs->color_component_map.color_map[k] =
pinst->saved->color_component_map.color_map[k];
}
code = pcs->type->set_overprint(pcs, pgs);
|
CWE-704
| null | null |
1,365
|
gx_dc_pattern2_save_dc(
const gx_device_color * pdevc,
gx_device_color_saved * psdc )
{
gs_pattern2_instance_t * pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
psdc->type = pdevc->type;
psdc->colors.pattern2.id = pinst->pattern_id;
psdc->colors.pattern2.shfill = pinst->shfill;
}
|
Exec Code
| 0
|
gx_dc_pattern2_save_dc(
const gx_device_color * pdevc,
gx_device_color_saved * psdc )
{
gs_pattern2_instance_t * pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
psdc->type = pdevc->type;
psdc->colors.pattern2.id = pinst->pattern_id;
psdc->colors.pattern2.shfill = pinst->shfill;
}
|
@@ -33,7 +33,7 @@
/* GC descriptors */
private_st_pattern2_template();
-private_st_pattern2_instance();
+public_st_pattern2_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern2_instance_enum_ptrs) {
@@ -206,10 +206,10 @@ gs_pattern2_set_color(const gs_client_color * pcc, gs_gstate * pgs)
pinst->saved->overprint_mode = pgs->overprint_mode;
pinst->saved->overprint = pgs->overprint;
-
+
num_comps = pgs->device->color_info.num_components;
for (k = 0; k < num_comps; k++) {
- pgs->color_component_map.color_map[k] =
+ pgs->color_component_map.color_map[k] =
pinst->saved->color_component_map.color_map[k];
}
code = pcs->type->set_overprint(pcs, pgs);
|
CWE-704
| null | null |
1,366
|
gx_dc_pattern2_shade_bbox_transform2fixed(const gs_rect * rect, const gs_gstate * pgs,
gs_fixed_rect * rfixed)
{
gs_rect dev_rect;
int code = gs_bbox_transform(rect, &ctm_only(pgs), &dev_rect);
if (code >= 0) {
rfixed->p.x = float2fixed(dev_rect.p.x);
rfixed->p.y = float2fixed(dev_rect.p.y);
rfixed->q.x = float2fixed(dev_rect.q.x);
rfixed->q.y = float2fixed(dev_rect.q.y);
}
return code;
}
|
Exec Code
| 0
|
gx_dc_pattern2_shade_bbox_transform2fixed(const gs_rect * rect, const gs_gstate * pgs,
gs_fixed_rect * rfixed)
{
gs_rect dev_rect;
int code = gs_bbox_transform(rect, &ctm_only(pgs), &dev_rect);
if (code >= 0) {
rfixed->p.x = float2fixed(dev_rect.p.x);
rfixed->p.y = float2fixed(dev_rect.p.y);
rfixed->q.x = float2fixed(dev_rect.q.x);
rfixed->q.y = float2fixed(dev_rect.q.y);
}
return code;
}
|
@@ -33,7 +33,7 @@
/* GC descriptors */
private_st_pattern2_template();
-private_st_pattern2_instance();
+public_st_pattern2_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern2_instance_enum_ptrs) {
@@ -206,10 +206,10 @@ gs_pattern2_set_color(const gs_client_color * pcc, gs_gstate * pgs)
pinst->saved->overprint_mode = pgs->overprint_mode;
pinst->saved->overprint = pgs->overprint;
-
+
num_comps = pgs->device->color_info.num_components;
for (k = 0; k < num_comps; k++) {
- pgs->color_component_map.color_map[k] =
+ pgs->color_component_map.color_map[k] =
pinst->saved->color_component_map.color_map[k];
}
code = pcs->type->set_overprint(pcs, pgs);
|
CWE-704
| null | null |
1,367
|
gx_dc_shading_path_add_box(gx_path *ppath, const gx_device_color * pdevc)
{
gs_pattern2_instance_t *pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
const gs_shading_t *psh = pinst->templat.Shading;
if (!psh->params.have_BBox)
return_error(gs_error_unregistered); /* Do not call in this case. */
else {
gs_gstate *pgs = pinst->saved;
return gs_shading_path_add_box(ppath, &psh->params.BBox, &pgs->ctm);
}
}
|
Exec Code
| 0
|
gx_dc_shading_path_add_box(gx_path *ppath, const gx_device_color * pdevc)
{
gs_pattern2_instance_t *pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
const gs_shading_t *psh = pinst->templat.Shading;
if (!psh->params.have_BBox)
return_error(gs_error_unregistered); /* Do not call in this case. */
else {
gs_gstate *pgs = pinst->saved;
return gs_shading_path_add_box(ppath, &psh->params.BBox, &pgs->ctm);
}
}
|
@@ -33,7 +33,7 @@
/* GC descriptors */
private_st_pattern2_template();
-private_st_pattern2_instance();
+public_st_pattern2_instance();
/* GC procedures */
static ENUM_PTRS_BEGIN(pattern2_instance_enum_ptrs) {
@@ -206,10 +206,10 @@ gs_pattern2_set_color(const gs_client_color * pcc, gs_gstate * pgs)
pinst->saved->overprint_mode = pgs->overprint_mode;
pinst->saved->overprint = pgs->overprint;
-
+
num_comps = pgs->device->color_info.num_components;
for (k = 0; k < num_comps; k++) {
- pgs->color_component_map.color_map[k] =
+ pgs->color_component_map.color_map[k] =
pinst->saved->color_component_map.color_map[k];
}
code = pcs->type->set_overprint(pcs, pgs);
|
CWE-704
| null | null |
1,368
|
colour_cleanup(i_ctx_t *i_ctx_p)
{
return 0;
}
|
Exec Code
| 0
|
colour_cleanup(i_ctx_t *i_ctx_p)
{
return 0;
}
|
@@ -65,6 +65,8 @@ static const float default_0_1[] = {0, 1, 0, 1, 0, 1, 0, 1};
/* imported from gsht.c */
extern void gx_set_effective_transfer(gs_gstate *);
+extern_st(st_pattern1_instance);
+extern_st(st_pattern2_instance);
/* Essential forward declarations */
static int validate_spaces(i_ctx_t *i_ctx_p, ref *arr, int *depth);
@@ -289,6 +291,9 @@ zsetcolor(i_ctx_t * i_ctx_p)
code = array_get(imemory, pImpl, 0, &pPatInst);
if (code < 0)
return code;
+ if (!r_is_struct(&pPatInst) || (!r_has_stype(&pPatInst, imemory, st_pattern1_instance) && !r_has_stype(&pPatInst, imemory, st_pattern2_instance)))
+ return_error(gs_error_typecheck);
+
cc.pattern = r_ptr(&pPatInst, gs_pattern_instance_t);
n_numeric_comps = ( pattern_instance_uses_base_space(cc.pattern)
? n_comps - 1
@@ -4423,7 +4428,7 @@ static int setindexedspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont, int
/* If we have a named color profile and the base space is DeviceN or
Separation use a different set of procedures to ensure the named
color remapping code is used */
- if (igs->icc_manager->device_named != NULL &&
+ if (igs->icc_manager->device_named != NULL &&
(base_type == gs_color_space_index_Separation ||
base_type == gs_color_space_index_DeviceN))
pcs = gs_cspace_alloc(imemory, &gs_color_space_type_Indexed_Named);
@@ -5585,7 +5590,7 @@ static int iccompareproc(i_ctx_t *i_ctx_p, ref *space, ref *testspace)
return 0;
/* As a quick check see if current is same as new */
- if (ICCdict1.value.bytes == ICCdict2.value.bytes)
+ if (ICCdict1.value.bytes == ICCdict2.value.bytes)
return 1;
/* Need to check all the various parts */
@@ -5605,7 +5610,7 @@ static int iccompareproc(i_ctx_t *i_ctx_p, ref *space, ref *testspace)
code2 = dict_find_string(&ICCdict2, "DataSource", &tempref2);
if (code2 <= 0)
return 0;
- if (r_size(tempref1) != r_size(tempref2))
+ if (r_size(tempref1) != r_size(tempref2))
return 0;
buff_size = r_size(tempref1);
|
CWE-704
| null | null |
1,369
|
pattern_instance_uses_base_space(const gs_pattern_instance_t * pinst)
{
return pinst->type->procs.uses_base_space(
pinst->type->procs.get_pattern(pinst) );
}
|
Exec Code
| 0
|
pattern_instance_uses_base_space(const gs_pattern_instance_t * pinst)
{
return pinst->type->procs.uses_base_space(
pinst->type->procs.get_pattern(pinst) );
}
|
@@ -65,6 +65,8 @@ static const float default_0_1[] = {0, 1, 0, 1, 0, 1, 0, 1};
/* imported from gsht.c */
extern void gx_set_effective_transfer(gs_gstate *);
+extern_st(st_pattern1_instance);
+extern_st(st_pattern2_instance);
/* Essential forward declarations */
static int validate_spaces(i_ctx_t *i_ctx_p, ref *arr, int *depth);
@@ -289,6 +291,9 @@ zsetcolor(i_ctx_t * i_ctx_p)
code = array_get(imemory, pImpl, 0, &pPatInst);
if (code < 0)
return code;
+ if (!r_is_struct(&pPatInst) || (!r_has_stype(&pPatInst, imemory, st_pattern1_instance) && !r_has_stype(&pPatInst, imemory, st_pattern2_instance)))
+ return_error(gs_error_typecheck);
+
cc.pattern = r_ptr(&pPatInst, gs_pattern_instance_t);
n_numeric_comps = ( pattern_instance_uses_base_space(cc.pattern)
? n_comps - 1
@@ -4423,7 +4428,7 @@ static int setindexedspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont, int
/* If we have a named color profile and the base space is DeviceN or
Separation use a different set of procedures to ensure the named
color remapping code is used */
- if (igs->icc_manager->device_named != NULL &&
+ if (igs->icc_manager->device_named != NULL &&
(base_type == gs_color_space_index_Separation ||
base_type == gs_color_space_index_DeviceN))
pcs = gs_cspace_alloc(imemory, &gs_color_space_type_Indexed_Named);
@@ -5585,7 +5590,7 @@ static int iccompareproc(i_ctx_t *i_ctx_p, ref *space, ref *testspace)
return 0;
/* As a quick check see if current is same as new */
- if (ICCdict1.value.bytes == ICCdict2.value.bytes)
+ if (ICCdict1.value.bytes == ICCdict2.value.bytes)
return 1;
/* Need to check all the various parts */
@@ -5605,7 +5610,7 @@ static int iccompareproc(i_ctx_t *i_ctx_p, ref *space, ref *testspace)
code2 = dict_find_string(&ICCdict2, "DataSource", &tempref2);
if (code2 <= 0)
return 0;
- if (r_size(tempref1) != r_size(tempref2))
+ if (r_size(tempref1) != r_size(tempref2))
return 0;
buff_size = r_size(tempref1);
|
CWE-704
| null | null |
1,370
|
zcurrentcolor(i_ctx_t * i_ctx_p)
{
os_ptr op = osp;
const gs_color_space * pcs = gs_currentcolorspace(igs);
const gs_client_color * pcc = gs_currentcolor(igs);
int i, n = cs_num_components(pcs);
bool push_pattern = n < 0;
/* check for pattern */
if (push_pattern) {
gs_pattern_instance_t * pinst = pcc->pattern;
if (pinst == 0 || !pattern_instance_uses_base_space(pinst))
n = 1;
else
n = -n;
}
/* check for sufficient space on the stack */
push(n);
op -= n - 1;
/* push the numeric operands, if any */
if (push_pattern)
--n;
for (i = 0; i < n; i++, op++) {
float rval = pcc->paint.values[i];
int ival = (int)rval;
/* the following handles indexed color spaces */
if (rval == ival && pcs->type->index == gs_color_space_index_Indexed)
make_int(op, ival);
else
make_real(op, rval);
}
/* push the pattern dictionary or null object, if appropriate */
if (push_pattern)
*op = istate->pattern[0];
return 0;
}
|
Exec Code
| 0
|
zcurrentcolor(i_ctx_t * i_ctx_p)
{
os_ptr op = osp;
const gs_color_space * pcs = gs_currentcolorspace(igs);
const gs_client_color * pcc = gs_currentcolor(igs);
int i, n = cs_num_components(pcs);
bool push_pattern = n < 0;
/* check for pattern */
if (push_pattern) {
gs_pattern_instance_t * pinst = pcc->pattern;
if (pinst == 0 || !pattern_instance_uses_base_space(pinst))
n = 1;
else
n = -n;
}
/* check for sufficient space on the stack */
push(n);
op -= n - 1;
/* push the numeric operands, if any */
if (push_pattern)
--n;
for (i = 0; i < n; i++, op++) {
float rval = pcc->paint.values[i];
int ival = (int)rval;
/* the following handles indexed color spaces */
if (rval == ival && pcs->type->index == gs_color_space_index_Indexed)
make_int(op, ival);
else
make_real(op, rval);
}
/* push the pattern dictionary or null object, if appropriate */
if (push_pattern)
*op = istate->pattern[0];
return 0;
}
|
@@ -65,6 +65,8 @@ static const float default_0_1[] = {0, 1, 0, 1, 0, 1, 0, 1};
/* imported from gsht.c */
extern void gx_set_effective_transfer(gs_gstate *);
+extern_st(st_pattern1_instance);
+extern_st(st_pattern2_instance);
/* Essential forward declarations */
static int validate_spaces(i_ctx_t *i_ctx_p, ref *arr, int *depth);
@@ -289,6 +291,9 @@ zsetcolor(i_ctx_t * i_ctx_p)
code = array_get(imemory, pImpl, 0, &pPatInst);
if (code < 0)
return code;
+ if (!r_is_struct(&pPatInst) || (!r_has_stype(&pPatInst, imemory, st_pattern1_instance) && !r_has_stype(&pPatInst, imemory, st_pattern2_instance)))
+ return_error(gs_error_typecheck);
+
cc.pattern = r_ptr(&pPatInst, gs_pattern_instance_t);
n_numeric_comps = ( pattern_instance_uses_base_space(cc.pattern)
? n_comps - 1
@@ -4423,7 +4428,7 @@ static int setindexedspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont, int
/* If we have a named color profile and the base space is DeviceN or
Separation use a different set of procedures to ensure the named
color remapping code is used */
- if (igs->icc_manager->device_named != NULL &&
+ if (igs->icc_manager->device_named != NULL &&
(base_type == gs_color_space_index_Separation ||
base_type == gs_color_space_index_DeviceN))
pcs = gs_cspace_alloc(imemory, &gs_color_space_type_Indexed_Named);
@@ -5585,7 +5590,7 @@ static int iccompareproc(i_ctx_t *i_ctx_p, ref *space, ref *testspace)
return 0;
/* As a quick check see if current is same as new */
- if (ICCdict1.value.bytes == ICCdict2.value.bytes)
+ if (ICCdict1.value.bytes == ICCdict2.value.bytes)
return 1;
/* Need to check all the various parts */
@@ -5605,7 +5610,7 @@ static int iccompareproc(i_ctx_t *i_ctx_p, ref *space, ref *testspace)
code2 = dict_find_string(&ICCdict2, "DataSource", &tempref2);
if (code2 <= 0)
return 0;
- if (r_size(tempref1) != r_size(tempref2))
+ if (r_size(tempref1) != r_size(tempref2))
return 0;
buff_size = r_size(tempref1);
|
CWE-704
| null | null |
1,371
|
zcurrentcolorspace(i_ctx_t * i_ctx_p)
{
os_ptr op = osp; /* required by "push" macro */
int code;
ref namestr,stref;
byte *body;
/* Adobe applications expect that the Device spaces (DeviceGray
* DeviceRGB and DeviceCMYK) will always return the same array.
* Not merely the same content but the same actual array. To do
* this we define the arrays at startup (see gs_cspace.ps), and
* recover them here by executing PostScript.
*/
if (r_has_type(&istate->colorspace[0].array, t_name)) {
name_string_ref(imemory, &istate->colorspace[0].array, &namestr);
if (r_size(&namestr) == 10 && !memcmp(namestr.value.bytes, "DeviceGray", 10)) {
body = ialloc_string(32, "string");
if (body == 0)
return_error(gs_error_VMerror);
memcpy(body, "systemdict /DeviceGray_array get", 32);
make_string(&stref, a_all | icurrent_space, 32, body);
} else {
if (r_size(&namestr) == 9 && !memcmp(namestr.value.bytes, "DeviceRGB", 9)) {
body = ialloc_string(31, "string");
if (body == 0)
return_error(gs_error_VMerror);
memcpy(body, "systemdict /DeviceRGB_array get", 31);
make_string(&stref, a_all | icurrent_space, 31, body);
} else {
if (r_size(&namestr) == 10 && !memcmp(namestr.value.bytes, "DeviceCMYK", 10)) {
body = ialloc_string(32, "string");
if (body == 0)
return_error(gs_error_VMerror);
memcpy(body, "systemdict /DeviceCMYK_array get", 32);
make_string(&stref, a_all | icurrent_space, 32, body);
} else {
/* Not one of the Device spaces, but still just a name. Give
* up and return the name on the stack.
*/
push(1);
code = ialloc_ref_array(op, a_all, 1, "currentcolorspace");
if (code < 0)
return code;
refset_null(op->value.refs, 1);
ref_assign_old(op, op->value.refs,
&istate->colorspace[0].array,
"currentcolorspace");
return 0;
}
}
}
r_set_attrs(&stref, a_executable);
esp++;
ref_assign(esp, &stref);
return o_push_estack;
} else {
/* If the space isn't a simple name, then we don't need any special
* action and can simply use it.
*/
push(1);
*op = istate->colorspace[0].array;
}
return 0;
}
|
Exec Code
| 0
|
zcurrentcolorspace(i_ctx_t * i_ctx_p)
{
os_ptr op = osp; /* required by "push" macro */
int code;
ref namestr,stref;
byte *body;
/* Adobe applications expect that the Device spaces (DeviceGray
* DeviceRGB and DeviceCMYK) will always return the same array.
* Not merely the same content but the same actual array. To do
* this we define the arrays at startup (see gs_cspace.ps), and
* recover them here by executing PostScript.
*/
if (r_has_type(&istate->colorspace[0].array, t_name)) {
name_string_ref(imemory, &istate->colorspace[0].array, &namestr);
if (r_size(&namestr) == 10 && !memcmp(namestr.value.bytes, "DeviceGray", 10)) {
body = ialloc_string(32, "string");
if (body == 0)
return_error(gs_error_VMerror);
memcpy(body, "systemdict /DeviceGray_array get", 32);
make_string(&stref, a_all | icurrent_space, 32, body);
} else {
if (r_size(&namestr) == 9 && !memcmp(namestr.value.bytes, "DeviceRGB", 9)) {
body = ialloc_string(31, "string");
if (body == 0)
return_error(gs_error_VMerror);
memcpy(body, "systemdict /DeviceRGB_array get", 31);
make_string(&stref, a_all | icurrent_space, 31, body);
} else {
if (r_size(&namestr) == 10 && !memcmp(namestr.value.bytes, "DeviceCMYK", 10)) {
body = ialloc_string(32, "string");
if (body == 0)
return_error(gs_error_VMerror);
memcpy(body, "systemdict /DeviceCMYK_array get", 32);
make_string(&stref, a_all | icurrent_space, 32, body);
} else {
/* Not one of the Device spaces, but still just a name. Give
* up and return the name on the stack.
*/
push(1);
code = ialloc_ref_array(op, a_all, 1, "currentcolorspace");
if (code < 0)
return code;
refset_null(op->value.refs, 1);
ref_assign_old(op, op->value.refs,
&istate->colorspace[0].array,
"currentcolorspace");
return 0;
}
}
}
r_set_attrs(&stref, a_executable);
esp++;
ref_assign(esp, &stref);
return o_push_estack;
} else {
/* If the space isn't a simple name, then we don't need any special
* action and can simply use it.
*/
push(1);
*op = istate->colorspace[0].array;
}
return 0;
}
|
@@ -65,6 +65,8 @@ static const float default_0_1[] = {0, 1, 0, 1, 0, 1, 0, 1};
/* imported from gsht.c */
extern void gx_set_effective_transfer(gs_gstate *);
+extern_st(st_pattern1_instance);
+extern_st(st_pattern2_instance);
/* Essential forward declarations */
static int validate_spaces(i_ctx_t *i_ctx_p, ref *arr, int *depth);
@@ -289,6 +291,9 @@ zsetcolor(i_ctx_t * i_ctx_p)
code = array_get(imemory, pImpl, 0, &pPatInst);
if (code < 0)
return code;
+ if (!r_is_struct(&pPatInst) || (!r_has_stype(&pPatInst, imemory, st_pattern1_instance) && !r_has_stype(&pPatInst, imemory, st_pattern2_instance)))
+ return_error(gs_error_typecheck);
+
cc.pattern = r_ptr(&pPatInst, gs_pattern_instance_t);
n_numeric_comps = ( pattern_instance_uses_base_space(cc.pattern)
? n_comps - 1
@@ -4423,7 +4428,7 @@ static int setindexedspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont, int
/* If we have a named color profile and the base space is DeviceN or
Separation use a different set of procedures to ensure the named
color remapping code is used */
- if (igs->icc_manager->device_named != NULL &&
+ if (igs->icc_manager->device_named != NULL &&
(base_type == gs_color_space_index_Separation ||
base_type == gs_color_space_index_DeviceN))
pcs = gs_cspace_alloc(imemory, &gs_color_space_type_Indexed_Named);
@@ -5585,7 +5590,7 @@ static int iccompareproc(i_ctx_t *i_ctx_p, ref *space, ref *testspace)
return 0;
/* As a quick check see if current is same as new */
- if (ICCdict1.value.bytes == ICCdict2.value.bytes)
+ if (ICCdict1.value.bytes == ICCdict2.value.bytes)
return 1;
/* Need to check all the various parts */
@@ -5605,7 +5610,7 @@ static int iccompareproc(i_ctx_t *i_ctx_p, ref *space, ref *testspace)
code2 = dict_find_string(&ICCdict2, "DataSource", &tempref2);
if (code2 <= 0)
return 0;
- if (r_size(tempref1) != r_size(tempref2))
+ if (r_size(tempref1) != r_size(tempref2))
return 0;
buff_size = r_size(tempref1);
|
CWE-704
| null | null |
1,372
|
zgetuseciecolor(i_ctx_t * i_ctx_p)
{
os_ptr op = osp;
push(1);
*op = istate->use_cie_color;
return 0;
}
|
Exec Code
| 0
|
zgetuseciecolor(i_ctx_t * i_ctx_p)
{
os_ptr op = osp;
push(1);
*op = istate->use_cie_color;
return 0;
}
|
@@ -65,6 +65,8 @@ static const float default_0_1[] = {0, 1, 0, 1, 0, 1, 0, 1};
/* imported from gsht.c */
extern void gx_set_effective_transfer(gs_gstate *);
+extern_st(st_pattern1_instance);
+extern_st(st_pattern2_instance);
/* Essential forward declarations */
static int validate_spaces(i_ctx_t *i_ctx_p, ref *arr, int *depth);
@@ -289,6 +291,9 @@ zsetcolor(i_ctx_t * i_ctx_p)
code = array_get(imemory, pImpl, 0, &pPatInst);
if (code < 0)
return code;
+ if (!r_is_struct(&pPatInst) || (!r_has_stype(&pPatInst, imemory, st_pattern1_instance) && !r_has_stype(&pPatInst, imemory, st_pattern2_instance)))
+ return_error(gs_error_typecheck);
+
cc.pattern = r_ptr(&pPatInst, gs_pattern_instance_t);
n_numeric_comps = ( pattern_instance_uses_base_space(cc.pattern)
? n_comps - 1
@@ -4423,7 +4428,7 @@ static int setindexedspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont, int
/* If we have a named color profile and the base space is DeviceN or
Separation use a different set of procedures to ensure the named
color remapping code is used */
- if (igs->icc_manager->device_named != NULL &&
+ if (igs->icc_manager->device_named != NULL &&
(base_type == gs_color_space_index_Separation ||
base_type == gs_color_space_index_DeviceN))
pcs = gs_cspace_alloc(imemory, &gs_color_space_type_Indexed_Named);
@@ -5585,7 +5590,7 @@ static int iccompareproc(i_ctx_t *i_ctx_p, ref *space, ref *testspace)
return 0;
/* As a quick check see if current is same as new */
- if (ICCdict1.value.bytes == ICCdict2.value.bytes)
+ if (ICCdict1.value.bytes == ICCdict2.value.bytes)
return 1;
/* Need to check all the various parts */
@@ -5605,7 +5610,7 @@ static int iccompareproc(i_ctx_t *i_ctx_p, ref *space, ref *testspace)
code2 = dict_find_string(&ICCdict2, "DataSource", &tempref2);
if (code2 <= 0)
return 0;
- if (r_size(tempref1) != r_size(tempref2))
+ if (r_size(tempref1) != r_size(tempref2))
return 0;
buff_size = r_size(tempref1);
|
CWE-704
| null | null |
1,373
|
Burr(IRCView* o, Burr* prev, QTextBlock b, int objFormat)
: m_block(b), m_format(objFormat), m_prev(prev), m_next(0),
m_owner(o)
{
if (m_prev)
m_prev->m_next = this;
}
|
DoS
| 0
|
Burr(IRCView* o, Burr* prev, QTextBlock b, int objFormat)
: m_block(b), m_format(objFormat), m_prev(prev), m_next(0),
m_owner(o)
{
if (m_prev)
m_prev->m_next = this;
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,374
|
IRCView::IRCView(QWidget* parent) : KTextBrowser(parent), m_rememberLine(0), m_lastMarkerLine(0), m_rememberLineDirtyBit(false), markerFormatObject(this)
{
m_mousePressedOnUrl = false;
m_isOnNick = false;
m_isOnChannel = false;
m_chatWin = 0;
m_server = 0;
setAcceptDrops(false);
connect(document(), SIGNAL(contentsChange(int,int,int)), SLOT(cullMarkedLine(int,int,int)));
QTextObjectInterface *iface = qobject_cast<QTextObjectInterface *>(&markerFormatObject);
if (!iface)
{
Q_ASSERT(iface);
}
document()->documentLayout()->registerHandler(IRCView::MarkerLine, &markerFormatObject);
document()->documentLayout()->registerHandler(IRCView::RememberLine, &markerFormatObject);
connect(this, SIGNAL(anchorClicked(QUrl)), this, SLOT(anchorClicked(QUrl)));
connect( this, SIGNAL(highlighted(QString)), this, SLOT(highlightedSlot(QString)) );
setOpenLinks(false);
setUndoRedoEnabled(0);
document()->setDefaultStyleSheet("a.nick:link {text-decoration: none}");
setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
setFocusPolicy(Qt::ClickFocus);
setReadOnly(true);
viewport()->setCursor(Qt::ArrowCursor);
setTextInteractionFlags(Qt::TextBrowserInteraction);
viewport()->setMouseTracking(true);
if (Preferences::self()->useParagraphSpacing()) enableParagraphSpacing();
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setContextMenuOptions(IrcContextMenus::ShowTitle | IrcContextMenus::ShowFindAction, true);
}
|
DoS
| 0
|
IRCView::IRCView(QWidget* parent) : KTextBrowser(parent), m_rememberLine(0), m_lastMarkerLine(0), m_rememberLineDirtyBit(false), markerFormatObject(this)
{
m_mousePressedOnUrl = false;
m_isOnNick = false;
m_isOnChannel = false;
m_chatWin = 0;
m_server = 0;
setAcceptDrops(false);
connect(document(), SIGNAL(contentsChange(int,int,int)), SLOT(cullMarkedLine(int,int,int)));
QTextObjectInterface *iface = qobject_cast<QTextObjectInterface *>(&markerFormatObject);
if (!iface)
{
Q_ASSERT(iface);
}
document()->documentLayout()->registerHandler(IRCView::MarkerLine, &markerFormatObject);
document()->documentLayout()->registerHandler(IRCView::RememberLine, &markerFormatObject);
connect(this, SIGNAL(anchorClicked(QUrl)), this, SLOT(anchorClicked(QUrl)));
connect( this, SIGNAL(highlighted(QString)), this, SLOT(highlightedSlot(QString)) );
setOpenLinks(false);
setUndoRedoEnabled(0);
document()->setDefaultStyleSheet("a.nick:link {text-decoration: none}");
setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
setFocusPolicy(Qt::ClickFocus);
setReadOnly(true);
viewport()->setCursor(Qt::ArrowCursor);
setTextInteractionFlags(Qt::TextBrowserInteraction);
viewport()->setMouseTracking(true);
if (Preferences::self()->useParagraphSpacing()) enableParagraphSpacing();
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setContextMenuOptions(IrcContextMenus::ShowTitle | IrcContextMenus::ShowFindAction, true);
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,375
|
IrcViewMimeData(const QTextDocumentFragment& _fragment): fragment(_fragment) {}
|
DoS
| 0
|
IrcViewMimeData(const QTextDocumentFragment& _fragment): fragment(_fragment) {}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,376
|
ScrollBarPin(QScrollBar *scrollBar) : m_bar(scrollBar)
{
if (m_bar)
m_bar = m_bar->value() == m_bar->maximum()? m_bar : 0;
}
|
DoS
| 0
|
ScrollBarPin(QScrollBar *scrollBar) : m_bar(scrollBar)
{
if (m_bar)
m_bar = m_bar->value() == m_bar->maximum()? m_bar : 0;
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,377
|
void IRCView::append(const QString& nick, const QString& message)
{
QString channelColor = Preferences::self()->color(Preferences::ChannelMessage).name();
m_tabNotification = Konversation::tnfNormal;
QString nickLine = createNickLine(nick, channelColor);
QChar::Direction dir;
QString text(filter(message, channelColor, nick, true, true, false, &dir));
QString line;
bool rtl = (dir == QChar::DirR);
if(rtl)
{
line = RLE;
line += LRE;
line += "<font color=\"" + channelColor + "\">" + nickLine +" %1" + PDF + RLM + " %3</font>";
}
else
{
if (!QApplication::isLeftToRight())
line += LRE;
line += "<font color=\"" + channelColor + "\">%1" + nickLine + " %3</font>";
}
line = line.arg(timeStamp(), nick, text);
emit textToLog(QString("<%1>\t%2").arg(nick, message));
doAppend(line, rtl);
}
|
DoS
| 0
|
void IRCView::append(const QString& nick, const QString& message)
{
QString channelColor = Preferences::self()->color(Preferences::ChannelMessage).name();
m_tabNotification = Konversation::tnfNormal;
QString nickLine = createNickLine(nick, channelColor);
QChar::Direction dir;
QString text(filter(message, channelColor, nick, true, true, false, &dir));
QString line;
bool rtl = (dir == QChar::DirR);
if(rtl)
{
line = RLE;
line += LRE;
line += "<font color=\"" + channelColor + "\">" + nickLine +" %1" + PDF + RLM + " %3</font>";
}
else
{
if (!QApplication::isLeftToRight())
line += LRE;
line += "<font color=\"" + channelColor + "\">%1" + nickLine + " %3</font>";
}
line = line.arg(timeStamp(), nick, text);
emit textToLog(QString("<%1>\t%2").arg(nick, message));
doAppend(line, rtl);
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,378
|
void IRCView::appendAction(const QString& nick, const QString& message)
{
QString actionColor = Preferences::self()->color(Preferences::ActionMessage).name();
QString line;
QString nickLine = createNickLine(nick, actionColor, false);
if (message.isEmpty())
{
if (!QApplication::isLeftToRight())
line += LRE;
line += "<font color=\"" + actionColor + "\">%1 * " + nickLine + "</font>";
line = line.arg(timeStamp(), nick);
emit textToLog(QString("\t * %1").arg(nick));
doAppend(line, false);
}
else
{
QChar::Direction dir;
QString text(filter(message, actionColor, nick, true,true, false, &dir));
bool rtl = (dir == QChar::DirR);
if (rtl)
{
line = RLE;
line += LRE;
line += "<font color=\"" + actionColor + "\">" + nickLine + " * %1" + PDF + " %3</font>";
}
else
{
if (!QApplication::isLeftToRight())
line += LRE;
line += "<font color=\"" + actionColor + "\">%1 * " + nickLine + " %3</font>";
}
line = line.arg(timeStamp(), nick, text);
emit textToLog(QString("\t * %1 %2").arg(nick, message));
doAppend(line, rtl);
}
}
|
DoS
| 0
|
void IRCView::appendAction(const QString& nick, const QString& message)
{
QString actionColor = Preferences::self()->color(Preferences::ActionMessage).name();
QString line;
QString nickLine = createNickLine(nick, actionColor, false);
if (message.isEmpty())
{
if (!QApplication::isLeftToRight())
line += LRE;
line += "<font color=\"" + actionColor + "\">%1 * " + nickLine + "</font>";
line = line.arg(timeStamp(), nick);
emit textToLog(QString("\t * %1").arg(nick));
doAppend(line, false);
}
else
{
QChar::Direction dir;
QString text(filter(message, actionColor, nick, true,true, false, &dir));
bool rtl = (dir == QChar::DirR);
if (rtl)
{
line = RLE;
line += LRE;
line += "<font color=\"" + actionColor + "\">" + nickLine + " * %1" + PDF + " %3</font>";
}
else
{
if (!QApplication::isLeftToRight())
line += LRE;
line += "<font color=\"" + actionColor + "\">%1 * " + nickLine + " %3</font>";
}
line = line.arg(timeStamp(), nick, text);
emit textToLog(QString("\t * %1 %2").arg(nick, message));
doAppend(line, rtl);
}
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,379
|
void IRCView::appendBacklogMessage(const QString& firstColumn,const QString& rawMessage)
{
QString time;
QString message = rawMessage;
QString nick = firstColumn;
QString backlogColor = Preferences::self()->color(Preferences::BacklogMessage).name();
m_tabNotification = Konversation::tnfNone;
int eot = nick.lastIndexOf(' ');
time = nick.left(eot);
nick = nick.mid(eot+1);
if(!nick.isEmpty() && !nick.startsWith('<') && !nick.startsWith('*'))
{
nick = '|' + nick + '|';
}
nick.replace('<',"<");
nick.replace('>',">");
QString line;
QChar::Direction dir;
QString text(filter(message, backlogColor, NULL, false, false, false, &dir));
bool rtl = (dir == QChar::DirR);
if(rtl)
{
line = RLE;
line += LRE;
line += "<font color=\"" + backlogColor + "\">%2 %1" + PDF + " %3</font>";
}
else
{
if (!QApplication::isLeftToRight())
line += LRE;
line += "<font color=\"" + backlogColor + "\">%1 %2 %3</font>";
}
line = line.arg(time, nick, text);
doAppend(line, rtl);
}
|
DoS
| 0
|
void IRCView::appendBacklogMessage(const QString& firstColumn,const QString& rawMessage)
{
QString time;
QString message = rawMessage;
QString nick = firstColumn;
QString backlogColor = Preferences::self()->color(Preferences::BacklogMessage).name();
m_tabNotification = Konversation::tnfNone;
int eot = nick.lastIndexOf(' ');
time = nick.left(eot);
nick = nick.mid(eot+1);
if(!nick.isEmpty() && !nick.startsWith('<') && !nick.startsWith('*'))
{
nick = '|' + nick + '|';
}
nick.replace('<',"<");
nick.replace('>',">");
QString line;
QChar::Direction dir;
QString text(filter(message, backlogColor, NULL, false, false, false, &dir));
bool rtl = (dir == QChar::DirR);
if(rtl)
{
line = RLE;
line += LRE;
line += "<font color=\"" + backlogColor + "\">%2 %1" + PDF + " %3</font>";
}
else
{
if (!QApplication::isLeftToRight())
line += LRE;
line += "<font color=\"" + backlogColor + "\">%1 %2 %3</font>";
}
line = line.arg(time, nick, text);
doAppend(line, rtl);
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,380
|
void IRCView::appendCommandMessage(const QString& type,const QString& message, bool parseURL, bool self)
{
QString commandColor = Preferences::self()->color(Preferences::CommandMessage).name();
QString prefix="***";
m_tabNotification = Konversation::tnfControl;
if(type == i18nc("Message type", "Join"))
{
prefix="-->";
parseURL=false;
}
else if(type == i18nc("Message type", "Part") || type == i18nc("Message type", "Quit"))
{
prefix="<--";
}
prefix=Qt::escape(prefix);
QString line;
QChar::Direction dir;
QString text(filter(message, commandColor, 0, true, parseURL, self, &dir));
bool rtl = (dir == QChar::DirR);
if(rtl)
{
line = RLE;
line += LRE;
line += "<font color=\"" + commandColor + "\">%2 %1" + PDF + " %3</font>";
}
else
{
if (!QApplication::isLeftToRight())
line += LRE;
line += "<font color=\"" + commandColor + "\">%1 %2 %3</font>";
}
line = line.arg(timeStamp(), prefix, text);
emit textToLog(QString("%1\t%2").arg(type, message));
doAppend(line, rtl, self);
}
|
DoS
| 0
|
void IRCView::appendCommandMessage(const QString& type,const QString& message, bool parseURL, bool self)
{
QString commandColor = Preferences::self()->color(Preferences::CommandMessage).name();
QString prefix="***";
m_tabNotification = Konversation::tnfControl;
if(type == i18nc("Message type", "Join"))
{
prefix="-->";
parseURL=false;
}
else if(type == i18nc("Message type", "Part") || type == i18nc("Message type", "Quit"))
{
prefix="<--";
}
prefix=Qt::escape(prefix);
QString line;
QChar::Direction dir;
QString text(filter(message, commandColor, 0, true, parseURL, self, &dir));
bool rtl = (dir == QChar::DirR);
if(rtl)
{
line = RLE;
line += LRE;
line += "<font color=\"" + commandColor + "\">%2 %1" + PDF + " %3</font>";
}
else
{
if (!QApplication::isLeftToRight())
line += LRE;
line += "<font color=\"" + commandColor + "\">%1 %2 %3</font>";
}
line = line.arg(timeStamp(), prefix, text);
emit textToLog(QString("%1\t%2").arg(type, message));
doAppend(line, rtl, self);
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,381
|
Burr* IRCView::appendLine(IRCView::ObjectFormats type)
{
ScrollBarPin barpin(verticalScrollBar());
SelectionPin selpin(this);
QTextCursor cursor(document());
cursor.movePosition(QTextCursor::End);
if (cursor.block().length() > 1) // this will be a 0x2029
cursor.insertBlock();
cursor.insertText(QString(QChar::ObjectReplacementCharacter), getFormat(type));
QTextBlock block = cursor.block();
Burr *b = new Burr(this, m_lastMarkerLine, block, type == MarkerLine? BlockIsMarker : BlockIsRemember);
block.setUserData(b);
m_lastMarkerLine = b;
cursor.setPosition(block.position());
return b;
}
|
DoS
| 0
|
Burr* IRCView::appendLine(IRCView::ObjectFormats type)
{
ScrollBarPin barpin(verticalScrollBar());
SelectionPin selpin(this);
QTextCursor cursor(document());
cursor.movePosition(QTextCursor::End);
if (cursor.block().length() > 1) // this will be a 0x2029
cursor.insertBlock();
cursor.insertText(QString(QChar::ObjectReplacementCharacter), getFormat(type));
QTextBlock block = cursor.block();
Burr *b = new Burr(this, m_lastMarkerLine, block, type == MarkerLine? BlockIsMarker : BlockIsRemember);
block.setUserData(b);
m_lastMarkerLine = b;
cursor.setPosition(block.position());
return b;
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,382
|
void IRCView::appendLog(const QString & message)
{
QColor channelColor = Preferences::self()->color(Preferences::ChannelMessage);
m_tabNotification = Konversation::tnfNone;
QString line("<font color=\"" + channelColor.name() + "\">" + message + "</font>");
doRawAppend(line, !QApplication::isLeftToRight());
}
|
DoS
| 0
|
void IRCView::appendLog(const QString & message)
{
QColor channelColor = Preferences::self()->color(Preferences::ChannelMessage);
m_tabNotification = Konversation::tnfNone;
QString line("<font color=\"" + channelColor.name() + "\">" + message + "</font>");
doRawAppend(line, !QApplication::isLeftToRight());
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,383
|
void IRCView::appendQuery(const QString& nick, const QString& message, bool inChannel)
{
QString queryColor=Preferences::self()->color(Preferences::QueryMessage).name();
m_tabNotification = Konversation::tnfPrivate;
QString nickLine = createNickLine(nick, queryColor, true, inChannel);
QString line;
QChar::Direction dir;
QString text(filter(message, queryColor, nick, true, true, false, &dir));
bool rtl = (dir == QChar::DirR);
if(rtl)
{
line = RLE;
line += LRE;
line += "<font color=\"" + queryColor + "\">" + nickLine + " %1" + PDF + RLM + " %3</font>";
}
else
{
if (!QApplication::isLeftToRight())
line += LRE;
line += "<font color=\"" + queryColor + "\">%1 " + nickLine + " %3</font>";
}
line = line.arg(timeStamp(), nick, text);
if (inChannel) {
emit textToLog(QString("<-> %1>\t%2").arg(nick, message));
} else {
emit textToLog(QString("<%1>\t%2").arg(nick, message));
}
doAppend(line, rtl);
}
|
DoS
| 0
|
void IRCView::appendQuery(const QString& nick, const QString& message, bool inChannel)
{
QString queryColor=Preferences::self()->color(Preferences::QueryMessage).name();
m_tabNotification = Konversation::tnfPrivate;
QString nickLine = createNickLine(nick, queryColor, true, inChannel);
QString line;
QChar::Direction dir;
QString text(filter(message, queryColor, nick, true, true, false, &dir));
bool rtl = (dir == QChar::DirR);
if(rtl)
{
line = RLE;
line += LRE;
line += "<font color=\"" + queryColor + "\">" + nickLine + " %1" + PDF + RLM + " %3</font>";
}
else
{
if (!QApplication::isLeftToRight())
line += LRE;
line += "<font color=\"" + queryColor + "\">%1 " + nickLine + " %3</font>";
}
line = line.arg(timeStamp(), nick, text);
if (inChannel) {
emit textToLog(QString("<-> %1>\t%2").arg(nick, message));
} else {
emit textToLog(QString("<%1>\t%2").arg(nick, message));
}
doAppend(line, rtl);
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,384
|
void IRCView::appendQueryAction(const QString& nick, const QString& message)
{
m_tabNotification = Konversation::tnfPrivate;
appendAction(nick, message);
}
|
DoS
| 0
|
void IRCView::appendQueryAction(const QString& nick, const QString& message)
{
m_tabNotification = Konversation::tnfPrivate;
appendAction(nick, message);
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,385
|
void IRCView::appendRaw(const QString& message, bool self)
{
QColor color = self ? Preferences::self()->color(Preferences::ChannelMessage)
: Preferences::self()->color(Preferences::ServerMessage);
m_tabNotification = Konversation::tnfNone;
QString line = QString(timeStamp() + " <font color=\"" + color.name() + "\">" + message + "</font>");
doAppend(line, false, self);
}
|
DoS
| 0
|
void IRCView::appendRaw(const QString& message, bool self)
{
QColor color = self ? Preferences::self()->color(Preferences::ChannelMessage)
: Preferences::self()->color(Preferences::ServerMessage);
m_tabNotification = Konversation::tnfNone;
QString line = QString(timeStamp() + " <font color=\"" + color.name() + "\">" + message + "</font>");
doAppend(line, false, self);
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,386
|
void IRCView::appendRememberLine()
{
m_rememberLineDirtyBit = false;
if (lastBlockIsLine(BlockIsRemember))
return;
if (m_rememberLine)
{
QTextBlock rem = m_rememberLine->m_block;
voidLineBlock(rem);
if (m_rememberLine != 0)
{
m_rememberLine = 0;
}
}
m_rememberLine = appendLine(IRCView::RememberLine);
}
|
DoS
| 0
|
void IRCView::appendRememberLine()
{
m_rememberLineDirtyBit = false;
if (lastBlockIsLine(BlockIsRemember))
return;
if (m_rememberLine)
{
QTextBlock rem = m_rememberLine->m_block;
voidLineBlock(rem);
if (m_rememberLine != 0)
{
m_rememberLine = 0;
}
}
m_rememberLine = appendLine(IRCView::RememberLine);
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,387
|
void IRCView::appendServerMessage(const QString& type, const QString& message, bool parseURL)
{
QString serverColor = Preferences::self()->color(Preferences::ServerMessage).name();
m_tabNotification = Konversation::tnfControl;
QString fixed;
if(Preferences::self()->fixedMOTD() && !m_fontDataBase.isFixedPitch(font().family()))
{
if(type == i18n("MOTD"))
fixed=" face=\"" + KGlobalSettings::fixedFont().family() + "\"";
}
QString line;
QChar::Direction dir;
QString text(filter(message, serverColor, 0 , true, parseURL, false, &dir));
bool rtl = (dir == QChar::DirR);
if(rtl)
{
line = RLE;
line += LRE;
line += "<font color=\"" + serverColor + "\"" + fixed + "><b>[</b>%2<b>]</b> %1" + PDF + " %3</font>";
}
else
{
if (!QApplication::isLeftToRight())
line += LRE;
line += "<font color=\"" + serverColor + "\"" + fixed + ">%1 <b>[</b>%2<b>]</b> %3</font>";
}
line = line.arg(timeStamp(), type, text);
emit textToLog(QString("%1\t%2").arg(type, message));
doAppend(line, rtl);
}
|
DoS
| 0
|
void IRCView::appendServerMessage(const QString& type, const QString& message, bool parseURL)
{
QString serverColor = Preferences::self()->color(Preferences::ServerMessage).name();
m_tabNotification = Konversation::tnfControl;
QString fixed;
if(Preferences::self()->fixedMOTD() && !m_fontDataBase.isFixedPitch(font().family()))
{
if(type == i18n("MOTD"))
fixed=" face=\"" + KGlobalSettings::fixedFont().family() + "\"";
}
QString line;
QChar::Direction dir;
QString text(filter(message, serverColor, 0 , true, parseURL, false, &dir));
bool rtl = (dir == QChar::DirR);
if(rtl)
{
line = RLE;
line += LRE;
line += "<font color=\"" + serverColor + "\"" + fixed + "><b>[</b>%2<b>]</b> %1" + PDF + " %3</font>";
}
else
{
if (!QApplication::isLeftToRight())
line += LRE;
line += "<font color=\"" + serverColor + "\"" + fixed + ">%1 <b>[</b>%2<b>]</b> %3</font>";
}
line = line.arg(timeStamp(), type, text);
emit textToLog(QString("%1\t%2").arg(type, message));
doAppend(line, rtl);
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,388
|
void IRCView::blockDeleted(Burr* b) //slot
{
Q_ASSERT(b); // this method only to be called from a ~Burr();
if (b == m_lastMarkerLine)
m_lastMarkerLine = b->m_prev;
if (b == m_rememberLine)
m_rememberLine = 0;
}
|
DoS
| 0
|
void IRCView::blockDeleted(Burr* b) //slot
{
Q_ASSERT(b); // this method only to be called from a ~Burr();
if (b == m_lastMarkerLine)
m_lastMarkerLine = b->m_prev;
if (b == m_rememberLine)
m_rememberLine = 0;
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,389
|
void IRCView::cancelRememberLine() //slot
{
m_rememberLineDirtyBit = false;
}
|
DoS
| 0
|
void IRCView::cancelRememberLine() //slot
{
m_rememberLineDirtyBit = false;
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,390
|
void IRCView::clearLines()
{
while (hasLines())
{
voidLineBlock(m_lastMarkerLine->m_block);
};
}
|
DoS
| 0
|
void IRCView::clearLines()
{
while (hasLines())
{
voidLineBlock(m_lastMarkerLine->m_block);
};
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,391
|
QMimeData *IRCView::createMimeDataFromSelection() const
{
const QTextDocumentFragment fragment(textCursor());
return new IrcViewMimeData(fragment);
}
|
DoS
| 0
|
QMimeData *IRCView::createMimeDataFromSelection() const
{
const QTextDocumentFragment fragment(textCursor());
return new IrcViewMimeData(fragment);
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,392
|
void IRCView::cullMarkedLine(int where, int rem, int add) //slot
{
bool showDebug = false;
QString output;
QDebug d = QDebug(&output);//KDebug(QtDebugMsg, __FILE__, __LINE__, Q_FUNC_INFO)();
bool merged = (add!=0 && rem !=0); // i have never seen this happen, adds and removes are always separate
int blockCount = document()->blockCount();
void *view = this;
QTextBlock prime = document()->firstBlock();
d << "================= cullMarkedLine" << _S(view) << _S(where) << _S(rem) << _S(add) << _S(blockCount) << _S(prime.length()) << _S(merged);
if (prime.length() == 1)
{
if (document()->blockCount() == 1) //the entire document was wiped. was a signal such a burden? apparently..
{
d << "- wipeLineParagraphs()" << (void*)m_rememberLine << (void*)m_lastMarkerLine;
wipeLineParagraphs();
}
else if (document()->characterAt(0).unicode() == 0x2029)
{
d << "- only QChar::ParagraphSeparator";
if (dynamic_cast<Burr*>(prime.userData()))
d << "Burr!" << prime.userData();
}
else
{
QString fc = "0x" + QString::number(document()->characterAt(0).unicode(), 16).rightJustified(4, '0');
d << "- block of length 1 but not 2029" << qPrintable(fc);
}
}
else if (prime.length() == 2)
{
QString fc = "0x" + QString::number(document()->characterAt(0).unicode(), 16).rightJustified(4, '0');
QString sc = "0x" + QString::number(document()->characterAt(1).unicode(), 16).rightJustified(4, '0');
d << "- prime(2)" << fc << sc;
}
if (showDebug)
{
DebugBanner;
kDebug() << output;
}
}
|
DoS
| 0
|
void IRCView::cullMarkedLine(int where, int rem, int add) //slot
{
bool showDebug = false;
QString output;
QDebug d = QDebug(&output);//KDebug(QtDebugMsg, __FILE__, __LINE__, Q_FUNC_INFO)();
bool merged = (add!=0 && rem !=0); // i have never seen this happen, adds and removes are always separate
int blockCount = document()->blockCount();
void *view = this;
QTextBlock prime = document()->firstBlock();
d << "================= cullMarkedLine" << _S(view) << _S(where) << _S(rem) << _S(add) << _S(blockCount) << _S(prime.length()) << _S(merged);
if (prime.length() == 1)
{
if (document()->blockCount() == 1) //the entire document was wiped. was a signal such a burden? apparently..
{
d << "- wipeLineParagraphs()" << (void*)m_rememberLine << (void*)m_lastMarkerLine;
wipeLineParagraphs();
}
else if (document()->characterAt(0).unicode() == 0x2029)
{
d << "- only QChar::ParagraphSeparator";
if (dynamic_cast<Burr*>(prime.userData()))
d << "Burr!" << prime.userData();
}
else
{
QString fc = "0x" + QString::number(document()->characterAt(0).unicode(), 16).rightJustified(4, '0');
d << "- block of length 1 but not 2029" << qPrintable(fc);
}
}
else if (prime.length() == 2)
{
QString fc = "0x" + QString::number(document()->characterAt(0).unicode(), 16).rightJustified(4, '0');
QString sc = "0x" + QString::number(document()->characterAt(1).unicode(), 16).rightJustified(4, '0');
d << "- prime(2)" << fc << sc;
}
if (showDebug)
{
DebugBanner;
kDebug() << output;
}
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,393
|
int IRCView::defaultHtmlReplace(QString& htmlText, TextHtmlData* data, int pos, const QString& tag)
{
QString replace;
if (data->openHtmlTags.contains(tag))
{
replace = closeToTagString(data, tag);
}
else
{
data->openHtmlTags.append(tag);
replace = QLatin1Char('<') + tag + QLatin1Char('>');
}
htmlText.replace(pos, 1, replace);
return replace.length();
}
|
DoS
| 0
|
int IRCView::defaultHtmlReplace(QString& htmlText, TextHtmlData* data, int pos, const QString& tag)
{
QString replace;
if (data->openHtmlTags.contains(tag))
{
replace = closeToTagString(data, tag);
}
else
{
data->openHtmlTags.append(tag);
replace = QLatin1Char('<') + tag + QLatin1Char('>');
}
htmlText.replace(pos, 1, replace);
return replace.length();
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,394
|
void IRCView::doAppend(const QString& newLine, bool rtl, bool self)
{
if (m_rememberLineDirtyBit)
appendRememberLine();
if (!self && m_chatWin)
m_chatWin->activateTabNotification(m_tabNotification);
int scrollMax = Preferences::self()->scrollbackMax();
if (scrollMax != 0)
{
bool atBottom = (verticalScrollBar()->value() == verticalScrollBar()->maximum());
document()->setMaximumBlockCount(atBottom ? scrollMax : document()->maximumBlockCount() + 1);
}
doRawAppend(newLine, rtl);
if (!m_autoTextToSend.isEmpty() && m_server)
{
QString sendText = m_server->parseWildcards(m_autoTextToSend,m_server->getNickname(), QString(), QString(), QString(), QString());
m_autoTextToSend.clear();
emit autoText(sendText);
}
else
{
m_autoTextToSend.clear();
}
if (!m_lastStatusText.isEmpty())
emit clearStatusBarTempText();
}
|
DoS
| 0
|
void IRCView::doAppend(const QString& newLine, bool rtl, bool self)
{
if (m_rememberLineDirtyBit)
appendRememberLine();
if (!self && m_chatWin)
m_chatWin->activateTabNotification(m_tabNotification);
int scrollMax = Preferences::self()->scrollbackMax();
if (scrollMax != 0)
{
bool atBottom = (verticalScrollBar()->value() == verticalScrollBar()->maximum());
document()->setMaximumBlockCount(atBottom ? scrollMax : document()->maximumBlockCount() + 1);
}
doRawAppend(newLine, rtl);
if (!m_autoTextToSend.isEmpty() && m_server)
{
QString sendText = m_server->parseWildcards(m_autoTextToSend,m_server->getNickname(), QString(), QString(), QString(), QString());
m_autoTextToSend.clear();
emit autoText(sendText);
}
else
{
m_autoTextToSend.clear();
}
if (!m_lastStatusText.isEmpty())
emit clearStatusBarTempText();
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,395
|
void IRCView::doRawAppend(const QString& newLine, bool rtl)
{
SelectionPin selpin(this); // HACK stop selection at end from growing
QString line(newLine);
line.remove('\n');
KTextBrowser::append(line);
QTextCursor formatCursor(document()->lastBlock());
QTextBlockFormat format = formatCursor.blockFormat();
if (!QApplication::isLeftToRight())
rtl = !rtl;
format.setAlignment(rtl ? Qt::AlignRight : Qt::AlignLeft);
formatCursor.setBlockFormat(format);
}
|
DoS
| 0
|
void IRCView::doRawAppend(const QString& newLine, bool rtl)
{
SelectionPin selpin(this); // HACK stop selection at end from growing
QString line(newLine);
line.remove('\n');
KTextBrowser::append(line);
QTextCursor formatCursor(document()->lastBlock());
QTextBlockFormat format = formatCursor.blockFormat();
if (!QApplication::isLeftToRight())
rtl = !rtl;
format.setAlignment(rtl ? Qt::AlignRight : Qt::AlignLeft);
formatCursor.setBlockFormat(format);
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,396
|
void IRCView::dragEnterEvent(QDragEnterEvent* e)
{
if (e->mimeData()->hasUrls())
e->acceptProposedAction();
else
e->ignore();
}
|
DoS
| 0
|
void IRCView::dragEnterEvent(QDragEnterEvent* e)
{
if (e->mimeData()->hasUrls())
e->acceptProposedAction();
else
e->ignore();
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,397
|
void IRCView::dragMoveEvent(QDragMoveEvent* e)
{
if (e->mimeData()->hasUrls())
e->accept();
else
e->ignore();
}
|
DoS
| 0
|
void IRCView::dragMoveEvent(QDragMoveEvent* e)
{
if (e->mimeData()->hasUrls())
e->accept();
else
e->ignore();
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,398
|
void IRCView::dropEvent(QDropEvent* e)
{
if (e->mimeData() && e->mimeData()->hasUrls())
emit urlsDropped(KUrl::List::fromMimeData(e->mimeData(), KUrl::List::PreferLocalUrls));
}
|
DoS
| 0
|
void IRCView::dropEvent(QDropEvent* e)
{
if (e->mimeData() && e->mimeData()->hasUrls())
emit urlsDropped(KUrl::List::fromMimeData(e->mimeData(), KUrl::List::PreferLocalUrls));
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
1,399
|
QString IRCView::filter(const QString& line, const QString& defaultColor, const QString& whoSent,
bool doHighlight, bool parseURL, bool self, QChar::Direction* direction)
{
QString filteredLine(line);
Application* konvApp = static_cast<Application*>(kapp);
if (filteredLine[0] == ' ')
{
filteredLine[0] = '\xA0';
}
filteredLine.replace('<', "\x0blt;");
filteredLine.replace('>', "\x0bgt;");
if (filteredLine.contains('\x07'))
{
if (Preferences::self()->beep())
{
kapp->beep();
}
filteredLine.remove('\x07');
}
filteredLine = ircTextToHtml(filteredLine, parseURL, defaultColor, whoSent, true, direction);
QString ownNick;
if (m_server)
{
ownNick = m_server->getNickname();
}
else if (m_chatWin->getType() == ChatWindow::DccChat)
{
ownNick = static_cast<DCC::ChatContainer*>(m_chatWin)->ownNick();
}
if(doHighlight && (whoSent != ownNick) && !self)
{
QString highlightColor;
if (Preferences::self()->highlightNick() &&
line.toLower().contains(QRegExp("(^|[^\\d\\w])" +
QRegExp::escape(ownNick.toLower()) +
"([^\\d\\w]|$)")))
{
highlightColor = Preferences::self()->highlightNickColor().name();
m_tabNotification = Konversation::tnfNick;
}
else
{
QList<Highlight*> highlightList = Preferences::highlightList();
QListIterator<Highlight*> it(highlightList);
Highlight* highlight;
QStringList highlightChatWindowList;
bool patternFound = false;
QStringList captures;
while (it.hasNext())
{
highlight = it.next();
QStringList highlightChatWindowList = highlight->getChatWindowList();
if (highlightChatWindowList.isEmpty() ||
highlightChatWindowList.contains(m_chatWin->getName(), Qt::CaseInsensitive))
{
if (highlight->getRegExp())
{
QRegExp needleReg(highlight->getPattern());
needleReg.setCaseSensitivity(Qt::CaseInsensitive);
patternFound = ((line.contains(needleReg)) ||
(whoSent.contains(needleReg)));
captures = needleReg.capturedTexts();
}
else
{
QString needle = highlight->getPattern();
patternFound = ((line.contains(needle, Qt::CaseInsensitive)) ||
(whoSent.contains(needle, Qt::CaseInsensitive)));
}
if (patternFound)
{
break;
}
}
}
if (patternFound)
{
highlightColor = highlight->getColor().name();
m_highlightColor = highlightColor;
m_tabNotification = Konversation::tnfHighlight;
if (Preferences::self()->highlightSoundsEnabled() && m_chatWin->notificationsEnabled())
{
konvApp->sound()->play(highlight->getSoundURL());
}
konvApp->notificationHandler()->highlight(m_chatWin, whoSent, line);
m_autoTextToSend = highlight->getAutoText();
for (int capture = 0; capture < captures.count(); capture++)
{
m_autoTextToSend.replace(QString("%%1").arg(capture), captures[capture]);
}
m_autoTextToSend.remove(QRegExp("%[0-9]"));
}
}
if (!highlightColor.isEmpty())
{
filteredLine = QLatin1String("<font color=\"") + highlightColor + QLatin1String("\">") + filteredLine +
QLatin1String("</font>");
}
}
else if (doHighlight && (whoSent == ownNick) && Preferences::self()->highlightOwnLines())
{
filteredLine = QLatin1String("<font color=\"") + Preferences::self()->highlightOwnLinesColor().name() +
QLatin1String("\">") + filteredLine + QLatin1String("</font>");
}
filteredLine = Konversation::Emoticons::parseEmoticons(filteredLine);
return filteredLine;
}
|
DoS
| 0
|
QString IRCView::filter(const QString& line, const QString& defaultColor, const QString& whoSent,
bool doHighlight, bool parseURL, bool self, QChar::Direction* direction)
{
QString filteredLine(line);
Application* konvApp = static_cast<Application*>(kapp);
if (filteredLine[0] == ' ')
{
filteredLine[0] = '\xA0';
}
filteredLine.replace('<', "\x0blt;");
filteredLine.replace('>', "\x0bgt;");
if (filteredLine.contains('\x07'))
{
if (Preferences::self()->beep())
{
kapp->beep();
}
filteredLine.remove('\x07');
}
filteredLine = ircTextToHtml(filteredLine, parseURL, defaultColor, whoSent, true, direction);
QString ownNick;
if (m_server)
{
ownNick = m_server->getNickname();
}
else if (m_chatWin->getType() == ChatWindow::DccChat)
{
ownNick = static_cast<DCC::ChatContainer*>(m_chatWin)->ownNick();
}
if(doHighlight && (whoSent != ownNick) && !self)
{
QString highlightColor;
if (Preferences::self()->highlightNick() &&
line.toLower().contains(QRegExp("(^|[^\\d\\w])" +
QRegExp::escape(ownNick.toLower()) +
"([^\\d\\w]|$)")))
{
highlightColor = Preferences::self()->highlightNickColor().name();
m_tabNotification = Konversation::tnfNick;
}
else
{
QList<Highlight*> highlightList = Preferences::highlightList();
QListIterator<Highlight*> it(highlightList);
Highlight* highlight;
QStringList highlightChatWindowList;
bool patternFound = false;
QStringList captures;
while (it.hasNext())
{
highlight = it.next();
QStringList highlightChatWindowList = highlight->getChatWindowList();
if (highlightChatWindowList.isEmpty() ||
highlightChatWindowList.contains(m_chatWin->getName(), Qt::CaseInsensitive))
{
if (highlight->getRegExp())
{
QRegExp needleReg(highlight->getPattern());
needleReg.setCaseSensitivity(Qt::CaseInsensitive);
patternFound = ((line.contains(needleReg)) ||
(whoSent.contains(needleReg)));
captures = needleReg.capturedTexts();
}
else
{
QString needle = highlight->getPattern();
patternFound = ((line.contains(needle, Qt::CaseInsensitive)) ||
(whoSent.contains(needle, Qt::CaseInsensitive)));
}
if (patternFound)
{
break;
}
}
}
if (patternFound)
{
highlightColor = highlight->getColor().name();
m_highlightColor = highlightColor;
m_tabNotification = Konversation::tnfHighlight;
if (Preferences::self()->highlightSoundsEnabled() && m_chatWin->notificationsEnabled())
{
konvApp->sound()->play(highlight->getSoundURL());
}
konvApp->notificationHandler()->highlight(m_chatWin, whoSent, line);
m_autoTextToSend = highlight->getAutoText();
for (int capture = 0; capture < captures.count(); capture++)
{
m_autoTextToSend.replace(QString("%%1").arg(capture), captures[capture]);
}
m_autoTextToSend.remove(QRegExp("%[0-9]"));
}
}
if (!highlightColor.isEmpty())
{
filteredLine = QLatin1String("<font color=\"") + highlightColor + QLatin1String("\">") + filteredLine +
QLatin1String("</font>");
}
}
else if (doHighlight && (whoSent == ownNick) && Preferences::self()->highlightOwnLines())
{
filteredLine = QLatin1String("<font color=\"") + Preferences::self()->highlightOwnLinesColor().name() +
QLatin1String("\">") + filteredLine + QLatin1String("</font>");
}
filteredLine = Konversation::Emoticons::parseEmoticons(filteredLine);
return filteredLine;
}
|
@@ -1633,7 +1633,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
}
// reopen relevant tags
- ret += openTags(data, i);
+ if (i > -1)
+ ret += openTags(data, i);
return ret;
}
@@ -1641,7 +1642,8 @@ QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag)
QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
- int i = from;
+ int i = from > -1 ? from : 0;
+
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
| null | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.