Commit 54ef9bea authored by Mark OLESEN's avatar Mark OLESEN Committed by Andrew Heather
Browse files

COMP: silence spurious GCC -Wstringop-truncation warning in ensightFile

parent ff3b9501
......@@ -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)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment