Commit c207cf51 authored by Mark Olesen's avatar Mark Olesen

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

parent fd0282f2
......@@ -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)
{
......
Markdown is supported
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