IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 531


Ignore:
Timestamp:
Apr 27, 2004, 12:39:48 PM (22 years ago)
Author:
evanalst
Message:

Fix psStringNCopy to handle negative counts.

Location:
trunk/psLib/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/sys/psString.c

    r440 r531  
    88 *  @author Eric Van Alst, MHPCC
    99 *   
    10  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-04-19 19:10:26 $
     10 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-04-27 22:39:48 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2121#include "psString.h"
    2222#include "psMemory.h"
     23#include "psError.h"
    2324
    2425/******************************************************************************/
     
    7172)
    7273{
     74    // Check the number of characters to copy is non-negative
     75    if ( nChar < 0 ) {
     76        // Log error message and return NULL
     77        psError(__FILE__,"psStringNCopy with negative count specified %d",
     78                nChar);
     79        return NULL;
     80    }
    7381    // Allocate memory using psAlloc function - nChar bytes
    7482    // Copy input string to memory allocated up to nChar characters
     
    7785}
    7886
     87
  • trunk/psLib/src/sysUtils/psString.c

    r440 r531  
    88 *  @author Eric Van Alst, MHPCC
    99 *   
    10  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-04-19 19:10:26 $
     10 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-04-27 22:39:48 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2121#include "psString.h"
    2222#include "psMemory.h"
     23#include "psError.h"
    2324
    2425/******************************************************************************/
     
    7172)
    7273{
     74    // Check the number of characters to copy is non-negative
     75    if ( nChar < 0 ) {
     76        // Log error message and return NULL
     77        psError(__FILE__,"psStringNCopy with negative count specified %d",
     78                nChar);
     79        return NULL;
     80    }
    7381    // Allocate memory using psAlloc function - nChar bytes
    7482    // Copy input string to memory allocated up to nChar characters
     
    7785}
    7886
     87
Note: See TracChangeset for help on using the changeset viewer.