IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4434


Ignore:
Timestamp:
Jun 29, 2005, 2:33:36 PM (21 years ago)
Author:
evanalst
Message:

Update psStringNCopy to check for maximum value.

Location:
trunk/psLib/src
Files:
4 edited

Legend:

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

    r4409 r4434  
    1212 *  @author Eric Van Alst, MHPCC
    1313 *
    14  *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-06-28 20:17:52 $
     14 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2005-06-30 00:33:36 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2020#include <stdlib.h>
    2121#include <string.h>
     22#include <limits.h>
    2223#include "psString.h"
    2324#include "psMemory.h"
     
    3435}
    3536
    36 psString psStringNCopy(const char *string, int nChar)
     37psString psStringNCopy(const char *string, unsigned int nChar)
    3738{
    3839    char *returnValue = NULL;
    3940
    4041    // Check the number of characters to copy is non-negative
    41     if (nChar < 0) {
     42    if (nChar == UINT_MAX) {
    4243        // Log error message and return NULL
    4344        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
  • trunk/psLib/src/sys/psString.h

    r4409 r4434  
    1313 *  @author Eric Van Alst, MHPCC
    1414 *
    15  *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2005-06-28 20:17:52 $
     15 *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
     16 *  @date $Date: 2005-06-30 00:33:36 $
    1717 *
    1818 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6464psString psStringNCopy(
    6565    const char *string,                ///< Input string of characters to copy
    66     int nChar                          ///< Number of bytes to allocate for string copy
     66    unsigned int nChar                          ///< Number of bytes to allocate for string copy
    6767);
    6868
  • trunk/psLib/src/sysUtils/psString.c

    r4409 r4434  
    1212 *  @author Eric Van Alst, MHPCC
    1313 *
    14  *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-06-28 20:17:52 $
     14 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2005-06-30 00:33:36 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2020#include <stdlib.h>
    2121#include <string.h>
     22#include <limits.h>
    2223#include "psString.h"
    2324#include "psMemory.h"
     
    3435}
    3536
    36 psString psStringNCopy(const char *string, int nChar)
     37psString psStringNCopy(const char *string, unsigned int nChar)
    3738{
    3839    char *returnValue = NULL;
    3940
    4041    // Check the number of characters to copy is non-negative
    41     if (nChar < 0) {
     42    if (nChar == UINT_MAX) {
    4243        // Log error message and return NULL
    4344        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
  • trunk/psLib/src/sysUtils/psString.h

    r4409 r4434  
    1313 *  @author Eric Van Alst, MHPCC
    1414 *
    15  *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2005-06-28 20:17:52 $
     15 *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
     16 *  @date $Date: 2005-06-30 00:33:36 $
    1717 *
    1818 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6464psString psStringNCopy(
    6565    const char *string,                ///< Input string of characters to copy
    66     int nChar                          ///< Number of bytes to allocate for string copy
     66    unsigned int nChar                          ///< Number of bytes to allocate for string copy
    6767);
    6868
Note: See TracChangeset for help on using the changeset viewer.