Changeset 12517 for trunk/psLib/src/sys/psString.c
- Timestamp:
- Mar 21, 2007, 11:37:58 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/sys/psString.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/sys/psString.c
r12286 r12517 13 13 * @author David Robbins, MHPCC 14 14 * 15 * @version $Revision: 1.5 3$ $Name: not supported by cvs2svn $16 * @date $Date: 2007-03- 07 00:17:48 $15 * @version $Revision: 1.54 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2007-03-21 21:37:58 $ 17 17 * 18 18 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 43 43 unsigned int lineno, 44 44 const char *func, 45 longnChar)45 size_t nChar) 46 46 { 47 47 if (nChar < 1) { … … 85 85 const char *func, 86 86 const char *string, 87 unsigned int nChar)87 size_t nChar) 88 88 { 89 89 // Pass through NULL values … … 93 93 94 94 // Check the number of characters to copy is non-negative 95 if (nChar == UINT_MAX) {95 if (nChar < 0) { 96 96 // Log error message and return NULL 97 97 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 98 _("Can not copy a negative number of characters (% d)."),98 _("Can not copy a negative number of characters (%zd)."), 99 99 nChar); 100 100 return NULL; … … 102 102 103 103 // Copy input string to memory allocated up to nChar characters 104 psString output = p_psStringAlloc(file, lineno, func, (size_t)nChar + 1);105 output = strncpy(output, string, (size_t)nChar);104 psString output = p_psStringAlloc(file, lineno, func, nChar + 1); 105 output = strncpy(output, string, nChar); 106 106 107 107 // Ensure the last byte is NULL character
Note:
See TracChangeset
for help on using the changeset viewer.
