From 29188f26f2713a5ac90b6dcdfb06e9b801d9664f Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Mon, 30 Oct 2017 23:58:24 +0100 Subject: [PATCH] rwengine: iwyu: fix TextureArchive and BinaryStream --- rwengine/src/BinaryStream.cpp | 23 ++++++++++------------- rwengine/src/BinaryStream.hpp | 8 ++++---- rwengine/src/TextureArchive.cpp | 9 ++++++--- rwengine/src/TextureArchive.hpp | 14 ++++++++------ 4 files changed, 28 insertions(+), 26 deletions(-) diff --git a/rwengine/src/BinaryStream.cpp b/rwengine/src/BinaryStream.cpp index 558f43f9..90b89c36 100644 --- a/rwengine/src/BinaryStream.cpp +++ b/rwengine/src/BinaryStream.cpp @@ -1,15 +1,15 @@ -#include +#include "BinaryStream.hpp" #include #include -#include +#include namespace RW { std::unique_ptr BinaryStream::parse(const std::string &filename) { std::ifstream dfile(filename, std::ios_base::binary); if (!dfile.is_open()) { - std::cerr << "Error opening file " << filename << std::endl; + RW_ERROR("Error opening file " << filename); return nullptr; } @@ -18,7 +18,7 @@ std::unique_ptr BinaryStream::parse(const std::string &filename) { dfile.seekg(0); char *data = new char[length]; dfile.read(data, length); - // std::cout << "File is " << length << " bytes" << std::endl << std::endl; + // RW_MESSAGE("File is " << length << " bytes"); auto BS = std::make_unique(); @@ -42,16 +42,15 @@ std::unique_ptr BinaryStream::parse(const std::string &filename) { prevHeader->next = sec; if (sectionHeader->ID == 0) { - std::cout << "Section ID is ZERO! Abort!" << std::endl; + RW_ERROR("Section ID is ZERO! Abort!"); break; } - std::cout << "Section " << std::hex << sectionHeader->ID << " (" + RW_MESSAGE("Section " << std::hex << sectionHeader->ID << " (" << sectionIdString(sectionHeader->ID) << ")" - << " - " << std::dec << sectionHeader->size << " bytes" - << std::endl; + << " - " << std::dec << sectionHeader->size << " bytes"); /* - std::cout << "Offset " << std::hex << offset << std::endl; + RW_MESSAGE("Offset " << std::hex << offset); */ size_t bytesOfData = 0; @@ -63,12 +62,10 @@ std::unique_ptr BinaryStream::parse(const std::string &filename) { bytesOfData); break; } - // std::cout << "It has " << std::dec << bytesOfData << " bytes of - // data!" << std::endl; + // RW_MESSAGE("It has " << std::dec << bytesOfData + // << " bytes of data!"); offset += sizeof(nativeSectionHeader_t) + bytesOfData; - // std::cout << std::endl; - prevHeader = sec; } diff --git a/rwengine/src/BinaryStream.hpp b/rwengine/src/BinaryStream.hpp index c36a76a3..d0a197e8 100644 --- a/rwengine/src/BinaryStream.hpp +++ b/rwengine/src/BinaryStream.hpp @@ -1,7 +1,7 @@ -#pragma once -#ifndef _BINARYSTREAM_HPP_ -#define _BINARYSTREAM_HPP_ +#ifndef _RWENGINE_BINARYSTREAM_HPP_ +#define _RWENGINE_BINARYSTREAM_HPP_ +#include #include #include @@ -38,4 +38,4 @@ public: }; } -#endif \ No newline at end of file +#endif diff --git a/rwengine/src/TextureArchive.cpp b/rwengine/src/TextureArchive.cpp index 2bb505bc..6e25cd68 100644 --- a/rwengine/src/TextureArchive.cpp +++ b/rwengine/src/TextureArchive.cpp @@ -1,9 +1,12 @@ -#include +#include "TextureArchive.hpp" +#include #include -#include +#include -#include "rw/defines.hpp" +#include + +#include "BinaryStream.hpp" namespace RW { diff --git a/rwengine/src/TextureArchive.hpp b/rwengine/src/TextureArchive.hpp index 4d76f2bf..c1593d95 100644 --- a/rwengine/src/TextureArchive.hpp +++ b/rwengine/src/TextureArchive.hpp @@ -1,13 +1,15 @@ -#pragma once -#ifndef _TEXTUREARCHIVE_HPP_ -#define _TEXTUREARCHIVE_HPP_ - -#include +#ifndef _RWENGINE_TEXTUREARCHIVE_HPP_ +#define _RWENGINE_TEXTUREARCHIVE_HPP_ +#include +#include +#include #include namespace RW { +class BinaryStream; + class TextureArchive { public: struct TextureHeader { @@ -43,4 +45,4 @@ public: }; } -#endif \ No newline at end of file +#endif