IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2103


Ignore:
Timestamp:
Oct 13, 2004, 3:10:58 PM (22 years ago)
Author:
gusciora
Message:

Error-checking on parameters.

Location:
trunk/psLib/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/astro/psCoord.c

    r2083 r2103  
    1010*  @author George Gusciora, MHPCC
    1111*
    12 *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-10-13 21:06:07 $
     12*  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-10-14 01:10:58 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    9696                               const psPlane* coords)
    9797{
     98    PS_CHECK_NULL_PTR_RETURN_NULL(transform);
     99    PS_CHECK_NULL_PTR_RETURN_NULL(coords);
    98100    if (out == NULL) {
    99101        out = (psPlane* ) psAlloc(sizeof(psPlane));
     
    114116                             float magnitude)
    115117{
     118    PS_CHECK_NULL_PTR_RETURN_NULL(transform);
     119    PS_CHECK_NULL_PTR_RETURN_NULL(coords);
    116120    if (out == NULL) {
    117121        out = (psPlane* ) psAlloc(sizeof(psPlane));
     
    151155                                 const psSphere* coord)
    152156{
     157    PS_CHECK_NULL_PTR_RETURN_NULL(transform);
     158    PS_CHECK_NULL_PTR_RETURN_NULL(coord);
    153159    double sinY = 0.0;
    154160    double cosY = 0.0;
     
    216222XXX: Waiting for the definition of the PS_PROJ_PAR projection.
    217223XXX: Waiting for the definition of the PS_PROJ_GLS projection.
     224XXX: get rid of the psAborts
    218225 *****************************************************************************/
    219226psPlane* psProject(const psSphere* coord,
    220227                   const psProjection* projection)
    221228{
     229    PS_CHECK_NULL_PTR_RETURN_NULL(coord);
     230    PS_CHECK_NULL_PTR_RETURN_NULL(projection);
     231
    222232    float R = 0.0;
    223233    float alpha = 0.0;
     
    254264    } else if (projection->type == PS_PROJ_GLS) {
    255265        psAbort(__func__, "The projection type PS_PROJ_GLS is undefined.\n");
     266    } else {
     267        psAbort(__func__, "Unknown projection type.\n");
    256268    }
    257269
     
    262274XXX: Waiting for the definition of the PS_PROJ_PAR projection.
    263275XXX: Waiting for the definition of the PS_PROJ_GLS projection.
     276XXX: get rid of the psAborts
    264277 *****************************************************************************/
    265278psSphere* psDeproject(const psPlane* coord,
    266279                      const psProjection* projection)
    267280{
     281    PS_CHECK_NULL_PTR_RETURN_NULL(coord);
     282    PS_CHECK_NULL_PTR_RETURN_NULL(projection);
     283
    268284    float R = 0.0;
    269285    float chu = 0.0;
     
    304320    } else if (projection->type == PS_PROJ_GLS) {
    305321        psAbort(__func__, "The projection type PS_PROJ_GLG is undefined.\n");
     322    } else {
     323        psAbort(__func__, "Unknown projection type.\n");
    306324    }
    307325
     
    329347                            psSphereOffsetUnit unit)
    330348{
     349    PS_CHECK_NULL_PTR_RETURN_NULL(position1);
     350    PS_CHECK_NULL_PTR_RETURN_NULL(position2);
     351
    331352    psPlane* lin;
    332353    psProjection proj;
     
    351372        tmp->d = position2->d - position1->d;
    352373
    353         // XXX: Wrap these to an acceptable range.  This assumes that all
     374        // Wrap these to an acceptable range.  This assumes that all
    354375        // angles are in radians.
    355376        tmp->r = fmod(tmp->r, 2*M_PI);
     
    394415                            psSphereOffsetUnit unit)
    395416{
     417    PS_CHECK_NULL_PTR_RETURN_NULL(position);
     418    PS_CHECK_NULL_PTR_RETURN_NULL(offset);
     419
    396420    psPlane lin;
    397421    psSphere* tmp;
  • trunk/psLib/src/astronomy/psCoord.c

    r2083 r2103  
    1010*  @author George Gusciora, MHPCC
    1111*
    12 *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-10-13 21:06:07 $
     12*  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-10-14 01:10:58 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    9696                               const psPlane* coords)
    9797{
     98    PS_CHECK_NULL_PTR_RETURN_NULL(transform);
     99    PS_CHECK_NULL_PTR_RETURN_NULL(coords);
    98100    if (out == NULL) {
    99101        out = (psPlane* ) psAlloc(sizeof(psPlane));
     
    114116                             float magnitude)
    115117{
     118    PS_CHECK_NULL_PTR_RETURN_NULL(transform);
     119    PS_CHECK_NULL_PTR_RETURN_NULL(coords);
    116120    if (out == NULL) {
    117121        out = (psPlane* ) psAlloc(sizeof(psPlane));
     
    151155                                 const psSphere* coord)
    152156{
     157    PS_CHECK_NULL_PTR_RETURN_NULL(transform);
     158    PS_CHECK_NULL_PTR_RETURN_NULL(coord);
    153159    double sinY = 0.0;
    154160    double cosY = 0.0;
     
    216222XXX: Waiting for the definition of the PS_PROJ_PAR projection.
    217223XXX: Waiting for the definition of the PS_PROJ_GLS projection.
     224XXX: get rid of the psAborts
    218225 *****************************************************************************/
    219226psPlane* psProject(const psSphere* coord,
    220227                   const psProjection* projection)
    221228{
     229    PS_CHECK_NULL_PTR_RETURN_NULL(coord);
     230    PS_CHECK_NULL_PTR_RETURN_NULL(projection);
     231
    222232    float R = 0.0;
    223233    float alpha = 0.0;
     
    254264    } else if (projection->type == PS_PROJ_GLS) {
    255265        psAbort(__func__, "The projection type PS_PROJ_GLS is undefined.\n");
     266    } else {
     267        psAbort(__func__, "Unknown projection type.\n");
    256268    }
    257269
     
    262274XXX: Waiting for the definition of the PS_PROJ_PAR projection.
    263275XXX: Waiting for the definition of the PS_PROJ_GLS projection.
     276XXX: get rid of the psAborts
    264277 *****************************************************************************/
    265278psSphere* psDeproject(const psPlane* coord,
    266279                      const psProjection* projection)
    267280{
     281    PS_CHECK_NULL_PTR_RETURN_NULL(coord);
     282    PS_CHECK_NULL_PTR_RETURN_NULL(projection);
     283
    268284    float R = 0.0;
    269285    float chu = 0.0;
     
    304320    } else if (projection->type == PS_PROJ_GLS) {
    305321        psAbort(__func__, "The projection type PS_PROJ_GLG is undefined.\n");
     322    } else {
     323        psAbort(__func__, "Unknown projection type.\n");
    306324    }
    307325
     
    329347                            psSphereOffsetUnit unit)
    330348{
     349    PS_CHECK_NULL_PTR_RETURN_NULL(position1);
     350    PS_CHECK_NULL_PTR_RETURN_NULL(position2);
     351
    331352    psPlane* lin;
    332353    psProjection proj;
     
    351372        tmp->d = position2->d - position1->d;
    352373
    353         // XXX: Wrap these to an acceptable range.  This assumes that all
     374        // Wrap these to an acceptable range.  This assumes that all
    354375        // angles are in radians.
    355376        tmp->r = fmod(tmp->r, 2*M_PI);
     
    394415                            psSphereOffsetUnit unit)
    395416{
     417    PS_CHECK_NULL_PTR_RETURN_NULL(position);
     418    PS_CHECK_NULL_PTR_RETURN_NULL(offset);
     419
    396420    psPlane lin;
    397421    psSphere* tmp;
Note: See TracChangeset for help on using the changeset viewer.