From 743b6d6d2b17e46323e8b3fc873ed7b850916f9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Mon, 3 Jul 2023 09:15:05 +0200 Subject: Fix compiler warnings Forwarded: https://github.com/electrickery/pd-maxlib/pull/2 Last-Update: 2023-07-03 Gbp-Pq: Name compiler-warnings.patch --- src/chord.c | 54 +++++++++++++++++++++++++++--------------------------- src/dist.c | 6 ------ src/gestalt.c | 2 +- src/pulse.c | 3 +-- src/remote.c | 6 ------ src/speedlim.c | 2 +- src/subst.c | 6 ++++-- 7 files changed, 34 insertions(+), 45 deletions(-) diff --git a/src/chord.c b/src/chord.c index 84563b6..3e6201e 100644 --- a/src/chord.c +++ b/src/chord.c @@ -124,26 +124,26 @@ typedef struct chord t_outlet *x_outchordinversion; /* inversion of the chord (root = 0, 1st = 1, 2nd = 2) */ t_outlet *x_outchordnotes; /* list with note numbers belonging to the chord */ - t_int x_pitch; - t_int x_pc[12]; /* pitch class array */ - t_int x_abs_pc[12]; /* pitch class array: absolute MIDI note numbers */ - t_int x_velo; - t_int x_alloctable[MAX_POLY]; /* a table used to store all playing notes */ - t_int x_poly; /* number of notes currently playing */ + int x_pitch; + int x_pc[12]; /* pitch class array */ + int x_abs_pc[12]; /* pitch class array: absolute MIDI note numbers */ + int x_velo; + int x_alloctable[MAX_POLY]; /* a table used to store all playing notes */ + int x_poly; /* number of notes currently playing */ t_atom x_chordlist[12]; /* list that stores the note numbers for output */ - t_int x_split; /* highes note number to process */ + int x_split; /* highes note number to process */ - t_int x_chord_type; /* chord's type (number between 0 and 68) */ - t_int x_chord_root; /* chord's root (pitch class) */ - t_int x_chord_bass; /* chord's bass note (MIDI note number) */ - t_int x_chord_inversion; /* chord's state of inversion (root, 1st, 2nd) */ + int x_chord_type; /* chord's type (number between 0 and 68) */ + int x_chord_root; /* chord's root (pitch class) */ + int x_chord_bass; /* chord's bass note (MIDI note number) */ + int x_chord_inversion; /* chord's state of inversion (root, 1st, 2nd) */ } t_chord; /* functions */ -static void chord_kick_out_member(t_chord *x, t_int number, t_int *members); -static void chord_chord_finder(t_chord *x, t_int num_pcs); -static void chord_draw_chord_type(t_chord *x, t_int num_pcs); +static void chord_kick_out_member(t_chord *x, int number, int *members); +static void chord_chord_finder(t_chord *x, int num_pcs); +static void chord_draw_chord_type(t_chord *x, int num_pcs); static void chord_unison(t_chord *x) @@ -412,7 +412,7 @@ static void chord_quintad(t_chord *x) static t_type_root quintads[8][8][8][8]; register int i, j, k, l; register t_type_root *t; - t_int members[5]; + int members[5]; int interval1, interval2, interval3, interval4; int *st; int maj9[5][4] = {{1,1,2,3}, {0,1,1,2}, {3,0,1,1}, {2,3,0,1}, {1,2,3,0}}; @@ -963,7 +963,7 @@ static void chord_sextad(t_chord *x) register int i, j, k, l, m; register t_type_root *t; register int* st; - t_int members[6]; + int members[6]; int interval1, interval2, interval3, interval4, interval5; int D9b3[6][5] = @@ -1189,7 +1189,7 @@ static void chord_sextad(t_chord *x) chord_kick_out_member(x, 6, members); } -static int chord_accidental(t_int pc) +static int chord_accidental(int pc) { switch (pc) { case 0: @@ -1440,7 +1440,7 @@ static int chord_name_thirteenth(t_chord *x, char* chord, int c, int rootName) -static void chord_spell_chord(t_chord *x, char *chord, t_int num_pcs) +static void chord_spell_chord(t_chord *x, char *chord, int num_pcs) { int rootName = 0; // keep index of root name class int c = 0; // pointer to current character @@ -1503,7 +1503,7 @@ static void chord_spell_chord(t_chord *x, char *chord, t_int num_pcs) } -static void chord_draw_chord_type(t_chord *x, t_int num_pcs) +static void chord_draw_chord_type(t_chord *x, int num_pcs) { char chord[255]; /* output string */ int i, j; @@ -1628,7 +1628,7 @@ static void chord_draw_chord_type(t_chord *x, t_int num_pcs) outlet_float(x->x_outchordval, x->x_chord_bass); } -static void chord_kick_out_member(t_chord *x, t_int number, t_int *members) +static void chord_kick_out_member(t_chord *x, int number, int *members) { int *distances; int minDistance = 1000; @@ -1663,7 +1663,7 @@ static void chord_kick_out_member(t_chord *x, t_int number, t_int *members) x->x_pc[members[badMember]] = 1; // replace most dissonant member } -static void chord_chord_finder(t_chord *x, t_int num_pcs) +static void chord_chord_finder(t_chord *x, int num_pcs) { int i; x->x_chord_type = kNone; @@ -1689,12 +1689,12 @@ static void chord_chord_finder(t_chord *x, t_int num_pcs) static void chord_float(t_chord *x, t_floatarg f) { - t_int velo = x->x_velo; - t_int allloc = 0; - t_int num_pc = 0; /* number of pitch classes present */ + int velo = x->x_velo; + int allloc = 0; + int num_pc = 0; /* number of pitch classes present */ int i, j, k, l; - x->x_pitch = (t_int)f; + x->x_pitch = (int)f; if(x->x_pitch <= x->x_split) { @@ -1775,7 +1775,7 @@ static void chord_float(t_chord *x, t_floatarg f) static void chord_ft1(t_chord *x, t_floatarg f) { - x->x_velo = (t_int)f; + x->x_velo = (int)f; } static t_class *chord_class; @@ -1791,7 +1791,7 @@ static void *chord_new(t_floatarg f) x->x_outchordinversion = outlet_new(&x->x_ob, gensym("float")); x->x_outchordnotes = outlet_new(&x->x_ob, gensym("float")); - x->x_split = (t_int)f; + x->x_split = (int)f; if(x->x_split == 0)x->x_split = 128; for(i = 0; i < MAX_POLY; i++)x->x_alloctable[i] = -1; diff --git a/src/dist.c b/src/dist.c index 4f6acc3..d53bc4f 100644 --- a/src/dist.c +++ b/src/dist.c @@ -111,7 +111,6 @@ static void dist_anything(t_dist *x, t_symbol *s, int argc, t_atom *argv) static void dist_send(t_dist *x, t_symbol *s, int argc, t_atom *argv) { int i; - t_atom av[MAX_ARG]; /* the 'new' t_atom without first element */ t_int ac = argc - 1; /* the 'new' number of arguments */ if(ac > MAX_ARG) @@ -119,11 +118,6 @@ static void dist_send(t_dist *x, t_symbol *s, int argc, t_atom *argv) post("dist: too many arguments!"); return; } - - for(i = 1; i < argc; i++) - { - av[i - 1] = argv[i]; /* just copy, don't care about types */ - } /* send only argument-part to receivers */ for(i = 0; i <= x->x_rec; i++) { diff --git a/src/gestalt.c b/src/gestalt.c index 0c3bdb8..25bc7ab 100644 --- a/src/gestalt.c +++ b/src/gestalt.c @@ -69,7 +69,7 @@ static void gestalt_float(t_gestalt *x, t_floatarg f) if(pitch < 1) pitch = 0; if(pitch > 127) pitch = 127; - interval = abs(pitch - x->x_lastpitch); + interval = abs(pitch - (int)x->x_lastpitch); gestalt = (clock_gettimesince(x->x_lastontime)/x->x_reftime) + interval; x->x_lastpitch = pitch; diff --git a/src/pulse.c b/src/pulse.c index b7964cd..4cc08e2 100644 --- a/src/pulse.c +++ b/src/pulse.c @@ -157,8 +157,7 @@ static void pulse_tick(Pulse *x) static void pulse_tempo(Pulse *x, t_floatarg t) { double time, msecdur, tickdur, fracremain; - t_int fracnumer, fracquotient, oldtempo; - oldtempo = x->p_tempo; + t_int fracnumer, fracquotient; x->p_tempo = (t<5) ? 5 : ((t>500) ? 500 : t); if (x->p_onoff) { /* calculate fraction of the beat we have done */ diff --git a/src/remote.c b/src/remote.c index 93974d9..9c06754 100644 --- a/src/remote.c +++ b/src/remote.c @@ -45,7 +45,6 @@ typedef struct _remote static void remote_anything(t_remote *x, t_symbol *s, int argc, t_atom *argv) { int i; - t_atom av[MAX_ARG]; /* the 'new' t_atom without first element */ t_int ac = argc - 1; /* the 'new' number of arguments */ char mysym[MAXPDSTRING]; t_symbol *target; @@ -60,11 +59,6 @@ static void remote_anything(t_remote *x, t_symbol *s, int argc, t_atom *argv) post("remote: too many arguments!"); return; } - - for(i = 1; i < argc; i++) - { - av[i - 1] = argv[i]; /* just copy, don't care about types */ - } /* send only argument-part to receivers */ if(x->x_prepend) { diff --git a/src/speedlim.c b/src/speedlim.c index 4b917c0..a198491 100644 --- a/src/speedlim.c +++ b/src/speedlim.c @@ -139,7 +139,7 @@ static void speedlim_anything(t_speedlim *x, t_symbol *s, int ac, t_atom *av) SPEEDLIM_INISIZE, x->x_messini); x->x_selector = s; x->x_natoms = ac; - if (ac) + if (ac && av) memcpy(x->x_message, av, ac * sizeof(*x->x_message)); } } diff --git a/src/subst.c b/src/subst.c index 5183955..b2b4b14 100644 --- a/src/subst.c +++ b/src/subst.c @@ -239,7 +239,8 @@ static int subst_calc(t_subst *x, int n) { while(npoints--) { - vec[i++].w_float = atom_getfloat(x->x_row + i); + vec[i].w_float = atom_getfloat(x->x_row + i); + i++; } } else // update @@ -247,7 +248,8 @@ static int subst_calc(t_subst *x, int n) npoints -= l; while (l--) { - vec[i++].w_float = atom_getfloat(x->x_row + i); + vec[i].w_float = atom_getfloat(x->x_row + i); + i++; } while (npoints--) vec[i++].w_float = 0; -- cgit v1.2.3