IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1992


Ignore:
Timestamp:
Oct 6, 2004, 1:38:49 PM (22 years ago)
Author:
gusciora
Message:

Error checking for NULL inputs, and memory.

Location:
trunk/psLib
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/dataManip/psMinimize.c

    r1991 r1992  
    99 *  @author GLF, MHPCC
    1010 *
    11  *  @version $Revision: 1.56 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-06 23:29:16 $
     11 *  @version $Revision: 1.57 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-06 23:38:49 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1818 *  XXX: Section 4.5.1.1 (predefined functions for Gauss minimization via
    1919 *       LMM) is not addressed here.  We are waiting for subsequent SDRs
    20  *       which will redfeine the LMM functions.
     20 *       which will redefine the LMM functions.
    2121 *
    2222 */
     
    424424                      psMinimizeLMChi2Func func)
    425425{
     426    PS_CHECK_NULL_PTR_RETURN_NULL(min);
     427    PS_CHECK_NULL_VECTOR_RETURN_NULL(params);
     428    PS_CHECK_EMPTY_VECTOR_RETURN_NULL(params);
     429    PS_CHECK_NULL_PTR_RETURN_NULL(coords);
     430    PS_CHECK_NULL_VECTOR_RETURN_NULL(value);
     431    PS_CHECK_EMPTY_VECTOR_RETURN_NULL(value);
     432    if (paramMask != NULL) {
     433        PS_CHECK_VECTOR_SIZE_EQUAL_RETURN_NULL(params, paramMask);
     434    }
    426435    psTrace(".psLib.dataManip.psMinimizeLMChi2", 4,
    427436            "---- psMinimizeLMChi2() begin ----\n");
     
    12991308 
    13001309XXX: Must define behavior on various NULL inputs.
     1310 
     1311XXX: Check for F32 types?
    13011312 *****************************************************************************/
    13021313bool psMinimizePowell(psMinimization *min,
  • trunk/psLib/src/dataManip/psMinimize.h

    r1982 r1992  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-10-06 21:30:53 $
     10 *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-10-06 23:38:49 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8383                               );
    8484
     85
     86// XXX: What if any of these arguments are NULL?
    8587typedef
    8688float (*psMinimizeLMChi2Func)(psVector *deriv,
  • trunk/psLib/src/math/psMinimize.c

    r1991 r1992  
    99 *  @author GLF, MHPCC
    1010 *
    11  *  @version $Revision: 1.56 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-06 23:29:16 $
     11 *  @version $Revision: 1.57 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-06 23:38:49 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1818 *  XXX: Section 4.5.1.1 (predefined functions for Gauss minimization via
    1919 *       LMM) is not addressed here.  We are waiting for subsequent SDRs
    20  *       which will redfeine the LMM functions.
     20 *       which will redefine the LMM functions.
    2121 *
    2222 */
     
    424424                      psMinimizeLMChi2Func func)
    425425{
     426    PS_CHECK_NULL_PTR_RETURN_NULL(min);
     427    PS_CHECK_NULL_VECTOR_RETURN_NULL(params);
     428    PS_CHECK_EMPTY_VECTOR_RETURN_NULL(params);
     429    PS_CHECK_NULL_PTR_RETURN_NULL(coords);
     430    PS_CHECK_NULL_VECTOR_RETURN_NULL(value);
     431    PS_CHECK_EMPTY_VECTOR_RETURN_NULL(value);
     432    if (paramMask != NULL) {
     433        PS_CHECK_VECTOR_SIZE_EQUAL_RETURN_NULL(params, paramMask);
     434    }
    426435    psTrace(".psLib.dataManip.psMinimizeLMChi2", 4,
    427436            "---- psMinimizeLMChi2() begin ----\n");
     
    12991308 
    13001309XXX: Must define behavior on various NULL inputs.
     1310 
     1311XXX: Check for F32 types?
    13011312 *****************************************************************************/
    13021313bool psMinimizePowell(psMinimization *min,
  • trunk/psLib/src/math/psMinimize.h

    r1982 r1992  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-10-06 21:30:53 $
     10 *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-10-06 23:38:49 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8383                               );
    8484
     85
     86// XXX: What if any of these arguments are NULL?
    8587typedef
    8688float (*psMinimizeLMChi2Func)(psVector *deriv,
  • trunk/psLib/test/dataManip/tst_psMinimize06.c

    r1830 r1992  
    2222This procedure ignores the coordinates, other than to ensure that they were
    2323passed correctly from psMinimizePowell().
     24 
    2425 *****************************************************************************/
    2526float myFunc(psVector *myDeriv,
     
    3435    if (myDeriv == NULL) {
    3536        myDeriv = psVectorAlloc(myParams->n, PS_TYPE_F32);
     37        psError(__func__, "myDeriv is NULL.\n");
    3638    }
    3739
     
    129131    psFree(myParamMask);
    130132    psFree(min);
     133    psFree(x);
     134    psFree(y);
     135    psFree(myCovar);
    131136
    132137    psMemCheckCorruption(1);
Note: See TracChangeset for help on using the changeset viewer.