IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4366


Ignore:
Timestamp:
Jun 22, 2005, 5:19:29 PM (21 years ago)
Author:
desonia
Message:

modified psLookupTableRead to take a long indexCol and added check for
an invalidly large indexCol for psLookupTableImport.

Location:
trunk/psLib
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/dataIO/psLookupTable.c

    r4321 r4366  
    77*  @author Ross Harman, MHPCC
    88*
    9 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2005-06-20 22:42:29 $
     9*  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2005-06-23 03:19:29 $
    1111*
    1212*  Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
     
    548548}
    549549
    550 psLookupTable *psLookupTableImport(psLookupTable *table, const psArray *vectors, int indexCol)
     550psLookupTable *psLookupTableImport(psLookupTable *table, const psArray *vectors, long indexCol)
    551551{
    552552    psLookupTable* outputTable = NULL;
     
    564564    if(indexCol < 0 ) {
    565565        psError(PS_ERR_BAD_PARAMETER_VALUE,true,"Index column cannot be less than zero");
     566        return NULL;
     567    }
     568
     569    if (indexCol >= vectors->n) {
     570        psError(PS_ERR_BAD_PARAMETER_VALUE,true,"Index column, %d, is larger than number of columns, %d.",
     571                indexCol, vectors->n);
    566572        return NULL;
    567573    }
  • trunk/psLib/src/dataIO/psLookupTable.h

    r4321 r4366  
    77*  @author Ross Harman, MHPCC
    88*
    9 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2005-06-20 22:42:29 $
     9*  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2005-06-23 03:19:29 $
    1111*
    1212*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3030    const char *filename;              ///< Name of file with table
    3131    const char *format;                ///< scanf-like format string for file
    32     unsigned int indexCol;             ///< Column of the index vector (starting at zero)
     32    long indexCol;                     ///< Column of the index vector (starting at zero)
    3333    psVector *index;                   ///< Vector of independent index values
    3434    psArray *values;                   ///< Array of dependent table values corresponding to index values
     
    9191 */
    9292psLookupTable *psLookupTableImport(
    93     psLookupTable *table,            ///< Lookup table into which to import
    94     const psArray *vectors,          ///< Array of vectors
    95     int indexCol                     ///< Index of the index vector in the array of vectors
     93    psLookupTable *table,              ///< Lookup table into which to import
     94    const psArray *vectors,            ///< Array of vectors
     95    long indexCol                      ///< Index of the index vector in the array of vectors
    9696);
    9797
  • trunk/psLib/src/types/psLookupTable.c

    r4321 r4366  
    77*  @author Ross Harman, MHPCC
    88*
    9 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2005-06-20 22:42:29 $
     9*  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2005-06-23 03:19:29 $
    1111*
    1212*  Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
     
    548548}
    549549
    550 psLookupTable *psLookupTableImport(psLookupTable *table, const psArray *vectors, int indexCol)
     550psLookupTable *psLookupTableImport(psLookupTable *table, const psArray *vectors, long indexCol)
    551551{
    552552    psLookupTable* outputTable = NULL;
     
    564564    if(indexCol < 0 ) {
    565565        psError(PS_ERR_BAD_PARAMETER_VALUE,true,"Index column cannot be less than zero");
     566        return NULL;
     567    }
     568
     569    if (indexCol >= vectors->n) {
     570        psError(PS_ERR_BAD_PARAMETER_VALUE,true,"Index column, %d, is larger than number of columns, %d.",
     571                indexCol, vectors->n);
    566572        return NULL;
    567573    }
  • trunk/psLib/src/types/psLookupTable.h

    r4321 r4366  
    77*  @author Ross Harman, MHPCC
    88*
    9 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2005-06-20 22:42:29 $
     9*  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2005-06-23 03:19:29 $
    1111*
    1212*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3030    const char *filename;              ///< Name of file with table
    3131    const char *format;                ///< scanf-like format string for file
    32     unsigned int indexCol;             ///< Column of the index vector (starting at zero)
     32    long indexCol;                     ///< Column of the index vector (starting at zero)
    3333    psVector *index;                   ///< Vector of independent index values
    3434    psArray *values;                   ///< Array of dependent table values corresponding to index values
     
    9191 */
    9292psLookupTable *psLookupTableImport(
    93     psLookupTable *table,            ///< Lookup table into which to import
    94     const psArray *vectors,          ///< Array of vectors
    95     int indexCol                     ///< Index of the index vector in the array of vectors
     93    psLookupTable *table,              ///< Lookup table into which to import
     94    const psArray *vectors,            ///< Array of vectors
     95    long indexCol                      ///< Index of the index vector in the array of vectors
    9696);
    9797
  • trunk/psLib/test/dataIO/tst_psLookupTable_01.c

    r4054 r4366  
    1212*  @author  Ross Harman, MHPCC
    1313*
    14 *  @version $Revision: 1.15 $  $Name: not supported by cvs2svn $
    15 *  @date  $Date: 2005-05-31 21:52:49 $
     14*  @version $Revision: 1.16 $  $Name: not supported by cvs2svn $
     15*  @date  $Date: 2005-06-23 03:19:29 $
    1616*
    1717*  Copyright 2004-5 Maui High Performance Computing Center, University of Hawaii
     
    621621{
    622622    psLookupTable*  table1  = NULL;
    623     psS32           numRows = 0;
     623    long           numRows = 0;
    624624
    625625    // Attempt to read table with NULL input table specified
Note: See TracChangeset for help on using the changeset viewer.