diff options
author | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2006-11-12 12:56:06 +0000 |
---|---|---|
committer | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2006-11-12 12:56:06 +0000 |
commit | 5846fb7f357436562a9afaf7d1003a70004b83eb (patch) | |
tree | e2bf686c19c0d8a4c0ac7cb1b7503f0a1000bc07 /src | |
parent | 78e8f0c6d99b5a6a38bcc17dfd3291bc2c25aa83 (diff) |
reduced compiler warnings by properly declaring functions and avoiding variable shadowing
svn path=/trunk/externals/iem/iemmatrix/; revision=6270
Diffstat (limited to 'src')
-rw-r--r-- | src/mtx_distance2.c | 4 | ||||
-rw-r--r-- | src/mtx_fill.c | 28 | ||||
-rw-r--r-- | src/mtx_inverse.c | 16 | ||||
-rw-r--r-- | src/mtx_prod.c | 2 |
4 files changed, 25 insertions, 25 deletions
diff --git a/src/mtx_distance2.c b/src/mtx_distance2.c index 2f765ba..097151b 100644 --- a/src/mtx_distance2.c +++ b/src/mtx_distance2.c @@ -70,8 +70,8 @@ static void mtx_distance2_matrix(t_mtx_binmtx *x, t_symbol *s, int argc, t_atom int n; for(n=0; n<col; n++){ - t_float x=atom_getfloat(&m1[c1+n])-atom_getfloat(&m2[c2+n]); - f+=x*x; + t_float val=atom_getfloat(&m1[c1+n])-atom_getfloat(&m2[c2+n]); + f+=val*val; } SETFLOAT(m,f); m++; diff --git a/src/mtx_fill.c b/src/mtx_fill.c index 29b4fd0..901793f 100644 --- a/src/mtx_fill.c +++ b/src/mtx_fill.c @@ -81,17 +81,17 @@ static int copyNonZeroAtomsToIntegerArrayMax (int *size, t_atom *x, int *y) return max; } -static void writeIndexedValuesIntoMatrix (int n, int *index, t_atom *x, t_atom *y) +static void writeIndexedValuesIntoMatrix (int n, int *idx, t_atom *x, t_atom *y) { - for (;n--;index++,x++) - if (*index) - y[*index-1] = *x; + for (;n--;idx++,x++) + if (*idx) + y[*idx-1] = *x; } -static void writeFloatIndexedIntoMatrix (int n, int *index, t_float f, t_atom *y) +static void writeFloatIndexedIntoMatrix (int n, int *idx, t_float f, t_atom *y) { - for (;n--;index++) - if (*index) - SETFLOAT(&y[*index-1], f); + for (;n--;idx++) + if (*idx) + SETFLOAT(&y[*idx-1], f); } static void mTXFillIndexMatrix (MTXfill *mtx_fill_obj, t_symbol *s, @@ -101,7 +101,7 @@ static void mTXFillIndexMatrix (MTXfill *mtx_fill_obj, t_symbol *s, int columns = atom_getint (argv++); int size = rows * columns; int list_size = argc - 2; - int *index = mtx_fill_obj->index; + int *idx = mtx_fill_obj->index; // size check if (!size) { @@ -125,17 +125,17 @@ static void mTXFillIndexMatrix (MTXfill *mtx_fill_obj, t_symbol *s, } else { if (size > mtx_fill_obj->index_size) { - if (!index) - index = (int *) getbytes (sizeof (int) * (size + 2)); + if (!idx) + idx = (int *) getbytes (sizeof (int) * (size + 2)); else - index = (int *) resizebytes (index, + idx = (int *) resizebytes (idx, sizeof (int) * (mtx_fill_obj->index_size+2), sizeof (t_atom) * (size + 2)); mtx_fill_obj->index_size = size; - mtx_fill_obj->index = index; + mtx_fill_obj->index = idx; } mtx_fill_obj->max_index = - copyNonZeroAtomsToIntegerArrayMax (&size, argv++, index); + copyNonZeroAtomsToIntegerArrayMax (&size, argv++, idx); mtx_fill_obj->num_idcs_used = size; if (!size) mtx_fill_obj->fill_type = DONT_FILL_JUST_PASS; diff --git a/src/mtx_inverse.c b/src/mtx_inverse.c index 242c250..2555835 100644 --- a/src/mtx_inverse.c +++ b/src/mtx_inverse.c @@ -17,7 +17,7 @@ static t_class *mtx_inverse_class; -t_matrixfloat* mtx_doInvert(t_matrixfloat*input, int rowcol, int*error){ +t_matrixfloat* mtx_doInvert(t_matrixfloat*input, int rowcol, int*err){ /* * row==col==rowclo * input=t_matrixfloat[row*col] @@ -77,7 +77,7 @@ t_matrixfloat* mtx_doInvert(t_matrixfloat*input, int rowcol, int*error){ } } } - if(error!=0)*error=ok; + if(err!=0)*err=ok; return inverted; } @@ -88,7 +88,7 @@ static void mtx_inverse_matrix(t_matrix *x, t_symbol *s, int argc, t_atom *argv) int row=atom_getfloat(argv); int col=atom_getfloat(argv+1); - int error=0; + int err=0; t_matrixfloat *original, *inverted; @@ -105,7 +105,7 @@ static void mtx_inverse_matrix(t_matrix *x, t_symbol *s, int argc, t_atom *argv) if (row==col){ /* fine, the matrix is square */ - inverted=mtx_doInvert(original, row, &error); + inverted=mtx_doInvert(original, row, &err); } else { /* we'll have to do the pseudo-inverse: * P=A'*inv(A*A') if row<col @@ -117,11 +117,11 @@ static void mtx_inverse_matrix(t_matrix *x, t_symbol *s, int argc, t_atom *argv) if(row>col){ inverteeCol=col; invertee =mtx_doMultiply(col, transposed, row, original, col); - inverted =mtx_doMultiply(col, mtx_doInvert(invertee, col, &error), col, transposed, row); + inverted =mtx_doMultiply(col, mtx_doInvert(invertee, col, &err), col, transposed, row); } else { inverteeCol=row; invertee =mtx_doMultiply(row, original, col, transposed, row); - inverted =mtx_doMultiply(col, transposed, row, mtx_doInvert(invertee, row, &error), row); + inverted =mtx_doMultiply(col, transposed, row, mtx_doInvert(invertee, row, &err), row); } freebytes(transposed, sizeof(t_matrixfloat)*col*row); freebytes(invertee , sizeof(t_matrixfloat)*inverteeCol*inverteeCol); @@ -133,9 +133,9 @@ static void mtx_inverse_matrix(t_matrix *x, t_symbol *s, int argc, t_atom *argv) /* 3b destroy the buffers */ freebytes(original, sizeof(t_matrixfloat)*row*col); - if(error){ + if(err){ outlet_bang(x->x_outlet); - pd_error(x, "mtx_inverse: couldn't really invert the matrix !!! %d error%c", error, (error-1)?'s':0); + pd_error(x, "mtx_inverse: couldn't really invert the matrix !!! %d error%c", err, (err-1)?'s':0); } /* 3c output the atombuf; */ diff --git a/src/mtx_prod.c b/src/mtx_prod.c index 15db307..2131dc5 100644 --- a/src/mtx_prod.c +++ b/src/mtx_prod.c @@ -49,7 +49,7 @@ static void mtx_prod_list(t_matrix *x, t_symbol *s, int argc, t_atom *argv){ } -static void *mtx_prod_new() +static void *mtx_prod_new(void) { t_matrix *x = (t_matrix *)pd_new(mtx_prod_class); outlet_new(&x->x_obj, 0); |