IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9755 for trunk/psLib


Ignore:
Timestamp:
Oct 26, 2006, 3:10:25 PM (20 years ago)
Author:
jhoblitt
Message:

fix formatMetadataItem() to handle printing of NULL psTimes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/types/psMetadataConfig.c

    r9750 r9755  
    1010*  @author Eric Van Alst, MHPCC
    1111*
    12 *  @version $Revision: 1.98 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2006-10-26 04:44:09 $
     12*  @version $Revision: 1.99 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2006-10-27 01:10:25 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    14221422        psStringAppend(&content, "%-15s  ", item->name);
    14231423        psTime *time = item->data.V;
    1424         if ( time->type == PS_TIME_UTC )
    1425             psStringAppend(&content, "%-8s  ", "UTC");
    1426         else if ( time->type == PS_TIME_TAI )
    1427             psStringAppend(&content, "%-8s  ", "TAI");
    1428         else if ( time->type == PS_TIME_UT1 )
    1429             psStringAppend(&content, "%-8s  ", "UT1");
    1430         else if ( time->type == PS_TIME_TT )
    1431             psStringAppend(&content, "%-8s  ", "TT");
    1432         else {
    1433             psError(PS_ERR_BAD_PARAMETER_VALUE, true, _("Specified psDataType, %d, is not supported."), time->type);
    1434             psFree(content);
    1435             return NULL;
    1436         }
    1437 
    1438         psString timeStr = psTimeToISO(time);
    1439         psStringAppend(&content, "%-15s", timeStr);
    1440         psFree(timeStr);
     1424        if (time) {
     1425            switch (time->type) {
     1426            case PS_TIME_UTC:
     1427                psStringAppend(&content, "%-8s  ", "UTC");
     1428                break;
     1429            case PS_TIME_TAI:
     1430                psStringAppend(&content, "%-8s  ", "TAI");
     1431                break;
     1432            case PS_TIME_UT1:
     1433                psStringAppend(&content, "%-8s  ", "UT1");
     1434                break;
     1435            case PS_TIME_TT:
     1436                psStringAppend(&content, "%-8s  ", "TT");
     1437                break;
     1438            default:
     1439                psError(PS_ERR_BAD_PARAMETER_VALUE, true,
     1440                        _("Specified psTime type, %d, is not supported."),
     1441                        time->type);
     1442                psFree(content);
     1443                return NULL;
     1444            }
     1445            psString timeStr = psTimeToISO(time);
     1446            psStringAppend(&content, "%-15s", timeStr);
     1447            psFree(timeStr);
     1448        } else {
     1449            // psTime is a NULL pointer
     1450            psStringAppend(&content, "%-15s", "NULL");
     1451        }
    14411452
    14421453        if (item->comment && strncmp(item->comment,"",2)) {
Note: See TracChangeset for help on using the changeset viewer.