refactor(Tools): restyle tools with astyle (#3465)

This commit is contained in:
Kargatum 2020-10-06 16:31:28 +07:00 committed by GitHub
parent be09e03756
commit b00a86f6ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 1004 additions and 936 deletions

View file

@ -14,8 +14,10 @@ MPQArchive::MPQArchive(const char* filename)
{
int result = libmpq__archive_open(&mpq_a, filename, -1);
printf("Opening %s\n", filename);
if(result) {
switch(result) {
if(result)
{
switch(result)
{
case LIBMPQ_ERROR_OPEN :
printf("Error opening archive '%s': Does file really exist?\n", filename);
break;
@ -52,9 +54,9 @@ MPQFile::MPQFile(const char* filename):
pointer(0),
size(0)
{
for(ArchiveSet::iterator i=gOpenArchives.begin(); i!=gOpenArchives.end();++i)
for(ArchiveSet::iterator i = gOpenArchives.begin(); i != gOpenArchives.end(); ++i)
{
mpq_archive *mpq_a = (*i)->mpq_a;
mpq_archive* mpq_a = (*i)->mpq_a;
uint32_t filenum;
if(libmpq__file_number(mpq_a, filename, &filenum)) continue;
@ -62,8 +64,9 @@ MPQFile::MPQFile(const char* filename):
libmpq__file_unpacked_size(mpq_a, filenum, &size);
// HACK: in patch.mpq some files don't want to open and give 1 for filesize
if (size<=1) {
// printf("warning: file %s has size %d; cannot read.\n", filename, size);
if (size <= 1)
{
// printf("warning: file %s has size %d; cannot read.\n", filename, size);
eof = true;
buffer = 0;
return;
@ -85,7 +88,8 @@ size_t MPQFile::read(void* dest, size_t bytes)
if (eof) return 0;
size_t rpos = pointer + bytes;
if (rpos > size_t(size)) {
if (rpos > size_t(size))
{
bytes = size - pointer;
eof = true;
}