[ObjectHandler-cvs] ObjectHandler/ohxl conversions.cpp,1.8,1.9
Brought to you by:
ericehlers,
nando
From: Eric E. <eri...@us...> - 2006-07-14 07:25:28
|
Update of /cvsroot/objecthandler/ObjectHandler/ohxl In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10028/ohxl Modified Files: conversions.cpp Log Message: fix memory leak Index: conversions.cpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/conversions.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** conversions.cpp 13 Jul 2006 14:39:32 -0000 1.8 --- conversions.cpp 14 Jul 2006 07:25:26 -0000 1.9 *************** *** 24,31 **** namespace ObjHandler { ! void validateMulti(const OPER *xMulti) { for (int i=0; i<xMulti->val.array.rows * xMulti->val.array.columns; i++) if (xMulti->val.array.lparray[i].xltype == xltypeErr) ! throw Exception("trigger parameter has error value"); } --- 24,32 ---- namespace ObjHandler { ! bool validateMulti(const OPER *xMulti) { for (int i=0; i<xMulti->val.array.rows * xMulti->val.array.columns; i++) if (xMulti->val.array.lparray[i].xltype == xltypeErr) ! return false; ! return true; } *************** *** 34,42 **** throw Exception("trigger parameter has error value"); } else if (xTrigger->xltype == xltypeMulti) { ! validateMulti(xTrigger); } else if (xTrigger->xltype == xltypeRef || xTrigger->xltype == xltypeSRef) { XLOPER xMulti; Excel(xlCoerce, &xMulti, 1, xTrigger, TempInt(xltypeMulti)); ! validateMulti(&xMulti); } } --- 35,47 ---- throw Exception("trigger parameter has error value"); } else if (xTrigger->xltype == xltypeMulti) { ! if (!validateMulti(xTrigger)) ! throw Exception("trigger parameter has error value"); } else if (xTrigger->xltype == xltypeRef || xTrigger->xltype == xltypeSRef) { XLOPER xMulti; Excel(xlCoerce, &xMulti, 1, xTrigger, TempInt(xltypeMulti)); ! bool isValid = validateMulti(&xMulti); ! Excel(xlFree, 0, 1, &xMulti); ! if (!isValid) ! throw Exception("trigger parameter has error value"); } } |