RCS file: /usr/local/cvs/repositories/pan-starrs/datasys/IPP/psLib/src/sys/psString.c,v
retrieving revision 1.23
diff -u -r1.23 psString.c
|
|
|
|
| 33 | 33 | // Allocate memory using psAlloc function |
| 34 | 34 | // Copy input string to memory just allocated |
| 35 | 35 | // Return the copy |
| 36 | | return strcpy(psAlloc(strlen(string) + 1), string); |
| | 36 | // Pass through NULL values |
| | 37 | return string ? strcpy(psAlloc(strlen(string) + 1), string) : NULL; |
| 37 | 38 | } |
| 38 | 39 | |
| 39 | 40 | psString psStringNCopy(const char *string, |
| … |
… |
|
| 52 | 53 | // Allocate memory using psAlloc function - nChar bytes |
| 53 | 54 | // Copy input string to memory allocated up to nChar characters |
| 54 | 55 | // Return the copy |
| 55 | | returnValue = strncpy(psAlloc((size_t) nChar + 1), string, (size_t) nChar); |
| | 56 | // Pass through NULL values |
| | 57 | returnValue = |
| | 58 | string ? strncpy(psAlloc((size_t) nChar + 1), string, (size_t) nChar) |
| | 59 | : NULL; |
| 56 | 60 | |
| 57 | 61 | // Ensure the last byte is NULL character |
| 58 | 62 | returnValue[nChar] = '\0'; |
RCS file: /usr/local/cvs/repositories/pan-starrs/datasys/IPP/psLib/src/sys/psString.h,v
retrieving revision 1.17
diff -u -r1.17 psString.h
|
|
|
|
| 37 | 37 | |
| 38 | 38 | /** Copies the input string |
| 39 | 39 | * |
| 40 | | * This function shall allocate memory to the length of the input string |
| 41 | | * plus one and copy the input string to the newly allocated memory. |
| | 40 | * This function shall allocate memory to the length of the input string plus |
| | 41 | * one and copy the input string to the newly allocated memory. If 'string' |
| | 42 | * is 'NULL' then 'NULL' is returned. |
| 42 | 43 | * |
| 43 | 44 | * @return psString: Copy of input string |
| 44 | 45 | */ |
| … |
… |
|
| 54 | 55 | * so if the input string is larger than nChar characters the copied |
| 55 | 56 | * string will be a substring of the input string. If the input string |
| 56 | 57 | * is smaller than nChar bytes then the remaining bytes allocated will |
| 57 | | * be set to NULL. |
| | 58 | * be set to NULL. If 'string' is 'NULL' then 'NULL' is returned. |
| 58 | 59 | * |
| 59 | 60 | * @return psString: Copy of input string |
| 60 | 61 | */ |
RCS file: /usr/local/cvs/repositories/pan-starrs/datasys/IPP/psLib/src/types/psMetadata.c,v
retrieving revision 1.96
diff -u -r1.96 psMetadata.c
|
|
|
|
| 243 | 243 | break; |
| 244 | 244 | case PS_DATA_STRING: |
| 245 | 245 | // 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 | } |
| 247 | 252 | break; |
| 248 | 253 | case PS_DATA_ARRAY: // psArray |
| 249 | 254 | case PS_DATA_BITSET: // psBitSet |