Merge branch 'master' into coverity_scan

pull/541/head
Bret Curtis 6 years ago
commit b284432e79

@ -54,7 +54,7 @@ matrix:
sudo: required sudo: required
env: env:
- MATRIX_EVAL="CC=clang-7 && CXX=clang++-7" - MATRIX_EVAL="CC=clang-7 && CXX=clang++-7"
- ANALYZE="scan-build-7 --use-cc clang-7 --use-c++ clang++-7" - ANALYZE="scan-build-7 --force-analyze-debug-code --use-cc clang-7 --use-c++ clang++-7"
- BUILD_OPENMW_CS="OFF" - BUILD_OPENMW_CS="OFF"
if: branch != coverity_scan if: branch != coverity_scan
compiler: clang compiler: clang
@ -64,7 +64,7 @@ matrix:
sudo: required sudo: required
env: env:
- MATRIX_EVAL="CC=clang-7 && CXX=clang++-7" - MATRIX_EVAL="CC=clang-7 && CXX=clang++-7"
- ANALYZE="scan-build-7 --use-cc clang-7 --use-c++ clang++-7" - ANALYZE="scan-build-7 --force-analyze-debug-code --use-cc clang-7 --use-c++ clang++-7"
- BUILD_OPENMW="OFF" - BUILD_OPENMW="OFF"
if: branch != coverity_scan if: branch != coverity_scan
compiler: clang compiler: clang

@ -353,9 +353,9 @@ if [ -z $SKIP_DOWNLOAD ]; then
"MyGUI-3.2.2-msvc${MSVC_YEAR}-win${BITS}.7z" "MyGUI-3.2.2-msvc${MSVC_YEAR}-win${BITS}.7z"
# OpenAL # OpenAL
download "OpenAL-Soft 1.17.2" \ download "OpenAL-Soft 1.19.1" \
"http://openal-soft.org/openal-binaries/openal-soft-1.17.2-bin.zip" \ "http://openal-soft.org/openal-binaries/openal-soft-1.19.1-bin.zip" \
"OpenAL-Soft-1.17.2.zip" "OpenAL-Soft-1.19.1.zip"
# OSG # OSG
download "OpenSceneGraph 3.4.1-scrawl" \ download "OpenSceneGraph 3.4.1-scrawl" \
@ -533,18 +533,18 @@ printf "MyGUI 3.2.2... "
cd $DEPS cd $DEPS
echo echo
# OpenAL # OpenAL
printf "OpenAL-Soft 1.17.2... " printf "OpenAL-Soft 1.19.1... "
{ {
if [ -d openal-soft-1.17.2-bin ]; then if [ -d openal-soft-1.19.1-bin ]; then
printf "Exists. " printf "Exists. "
elif [ -z $SKIP_EXTRACT ]; then elif [ -z $SKIP_EXTRACT ]; then
rm -rf openal-soft-1.17.2-bin rm -rf openal-soft-1.19.1-bin
eval 7z x -y OpenAL-Soft-1.17.2.zip $STRIP eval 7z x -y OpenAL-Soft-1.19.1.zip $STRIP
fi fi
OPENAL_SDK="$(real_pwd)/openal-soft-1.17.2-bin" OPENAL_SDK="$(real_pwd)/openal-soft-1.19.1-bin"
add_cmake_opts -DOPENAL_INCLUDE_DIR="${OPENAL_SDK}/include/AL" \ add_cmake_opts -DOPENAL_INCLUDE_DIR="${OPENAL_SDK}/include/AL" \
-DOPENAL_LIBRARY="${OPENAL_SDK}/libs/Win${BITS}/OpenAL32.lib" -DOPENAL_LIBRARY="${OPENAL_SDK}/libs/Win${BITS}/OpenAL32.lib"
add_runtime_dlls "$(pwd)/openal-soft-1.17.2-bin/bin/WIN${BITS}/soft_oal.dll:OpenAL32.dll" add_runtime_dlls "$(pwd)/openal-soft-1.19.1-bin/bin/WIN${BITS}/soft_oal.dll:OpenAL32.dll"
echo Done. echo Done.
} }
cd $DEPS cd $DEPS

