Update of /cvsroot/pure-data/externals/iem/iemmatrix/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24730
Modified Files: mtx_mul.c mtx_transpose.c Log Message: added safety checks whether the matrix is non-NULL
Index: mtx_transpose.c =================================================================== RCS file: /cvsroot/pure-data/externals/iem/iemmatrix/src/mtx_transpose.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mtx_transpose.c 11 May 2005 13:05:29 -0000 1.3 --- mtx_transpose.c 11 May 2005 14:06:27 -0000 1.4 *************** *** 19,23 **** t_matrixfloat*mtx_doTranspose(t_matrixfloat*transposee, int row, int col){ int r,c; ! t_matrixfloat*transposed=(t_matrixfloat*)getbytes(sizeof(t_matrixfloat)*row*col); r=row; while(r--){ --- 19,25 ---- t_matrixfloat*mtx_doTranspose(t_matrixfloat*transposee, int row, int col){ int r,c; ! t_matrixfloat*transposed=0; ! if(!transposee||!row||!col)return 0; ! transposed=(t_matrixfloat*)getbytes(sizeof(t_matrixfloat)*row*col); r=row; while(r--){
Index: mtx_mul.c =================================================================== RCS file: /cvsroot/pure-data/externals/iem/iemmatrix/src/mtx_mul.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mtx_mul.c 11 May 2005 13:05:29 -0000 1.1 --- mtx_mul.c 11 May 2005 14:06:26 -0000 1.2 *************** *** 25,29 ****
t_matrixfloat*mtx_doMultiply(int rowA, t_matrixfloat*A, int colArowB, t_matrixfloat*B, int colB){ ! t_matrixfloat*result=(t_matrixfloat*)getbytes(sizeof(t_matrixfloat)*rowA*colB); int r, c, n; for(r=0; r<rowA; r++){ --- 25,31 ----
t_matrixfloat*mtx_doMultiply(int rowA, t_matrixfloat*A, int colArowB, t_matrixfloat*B, int colB){ ! t_matrixfloat*result=0; ! if(!A || !B || !rowA || !colArowB || !colB)return 0; ! result=(t_matrixfloat*)getbytes(sizeof(t_matrixfloat)*rowA*colB); int r, c, n; for(r=0; r<rowA; r++){ *************** *** 32,35 **** --- 34,38 ---- for(n=0;n<colArowB; n++) sum+=A[colArowB*r+n]*B[colB*n+c]; + result[colB*r+c]=sum; } }