forked from mia/Aegisub
Fix a bunch of warnings when building with gcc on linux
This commit is contained in:
parent
291437eed6
commit
53f02d33a6
9 changed files with 18 additions and 15 deletions
|
@ -151,6 +151,7 @@ AS_IF([test x$enable_compiler_flags != xno], [
|
||||||
CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wno-unused-parameter -fno-strict-aliasing -pipe -g"
|
CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wno-unused-parameter -fno-strict-aliasing -pipe -g"
|
||||||
AC_CXX_FLAG([-std=c++11])
|
AC_CXX_FLAG([-std=c++11])
|
||||||
AC_CXX_FLAG([-Wno-c++11-narrowing])
|
AC_CXX_FLAG([-Wno-c++11-narrowing])
|
||||||
|
AC_C_FLAG([-Wno-unused-local-typedefs])
|
||||||
AC_CXX_FLAG([-Wno-unused-local-typedefs])
|
AC_CXX_FLAG([-Wno-unused-local-typedefs])
|
||||||
|
|
||||||
# -O* messes with debugging.
|
# -O* messes with debugging.
|
||||||
|
|
|
@ -34,7 +34,7 @@ class SyntaxHighlighter {
|
||||||
std::string const& text;
|
std::string const& text;
|
||||||
agi::SpellChecker *spellchecker;
|
agi::SpellChecker *spellchecker;
|
||||||
|
|
||||||
void SetStyling(int len, int type) {
|
void SetStyling(size_t len, int type) {
|
||||||
if (ranges.size() && ranges.back().type == type)
|
if (ranges.size() && ranges.back().type == type)
|
||||||
ranges.back().length += len;
|
ranges.back().length += len;
|
||||||
else
|
else
|
||||||
|
|
|
@ -121,7 +121,7 @@ file_mapping::~file_mapping() {
|
||||||
read_file_mapping::read_file_mapping(fs::path const& filename)
|
read_file_mapping::read_file_mapping(fs::path const& filename)
|
||||||
: file(filename, false)
|
: file(filename, false)
|
||||||
{
|
{
|
||||||
offset_t size;
|
offset_t size = 0;
|
||||||
ipcdetail::get_file_size(file.get_mapping_handle().handle, size);
|
ipcdetail::get_file_size(file.get_mapping_handle().handle, size);
|
||||||
file_size = static_cast<uint64_t>(size);
|
file_size = static_cast<uint64_t>(size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,7 +218,7 @@ namespace ass {
|
||||||
ptrdiff_t len = it->value().end() - it->value().begin();
|
ptrdiff_t len = it->value().end() - it->value().begin();
|
||||||
assert(len > 0);
|
assert(len > 0);
|
||||||
if (data.empty() || data.back().type != id)
|
if (data.empty() || data.back().type != id)
|
||||||
data.push_back(DialogueToken{id, len});
|
data.push_back(DialogueToken{id, static_cast<size_t>(len)});
|
||||||
else
|
else
|
||||||
data.back().length += len;
|
data.back().length += len;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ Thesaurus::Thesaurus(agi::fs::path const& dat_path, agi::fs::path const& idx_pat
|
||||||
std::vector<std::string> chunks;
|
std::vector<std::string> chunks;
|
||||||
boost::split(chunks, line, _1 == '|');
|
boost::split(chunks, line, _1 == '|');
|
||||||
if (chunks.size() == 2)
|
if (chunks.size() == 2)
|
||||||
offsets[chunks[0]] = atoi(chunks[1].c_str());
|
offsets[chunks[0]] = static_cast<size_t>(atoi(chunks[1].c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace charset { class IconvWrapper; }
|
||||||
|
|
||||||
class Thesaurus {
|
class Thesaurus {
|
||||||
/// Map of word -> byte position in the data file
|
/// Map of word -> byte position in the data file
|
||||||
boost::container::flat_map<std::string, int> offsets;
|
boost::container::flat_map<std::string, size_t> offsets;
|
||||||
/// Read handle to the data file
|
/// Read handle to the data file
|
||||||
std::unique_ptr<read_file_mapping> dat;
|
std::unique_ptr<read_file_mapping> dat;
|
||||||
/// Converter from the data file's charset to UTF-8
|
/// Converter from the data file's charset to UTF-8
|
||||||
|
|
|
@ -346,7 +346,9 @@ public:
|
||||||
throw agi::AudioProviderOpenError("Found 'data' chunk before 'fmt ' chunk, file is invalid.", nullptr);
|
throw agi::AudioProviderOpenError("Found 'data' chunk before 'fmt ' chunk, file is invalid.", nullptr);
|
||||||
|
|
||||||
auto samples = chunk_size / bytes_per_sample / channels;
|
auto samples = chunk_size / bytes_per_sample / channels;
|
||||||
index_points.push_back(IndexPoint{filepos, samples});
|
index_points.push_back(IndexPoint{
|
||||||
|
static_cast<int64_t>(filepos),
|
||||||
|
static_cast<int64_t>(samples)});
|
||||||
num_samples += samples;
|
num_samples += samples;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,10 @@
|
||||||
|
|
||||||
#include <wx/msgdlg.h>
|
#include <wx/msgdlg.h>
|
||||||
|
|
||||||
static const size_t bad_pos = -1;
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
static const size_t bad_pos = -1;
|
||||||
|
static const MatchState bad_match{nullptr, 0, bad_pos};
|
||||||
|
|
||||||
auto get_dialogue_field(SearchReplaceSettings::Field field) -> decltype(&AssDialogueBase::Text) {
|
auto get_dialogue_field(SearchReplaceSettings::Field field) -> decltype(&AssDialogueBase::Text) {
|
||||||
switch (field) {
|
switch (field) {
|
||||||
case SearchReplaceSettings::Field::TEXT: return &AssDialogueBase::Text;
|
case SearchReplaceSettings::Field::TEXT: return &AssDialogueBase::Text;
|
||||||
|
@ -157,7 +158,7 @@ matcher get_matcher(SearchReplaceSettings const& settings, Accessor&& a) {
|
||||||
boost::smatch result;
|
boost::smatch result;
|
||||||
auto const& str = a.get(diag, start);
|
auto const& str = a.get(diag, start);
|
||||||
if (!u32regex_search(str, result, regex, start > 0 ? boost::match_not_bol : boost::match_default))
|
if (!u32regex_search(str, result, regex, start > 0 ? boost::match_not_bol : boost::match_default))
|
||||||
return {nullptr, 0, -1};
|
return bad_match;
|
||||||
return a.make_match_state(result.position(), result.position() + result.length(), ®ex);
|
return a.make_match_state(result.position(), result.position() + result.length(), ®ex);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -169,19 +170,18 @@ matcher get_matcher(SearchReplaceSettings const& settings, Accessor&& a) {
|
||||||
if (!settings.match_case)
|
if (!settings.match_case)
|
||||||
look_for = boost::locale::fold_case(look_for);
|
look_for = boost::locale::fold_case(look_for);
|
||||||
|
|
||||||
MatchState invalid{nullptr, 0, -1};
|
|
||||||
return [=](const AssDialogue *diag, size_t start) mutable -> MatchState {
|
return [=](const AssDialogue *diag, size_t start) mutable -> MatchState {
|
||||||
const auto str = a.get(diag, start);
|
const auto str = a.get(diag, start);
|
||||||
if (full_match_only && str.size() != look_for.size())
|
if (full_match_only && str.size() != look_for.size())
|
||||||
return invalid;
|
return bad_match;
|
||||||
|
|
||||||
if (match_case) {
|
if (match_case) {
|
||||||
const auto pos = str.find(look_for);
|
const auto pos = str.find(look_for);
|
||||||
return pos == std::string::npos ? invalid : a.make_match_state(pos, pos + look_for.size());
|
return pos == std::string::npos ? bad_match : a.make_match_state(pos, pos + look_for.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto pos = agi::util::ifind(str, look_for);
|
const auto pos = agi::util::ifind(str, look_for);
|
||||||
return pos.first == bad_pos ? invalid : a.make_match_state(pos.first, pos.second);
|
return pos.first == bad_pos ? bad_match : a.make_match_state(pos.first, pos.second);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ bool SearchReplaceEngine::FindReplace(bool replace) {
|
||||||
auto it = context->ass->iterator_to(*line);
|
auto it = context->ass->iterator_to(*line);
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
|
|
||||||
MatchState replace_ms{nullptr, 0, -1};
|
auto replace_ms = bad_match;
|
||||||
if (replace) {
|
if (replace) {
|
||||||
if (settings.field == SearchReplaceSettings::Field::TEXT)
|
if (settings.field == SearchReplaceSettings::Field::TEXT)
|
||||||
pos = context->textSelectionController->GetSelectionStart();
|
pos = context->textSelectionController->GetSelectionStart();
|
||||||
|
|
|
@ -89,7 +89,7 @@ void SubtitlesProvider::LoadSubtitles(AssFile *subs, int time) {
|
||||||
|
|
||||||
push_header("[Events]\n");
|
push_header("[Events]\n");
|
||||||
for (auto const& line : subs->Events) {
|
for (auto const& line : subs->Events) {
|
||||||
if (!line.Comment && time < 0 || !(line.Start > time || line.End <= time))
|
if (!line.Comment && (time < 0 || !(line.Start > time || line.End <= time)))
|
||||||
push_line(line.GetEntryData());
|
push_line(line.GetEntryData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue