From 2e815b6046e4ae47e5bca62f7c3ad31ca0724287 Mon Sep 17 00:00:00 2001 From: Kevin Larke Date: Mon, 8 Jun 2015 09:13:41 -0700 Subject: [PATCH] cmProc2.h/c : Fixed bug in _cmVectArrayWriteMatrix() which caused the resulting file to be misformatted. Added dcumenation to cmVectArray. --- cmProc2.c | 2 +- cmProc2.h | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/cmProc2.c b/cmProc2.c index 55c7406..ab9f6e2 100644 --- a/cmProc2.c +++ b/cmProc2.c @@ -4085,7 +4085,7 @@ cmRC_t _cmVectArrayWriteMatrix( cmCtx* ctx, const char* fn, unsigned flags, cons memcpy(vv + ci*tbc, v + ci*rn*tbc, tbc ); // append the row to the VectArray - if((rc = cmVectArrayAppendV(p,v,cn)) != cmOkRC ) + if((rc = cmVectArrayAppendV(p,vv,cn)) != cmOkRC ) { rc = cmCtxRtCondition(&p->obj,rc,"Vector append failed in %s().",__FUNCTION__); goto errLabel; diff --git a/cmProc2.h b/cmProc2.h index 5f52342..206c598 100644 --- a/cmProc2.h +++ b/cmProc2.h @@ -838,8 +838,12 @@ extern "C" { unsigned cmVectArrayMaxRowCount( const cmVectArray_t* p ); // Store a new vector by appending it to the end of the internal vector list. - // Note that the true type of v[] in the call to cmVectArrayAppendV() must match + // Note: + // 1. The true type of v[] in the call to cmVectArrayAppendV() must match // the data type set in p->flags. + // 2. The 'vn' argument to atVectArrayAppendV() is an element count not + // a byte count. The size of each element is determined by the data type + // as set by atVectArrayAlloc(). cmRC_t cmVectArrayAppendV( cmVectArray_t* p, const void* v, unsigned vn ); cmRC_t cmVectArrayAppendS( cmVectArray_t* p, const cmSample_t* v, unsigned vn ); cmRC_t cmVectArrayAppendR( cmVectArray_t* p, const cmReal_t* v, unsigned vn ); @@ -858,8 +862,12 @@ extern "C" { unsigned cmVectArrayForEachS( cmVectArray_t* p, unsigned idx, unsigned cnt, cmVectArrayForEachFuncS_t func, void* arg ); // Write the vector v[vn] in the VectArray file format. - // Note that the true type of v[] in cmVectArrayWriteVectoV() must match the + // Note: + // 1. The true type of v[] in cmVectArrayWriteVectoV() must match the // data type set in the 'flags' parameter. + // 2. The 'vn' argument to atVectArrayWriteVectorV() is an element count not + // a byte count. The size of each element is determined by the data type + // as set by atVectArrayAlloc(). cmRC_t cmVectArrayWriteVectorV( cmCtx* ctx, const char* fn, const void* v, unsigned vn, unsigned flags ); cmRC_t cmVectArrayWriteVectorS( cmCtx* ctx, const char* fn, const cmSample_t* v, unsigned vn ); cmRC_t cmVectArrayWriteVectorR( cmCtx* ctx, const char* fn, const cmReal_t* v, unsigned vn ); @@ -869,8 +877,12 @@ extern "C" { cmRC_t cmVectArrayWriteVectorU( cmCtx* ctx, const char* fn, const unsigned* v, unsigned vn ); // Write the column-major matrix m[rn,cn] to the file 'fn'. - // Note that the true type of m[] in cmVectArrayWriteMatrixV() must match the + // Notes: + // 1. The true type of m[] in cmVectArrayWriteMatrixV() must match the // data type set in the 'flags' parameter. + // 2. The 'rn','cn' arguments to atVectWriteMatrixV() is are element counts not + // byte counts. The size of each element is determined by the data type + // as set by atVectArrayAlloc(). cmRC_t cmVectArrayWriteMatrixV( cmCtx* ctx, const char* fn, const void* m, unsigned rn, unsigned cn, unsigned flags ); cmRC_t cmVectArrayWriteMatrixS( cmCtx* ctx, const char* fn, const cmSample_t* m, unsigned rn, unsigned cn ); cmRC_t cmVectArrayWriteMatrixR( cmCtx* ctx, const char* fn, const cmReal_t* m, unsigned rn, unsigned cn );