mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
COMP: silence spurious GCC -Wstringop-truncation warning in ensightFile
This commit is contained in:
@ -165,8 +165,15 @@ Foam::Ostream& Foam::ensightFile::write
|
||||
|
||||
Foam::Ostream& Foam::ensightFile::write(const char* value)
|
||||
{
|
||||
// Parentheses around strncpy to silence the GCC -Wstringop-truncation
|
||||
// warning, which is spurious here.
|
||||
// The max-size and buffer-size *are* identical, which means the buffer
|
||||
// may not have a nul terminator. However, this is properly handled in
|
||||
// the subsequent binary write and the ASCII write explicitly adds
|
||||
// a nul terminator.
|
||||
|
||||
char buf[80];
|
||||
strncpy(buf, value, 80); // max 80 chars or padded with nul if smaller
|
||||
(strncpy(buf, value, 80)); // max 80 chars or padded with nul if smaller
|
||||
|
||||
if (format() == IOstream::BINARY)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user