@ -507,7 +507,7 @@ int clone(Arguments& info)
esm.endRecord(typeName.toString()); esm.endRecord(typeName.toString());
saved++; saved++;
int perc = (int)((saved / (float)recordCount)*100); int perc = recordCount == 0 ? 100 : (int)((saved / (float)recordCount)*100);
if (perc % 10 == 0) if (perc % 10 == 0)
{ {
std::cerr << "\r" << perc << "%"; std::cerr << "\r" << perc << "%";

@ -860,11 +860,12 @@ std::vector<std::string>::iterator MwIniImporter::findString(std::vector<std::st
} }
void MwIniImporter::addPaths(std::vector<boost::filesystem::path>& output, std::vector<std::string> input) { void MwIniImporter::addPaths(std::vector<boost::filesystem::path>& output, std::vector<std::string> input) {
for (auto& path : input) { for (auto& path : input)
{
if (path.front() == '"') if (path.front() == '"')
{ {
path.erase(path.begin()); // Drop first and last characters - quotation marks
path.erase(path.end() - 1); path = path.substr(1, path.size() - 2);
} }
output.emplace_back(path); output.emplace_back(path);
} }

@ -10,6 +10,7 @@
#include <components/vfs/bsaarchive.hpp> #include <components/vfs/bsaarchive.hpp>
#include <components/vfs/filesystemarchive.hpp> #include <components/vfs/filesystemarchive.hpp>
#include <boost/exception/all.hpp>
#include <boost/program_options.hpp> #include <boost/program_options.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
@ -128,14 +129,24 @@ std::vector<std::string> parseOptions (int argc, char** argv)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
std::vector<std::string> files = parseOptions (argc, argv); std::vector<std::string> files;
try
{
files = parseOptions (argc, argv);
}
catch( boost::exception &e )
{
std::cout << "ERROR parsing arguments: " << boost::diagnostic_information(e) << std::endl;
exit(1);
}
// std::cout << "Reading Files" << std::endl; // std::cout << "Reading Files" << std::endl;
for(std::vector<std::string>::const_iterator it=files.begin(); it!=files.end(); ++it) for(std::vector<std::string>::const_iterator it=files.begin(); it!=files.end(); ++it)
{ {
std::string name = *it; std::string name = *it;
try{ try
{
if(isNIF(name)) if(isNIF(name))
{ {
//std::cout << "Decoding: " << name << std::endl; //std::cout << "Decoding: " << name << std::endl;

@ -9,7 +9,7 @@
#include "document.hpp" #include "document.hpp"
CSMDoc::DocumentManager::DocumentManager (const Files::ConfigurationManager& configuration) CSMDoc::DocumentManager::DocumentManager (const Files::ConfigurationManager& configuration)
: mConfiguration (configuration), mEncoding (ToUTF8::WINDOWS_1252) : mConfiguration (configuration), mEncoding (ToUTF8::WINDOWS_1252), mFsStrict(false)
{ {
boost::filesystem::path projectPath = configuration.getUserDataPath() / "projects"; boost::filesystem::path projectPath = configuration.getUserDataPath() / "projects";

@ -5,6 +5,8 @@
#include <QAction> #include <QAction>
#include <QWidget> #include <QWidget>
#include <components/debug/debuglog.hpp>
#include "state.hpp" #include "state.hpp"
#include "shortcutmanager.hpp" #include "shortcutmanager.hpp"
@ -71,7 +73,14 @@ namespace CSMPrefs
Shortcut::~Shortcut() Shortcut::~Shortcut()
{ {
State::get().getShortcutManager().removeShortcut(this); try
{
State::get().getShortcutManager().removeShortcut(this);
}
catch(const std::exception& e)
{
Log(Debug::Error) << "Error in the destructor: " << e.what();
}
} }
bool Shortcut::isEnabled() const bool Shortcut::isEnabled() const

@ -21,6 +21,11 @@ namespace CSMWorld
return mIsBeast; return mIsBeast;
} }
ActorAdapter::RaceData::RaceData()
{
mIsBeast = false;
}
bool ActorAdapter::RaceData::handlesPart(ESM::PartReferenceType type) const bool ActorAdapter::RaceData::handlesPart(ESM::PartReferenceType type) const
{ {
switch (type) switch (type)
@ -83,6 +88,12 @@ namespace CSMWorld
} }
ActorAdapter::ActorData::ActorData()
{
mCreature = false;
mFemale = false;
}
const std::string& ActorAdapter::ActorData::getId() const const std::string& ActorAdapter::ActorData::getId() const
{ {
return mId; return mId;

@ -43,6 +43,8 @@ namespace CSMWorld
class RaceData class RaceData
{ {
public: public:
RaceData();
/// Retrieves the id of the race represented /// Retrieves the id of the race represented
const std::string& getId() const; const std::string& getId() const;
/// Checks if it's a beast race /// Checks if it's a beast race
@ -80,6 +82,8 @@ namespace CSMWorld
class ActorData class ActorData
{ {
public: public:
ActorData();
/// Retrieves the id of the actor represented /// Retrieves the id of the actor represented
const std::string& getId() const; const std::string& getId() const;
/// Checks if the actor is a creature /// Checks if the actor is a creature

@ -198,7 +198,13 @@ CSMWorld::ModifyCommand::ModifyCommand (QAbstractItemModel& model, const QModelI
if (mIndex.parent().isValid()) if (mIndex.parent().isValid())
{ {
setText ("Modify " + dynamic_cast<CSMWorld::IdTree*>(mModel)->nestedHeaderData ( CSMWorld::IdTree* tree = dynamic_cast<CSMWorld::IdTree*>(mModel);
if (tree == nullptr)
{
throw std::logic_error("CSMWorld::ModifyCommand: Attempt to add nested values to the non-nested model");
}
setText ("Modify " + tree->nestedHeaderData (
mIndex.parent().column(), mIndex.column(), Qt::Horizontal, Qt::DisplayRole).toString()); mIndex.parent().column(), mIndex.column(), Qt::Horizontal, Qt::DisplayRole).toString());
} }
else else

@ -8,6 +8,8 @@
#include <QStackedWidget> #include <QStackedWidget>
#include <QListWidgetItem> #include <QListWidgetItem>
#include <components/debug/debuglog.hpp>
#include "../../model/prefs/state.hpp" #include "../../model/prefs/state.hpp"
#include "page.hpp" #include "page.hpp"
@ -77,8 +79,15 @@ CSVPrefs::Dialogue::Dialogue()
CSVPrefs::Dialogue::~Dialogue() CSVPrefs::Dialogue::~Dialogue()
{ {
if (isVisible()) try
CSMPrefs::State::get().save(); {
if (isVisible())
CSMPrefs::State::get().save();
}
catch(const std::exception& e)
{
Log(Debug::Error) << "Error in the destructor: " << e.what();
}
} }
void CSVPrefs::Dialogue::closeEvent (QCloseEvent *event) void CSVPrefs::Dialogue::closeEvent (QCloseEvent *event)

@ -463,6 +463,7 @@ namespace CSVRender
, mDistance(0) , mDistance(0)
, mOrbitSpeed(osg::PI / 4) , mOrbitSpeed(osg::PI / 4)
, mOrbitSpeedMult(4) , mOrbitSpeedMult(4)
, mConstRoll(false)
{ {
CSMPrefs::Shortcut* naviPrimaryShortcut = new CSMPrefs::Shortcut("scene-navi-primary", widget); CSMPrefs::Shortcut* naviPrimaryShortcut = new CSMPrefs::Shortcut("scene-navi-primary", widget);
naviPrimaryShortcut->enable(false); naviPrimaryShortcut->enable(false);

@ -224,8 +224,11 @@ namespace CSVRender
void Pathgrid::applyPoint(CSMWorld::CommandMacro& commands, const osg::Vec3d& worldPos) void Pathgrid::applyPoint(CSMWorld::CommandMacro& commands, const osg::Vec3d& worldPos)
{ {
CSMWorld::IdTree* model = dynamic_cast<CSMWorld::IdTree*>(mData.getTableModel( CSMWorld::IdTree* model = dynamic_cast<CSMWorld::IdTree*>(mData.getTableModel(CSMWorld::UniversalId::Type_Pathgrids));
CSMWorld::UniversalId::Type_Pathgrids)); if (model == nullptr)
{
throw std::logic_error("CSVRender::Pathgrid: Attempt to add nested values to the non-nested model");
}
const CSMWorld::Pathgrid* source = getPathgridSource(); const CSMWorld::Pathgrid* source = getPathgridSource();
if (source) if (source)
@ -357,8 +360,11 @@ namespace CSVRender
const CSMWorld::Pathgrid* source = getPathgridSource(); const CSMWorld::Pathgrid* source = getPathgridSource();
if (source) if (source)
{ {
CSMWorld::IdTree* model = dynamic_cast<CSMWorld::IdTree*>(mData.getTableModel( CSMWorld::IdTree* model = dynamic_cast<CSMWorld::IdTree*>(mData.getTableModel(CSMWorld::UniversalId::Type_Pathgrids));
CSMWorld::UniversalId::Type_Pathgrids)); if (model == nullptr)
{
throw std::logic_error("CSVRender::Pathgrid: Attempt to add nested values to the non-nested model");
}
// Want to remove nodes from end of list first // Want to remove nodes from end of list first
std::sort(mSelected.begin(), mSelected.end(), std::greater<int>()); std::sort(mSelected.begin(), mSelected.end(), std::greater<int>());
@ -458,8 +464,11 @@ namespace CSVRender
} }
} }
CSMWorld::IdTree* model = dynamic_cast<CSMWorld::IdTree*>(mData.getTableModel( CSMWorld::IdTree* model = dynamic_cast<CSMWorld::IdTree*>(mData.getTableModel(CSMWorld::UniversalId::Type_Pathgrids));
CSMWorld::UniversalId::Type_Pathgrids)); if (model == nullptr)
{
throw std::logic_error("CSVRender::Pathgrid: Attempt to add nested values to the non-nested model");
}
int parentColumn = mPathgridCollection.findColumnIndex(CSMWorld::Columns::ColumnId_PathgridEdges); int parentColumn = mPathgridCollection.findColumnIndex(CSMWorld::Columns::ColumnId_PathgridEdges);
@ -633,8 +642,11 @@ namespace CSVRender
void Pathgrid::addEdge(CSMWorld::CommandMacro& commands, const CSMWorld::Pathgrid& source, unsigned short node1, void Pathgrid::addEdge(CSMWorld::CommandMacro& commands, const CSMWorld::Pathgrid& source, unsigned short node1,
unsigned short node2) unsigned short node2)
{ {
CSMWorld::IdTree* model = dynamic_cast<CSMWorld::IdTree*>(mData.getTableModel( CSMWorld::IdTree* model = dynamic_cast<CSMWorld::IdTree*>(mData.getTableModel(CSMWorld::UniversalId::Type_Pathgrids));
CSMWorld::UniversalId::Type_Pathgrids)); if (model == nullptr)
{
throw std::logic_error("CSVRender::Pathgrid: Attempt to add nested values to the non-nested model");
}
int recordIndex = mPathgridCollection.getIndex(mId); int recordIndex = mPathgridCollection.getIndex(mId);
int parentColumn = mPathgridCollection.findColumnIndex(CSMWorld::Columns::ColumnId_PathgridEdges); int parentColumn = mPathgridCollection.findColumnIndex(CSMWorld::Columns::ColumnId_PathgridEdges);

@ -13,6 +13,7 @@
#include <osg/Material> #include <osg/Material>
#include <osg/Version> #include <osg/Version>
#include <components/debug/debuglog.hpp>
#include <components/resource/scenemanager.hpp> #include <components/resource/scenemanager.hpp>
#include <components/resource/resourcesystem.hpp> #include <components/resource/resourcesystem.hpp>
#include <components/sceneutil/lightmanager.hpp> #include <components/sceneutil/lightmanager.hpp>
@ -96,7 +97,14 @@ RenderWidget::RenderWidget(QWidget *parent, Qt::WindowFlags f)
RenderWidget::~RenderWidget() RenderWidget::~RenderWidget()
{ {
CompositeViewer::get().removeView(mView); try
{
CompositeViewer::get().removeView(mView);
}
catch(const std::exception& e)
{
Log(Debug::Error) << "Error in the destructor: " << e.what();
}
} }
void RenderWidget::flagAsModified() void RenderWidget::flagAsModified()

@ -256,9 +256,9 @@ void CSVRender::TerrainTextureMode::editTerrainTextureGrid(const WorldspaceHitRe
std::string mBrushTextureInt = mBrushTexture.substr (hashlocation+1); std::string mBrushTextureInt = mBrushTexture.substr (hashlocation+1);
int brushInt = stoi(mBrushTexture.substr (hashlocation+1))+1; // All indices are offset by +1 int brushInt = stoi(mBrushTexture.substr (hashlocation+1))+1; // All indices are offset by +1
float rf = mBrushSize/2; int rf = mBrushSize / 2;
int r = (mBrushSize/2)+1; int r = mBrushSize / 2 + 1;
float distance = 0; int distance = 0;
if (mBrushShape == 0) if (mBrushShape == 0)
{ {

@ -25,7 +25,11 @@ std::string CSVWorld::CellCreator::getId() const
void CSVWorld::CellCreator::configureCreateCommand(CSMWorld::CreateCommand& command) const void CSVWorld::CellCreator::configureCreateCommand(CSMWorld::CreateCommand& command) const
{ {
CSMWorld::IdTree *model = dynamic_cast<CSMWorld::IdTree *>(getData().getTableModel(getCollectionId())); CSMWorld::IdTree *model = dynamic_cast<CSMWorld::IdTree *>(getData().getTableModel(getCollectionId()));
Q_ASSERT(model != nullptr); if (model == nullptr)
{
throw std::logic_error("CSVWorld::CellCreator: Attempt to add nested values to the non-nested model");
}
int parentIndex = model->findColumnIndex(CSMWorld::Columns::ColumnId_Cell); int parentIndex = model->findColumnIndex(CSMWorld::Columns::ColumnId_Cell);
int index = model->findNestedColumnIndex(parentIndex, CSMWorld::Columns::ColumnId_Interior); int index = model->findNestedColumnIndex(parentIndex, CSMWorld::Columns::ColumnId_Interior);
command.addNestedValue(parentIndex, index, mType->currentIndex() == 0); command.addNestedValue(parentIndex, index, mType->currentIndex() == 0);

@ -555,8 +555,13 @@ void CSVWorld::EditWidget::remake(int row)
if (mTable->hasChildren(mTable->index(row, i)) && if (mTable->hasChildren(mTable->index(row, i)) &&
!(flags & CSMWorld::ColumnBase::Flag_Dialogue_List)) !(flags & CSMWorld::ColumnBase::Flag_Dialogue_List))
{ {
mNestedModels.push_back(new CSMWorld::NestedTableProxyModel ( CSMWorld::IdTree *innerTable = dynamic_cast<CSMWorld::IdTree*>(mTable);
mTable->index(row, i), display, dynamic_cast<CSMWorld::IdTree*>(mTable))); if (innerTable == nullptr)
{
throw std::logic_error("CSVWorld::EditWidget: Attempt to add nested values to the non-nested model");
}
mNestedModels.push_back(new CSMWorld::NestedTableProxyModel (mTable->index(row, i), display, innerTable));
int idColumn = mTable->findColumnIndex (CSMWorld::Columns::ColumnId_Id); int idColumn = mTable->findColumnIndex (CSMWorld::Columns::ColumnId_Id);
int typeColumn = mTable->findColumnIndex (CSMWorld::Columns::ColumnId_RecordType); int typeColumn = mTable->findColumnIndex (CSMWorld::Columns::ColumnId_RecordType);

@ -81,8 +81,11 @@ void CSVWorld::ScriptHighlighter::highlight (const Compiler::TokenLoc& loc, Type
CSVWorld::ScriptHighlighter::ScriptHighlighter (const CSMWorld::Data& data, Mode mode, CSVWorld::ScriptHighlighter::ScriptHighlighter (const CSMWorld::Data& data, Mode mode,
QTextDocument *parent) QTextDocument *parent)
: QSyntaxHighlighter (parent), Compiler::Parser (mErrorHandler, mContext), mContext (data), : QSyntaxHighlighter (parent)
mMode (mode) , Compiler::Parser (mErrorHandler, mContext)
, mContext (data)
, mMode (mode)
, mMarkOccurrences (false)
{ {
QColor color ("black"); QColor color ("black");
QTextCharFormat format; QTextCharFormat format;

@ -743,6 +743,7 @@ namespace
mVertices (vertices), mVertices (vertices),
mRenderXform (renderXform) mRenderXform (renderXform)
{ {
assert(font != nullptr);
mVertexColourType = MyGUI::RenderManager::getInstance().getVertexFormat(); mVertexColourType = MyGUI::RenderManager::getInstance().getVertexFormat();
} }

@ -25,6 +25,8 @@ bool shouldAcceptKeyFocus(MyGUI::Widget* w)
/// Recursively get all child widgets that accept keyboard input /// Recursively get all child widgets that accept keyboard input
void getKeyFocusWidgets(MyGUI::Widget* parent, std::vector<MyGUI::Widget*>& results) void getKeyFocusWidgets(MyGUI::Widget* parent, std::vector<MyGUI::Widget*>& results)
{ {
assert(parent != nullptr);
if (!parent->getVisible() || !parent->getEnabled()) if (!parent->getVisible() || !parent->getEnabled())
return; return;

@ -955,6 +955,7 @@ namespace MWMechanics
, mStoredInitialActorPosition(wander->mStoredInitialActorPosition) , mStoredInitialActorPosition(wander->mStoredInitialActorPosition)
, mHasDestination(false) , mHasDestination(false)
, mDestination(osg::Vec3f(0, 0, 0)) , mDestination(osg::Vec3f(0, 0, 0))
, mUsePathgrid(false)
{ {
if (mStoredInitialActorPosition) if (mStoredInitialActorPosition)
mInitialActorPosition = wander->mInitialActorPosition; mInitialActorPosition = wander->mInitialActorPosition;

@ -90,7 +90,7 @@ bool FFmpeg_Decoder::getNextPacket()
bool FFmpeg_Decoder::getAVAudioData() bool FFmpeg_Decoder::getAVAudioData()
{ {
bool got_frame; bool got_frame = false;
if(mCodecCtx->codec_type != AVMEDIA_TYPE_AUDIO) if(mCodecCtx->codec_type != AVMEDIA_TYPE_AUDIO)
return false; return false;
@ -431,6 +431,7 @@ size_t FFmpeg_Decoder::getSampleOffset()
FFmpeg_Decoder::FFmpeg_Decoder(const VFS::Manager* vfs) FFmpeg_Decoder::FFmpeg_Decoder(const VFS::Manager* vfs)
: Sound_Decoder(vfs) : Sound_Decoder(vfs)
, mFormatCtx(nullptr) , mFormatCtx(nullptr)
, mCodecCtx(nullptr)
, mStream(nullptr) , mStream(nullptr)
, mFrame(nullptr) , mFrame(nullptr)
, mFrameSize(0) , mFrameSize(0)

@ -267,8 +267,6 @@ namespace
struct NifFileMock : Nif::File struct NifFileMock : Nif::File
{ {
MOCK_CONST_METHOD1(fail, void (const std::string&));
MOCK_CONST_METHOD1(warn, void (const std::string&));
MOCK_CONST_METHOD1(getRecord, Nif::Record* (std::size_t)); MOCK_CONST_METHOD1(getRecord, Nif::Record* (std::size_t));
MOCK_CONST_METHOD0(numRecords, std::size_t ()); MOCK_CONST_METHOD0(numRecords, std::size_t ());
MOCK_CONST_METHOD1(getRoot, Nif::Record* (std::size_t)); MOCK_CONST_METHOD1(getRoot, Nif::Record* (std::size_t));

@ -129,6 +129,7 @@ namespace
config.bmin[2] -= getBorderSize(settings); config.bmin[2] -= getBorderSize(settings);
config.bmax[0] += getBorderSize(settings); config.bmax[0] += getBorderSize(settings);
config.bmax[2] += getBorderSize(settings); config.bmax[2] += getBorderSize(settings);
config.tileSize = settings.mTileSize;
return config; return config;
} }

@ -134,9 +134,9 @@ public:
{ {
state->bindVertexBufferObject(bufferobject); state->bindVertexBufferObject(bufferobject);
glVertexPointer(3, GL_FLOAT, sizeof(MyGUI::Vertex), static_cast<char*>(0)); glVertexPointer(3, GL_FLOAT, sizeof(MyGUI::Vertex), reinterpret_cast<char*>(0));
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(MyGUI::Vertex), static_cast<char*>(0) + 12); glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(MyGUI::Vertex), reinterpret_cast<char*>(12));
glTexCoordPointer(2, GL_FLOAT, sizeof(MyGUI::Vertex), static_cast<char*>(0) + 16); glTexCoordPointer(2, GL_FLOAT, sizeof(MyGUI::Vertex), reinterpret_cast<char*>(16));
} }
else else
{ {

@ -18,10 +18,6 @@ struct File
{ {
virtual ~File() = default; virtual ~File() = default;
virtual void fail(const std::string &msg) const = 0;
virtual void warn(const std::string &msg) const = 0;
virtual Record *getRecord(size_t index) const = 0; virtual Record *getRecord(size_t index) const = 0;
virtual size_t numRecords() const = 0; virtual size_t numRecords() const = 0;
@ -71,14 +67,14 @@ class NIFFile final : public File
public: public:
/// Used if file parsing fails /// Used if file parsing fails
void fail(const std::string &msg) const override void fail(const std::string &msg) const
{ {
std::string err = " NIFFile Error: " + msg; std::string err = " NIFFile Error: " + msg;
err += "\nFile: " + filename; err += "\nFile: " + filename;
throw std::runtime_error(err); throw std::runtime_error(err);
} }
/// Used when something goes wrong, but not catastrophically so /// Used when something goes wrong, but not catastrophically so
void warn(const std::string &msg) const override void warn(const std::string &msg) const
{ {
Log(Debug::Warning) << " NIFFile Warning: " << msg << "\nFile: " << filename; Log(Debug::Warning) << " NIFFile Warning: " << msg << "\nFile: " << filename;
} }

Loading…
Cancel
Save