IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12735


Ignore:
Timestamp:
Apr 4, 2007, 9:46:28 AM (19 years ago)
Author:
Paul Price
Message:

Adding const, errors for string/enum conversions

Location:
trunk/psLib/src/astro
Files:
2 edited

Legend:

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

    r12479 r12735  
    1010*  @author GLG, MHPCC
    1111*
    12 *  @version $Revision: 1.136 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2007-03-18 22:00:09 $
     12*  @version $Revision: 1.137 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2007-04-04 19:46:28 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    11981198}
    11991199
    1200 char * psProjectTypeToString (psProjectionType type, char *prefix)
    1201 {
     1200psString psProjectTypeToString(psProjectionType type, const char *prefix)
     1201{
     1202    PS_ASSERT_STRING_NON_EMPTY(prefix, NULL);
    12021203
    12031204    char *name = NULL;
     
    12421243
    12431244    default:
    1244         psLogMsg ("psLib.astrom", 2, "warning: unknown projection type %d\n", type);
     1245        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Unknown projection type: %d\n", type);
    12451246        return NULL;
    12461247    }
     
    12481249}
    12491250
    1250 psProjectionType psProjectTypeFromString (char *name)
    1251 {
    1252 
    1253     psProjectionType type = PS_PROJ_NTYPE;
    1254     if (!strcmp (&name[4], "-LIN"))
    1255         type = PS_PROJ_LIN;
    1256     if (!strcmp (&name[4], "-PLY"))
    1257         type = PS_PROJ_PLY;
    1258     if (!strcmp (&name[4], "-WRP"))
    1259         type = PS_PROJ_WRP;
    1260     if (!strcmp (&name[4], "-TAN"))
    1261         type = PS_PROJ_TAN;
    1262     if (!strcmp (&name[4], "-DIS"))
    1263         type = PS_PROJ_DIS;
    1264     if (!strcmp (&name[4], "-SIN"))
    1265         type = PS_PROJ_SIN;
    1266     if (!strcmp (&name[4], "-STG"))
    1267         type = PS_PROJ_STG;
    1268     if (!strcmp (&name[4], "-AIT"))
    1269         type = PS_PROJ_AIT;
    1270     if (!strcmp (&name[4], "-PAR"))
    1271         type = PS_PROJ_PAR;
    1272     if (!strcmp (&name[4], "-GLS"))
    1273         type = PS_PROJ_GLS;
    1274     if (!strcmp (&name[4], "-CAR"))
    1275         type = PS_PROJ_CAR;
    1276     if (!strcmp (&name[4], "-MER"))
    1277         type = PS_PROJ_MER;
    1278     return type;
    1279 }
     1251psProjectionType psProjectTypeFromString(const char *name)
     1252{
     1253    PS_ASSERT_STRING_NON_EMPTY(name, PS_PROJ_NONE);
     1254
     1255    if (!strcmp (&name[4], "-LIN")) return PS_PROJ_LIN;
     1256    if (!strcmp (&name[4], "-PLY")) return PS_PROJ_PLY;
     1257    if (!strcmp (&name[4], "-WRP")) return PS_PROJ_WRP;
     1258    if (!strcmp (&name[4], "-TAN")) return PS_PROJ_TAN;
     1259    if (!strcmp (&name[4], "-DIS")) return PS_PROJ_DIS;
     1260    if (!strcmp (&name[4], "-SIN")) return PS_PROJ_SIN;
     1261    if (!strcmp (&name[4], "-STG")) return PS_PROJ_STG;
     1262    if (!strcmp (&name[4], "-AIT")) return PS_PROJ_AIT;
     1263    if (!strcmp (&name[4], "-PAR")) return PS_PROJ_PAR;
     1264    if (!strcmp (&name[4], "-GLS")) return PS_PROJ_GLS;
     1265    if (!strcmp (&name[4], "-CAR")) return PS_PROJ_CAR;
     1266    if (!strcmp (&name[4], "-MER")) return PS_PROJ_MER;
     1267
     1268    psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Unrecognised projection type: %s", name);
     1269    return PS_PROJ_NONE;
     1270}
  • trunk/psLib/src/astro/psCoord.h

    r11668 r12735  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.57 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2007-02-06 21:36:09 $
     10 *  @version $Revision: 1.58 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2007-04-04 19:46:28 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    119119 */
    120120typedef enum {
     121    PS_PROJ_NONE,                      ///< No projection
    121122    PS_PROJ_LIN,                       ///< Linear projection
    122123    PS_PROJ_PLY,                       ///< Linear polynomial projection
     
    442443);
    443444
    444 char * psProjectTypeToString (psProjectionType type, char *prefix);
    445 psProjectionType psProjectTypeFromString (char *name);
     445psString psProjectTypeToString(psProjectionType type, const char *prefix);
     446psProjectionType psProjectTypeFromString(const char *name);
    446447
    447448
Note: See TracChangeset for help on using the changeset viewer.