Fix gcc 8 compiler warning in FileIo.cpp about truncating use of strncpy [-Wstringop-truncation].
Refs #5294 Differential Revision: https://code.wildfiregames.com/D2159 Tested on: gcc 9, Jenkins This was SVN commit r22626.
This commit is contained in:
parent
82f765b4cc
commit
7876ca7acb
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2013 Wildfire Games.
|
||||
/* Copyright (C) 2019 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -47,7 +47,7 @@ CFilePacker::CFilePacker(u32 version, const char magic[4])
|
||||
// put header in our data array.
|
||||
// (its payloadSize_le will be updated on every Pack*() call)
|
||||
FileHeader header;
|
||||
strncpy(header.magic, magic, 4); // not 0-terminated => no _s
|
||||
std::copy(magic, magic + 4, header.magic);
|
||||
write_le32(&header.version_le, version);
|
||||
write_le32(&header.payloadSize_le, 0);
|
||||
m_writeBuffer.Append(&header, sizeof(FileHeader));
|
||||
|
Loading…
Reference in New Issue
Block a user