Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame^] | 1 | From 6379331cd0647fc6f149f55e4505a9a92e4f159f Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Mon, 22 Aug 2022 22:43:26 -0700 |
| 4 | Subject: [PATCH] Fix deprecared function prototypes |
| 5 | |
| 6 | Fixes following errors: |
| 7 | error: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] |
| 8 | |
| 9 | Upstream-Status: Submitted [https://github.com/libgd/libgd/pull/835] |
| 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 11 | --- |
| 12 | src/gd_nnquant.c | 32 +++++++------------------------- |
| 13 | src/gd_tiff.c | 4 +--- |
| 14 | 2 files changed, 8 insertions(+), 28 deletions(-) |
| 15 | |
| 16 | diff --git a/src/gd_nnquant.c b/src/gd_nnquant.c |
| 17 | index 8b9aa794..013f7160 100644 |
| 18 | --- a/src/gd_nnquant.c |
| 19 | +++ b/src/gd_nnquant.c |
| 20 | @@ -112,12 +112,7 @@ typedef struct { |
| 21 | |
| 22 | /* Initialise network in range (0,0,0,0) to (255,255,255,255) and set parameters |
| 23 | ----------------------------------------------------------------------- */ |
| 24 | -static void initnet(nnq, thepic, len, sample, colours) |
| 25 | -nn_quant *nnq; |
| 26 | -unsigned char *thepic; |
| 27 | -int len; |
| 28 | -int sample; |
| 29 | -int colours; |
| 30 | +static void initnet(nn_quant *nnq, unsigned char *thepic, int len, int sample, int colours) |
| 31 | { |
| 32 | register int i; |
| 33 | register int *p; |
| 34 | @@ -163,9 +158,7 @@ static void unbiasnet(nn_quant *nnq) |
| 35 | } |
| 36 | |
| 37 | /* Output colormap to unsigned char ptr in RGBA format */ |
| 38 | -static void getcolormap(nnq, map) |
| 39 | -nn_quant *nnq; |
| 40 | -unsigned char *map; |
| 41 | +static void getcolormap(nn_quant *nnq, unsigned char *map) |
| 42 | { |
| 43 | int i,j; |
| 44 | for(j=0; j < nnq->netsize; j++) { |
| 45 | @@ -232,9 +225,7 @@ static void inxbuild(nn_quant *nnq) |
| 46 | |
| 47 | /* Search for ABGR values 0..255 (after net is unbiased) and return colour index |
| 48 | ---------------------------------------------------------------------------- */ |
| 49 | -static unsigned int inxsearch(nnq, al,b,g,r) |
| 50 | -nn_quant *nnq; |
| 51 | -register int al, b, g, r; |
| 52 | +static unsigned int inxsearch(nn_quant *nnq, int al, int b, int g, int r) |
| 53 | { |
| 54 | register int i, j, dist, a, bestd; |
| 55 | register int *p; |
| 56 | @@ -306,9 +297,7 @@ register int al, b, g, r; |
| 57 | |
| 58 | /* Search for biased ABGR values |
| 59 | ---------------------------- */ |
| 60 | -static int contest(nnq, al,b,g,r) |
| 61 | -nn_quant *nnq; |
| 62 | -register int al,b,g,r; |
| 63 | +static int contest(nn_quant *nnq, int al, int b, int g, int r) |
| 64 | { |
| 65 | /* finds closest neuron (min dist) and updates freq */ |
| 66 | /* finds best neuron (min dist-bias) and returns position */ |
| 67 | @@ -362,9 +351,7 @@ register int al,b,g,r; |
| 68 | /* Move neuron i towards biased (a,b,g,r) by factor alpha |
| 69 | ---------------------------------------------------- */ |
| 70 | |
| 71 | -static void altersingle(nnq, alpha,i,al,b,g,r) |
| 72 | -nn_quant *nnq; |
| 73 | -register int alpha,i,al,b,g,r; |
| 74 | +static void altersingle(nn_quant *nnq, int alpha, int i,int al, int b, int g, int r) |
| 75 | { |
| 76 | register int *n; |
| 77 | |
| 78 | @@ -382,10 +369,7 @@ register int alpha,i,al,b,g,r; |
| 79 | /* Move adjacent neurons by precomputed alpha*(1-((i-j)^2/[r]^2)) in radpower[|i-j|] |
| 80 | --------------------------------------------------------------------------------- */ |
| 81 | |
| 82 | -static void alterneigh(nnq, rad,i,al,b,g,r) |
| 83 | -nn_quant *nnq; |
| 84 | -int rad,i; |
| 85 | -register int al,b,g,r; |
| 86 | +static void alterneigh(nn_quant *nnq, int rad, int i, int al,int b,int g, int r) |
| 87 | { |
| 88 | register int j,k,lo,hi,a; |
| 89 | register int *p, *q; |
| 90 | @@ -429,9 +413,7 @@ register int al,b,g,r; |
| 91 | /* Main Learning Loop |
| 92 | ------------------ */ |
| 93 | |
| 94 | -static void learn(nnq, verbose) /* Stu: N.B. added parameter so that main() could control verbosity. */ |
| 95 | -nn_quant *nnq; |
| 96 | -int verbose; |
| 97 | +static void learn(nn_quant *nnq, int verbose) /* Stu: N.B. added parameter so that main() could control verbosity. */ |
| 98 | { |
| 99 | register int i,j,al,b,g,r; |
| 100 | int radius,rad,alpha,step,delta,samplepixels; |
| 101 | diff --git a/src/gd_tiff.c b/src/gd_tiff.c |
| 102 | index 7f72b610..3d90e61a 100644 |
| 103 | --- a/src/gd_tiff.c |
| 104 | +++ b/src/gd_tiff.c |
| 105 | @@ -446,9 +446,7 @@ BGD_DECLARE(void) gdImageTiffCtx(gdImagePtr image, gdIOCtx *out) |
| 106 | } |
| 107 | |
| 108 | /* Check if we are really in 8bit mode */ |
| 109 | -static int checkColorMap(n, r, g, b) |
| 110 | -int n; |
| 111 | -uint16_t *r, *g, *b; |
| 112 | +static int checkColorMap(int n, uint16_t *r, uint16_t *g, uint16_t *b) |
| 113 | { |
| 114 | while (n-- > 0) |
| 115 | if (*r++ >= 256 || *g++ >= 256 || *b++ >= 256) |