summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--base/gxfdrop.c6
-rw-r--r--base/gxfill.c5
-rw-r--r--base/gxhintn.c28
-rw-r--r--base/gximono.c2
-rw-r--r--base/gxshade6.c82
-rw-r--r--base/gxstroke.c6
-rw-r--r--base/gxttfb.c2
-rw-r--r--base/sjpx_openjpeg.c2
-rw-r--r--base/ttfmain.c4
-rw-r--r--base/vdtrace.c2
-rw-r--r--contrib/gdevgdi.c4
-rw-r--r--contrib/gdevlx7.c24
-rw-r--r--contrib/opvp/gdevopvp.c23
-rw-r--r--windows/ghostscript.vcproj4
14 files changed, 49 insertions, 145 deletions
diff --git a/base/gxfdrop.c b/base/gxfdrop.c
index d1cec19b9..0611bcf7c 100644
--- a/base/gxfdrop.c
+++ b/base/gxfdrop.c
@@ -176,7 +176,7 @@ static int store_margin(line_list * ll, margin_set * set, int ii0, int ii1)
}
me = (m0 == 0 ? set->margin_list : m0->next);
if (me == 0)
- m0 = m0; /* Already set. */
+ {} /* Already set. */
else if (me->iend < i0)
m0 = me; /* Insert after me. */
else if (me->ibeg > i1)
@@ -212,10 +212,6 @@ static int store_margin(line_list * ll, margin_set * set, int ii0, int ii1)
return 0;
}
-static inline int to_interval(int x, int l, int u)
-{ return x < l ? l : x > u ? u : x;
-}
-
static inline fixed Y_AT_X(active_line *alp, fixed xp)
{ return alp->start.y + fixed_mult_quo(xp - alp->start.x, alp->diff.y, alp->diff.x);
}
diff --git a/base/gxfill.c b/base/gxfill.c
index a4acffe9b..11e7f6dea 100644
--- a/base/gxfill.c
+++ b/base/gxfill.c
@@ -2028,11 +2028,6 @@ intersect_al(line_list *ll, fixed y, fixed *y_top, int draw, bool all_bands)
*y_top = y1;
}
-static inline int sign(int a)
-{
- return a < 0 ? -1 : a > 0 ? 1 : 0;
-}
-
/* ---------------- Trapezoid filling loop ---------------- */
/* Generate specialized algorythms for the most important cases : */
diff --git a/base/gxhintn.c b/base/gxhintn.c
index cc44f402b..1ad70eee1 100644
--- a/base/gxhintn.c
+++ b/base/gxhintn.c
@@ -151,7 +151,9 @@ static const unsigned int split_bits = 12;
static const unsigned int max_coord_bits = 24; /* = split_bits * 2 */
static const unsigned int matrix_bits = 19; /* <= sizeof(int) * 8 - 1 - split_bits */
static const unsigned int g2o_bitshift = 12; /* <= matrix_bits + max_coord_bits - (sizeof(int) * 8 + 1) */
+#ifndef HAVE_INT64_T
static const int32_t FFFFF000 = ~(int32_t)0xFFF; /* = ~(((int32_t)1 << split_bits) - 1) */
+#endif
/* Constants above must satisfy expressions given in comments. */
/* Computes (a*b)>>s, s <= 12 */
@@ -188,16 +190,9 @@ static inline int32_t Max(int32_t a, int32_t b)
{ return a > b ? a : b;
}
-static inline int32_t Min(int32_t a, int32_t b)
-{ return a < b ? a : b;
-}
-
static inline long rshift(long a, int b)
{ return b > 0 ? a << b : a >> -b;
}
-static inline ulong urshift(ulong a, int b)
-{ return b > 0 ? a << b : a >> -b;
-}
/*---------------------- members of matrix classes -------------------------*/
static inline void double_matrix__set(double_matrix * self, const gs_matrix_fixed * m)
@@ -345,10 +340,12 @@ static inline t1_glyph_space_coord o2g_dist(t1_hinter * h, t1_hinter_space_coord
{ return shift_rounded(mul_shift(od, coef, split_bits), h->g2o_fraction_bits + h->ctmi.bitshift - _fixed_shift - split_bits);
}
+#if VD_TRACE
static inline void o2g_float(t1_hinter * h, t1_hinter_space_coord ox, t1_hinter_space_coord oy, t1_glyph_space_coord *gx, t1_glyph_space_coord *gy)
{ *gx = (long)(((double)ox * h->ctmi.xx + (double)oy * h->ctmi.yx) * fixed_scale / h->g2o_fraction / h->ctmi.denominator);
*gy = (long)(((double)ox * h->ctmi.xy + (double)oy * h->ctmi.yy) * fixed_scale / h->g2o_fraction / h->ctmi.denominator);
}
+#endif
/* --------------------- t1_hint class members ---------------------*/
@@ -1817,23 +1814,6 @@ static inline bool t1_hinter__is_small_angle(t1_hinter * self, int pole_index0,
return true;
}
-static inline bool t1_hinter__is_conjugated(t1_hinter * self, int pole_index)
-{ int prev = t1_hinter__segment_beg(self, pole_index);
- int next = t1_hinter__segment_end(self, pole_index);
- long gx0 = self->pole[prev].gx - self->pole[pole_index].gx;
- long gy0 = self->pole[prev].gy - self->pole[pole_index].gy;
- long gx1 = self->pole[next].gx - self->pole[pole_index].gx;
- long gy1 = self->pole[next].gy - self->pole[pole_index].gy;
- long vp = gx0 * gy1 - gy0 * gx1;
- long sp = gx0 * gy1 - gy0 * gx1;
-
- if (sp > 0)
- return false;
- if (vp == 0)
- return true;
- return any_abs(vp) < -sp / 1000; /* The threshold is taken from scratch. */
-}
-
static inline bool t1_hinter__next_contour_pole(t1_hinter * self, int pole_index)
{ int contour_index = self->pole[pole_index].contour_index;
int beg_contour_pole = self->contour[contour_index];
diff --git a/base/gximono.c b/base/gximono.c
index f32941d50..058cdf3f7 100644
--- a/base/gximono.c
+++ b/base/gximono.c
@@ -208,6 +208,7 @@ not_fast_halftoning:
}
#define USE_SET_GRAY_FUNCTION 0
+#if USE_SET_GRAY_FUNCTION
/* Temporary function to make it easier to debug the uber-macro below */
static inline int
image_set_gray(byte sample_value, const bool masked, uint mask_base,
@@ -249,6 +250,7 @@ image_set_gray(byte sample_value, const bool masked, uint mask_base,
}
return(0);
}
+#endif
/*
* Rendering procedure for general mono-component images, dealing with
diff --git a/base/gxshade6.c b/base/gxshade6.c
index a4cc72283..02feda0b7 100644
--- a/base/gxshade6.c
+++ b/base/gxshade6.c
@@ -1817,6 +1817,7 @@ split_curve(const gs_fixed_point pole[4], gs_fixed_point q0[4], gs_fixed_point q
split_curve_s(pole, q0, q1, 1);
}
+#ifdef SHADING_SWAP_AXES_FOR_PRECISION
static inline void
do_swap_axes(gs_fixed_point *p, int k)
{
@@ -1827,18 +1828,6 @@ do_swap_axes(gs_fixed_point *p, int k)
}
}
-static inline void
-y_extreme_vertice(gs_fixed_point *q, const gs_fixed_point *p, int k, int minmax)
-{
- int i;
- gs_fixed_point r = *p;
-
- for (i = 1; i < k; i++)
- if ((p[i].y - r.y) * minmax > 0)
- r = p[i];
- *q = r;
-}
-
static inline fixed
span_x(const gs_fixed_point *p, int k)
{
@@ -1864,27 +1853,7 @@ span_y(const gs_fixed_point *p, int k)
}
return ymax - ymin;
}
-
-static inline void
-draw_wedge(const gs_fixed_point *p, int n)
-{
-#ifdef DEBUG
- int i;
-
- if (!vd_enabled)
- return;
- vd_setlinewidth(4);
- vd_setcolor(RGB(255, 0, 0));
- vd_beg_path;
- vd_moveto(p[0].x, p[0].y);
- for (i = 1; i < n; i++)
- vd_lineto(p[i].x, p[i].y);
- vd_closepath;
- vd_end_path;
- vd_fill;
- /*vd_stroke;*/
#endif
-}
static inline fixed
manhattan_dist(const gs_fixed_point *p0, const gs_fixed_point *p1)
@@ -2635,8 +2604,9 @@ constant_color_quadrangle_aux(patch_fill_state_t *pfs, const quadrangle_patch *p
{ gs_fixed_point qq[4];
make_vertices(qq, p);
-# if 0 /* Swapping axes may improve the precision,
- but slows down due to the area expantion needed
+#ifdef SHADING_SWAP_AXES_FOR_PRECISION
+ /* Swapping axes may improve the precision,
+ but slows down due to the area expansion needed
in gx_shade_trapezoid. */
dx = span_x(qq, 4);
dy = span_y(qq, 4);
@@ -2644,7 +2614,7 @@ constant_color_quadrangle_aux(patch_fill_state_t *pfs, const quadrangle_patch *p
do_swap_axes(qq, 4);
swap_axes = true;
}
-# endif
+#endif
wrap_vertices_by_y(q, qq);
}
{ fixed dx1 = q[1].x - q[0].x, dy1 = q[1].y - q[0].y;
@@ -2878,26 +2848,6 @@ is_quadrangle_color_monotonic(const patch_fill_state_t *pfs, const quadrangle_pa
return !code;
}
-static inline bool
-quadrangle_bbox_covers_pixel_centers(const quadrangle_patch *p)
-{
- fixed xbot, xtop, ybot, ytop;
-
- xbot = min(min(p->p[0][0]->p.x, p->p[0][1]->p.x),
- min(p->p[1][0]->p.x, p->p[1][1]->p.x));
- xtop = max(max(p->p[0][0]->p.x, p->p[0][1]->p.x),
- max(p->p[1][0]->p.x, p->p[1][1]->p.x));
- if (covers_pixel_centers(xbot, xtop))
- return true;
- ybot = min(min(p->p[0][0]->p.y, p->p[0][1]->p.y),
- min(p->p[1][0]->p.y, p->p[1][1]->p.y));
- ytop = max(max(p->p[0][0]->p.y, p->p[0][1]->p.y),
- max(p->p[1][0]->p.y, p->p[1][1]->p.y));
- if (covers_pixel_centers(ybot, ytop))
- return true;
- return false;
-}
-
static inline void
divide_bar(patch_fill_state_t *pfs,
const shading_vertex_t *p0, const shading_vertex_t *p1, int radix, shading_vertex_t *p,
@@ -3886,28 +3836,6 @@ fill_stripe(patch_fill_state_t *pfs, const tensor_patch *p)
return fill_wedges(pfs, ku[3], kum, p->pole[3], 1, p->c[1][0], p->c[1][1], inpatch_wedge);
}
-static inline bool
-is_curve_x_monotonic(const gs_fixed_point *pole, int pole_step)
-{ /* true = monotonic, false = don't know. */
- return (pole[0 * pole_step].x <= pole[1 * pole_step].x &&
- pole[1 * pole_step].x <= pole[2 * pole_step].x &&
- pole[2 * pole_step].x <= pole[3 * pole_step].x) ||
- (pole[0 * pole_step].x >= pole[1 * pole_step].x &&
- pole[1 * pole_step].x >= pole[2 * pole_step].x &&
- pole[2 * pole_step].x >= pole[3 * pole_step].x);
-}
-
-static inline bool
-is_curve_y_monotonic(const gs_fixed_point *pole, int pole_step)
-{ /* true = monotonic, false = don't know. */
- return (pole[0 * pole_step].y <= pole[1 * pole_step].y &&
- pole[1 * pole_step].y <= pole[2 * pole_step].y &&
- pole[2 * pole_step].y <= pole[3 * pole_step].y) ||
- (pole[0 * pole_step].y >= pole[1 * pole_step].y &&
- pole[1 * pole_step].y >= pole[2 * pole_step].y &&
- pole[2 * pole_step].y >= pole[3 * pole_step].y);
-}
-
static inline bool neqs(int *a, int b)
{ /* Unequal signs. Assuming -1, 0, 1 only. */
if (*a * b < 0)
diff --git a/base/gxstroke.c b/base/gxstroke.c
index 1c6eebea7..da16bd201 100644
--- a/base/gxstroke.c
+++ b/base/gxstroke.c
@@ -1715,8 +1715,7 @@ stroke_add_fast(gx_path * ppath, gx_path * rpath, bool ensure_closed, int first,
* line segments generated from arcs to be round. This would
* solve some flatness issues, but makes some pathological
* cases incredibly slow. */
- if ((join == gs_join_round)
- /* || (flags & nf_all_from_arc) */) {
+ if (join == gs_join_round /* || (flags & nf_all_from_arc) */) {
code = add_pie_join_fast_ccw(ppath, plp, nplp, reflected);
} else { /* non-round join */
code = line_join_points_fast_ccw(pgs_lp, plp, nplp,
@@ -1755,8 +1754,7 @@ stroke_add_fast(gx_path * ppath, gx_path * rpath, bool ensure_closed, int first,
* line segments generated from arcs to be round. This would
* solve some flatness issues, but makes some pathological
* cases incredibly slow. */
- if ((join == gs_join_round)
- /* || (flags & nf_all_from_arc) */) {
+ if (join == gs_join_round /* || (flags & nf_all_from_arc) */) {
code = add_pie_join_fast_cw(rpath, plp, nplp, reflected);
} else { /* non-round join */
code = line_join_points_fast_cw(pgs_lp, plp, nplp,
diff --git a/base/gxttfb.c b/base/gxttfb.c
index 363da209c..aae788259 100644
--- a/base/gxttfb.c
+++ b/base/gxttfb.c
@@ -239,6 +239,7 @@ static void DebugRepaint(ttfFont *ttf)
{
}
+#ifdef DEBUG
static int DebugPrint(ttfFont *ttf, const char *fmt, ...)
{
char buf[500];
@@ -255,6 +256,7 @@ static int DebugPrint(ttfFont *ttf, const char *fmt, ...)
}
return 0;
}
+#endif
static void WarnBadInstruction(gs_font_type42 *pfont, int glyph_index)
{
diff --git a/base/sjpx_openjpeg.c b/base/sjpx_openjpeg.c
index 281e2d217..cd52ccaad 100644
--- a/base/sjpx_openjpeg.c
+++ b/base/sjpx_openjpeg.c
@@ -35,7 +35,7 @@ static OPJ_SIZE_T sjpx_stream_read(void * p_buffer, OPJ_SIZE_T p_nb_bytes, void
OPJ_SIZE_T len;
len = sb->size - sb->pos;
- if (len < 0)
+ if (sb->size < sb->pos)
len = 0;
if (len == 0)
return (OPJ_SIZE_T)-1; /* End of file! */
diff --git a/base/ttfmain.c b/base/ttfmain.c
index a692a5fbb..9b17e5350 100644
--- a/base/ttfmain.c
+++ b/base/ttfmain.c
@@ -707,8 +707,8 @@ retry:
/* We have a range or errors that can be caused by
* bad bytecode
*/
- if (error >= TT_Err_Invalid_Opcode
- || error <= TT_Err_Invalid_Displacement) {
+ if ((int)error >= TT_Err_Invalid_Opcode
+ || (int)error <= TT_Err_Invalid_Displacement) {
error = fBadInstruction;
}
else {
diff --git a/base/vdtrace.c b/base/vdtrace.c
index 049614a4a..6032ebec8 100644
--- a/base/vdtrace.c
+++ b/base/vdtrace.c
@@ -42,10 +42,12 @@ static inline double scale_y(vd_trace_interface *I, double y)
#define SX(x) scale_x(vd_trace1, x)
#define SY(y) scale_y(vd_trace1, y)
+#ifdef DEBUG
static inline double bezier_point(double p0, double p1, double p2, double p3, double t)
{ double s = 1-t;
return p0*s*s*s + 3*p1*s*s*t + 3*p2*s*t*t + p3*t*t*t;
}
+#endif
static void vd_flatten(double p0x, double p0y, double p1x, double p1y, double p2x, double p2y, double p3x, double p3y)
{
diff --git a/contrib/gdevgdi.c b/contrib/gdevgdi.c
index ef11d9d98..41104b84d 100644
--- a/contrib/gdevgdi.c
+++ b/contrib/gdevgdi.c
@@ -467,10 +467,6 @@ unsigned long FrameTiffComp(unsigned char *pubDest,
}
else
{
- if(i == 0x253)
- {
- i = i;
- }
usLineSize = PreTiffComp(SrcPtr, usBytesPerLine);
}
SrcPtr += usBytesPerLine;
diff --git a/contrib/gdevlx7.c b/contrib/gdevlx7.c
index 043ac079a..99b3ac3e8 100644
--- a/contrib/gdevlx7.c
+++ b/contrib/gdevlx7.c
@@ -361,18 +361,22 @@ static void find_lr_pixels(byte *buf[],int bytelen,int bufheight,
/* ------ Driver procedures ------ */
/*** THIS NEED TO BE REWORKED SOON ***/
-static const int LEFT_MARGIN=50;
-static const int VERTSIZE=LX7_BSW_H;
+enum {
+ LEFT_MARGIN=50,
+ VERTSIZE=LX7_BSW_H
+};
/* offsets to print line sequence (defined in outbuf)
*/
-static const int IDX_SEQLEN=5;
-static const int IDX_HORRES=8;
-static const int IDX_PACKETS=13;
-static const int IDX_5700DIF=12;
-static const int IDX_HSTART=15;
-static const int IDX_HEND=17;
-static const int IDX_DATA=26;
-static const int IDX_CARTRIDGE=10;
+enum {
+ IDX_SEQLEN=5,
+ IDX_HORRES=8,
+ IDX_PACKETS=13,
+ IDX_5700DIF=12,
+ IDX_HSTART=15,
+ IDX_HEND=17,
+ IDX_DATA=26,
+ IDX_CARTRIDGE=10
+};
#define DIV8(x) ( (x) >> 3 )
#define MOD8(x) ( (x) & 0x7 )
diff --git a/contrib/opvp/gdevopvp.c b/contrib/opvp/gdevopvp.c
index aca3e6acb..c8bc50dc6 100644
--- a/contrib/opvp/gdevopvp.c
+++ b/contrib/opvp/gdevopvp.c
@@ -489,7 +489,7 @@ static opvp_cspace_t cspace_0_2_to_1_0[] = {
};
/* color space mapping 1.0 to 0.2 */
-static opvp_cspace_t cspace_1_0_to_0_2[] = {
+static OPVP_ColorSpace cspace_1_0_to_0_2[] = {
OPVP_cspaceBW,
OPVP_cspaceDeviceGray,
OPVP_cspaceDeviceCMY,
@@ -501,7 +501,7 @@ static opvp_cspace_t cspace_1_0_to_0_2[] = {
};
/* image format mapping 1.0 to 0.2 */
-static opvp_imageformat_t iformat_1_0_to_0_2[] = {
+static OPVP_ImageFormat iformat_1_0_to_0_2[] = {
OPVP_iformatRaw,
OPVP_iformatRaw, /* OPVP_IFORMAT_MASK use iformat raw in 0.2 */
OPVP_iformatRLE,
@@ -620,7 +620,7 @@ SetColorSpaceWrapper(opvp_dc_t printerContext, opvp_cspace_t cspace)
*ErrorNo = OPVP_NOTSUPPORTED_0_2;
return -1;
}
- if (cspace
+ if ((int)cspace
>= sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
/* unknown color space */
*ErrorNo = OPVP_PARAMERROR_0_2;
@@ -664,7 +664,7 @@ SetStrokeColorWrapper(opvp_dc_t printerContext, const opvp_brush_t *brush)
/* 0.2 doesn't have OPVP_CSPACE_DEVICEKRGB */
return OPVP_NOTSUPPORTED;
}
- if (brush->colorSpace
+ if ((int)brush->colorSpace
>= sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
/* unknown color space */
*ErrorNo = OPVP_PARAMERROR_0_2;
@@ -691,7 +691,7 @@ SetFillColorWrapper(opvp_dc_t printerContext, const opvp_brush_t *brush)
/* 0.2 doesn't have OPVP_CSPACE_DEVICEKRGB */
return OPVP_NOTSUPPORTED;
}
- if (brush->colorSpace
+ if ((int)brush->colorSpace
>= sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
/* unknown color space */
*ErrorNo = OPVP_PARAMERROR_0_2;
@@ -719,7 +719,7 @@ SetBgColorWrapper(opvp_dc_t printerContext, const opvp_brush_t *brush)
*ErrorNo = OPVP_NOTSUPPORTED_0_2;
return -1;
}
- if (brush->colorSpace
+ if ((int)brush->colorSpace
>= sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
/* unknown color space */
*ErrorNo = OPVP_PARAMERROR_0_2;
@@ -2061,8 +2061,7 @@ opvp_open(gx_device *dev)
/* open printer device */
code = gdev_prn_open(dev);
if (code < 0) {
- ecode = ecode;
- return ecode;
+ return code;
}
while (dev->child) {
dev = dev->child;
@@ -2072,16 +2071,14 @@ opvp_open(gx_device *dev)
/* open output stream */
code = gdev_prn_open_printer_seekable(dev, true, false);
if (code < 0) {
- ecode = code;
- return ecode;
+ return code;
}
outputFD = fileno(rdev->file);
}
/* RE-load vector driver */
if ((code = opvp_load_vector_driver())) {
- ecode = code;
- return ecode;
+ return code;
}
/* call opvpOpenPrinter */
@@ -2131,7 +2128,7 @@ opvp_open(gx_device *dev)
int i;
for (i = 0;i < nn;i++) {
- if (p[i] < sizeof(cspace_available)) {
+ if ((unsigned int)p[i] < sizeof(cspace_available)) {
cspace_available[p[i]] = 1;
}
}
diff --git a/windows/ghostscript.vcproj b/windows/ghostscript.vcproj
index 3c9c86c45..cf4072c07 100644
--- a/windows/ghostscript.vcproj
+++ b/windows/ghostscript.vcproj
@@ -2646,6 +2646,10 @@
>
</File>
<File
+ RelativePath="..\base\sjpx_openjpeg.c"
+ >
+ </File>
+ <File
RelativePath="..\base\slzwc.c"
>
</File>