IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6132


Ignore:
Timestamp:
Jan 21, 2006, 1:44:37 PM (20 years ago)
Author:
magnier
Message:

adding patch from josh

Location:
branches/eam_rel9_b1/psLib/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_rel9_b1/psLib/src/sys/psString.c

    r6025 r6132  
    1212 *  @author Eric Van Alst, MHPCC
    1313 *
    14  *  @version $Revision: 1.21.6.1 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2006-01-17 09:23:21 $
     14 *  @version $Revision: 1.21.6.2 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2006-01-21 23:44:37 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3232    // Copy input string to memory just allocated
    3333    // Return the copy
    34     return strcpy(psAlloc(strlen(string) + 1), string);
     34    // Pass through NULL values
     35    return string ? strcpy(psAlloc(strlen(string) + 1), string) : NULL;
    3536}
    3637
     
    5051    // Copy input string to memory allocated up to nChar characters
    5152    // Return the copy
    52     returnValue = strncpy(psAlloc((size_t) nChar + 1), string, (size_t) nChar);
     53    // Pass through NULL values
     54    returnValue =
     55              string ? strncpy(psAlloc((size_t) nChar + 1), string, (size_t) nChar)
     56              : NULL;
    5357
    5458    // Ensure the last byte is NULL character
  • branches/eam_rel9_b1/psLib/src/sys/psString.h

    r6025 r6132  
    1313 *  @author Eric Van Alst, MHPCC
    1414 *
    15  *  @version $Revision: 1.16.18.1 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2006-01-17 09:23:21 $
     15 *  @version $Revision: 1.16.18.2 $ $Name: not supported by cvs2svn $
     16 *  @date $Date: 2006-01-21 23:44:37 $
    1717 *
    1818 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3636/** Copies the input string
    3737 *
    38  *  This function shall allocate memory to the length of the input string
    39  *  plus one and copy the input string to the newly allocated memory.
     38 *  This function shall allocate memory to the length of the input string plus
     39 *  one and copy the input string to the newly allocated memory.  If 'string'
     40 *  is 'NULL' then 'NULL' is returned.
    4041 *
    4142 *  @return psString:      Copy of input string
     
    5455 *  string will be a substring of the input string.  If the input string
    5556 *  is smaller than nChar bytes then the remaining bytes allocated will
    56  *  be set to NULL.
     57 *  be set to NULL.  If 'string' is 'NULL' then 'NULL' is returned.
    5758 *
    5859 *  @return  psString:   Copy of input string
  • branches/eam_rel9_b1/psLib/src/types/psMetadata.c

    r6026 r6132  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.92.6.2 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2006-01-17 09:24:23 $
     14 *  @version $Revision: 1.92.6.3 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2006-01-21 23:44:37 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    244244    case PS_DATA_STRING:
    245245        // Perform copy of input strings
    246         metadataItem->data.V = psStringNCopy(va_arg(argPtr, char *), MAX_STRING_LENGTH);
     246        {
     247            char *string = va_arg(argPtr, char *);
     248            metadataItem->data.V =
     249                string ? psStringNCopy(string, MAX_STRING_LENGTH)
     250                : NULL;
     251        }
    247252        break;
    248253    case     PS_DATA_ARRAY:                     // psArray
Note: See TracChangeset for help on using the changeset viewer.