1
0
mirror of synced 2024-11-25 00:00:27 +01:00

fix: Workaround that broke functionality. Instead disable warnings

This actually fixes #515 for now
This commit is contained in:
WerWolv 2022-05-28 16:18:55 +02:00
parent 39c743631b
commit 088205385f
3 changed files with 10 additions and 5 deletions

View File

@ -2,9 +2,14 @@
#include <hex.hpp> #include <hex.hpp>
// TODO: Workaround for weird issue picked up by GCC 12.1.0 and later. This seems like a compiler bug mentioned in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98465
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wrestrict"
#pragma GCC diagnostic ignored "-Wstringop-overread"
#include <map> #include <map>
#include <string_view> #include <string_view>
#include <vector> #include <vector>
#pragma GCC diagnostic pop
#include <hex/helpers/fs.hpp> #include <hex/helpers/fs.hpp>
#include <hex/helpers/file.hpp> #include <hex/helpers/file.hpp>

View File

@ -42,10 +42,6 @@ namespace hex {
continue; continue;
if (delimiterPos >= line.length()) if (delimiterPos >= line.length())
continue; continue;
if (delimiterPos >= from.length())
continue;
if (delimiterPos >= to.length())
continue;
from = line.substr(0, delimiterPos); from = line.substr(0, delimiterPos);
to = line.substr(delimiterPos + 1); to = line.substr(delimiterPos + 1);

View File

@ -204,11 +204,15 @@ namespace hex {
} }
std::vector<std::string> splitString(const std::string &string, const std::string &delimiter) { std::vector<std::string> splitString(const std::string &string, const std::string &delimiter) {
size_t start = 0, end; size_t start = 0, end = 0;
std::string token; std::string token;
std::vector<std::string> res; std::vector<std::string> res;
while ((end = string.find(delimiter, start)) != std::string::npos) { while ((end = string.find(delimiter, start)) != std::string::npos) {
size_t size = end - start;
if (start + size > string.length())
break;
token = string.substr(start, end - start); token = string.substr(start, end - start);
start = end + delimiter.length(); start = end + delimiter.length();
res.push_back(token); res.push_back(token);