Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
54ef9bea
Commit
54ef9bea
authored
Jul 08, 2019
by
Mark OLESEN
Committed by
Andrew Heather
Jul 08, 2019
Browse files
COMP: silence spurious GCC -Wstringop-truncation warning in ensightFile
parent
ff3b9501
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/fileFormats/ensight/file/ensightFile.C
View file @
54ef9bea
...
...
@@ -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
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment