From 9cf84ecda3a45c309124ef24d8b46b631461658e Mon Sep 17 00:00:00 2001 From: WrinklyNinja Date: Sat, 12 Oct 2013 20:59:35 +0100 Subject: [PATCH] Misc. fixes. * Dirty CRCs are now written out to YAML as hex strings, and plugins have their dirty info written out. * Dirty info is now taken into account when checking if a plugin has any metadata or not. * Implemented neater string -> hex int conversion. --- src/backend/generators.h | 5 ++++- src/backend/metadata.cpp | 2 +- src/gui/editor.cpp | 6 +----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/backend/generators.h b/src/backend/generators.h index 0406516a..88ab85d4 100644 --- a/src/backend/generators.h +++ b/src/backend/generators.h @@ -682,7 +682,7 @@ namespace YAML { inline Emitter& operator << (Emitter& out, const boss::PluginDirtyInfo& rhs) { out << BeginMap - << Key << "crc" << Value << rhs.CRC() + << Key << "crc" << Value << Hex << rhs.CRC() << Dec << Key << "util" << Value << rhs.CleaningUtility(); if (rhs.ITMs() > 0) @@ -809,6 +809,9 @@ namespace YAML { if (!rhs.Tags().empty()) out << Key << "tag" << Value << rhs.Tags(); + if (!rhs.DirtyInfo().empty()) + out << Key << "dirty" << Value << rhs.DirtyInfo(); + out << EndMap; } } diff --git a/src/backend/metadata.cpp b/src/backend/metadata.cpp index da522732..b82974cc 100644 --- a/src/backend/metadata.cpp +++ b/src/backend/metadata.cpp @@ -612,7 +612,7 @@ namespace boss { } bool Plugin::HasNameOnly() const { - return priority == 0 && enabled == true && loadAfter.empty() && requirements.empty() && incompatibilities.empty() && messages.empty() && tags.empty(); + return priority == 0 && enabled == true && loadAfter.empty() && requirements.empty() && incompatibilities.empty() && messages.empty() && tags.empty() && _dirtyInfo.empty(); } bool Plugin::IsRegexPlugin() const { diff --git a/src/gui/editor.cpp b/src/gui/editor.cpp index 56f34936..591fc9cf 100644 --- a/src/gui/editor.cpp +++ b/src/gui/editor.cpp @@ -26,7 +26,6 @@ #include "../backend/streams.h" #include -#include #include #include @@ -904,10 +903,7 @@ boss::Tag Editor::RowToTag(wxListView * list, long row) const { boss::PluginDirtyInfo Editor::RowToPluginDirtyInfo(wxListView * list, long row) const { string text(list->GetItemText(row, 0).ToUTF8()); - uint32_t crc; - std::stringstream ss; - ss << std::hex << text; - ss >> crc; + uint32_t crc = strtoul(text.c_str(), NULL, 16); return boss::PluginDirtyInfo( crc, atoi(string(list->GetItemText(row, 1).ToUTF8()).c_str()),