Please sign in to comment.
Simplify msDBFWriteAttribute to get rid of compiler warnings in lates…
…t GCC. Latest GCC shows these warnings when compiling release build: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=] warning: ‘strncpy’ output may be truncated copying between 0 and 39 bytes from a string of length 39 [-Wstringop-truncation] warning: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation] In msDBFWriteAttribute we can replace strncpy with memcpy since we already check for the string length and we don't want the strncpy capability of writing extra \0 characters. Also replace the 2 snprintf calls (one for the specific format, and one for the value) with a single one. As snprintf can handle 0 precision numbers just fine, we don't need a separate branch for that either. NOTE, this does change the rounding for doubles whose field precision is set to 0. Before 90.9 would be converted to 90, with the new code it would become 91.
- Loading branch information...