Some GCC 4.6 compatibility changes.

The `g_path_local` definition is somewhat arbitrary.
This commit is contained in:
Oliver Hamlet
2014-09-30 18:01:59 +01:00
parent 614ae83a42
commit 80b69cfdda
7 changed files with 25 additions and 21 deletions
+1 -1
View File
@@ -132,7 +132,7 @@ IF (CMAKE_COMPILER_IS_GNUCXX)
ENDIF ()
set (LOOT_LIBS git2
libyaml-cpp
yaml-cpp
loadorder${PROJECT_ARCH})
ENDIF ()
+1 -1
View File
@@ -552,7 +552,7 @@ LOOT_API unsigned int loot_get_tag_map(loot_db db, char *** const tagMap, size_t
try {
unsigned int UID = 0;
for (const auto &tag : allTags) {
db->bashTagMap.emplace(tag, UID);
db->bashTagMap.insert(std::pair<std::string, unsigned int>(tag, UID));
//Also allocate memory.
db->extTagMap[UID] = ToNewCString(tag);
UID++;
+7 -7
View File
@@ -203,11 +203,11 @@ namespace loot {
match = *it;
// Now we want to also match possibly multiple regex entries.
it = find(regexPlugins.begin(), regexPlugins.end(), plugin);
while (it != regexPlugins.end()) {
match.MergeMetadata(*it);
auto regIt = find(regexPlugins.begin(), regexPlugins.end(), plugin);
while (regIt != regexPlugins.end()) {
match.MergeMetadata(*regIt);
it = find(++it, regexPlugins.end(), plugin);
regIt = find(++regIt, regexPlugins.end(), plugin);
}
return match;
@@ -724,7 +724,7 @@ namespace loot {
try {
SetLoadOrder(pluginArr, pluginArrSize);
}
catch (error &e) {
catch (error &/*e*/) {
for (size_t i = 0; i < pluginArrSize; i++)
delete[] pluginArr[i];
delete[] pluginArr;
@@ -782,7 +782,7 @@ namespace loot {
uintmax_t fileSize = fs::file_size(it->path());
meanFileSize += fileSize;
tempMap.emplace(it->path().filename().string(), fileSize);
tempMap.insert(pair<string, uintmax_t>(it->path().filename().string(), fileSize));
}
}
meanFileSize /= tempMap.size(); //Rounding error, but not important.
@@ -792,7 +792,7 @@ namespace loot {
BOOST_LOG_TRIVIAL(info) << "Found plugin: " << pluginPair.first;
//Insert the lowercased name as a key for case-insensitive matching.
auto plugin = plugins.emplace(boost::locale::to_lower(pluginPair.first), Plugin(pluginPair.first));
auto plugin = plugins.insert(pair<string, Plugin>(boost::locale::to_lower(pluginPair.first), Plugin(pluginPair.first)));
if (pluginPair.second > meanFileSize) {
BOOST_LOG_TRIVIAL(trace) << "Creating individual loading thread for: " << pluginPair.first;
+4
View File
@@ -35,7 +35,11 @@ namespace loot {
const boost::filesystem::path g_path_readme = boost::filesystem::current_path() / "docs" / "LOOT Readme.html";
const boost::filesystem::path g_path_report = boost::filesystem::current_path() / "resources" / "report" / "report.html";
const boost::filesystem::path g_path_l10n = boost::filesystem::current_path() / "resources" / "l10n";
#ifdef _WIN32
const boost::filesystem::path g_path_local = GetLocalAppDataPath() / "LOOT";
#else
const boost::filesystem::path g_path_local = boost::filesystem::current_path();
#endif
const boost::filesystem::path g_path_settings = g_path_local / "settings.yaml";
const boost::filesystem::path g_path_log = g_path_local / "LOOTDebugLog.txt";
}
+3 -3
View File
@@ -148,7 +148,7 @@ namespace loot {
throw loot::error(loot::error::condition_eval_fail, (boost::format(lc::translate("Failed to parse condition \"%1%\".")) % _condition).str());
}
game.conditionCache.emplace(boost::locale::to_lower(_condition), eval);
game.conditionCache.insert(pair<string, bool>(boost::locale::to_lower(_condition), eval));
return eval;
}
@@ -708,11 +708,11 @@ namespace loot {
crc = it->second;
else if (boost::filesystem::exists(game.DataPath() / name)) {
crc = GetCrc32(game.DataPath() / name);
game.crcCache.emplace(boost::locale::to_lower(name), crc);
game.crcCache.insert(pair<string, uint32_t>(boost::locale::to_lower(name), crc));
}
else if (boost::filesystem::exists(game.DataPath() / (name + ".ghost"))) {
crc = GetCrc32(game.DataPath() / (name + ".ghost"));
game.crcCache.emplace(boost::locale::to_lower(name), crc);
game.crcCache.insert(pair<string, uint32_t>(boost::locale::to_lower(name), crc));
}
else
_dirtyInfo.clear();
+1 -1
View File
@@ -280,7 +280,7 @@ namespace loot {
namespace std {
template<>
struct hash < loot::Plugin > {
size_t operator() (const loot::Plugin& plugin) {
size_t operator() (const loot::Plugin& plugin) const {
return hash<string>()(boost::locale::to_lower(plugin.Name()));
}
};
+8 -8
View File
@@ -339,7 +339,7 @@ namespace YAML {
rhs.clear();
for (const auto &element : node) {
rhs.insert(element.as<T>());
rhs.insert(element.template as<T>());
}
return true;
}
@@ -361,7 +361,7 @@ namespace YAML {
rhs.clear();
for (const auto &element : node) {
rhs.insert(element.as<T>());
rhs.insert(element.template as<T>());
}
return true;
}
@@ -555,7 +555,7 @@ namespace loot {
BOOST_LOG_TRIVIAL(trace) << "Checking to see if any files matching the regex \"" << regexStr << "\" exist.";
regex sepReg("/|(\\\\\\\\)", regex::ECMAScript | regex::icase);
std::regex sepReg("/|(\\\\\\\\)", std::regex::ECMAScript | std::regex::icase);
std::vector<std::string> components;
std::sregex_token_iterator it(regexStr.begin(), regexStr.end(), sepReg, -1);
@@ -589,11 +589,11 @@ namespace loot {
return;
}
regex reg;
std::regex reg;
try {
reg = regex(filename, regex::ECMAScript | regex::icase);
reg = std::regex(filename, std::regex::ECMAScript | std::regex::icase);
}
catch (exception& /*e*/) {
catch (std::exception& /*e*/) {
BOOST_LOG_TRIVIAL(error) << "Invalid regex string:" << filename;
throw loot::error(loot::error::invalid_args, boost::locale::translate("Invalid regex string:").str() + " " + filename);
}
@@ -619,7 +619,7 @@ namespace loot {
}
uint32_t crc;
unordered_map<std::string, uint32_t>::iterator it = _game->crcCache.find(boost::locale::to_lower(file));
std::unordered_map<std::string, uint32_t>::iterator it = _game->crcCache.find(boost::locale::to_lower(file));
if (it != _game->crcCache.end())
crc = it->second;
@@ -635,7 +635,7 @@ namespace loot {
return;
}
_game->crcCache.emplace(boost::locale::to_lower(file), crc);
_game->crcCache.insert(std::pair<std::string, uint32_t>(boost::locale::to_lower(file), crc));
}
result = checksum == crc;