Changeset View
Changeset View
Standalone View
Standalone View
source/ps/FileIo.cpp
/* Copyright (C) 2013 Wildfire Games. | /* Copyright (C) 2019 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
Show All 32 Lines | |||||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||
// CFilePacker | // CFilePacker | ||||
CFilePacker::CFilePacker(u32 version, const char magic[4]) | CFilePacker::CFilePacker(u32 version, const char magic[4]) | ||||
{ | { | ||||
// put header in our data array. | // put header in our data array. | ||||
// (its payloadSize_le will be updated on every Pack*() call) | // (its payloadSize_le will be updated on every Pack*() call) | ||||
FileHeader header; | 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.version_le, version); | ||||
write_le32(&header.payloadSize_le, 0); | write_le32(&header.payloadSize_le, 0); | ||||
m_writeBuffer.Append(&header, sizeof(FileHeader)); | m_writeBuffer.Append(&header, sizeof(FileHeader)); | ||||
} | } | ||||
CFilePacker::~CFilePacker() | CFilePacker::~CFilePacker() | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 122 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator