Skip to content

Commit 41c3e3d

Browse files
committed
Remove unused variables and functions
We remove the unused variables altogether, and port libgd/libgd@f50c24e to silence the compiler warnings.
1 parent d1f3746 commit 41c3e3d

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

ext/gd/libgd/gd_interpolation.c

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ static double filter_generalized_cubic(const double t)
366366
return 0;
367367
}
368368

369+
#ifdef FUNCTION_NOT_USED_YET
369370
/* CubicSpline filter, default radius 2 */
370371
static double filter_cubic_spline(const double x1)
371372
{
@@ -381,7 +382,9 @@ static double filter_cubic_spline(const double x1)
381382
}
382383
return 0;
383384
}
385+
#endif
384386

387+
#ifdef FUNCTION_NOT_USED_YET
385388
/* CubicConvolution filter, default radius 3 */
386389
static double filter_cubic_convolution(const double x1)
387390
{
@@ -394,6 +397,7 @@ static double filter_cubic_convolution(const double x1)
394397
if (x <= 3.0) return ( (1.0/12.0) * x2_x - (2.0 / 3.0) * x2 + 1.75 * x - 1.5);
395398
return 0;
396399
}
400+
#endif
397401

398402
static double filter_box(double x) {
399403
if (x < - DEFAULT_FILTER_BOX)
@@ -418,15 +422,17 @@ static double filter_catmullrom(const double x)
418422
return(0.0f);
419423
}
420424

425+
#ifdef FUNCTION_NOT_USED_YET
421426
static double filter_filter(double t)
422427
{
423428
/* f(t) = 2|t|^3 - 3|t|^2 + 1, -1 <= t <= 1 */
424429
if(t < 0.0) t = -t;
425430
if(t < 1.0) return((2.0 * t - 3.0) * t * t + 1.0);
426431
return(0.0);
427432
}
433+
#endif
428434

429-
435+
#ifdef FUNCTION_NOT_USED_YET
430436
/* Lanczos8 filter, default radius 8 */
431437
static double filter_lanczos8(const double x1)
432438
{
@@ -441,8 +447,9 @@ static double filter_lanczos8(const double x1)
441447
return 0.0;
442448
#undef R
443449
}
450+
#endif
444451

445-
452+
#ifdef FUNCTION_NOT_USED_YET
446453
/* Lanczos3 filter, default radius 3 */
447454
static double filter_lanczos3(const double x1)
448455
{
@@ -458,6 +465,7 @@ static double filter_lanczos3(const double x1)
458465
return 0.0;
459466
#undef R
460467
}
468+
#endif
461469

462470
/* Hermite filter, default radius 1 */
463471
static double filter_hermite(const double x1)
@@ -515,13 +523,15 @@ static double filter_mitchell(const double x)
515523

516524

517525

526+
#ifdef FUNCTION_NOT_USED_YET
518527
/* Cosine filter, default radius 1 */
519528
static double filter_cosine(const double x)
520529
{
521530
if ((x >= -1.0) && (x <= 1.0)) return ((cos(x * M_PI) + 1.0)/2.0);
522531

523532
return 0;
524533
}
534+
#endif
525535

526536
/* Quadratic filter, default radius 1.5 */
527537
static double filter_quadratic(const double x1)
@@ -553,6 +563,7 @@ static double filter_bspline(const double x)
553563
}
554564
}
555565

566+
#ifdef FUNCTION_NOT_USED_YET
556567
/* QuadraticBSpline filter, default radius 1.5 */
557568
static double filter_quadratic_bspline(const double x1)
558569
{
@@ -562,6 +573,7 @@ static double filter_quadratic_bspline(const double x1)
562573
if (x <= 1.5) return (0.5 * x * x - 1.5 * x + 1.125);
563574
return 0.0;
564575
}
576+
#endif
565577

566578
static double filter_gaussian(const double x)
567579
{
@@ -603,14 +615,15 @@ static double filter_sinc(const double x)
603615
return (sin(M_PI * (double) x) / (M_PI * (double) x));
604616
}
605617

618+
#ifdef FUNCTION_NOT_USED_YET
606619
static double filter_welsh(const double x)
607620
{
608621
/* Welsh parabolic windowing filter */
609622
if (x < 1.0)
610623
return(1 - x*x);
611624
return(0.0);
612625
}
613-
626+
#endif
614627

615628
/* Copied from upstream's libgd */
616629
static inline int _color_blend (const int dst, const int src)
@@ -1287,7 +1300,6 @@ static gdImagePtr gdImageScaleBilinearTC(gdImagePtr im, const unsigned int new_w
12871300

12881301
int dst_offset_h;
12891302
int dst_offset_v = 0;
1290-
int dwSrcTotalOffset;
12911303
long i;
12921304
gdImagePtr new_img;
12931305

@@ -1326,7 +1338,6 @@ static gdImagePtr gdImageScaleBilinearTC(gdImagePtr im, const unsigned int new_w
13261338
f_g1, f_g2, f_g3, f_g4,
13271339
f_b1, f_b2, f_b3, f_b4,
13281340
f_a1, f_a2, f_a3, f_a4;
1329-
dwSrcTotalOffset = m + n;
13301341
/* 0 for bgColor; (n,m) is supposed to be valid anyway */
13311342
pixel1 = getPixelOverflowTC(im, n, m, 0);
13321343
pixel2 = getPixelOverflowTC(im, n + 1, m, pixel1);
@@ -2352,12 +2363,10 @@ int gdTransformAffineCopy(gdImagePtr dst,
23522363
gdRect bbox;
23532364
int end_x, end_y;
23542365
gdInterpolationMethod interpolation_id_bak = GD_DEFAULT;
2355-
interpolation_method interpolation_bak;
23562366

23572367
/* These methods use special implementations */
23582368
if (src->interpolation_id == GD_BILINEAR_FIXED || src->interpolation_id == GD_BICUBIC_FIXED || src->interpolation_id == GD_NEAREST_NEIGHBOUR) {
23592369
interpolation_id_bak = src->interpolation_id;
2360-
interpolation_bak = src->interpolation;
23612370

23622371
gdImageSetInterpolationMethod(src, GD_BICUBIC);
23632372
}

0 commit comments

Comments
 (0)