mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 03:06:29 +00:00
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:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user