From 5f1ee8fe699e7de6c17a208a6e6bd41ef29f9759 Mon Sep 17 00:00:00 2001 From: Jonathan Wilkes <jon.w.wilkes@gmail.com> Date: Thu, 31 Dec 2020 20:16:55 +0000 Subject: [PATCH] remove unused variables, use correct types as args, protect against overflow --- pd/src/d_fft_mayer.c | 4 ++-- pd/src/g_all_guis.h | 2 +- pd/src/g_bang.c | 2 +- pd/src/g_readwrite.c | 4 ++++ pd/src/g_toggle.c | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pd/src/d_fft_mayer.c b/pd/src/d_fft_mayer.c index 8df7fb3ff..3e51d3086 100644 --- a/pd/src/d_fft_mayer.c +++ b/pd/src/d_fft_mayer.c @@ -398,7 +398,7 @@ void mayer_ifft(int n, REAL *real, REAL *imag) void mayer_realfft(int n, REAL *real) { - REAL a,b,c,d; + REAL a,b; int i,j,k; mayer_fht(real,n); for (i=1,j=n-1,k=n/2;i<k;i++,j--) { @@ -411,7 +411,7 @@ void mayer_realfft(int n, REAL *real) void mayer_realifft(int n, REAL *real) { - REAL a,b,c,d; + REAL a,b; int i,j,k; for (i=1,j=n-1,k=n/2;i<k;i++,j--) { a = real[i]; diff --git a/pd/src/g_all_guis.h b/pd/src/g_all_guis.h index b7684019f..39d88ebb5 100644 --- a/pd/src/g_all_guis.h +++ b/pd/src/g_all_guis.h @@ -48,7 +48,7 @@ typedef struct _scalehandle t_symbol *h_bindsym; int h_scale; char h_pathname[37]; // max size for ".x%llx.h%llx" = 5+4*sizeof(long) - char h_outlinetag[18]; // max size for "h%llx" = 2+2*sizeof(long) + char h_outlinetag[25]; // "h%zux", (t_uint)h int h_dragon; // bool int h_dragx; int h_dragy; diff --git a/pd/src/g_bang.c b/pd/src/g_bang.c index 00d2b0be8..c32084841 100644 --- a/pd/src/g_bang.c +++ b/pd/src/g_bang.c @@ -132,7 +132,7 @@ static void bng__motionhook(t_scalehandle *sh, { if (mouse_y > y2) d = mouse_y - y2; - else if (abs(mouse_y - y2) < abs(mouse_x - x2)) + else if (abs((int)(mouse_y - y2)) < abs((int)(mouse_x - x2))) d = mouse_y - y2; else d = mouse_x - x2; diff --git a/pd/src/g_readwrite.c b/pd/src/g_readwrite.c index 007dcc0ee..ae4ee02ab 100644 --- a/pd/src/g_readwrite.c +++ b/pd/src/g_readwrite.c @@ -552,6 +552,7 @@ void canvas_writescalar(t_symbol *templatesym, t_word *w, t_binbuf *b, } } +/* static void glist_writelist(t_gobj *y, t_binbuf *b) { for (; y; y = y->g_next) @@ -563,6 +564,7 @@ static void glist_writelist(t_gobj *y, t_binbuf *b) } } } +*/ /* ------------ routines to write out templates for data ------- */ @@ -637,6 +639,7 @@ static void canvas_addtemplatesforstruct(t_template *template, } } +/* static void canvas_addtemplatesforlist(t_gobj *y, int *p_ntemplates, t_symbol ***p_templatevec) { @@ -649,6 +652,7 @@ static void canvas_addtemplatesforlist(t_gobj *y, } } } +*/ /* write all "scalars" in a glist to a binbuf. */ t_binbuf *glist_writetobinbuf(t_glist *x, int wholething) diff --git a/pd/src/g_toggle.c b/pd/src/g_toggle.c index 195887fc5..bcc06a597 100644 --- a/pd/src/g_toggle.c +++ b/pd/src/g_toggle.c @@ -114,7 +114,7 @@ static void toggle__motionhook(t_scalehandle *sh, t_floatarg mouse_x, t_floatarg { if (mouse_y > y2) d = mouse_y - y2; - else if (abs(mouse_y - y2) < abs(mouse_x - x2)) + else if (abs((int)(mouse_y - y2)) < abs((int)(mouse_x - x2))) d = mouse_y - y2; else d = mouse_x - x2; -- GitLab