Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -165,8 +165,15 @@ Foam::Ostream& Foam::ensightFile::write ...@@ -165,8 +165,15 @@ Foam::Ostream& Foam::ensightFile::write
Foam::Ostream& Foam::ensightFile::write(const char* value) 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]; 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) if (format() == IOstream::BINARY)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment