diff --git a/aegisub/libaegisub/unix/util.cpp b/aegisub/libaegisub/unix/util.cpp index b268252e8..3b831644b 100644 --- a/aegisub/libaegisub/unix/util.cpp +++ b/aegisub/libaegisub/unix/util.cpp @@ -78,7 +78,7 @@ uint64_t freespace(std::string const& path, PathType type) { acs::CheckDirRead(check); if ((statvfs(check.c_str(), &fs)) == 0) { - return fs.f_bsize * fs.f_bavail; + return (uint64_t)fs.f_bsize * fs.f_bavail; } else { /// @todo We need a collective set of exceptions for ENOTDIR, EIO etc. throw("Failed getting free space"); diff --git a/aegisub/src/ass_dialogue.cpp b/aegisub/src/ass_dialogue.cpp index 76ed31eed..b0c6f015e 100644 --- a/aegisub/src/ass_dialogue.cpp +++ b/aegisub/src/ass_dialogue.cpp @@ -290,7 +290,7 @@ void AssDialogue::StripTag (wxString tagName) { continue; } - AssDialogueBlockOverride *over = dynamic_cast(*cur); + AssDialogueBlockOverride *over = static_cast(*cur); wxString temp; for (size_t i = 0; i < over->Tags.size(); ++i) { if (over->Tags[i]->Name != tagName) diff --git a/aegisub/src/ass_karaoke.cpp b/aegisub/src/ass_karaoke.cpp index c83f21671..04ccc667e 100644 --- a/aegisub/src/ass_karaoke.cpp +++ b/aegisub/src/ass_karaoke.cpp @@ -206,6 +206,10 @@ void AssKaraoke::AddSplit(size_t syl_idx, size_t pos) { if (new_syl.text.empty()) new_syl.duration = 0; + else if (syl.text.empty()) { + new_syl.duration = syl.duration; + syl.duration = 0; + } else { new_syl.duration = syl.duration * new_syl.text.size() / (syl.text.size() + new_syl.text.size()); syl.duration -= new_syl.duration; diff --git a/aegisub/src/audio_marker.h b/aegisub/src/audio_marker.h index ce97dad99..1e512e932 100644 --- a/aegisub/src/audio_marker.h +++ b/aegisub/src/audio_marker.h @@ -183,7 +183,7 @@ class SecondsMarkerProvider : public AudioMarkerProvider { Pen *style; int position; - Marker(Pen *style) : style(style) { } + Marker(Pen *style) : style(style), position(0) { } int GetPosition() const { return position; } FeetStyle GetFeet() const { return Feet_None; } bool CanSnap() const { return false; } diff --git a/aegisub/src/audio_player_alsa.cpp b/aegisub/src/audio_player_alsa.cpp index 691154d29..e08af182d 100644 --- a/aegisub/src/audio_player_alsa.cpp +++ b/aegisub/src/audio_player_alsa.cpp @@ -148,6 +148,7 @@ struct PlaybackState { start_position = 0; end_position = 0; last_position = 0; + memset(&last_position_time, 0, sizeof last_position_time); provider = 0; } }; @@ -275,7 +276,7 @@ do_setup: } // Fill buffer - long tmp_pcm_avail = snd_pcm_avail(pcm); + snd_pcm_sframes_t tmp_pcm_avail = snd_pcm_avail(pcm); if (tmp_pcm_avail == -EPIPE) { if (snd_pcm_recover(pcm, -EPIPE, 1) < 0) @@ -288,8 +289,8 @@ do_setup: avail = std::min(tmp_pcm_avail, (snd_pcm_sframes_t)(ps.end_position-position)); if (avail < 0) { - printf("\n--------- avail was less than 0: %" PRId64 "\n", avail); - printf("snd_pcm_avail(pcm): %" PRId64 "\n", tmp_pcm_avail); + printf("\n--------- avail was less than 0: %ld\n", (long)avail); + printf("snd_pcm_avail(pcm): %ld\n", (long)tmp_pcm_avail); printf("original position: %" PRId64 "\n", orig_position); printf("current position: %" PRId64 "\n", position); printf("original ps.end_position: %" PRId64 "\n", orig_ps_end_position); diff --git a/aegisub/src/audio_provider_pcm.cpp b/aegisub/src/audio_provider_pcm.cpp index 81ce75d63..d9c141d10 100644 --- a/aegisub/src/audio_provider_pcm.cpp +++ b/aegisub/src/audio_provider_pcm.cpp @@ -60,8 +60,11 @@ #include "utils.h" PCMAudioProvider::PCMAudioProvider(const wxString &filename) +: current_mapping(0) +, mapping_start(0) +, mapping_length(0) #ifdef _WIN32 -: file_handle(0, CloseHandle) +, file_handle(0, CloseHandle) , file_mapping(0, CloseHandle) { file_handle = CreateFile( @@ -91,11 +94,8 @@ PCMAudioProvider::PCMAudioProvider(const wxString &filename) if (file_mapping == 0) throw agi::AudioProviderOpenError("Failed creating file mapping", 0); - - current_mapping = 0; - #else -: file_handle(open(filename.mb_str(*wxConvFileName), O_RDONLY), close) +, file_handle(open(filename.mb_str(*wxConvFileName), O_RDONLY), close) { if (file_handle == -1) throw agi::FileNotFoundError(STD_STR(filename)); @@ -107,8 +107,6 @@ PCMAudioProvider::PCMAudioProvider(const wxString &filename) throw agi::AudioProviderOpenError("Could not stat file to get size", 0); } file_size = filestats.st_size; - - current_mapping = 0; #endif float_samples = false; } diff --git a/aegisub/src/audio_provider_pcm.h b/aegisub/src/audio_provider_pcm.h index 50e9ba250..3d3def4de 100644 --- a/aegisub/src/audio_provider_pcm.h +++ b/aegisub/src/audio_provider_pcm.h @@ -56,19 +56,19 @@ /// /// DOCME class PCMAudioProvider : public AudioProvider { -#ifdef _WIN32 - agi::scoped_holder file_handle; - agi::scoped_holder file_mapping; - mutable void *current_mapping; +#ifdef _WIN32 mutable int64_t mapping_start; mutable size_t mapping_length; + + agi::scoped_holder file_handle; + agi::scoped_holder file_mapping; #else - agi::scoped_holder file_handle; - mutable void *current_mapping; mutable off_t mapping_start; mutable size_t mapping_length; + + agi::scoped_holder file_handle; #endif protected: diff --git a/aegisub/src/audio_timing_karaoke.cpp b/aegisub/src/audio_timing_karaoke.cpp index 9a91590f3..4bb0f4383 100644 --- a/aegisub/src/audio_timing_karaoke.cpp +++ b/aegisub/src/audio_timing_karaoke.cpp @@ -62,7 +62,13 @@ public: { } - KaraokeMarker(int position) : position(position) { } + KaraokeMarker(int position) + : position(position) + , pen(0) + , style(Feet_None) + { + } + operator int() const { return position; } }; diff --git a/aegisub/src/auto4_lua.cpp b/aegisub/src/auto4_lua.cpp index 7f586a701..27877633b 100644 --- a/aegisub/src/auto4_lua.cpp +++ b/aegisub/src/auto4_lua.cpp @@ -760,6 +760,7 @@ namespace Automation4 { // LuaFeature LuaFeature::LuaFeature(lua_State *L) : L(L) + , myid(0) { } diff --git a/aegisub/src/auto4_lua_assfile.cpp b/aegisub/src/auto4_lua_assfile.cpp index c6c812acb..f457ecae3 100644 --- a/aegisub/src/auto4_lua_assfile.cpp +++ b/aegisub/src/auto4_lua_assfile.cpp @@ -716,7 +716,7 @@ namespace Automation4 { , last_entry_id(1) { // prepare userdata object - *static_cast(lua_newuserdata(L, sizeof(LuaAssFile**))) = this; + *static_cast(lua_newuserdata(L, sizeof(LuaAssFile*))) = this; // make the metatable lua_newtable(L); diff --git a/aegisub/src/auto4_lua_dialog.cpp b/aegisub/src/auto4_lua_dialog.cpp index 56a18b247..08b2bf9dd 100644 --- a/aegisub/src/auto4_lua_dialog.cpp +++ b/aegisub/src/auto4_lua_dialog.cpp @@ -177,6 +177,7 @@ namespace Automation4 { Edit(lua_State *L) : LuaDialogControl(L) , text(get_field(L, "value")) + , cw(0) { // Undocumented behaviour, 'value' is also accepted as key for text, // mostly so a text control can stand in for other things. @@ -290,6 +291,7 @@ namespace Automation4 { IntEdit(lua_State *L) : Edit(L) + , cw(0) , value(get_field(L, "value", 0)) , min(get_field(L, "min", INT_MIN)) , max(get_field(L, "max", INT_MAX)) @@ -415,6 +417,7 @@ namespace Automation4 { Dropdown(lua_State *L) : LuaDialogControl(L) , value(get_field(L, "value")) + , cw(0) { lua_getfield(L, -1, "items"); read_string_array(L, items); @@ -455,6 +458,7 @@ namespace Automation4 { : LuaDialogControl(L) , label(get_field(L, "label")) , value(get_field(L, "value", false)) + , cw(0) { } @@ -491,6 +495,7 @@ namespace Automation4 { LuaDialog::LuaDialog(lua_State *L, bool include_buttons) : use_buttons(include_buttons) , button_pushed(0) + , window(0) { LOG_D("automation/lua/dialog") << "creating LuaDialoug, addr: " << this; diff --git a/aegisub/src/command/edit.cpp b/aegisub/src/command/edit.cpp index 6a08078fc..adf99e0c3 100644 --- a/aegisub/src/command/edit.cpp +++ b/aegisub/src/command/edit.cpp @@ -42,6 +42,8 @@ #include #include +#include +#include #endif #include "command.h" diff --git a/aegisub/src/dialog_dummy_video.cpp b/aegisub/src/dialog_dummy_video.cpp index 05715bf1d..432206dc9 100644 --- a/aegisub/src/dialog_dummy_video.cpp +++ b/aegisub/src/dialog_dummy_video.cpp @@ -70,14 +70,8 @@ enum { /// DOCME struct ResolutionShortcut { - - /// DOCME const char *name; - - /// DOCME int width; - - /// DOCME int height; }; @@ -95,13 +89,6 @@ static ResolutionShortcut resolutions[] = { {0, 0, 0} }; - - -/// @brief DOCME -/// @param parent -/// @param out_filename -/// @return -/// bool DialogDummyVideo::CreateDummyVideo(wxWindow *parent, wxString &out_filename) { DialogDummyVideo dlg(parent); @@ -156,9 +143,6 @@ bool DialogDummyVideo::CreateDummyVideo(wxWindow *parent, wxString &out_filename } } -/// @brief DOCME -/// @param parent -/// DialogDummyVideo::DialogDummyVideo(wxWindow *parent) : wxDialog(parent, -1, _("Dummy video options"),wxDefaultPosition,wxDefaultSize) { @@ -204,9 +188,6 @@ DialogDummyVideo::DialogDummyVideo(wxWindow *parent) main_sizer->Add(new wxStaticLine(this,wxHORIZONTAL),0,wxALL|wxEXPAND,5); main_sizer->Add(btnSizer,0,wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND,5); -// main_sizer->Add(CreateSeparatedButtonSizer(wxOK|wxCANCEL), 0, wxALL|wxEXPAND, 5); -// ok_button = static_cast(FindWindow(wxID_OK)); -// cancel_button = static_cast(FindWindow(wxID_CANCEL)); // Initialise controls int lastwidth, lastheight, lastres = 0; @@ -219,11 +200,6 @@ DialogDummyVideo::DialogDummyVideo(wxWindow *parent) lastres++; } pattern->SetValue(OPT_GET("Video/Dummy/Pattern")->GetBool()); - /*fps->Append("23.976"); - fps->Append("29.97"); - fps->Append("24"); - fps->Append("25"); - fps->Append("30");*/ width->ChangeValue(AegiIntegerToString(OPT_GET("Video/Dummy/Last/Width")->GetInt())); height->ChangeValue(AegiIntegerToString(OPT_GET("Video/Dummy/Last/Height")->GetInt())); length->SetRange(0, 0x10000000); @@ -235,10 +211,6 @@ DialogDummyVideo::DialogDummyVideo(wxWindow *parent) CenterOnParent(); } - - -/// @brief DOCME -/// DialogDummyVideo::~DialogDummyVideo() { } @@ -251,11 +223,6 @@ BEGIN_EVENT_TABLE(DialogDummyVideo,wxDialog) EVT_TEXT(Dummy_Video_Length, DialogDummyVideo::OnLengthChange) END_EVENT_TABLE() - - -/// @brief DOCME -/// @param evt -/// void DialogDummyVideo::OnResolutionShortcut(wxCommandEvent &) { int rs = resolution_shortcuts->GetSelection(); @@ -263,40 +230,21 @@ void DialogDummyVideo::OnResolutionShortcut(wxCommandEvent &) height->ChangeValue(wxString::Format("%d", resolutions[rs].height)); } - - -/// @brief DOCME -/// @param evt -/// void DialogDummyVideo::OnFpsChange(wxCommandEvent &) { UpdateLengthDisplay(); } - - -/// @brief DOCME -/// @param evt -/// void DialogDummyVideo::OnLengthSpin(wxSpinEvent &) { UpdateLengthDisplay(); } - - -/// @brief DOCME -/// @param evt -/// void DialogDummyVideo::OnLengthChange(wxCommandEvent &) { UpdateLengthDisplay(); } - - -/// @brief DOCME -/// void DialogDummyVideo::UpdateLengthDisplay() { double fpsval; @@ -323,5 +271,3 @@ void DialogDummyVideo::UpdateLengthDisplay() ok_button->Disable(); } } - - diff --git a/aegisub/src/dialog_dummy_video.h b/aegisub/src/dialog_dummy_video.h index 8f902e9e5..ab86d652e 100644 --- a/aegisub/src/dialog_dummy_video.h +++ b/aegisub/src/dialog_dummy_video.h @@ -55,36 +55,16 @@ class DialogDummyVideo : public wxDialog { DialogDummyVideo(wxWindow *parent); ~DialogDummyVideo(); - /// DOCME wxComboBox *resolution_shortcuts; - - /// DOCME wxTextCtrl *width; - - /// DOCME wxTextCtrl *height; - - /// DOCME ColourButton *colour; - - /// DOCME wxCheckBox *pattern; - - /// DOCME wxTextCtrl *fps; - - /// DOCME wxSpinCtrl *length; - - /// DOCME wxStaticText *length_display; - - /// DOCME wxButton *ok_button; - /// DOCME - wxButton *cancel_button; - void OnResolutionShortcut(wxCommandEvent &evt); void OnFpsChange(wxCommandEvent &evt); void OnLengthSpin(wxSpinEvent &evt); diff --git a/aegisub/src/dialog_search_replace.cpp b/aegisub/src/dialog_search_replace.cpp index dded1d7ca..32ac451ea 100644 --- a/aegisub/src/dialog_search_replace.cpp +++ b/aegisub/src/dialog_search_replace.cpp @@ -218,9 +218,23 @@ void DialogSearchReplace::UpdateDropDowns() { } } -/// @brief Constructor SearchReplaceEngine /////////////////////// -SearchReplaceEngine::SearchReplaceEngine () { - CanContinue = false; +SearchReplaceEngine::SearchReplaceEngine() +: curLine(0) +, pos(0) +, matchLen(0) +, replaceLen(0) +, Modified(0) +, LastWasFind(true) +, hasReplace(false) +, isReg(false) +, matchCase(false) +, updateVideo(false) +, CanContinue(false) +, hasFocus(false) +, field(0) +, affect(0) +, context(0) +{ } void SearchReplaceEngine::FindNext() { @@ -228,7 +242,6 @@ void SearchReplaceEngine::FindNext() { } -/// @brief Find & Replace next instance void SearchReplaceEngine::ReplaceNext(bool DoReplace) { if (!CanContinue) { OpenDialog(DoReplace); diff --git a/aegisub/src/dialog_search_replace.h b/aegisub/src/dialog_search_replace.h index 5f8973c39..d1d993f4a 100644 --- a/aegisub/src/dialog_search_replace.h +++ b/aegisub/src/dialog_search_replace.h @@ -45,66 +45,27 @@ namespace agi { struct Context; } - -/// DOCME -/// @class SearchReplaceEngine -/// @brief DOCME -/// -/// DOCME class SearchReplaceEngine { - /// DOCME int curLine; - - /// DOCME size_t pos; - - /// DOCME size_t matchLen; - - /// DOCME size_t replaceLen; - - /// DOCME bool Modified; - - /// DOCME bool LastWasFind; - - /// DOCME bool hasReplace; - - /// DOCME bool isReg; - - /// DOCME bool matchCase; - - /// DOCME bool updateVideo; - - /// DOCME bool CanContinue; - - /// DOCME bool hasFocus; - - /// DOCME int field; - - /// DOCME int affect; - - /// DOCME wxString LookFor; - - /// DOCME wxString ReplaceWith; - wxString *GetText(AssDialogue *cur, int field); public: - /// DOCME agi::Context *context; void FindNext(); @@ -123,37 +84,17 @@ public: // Instance extern SearchReplaceEngine Search; -/// DOCME -/// @class DialogSearchReplace -/// @brief DOCME -/// -/// DOCME class DialogSearchReplace : public wxDialog { friend class SearchReplaceEngine; - /// DOCME bool hasReplace; - - /// DOCME wxComboBox *FindEdit; - - /// DOCME wxComboBox *ReplaceEdit; - - /// DOCME wxCheckBox *CheckMatchCase; - - /// DOCME wxCheckBox *CheckRegExp; - - /// DOCME wxCheckBox *CheckUpdateVideo; - - /// DOCME wxRadioBox *Affect; - - /// DOCME wxRadioBox *Field; void UpdateDropDowns(); diff --git a/aegisub/src/export_framerate.cpp b/aegisub/src/export_framerate.cpp index 520d548e8..b9160bf91 100644 --- a/aegisub/src/export_framerate.cpp +++ b/aegisub/src/export_framerate.cpp @@ -59,6 +59,11 @@ AssTransformFramerateFilter::AssTransformFramerateFilter() : AssExportFilter(_("Transform Framerate"), _("Transform subtitle times, including those in override tags, from an input framerate to an output framerate.\n\nThis is useful for converting regular time subtitles to VFRaC time subtitles for hardsubbing.\nIt can also be used to convert subtitles to a different speed video, such as NTSC to PAL speedup."), 1000) , c(0) +, line(0) +, newStart(0) +, newEnd(0) +, newK(0) +, oldK(0) , Input(0) , Output(0) { diff --git a/aegisub/src/font_file_lister.cpp b/aegisub/src/font_file_lister.cpp index 98a1856e2..b439adf6e 100644 --- a/aegisub/src/font_file_lister.cpp +++ b/aegisub/src/font_file_lister.cpp @@ -41,6 +41,8 @@ using namespace std::tr1::placeholders; FontCollector::FontCollector(FontCollectorStatusCallback status_callback, FontFileLister &lister) : status_callback(status_callback) , lister(lister) +, missing(0) +, missing_glyphs(0) { } diff --git a/aegisub/src/gl_text.cpp b/aegisub/src/gl_text.cpp index f619ee8ab..3ae7d9801 100644 --- a/aegisub/src/gl_text.cpp +++ b/aegisub/src/gl_text.cpp @@ -377,6 +377,11 @@ void OpenGLTextGlyph::Draw(float x, float y) const { /// @brief DOCME OpenGLTextGlyph::OpenGLTextGlyph(int value, wxFont const& font) : str(wxChar(value)) +, tex(0) +, x1(0) +, x2(0) +, y1(0) +, y2(0) , font(font) { wxCoord desc,lead; diff --git a/aegisub/src/mkv_wrap.cpp b/aegisub/src/mkv_wrap.cpp index 12dec661b..8e4f1bd31 100644 --- a/aegisub/src/mkv_wrap.cpp +++ b/aegisub/src/mkv_wrap.cpp @@ -334,7 +334,9 @@ longlong StdIoGetFileSize(InputStream *_st) { return epos; } -MkvStdIO::MkvStdIO(wxString filename) { +MkvStdIO::MkvStdIO(wxString filename) +: error(0) +{ read = StdIoRead; scan = StdIoScan; getcachesize = StdIoGetCacheSize; diff --git a/aegisub/src/preferences.cpp b/aegisub/src/preferences.cpp index 99b5dbd96..9ac746fa6 100644 --- a/aegisub/src/preferences.cpp +++ b/aegisub/src/preferences.cpp @@ -343,7 +343,10 @@ class HotkeyRenderer : public wxDataViewCustomRenderer { wxTextCtrl *ctrl; public: - HotkeyRenderer() : wxDataViewCustomRenderer("string", wxDATAVIEW_CELL_EDITABLE) { } + HotkeyRenderer() + : wxDataViewCustomRenderer("string", wxDATAVIEW_CELL_EDITABLE) + , ctrl(0) + { } wxWindow *CreateEditorCtrl(wxWindow *parent, wxRect label_rect, wxVariant const& var) { ctrl = new wxTextCtrl(parent, -1, var.GetString(), label_rect.GetPosition(), label_rect.GetSize(), wxTE_PROCESS_ENTER); diff --git a/aegisub/src/subs_edit_ctrl.cpp b/aegisub/src/subs_edit_ctrl.cpp index 05cc194d8..db5ed1882 100644 --- a/aegisub/src/subs_edit_ctrl.cpp +++ b/aegisub/src/subs_edit_ctrl.cpp @@ -869,7 +869,7 @@ void SubsTextEditCtrl::SplitLine(bool estimateTimes) { n1->Text = orig.Left(from).Trim(true); // Trim off trailing whitespace n2->Text = orig.Mid(from).Trim(false); // Trim off leading whitespace - if (estimateTimes) { + if (estimateTimes && orig.size()) { double splitPos = double(from) / orig.size(); n2->Start = n1->End = (int)((n1->End - n1->Start) * splitPos) + n1->Start; } diff --git a/aegisub/src/subs_grid.cpp b/aegisub/src/subs_grid.cpp index df9b305eb..e0fa9fcaf 100644 --- a/aegisub/src/subs_grid.cpp +++ b/aegisub/src/subs_grid.cpp @@ -75,20 +75,16 @@ static void expand_times(AssDialogue *src, AssDialogue *dst) { /// @brief Recombine void SubtitlesGrid::RecombineLines() { - using namespace std; - Selection selectedSet = GetSelectedSet(); if (selectedSet.size() < 2) return; AssDialogue *activeLine = GetActiveLine(); - vector sel; - sel.reserve(selectedSet.size()); - copy(selectedSet.begin(), selectedSet.end(), back_inserter(sel)); + std::vector sel(selectedSet.begin(), selectedSet.end()); for_each(sel.begin(), sel.end(), trim_text); sort(sel.begin(), sel.end(), &AssFile::CompStart); - typedef vector::iterator diag_iter; + typedef std::vector::iterator diag_iter; diag_iter end = sel.end() - 1; for (diag_iter cur = sel.begin(); cur != end; ++cur) { AssDialogue *d1 = *cur; @@ -97,21 +93,21 @@ void SubtitlesGrid::RecombineLines() { // 1, 1+2 (or 2+1), 2 gets turned into 1, 2, 2 so kill the duplicate if (d1->Text == (*d2)->Text) { expand_times(d1, *d2); - delete d1; context->ass->Line.remove(d1); + delete d1; continue; } // 1, 1+2, 1 turns into 1, 2, [empty] if (d1->Text.empty()) { - delete d1; context->ass->Line.remove(d1); + delete d1; continue; } // If d2 is the last line in the selection it'll never hit the above test if (d2 == end && (*d2)->Text.empty()) { - delete *d2; context->ass->Line.remove(*d2); + delete *d2; continue; } diff --git a/aegisub/src/subtitle_format.cpp b/aegisub/src/subtitle_format.cpp index ec59bfa53..000a76a4c 100644 --- a/aegisub/src/subtitle_format.cpp +++ b/aegisub/src/subtitle_format.cpp @@ -243,7 +243,7 @@ void SubtitleFormat::RecombineOverlaps(LineList &lines) { //Is there an A part before the overlap? if (curdlg->Start > prevdlg->Start) { // Produce new entry with correct values - AssDialogue *newdlg = dynamic_cast(prevdlg->Clone()); + AssDialogue *newdlg = static_cast(prevdlg->Clone()); newdlg->Start = prevdlg->Start; newdlg->End = curdlg->Start; newdlg->Text = prevdlg->Text; @@ -253,7 +253,7 @@ void SubtitleFormat::RecombineOverlaps(LineList &lines) { // Overlapping A+B part { - AssDialogue *newdlg = dynamic_cast(prevdlg->Clone()); + AssDialogue *newdlg = static_cast(prevdlg->Clone()); newdlg->Start = curdlg->Start; newdlg->End = (prevdlg->End < curdlg->End) ? prevdlg->End : curdlg->End; // Put an ASS format hard linewrap between lines @@ -265,7 +265,7 @@ void SubtitleFormat::RecombineOverlaps(LineList &lines) { // Is there an A part after the overlap? if (prevdlg->End > curdlg->End) { // Produce new entry with correct values - AssDialogue *newdlg = dynamic_cast(prevdlg->Clone()); + AssDialogue *newdlg = static_cast(prevdlg->Clone()); newdlg->Start = curdlg->End; newdlg->End = prevdlg->End; newdlg->Text = prevdlg->Text; @@ -276,7 +276,7 @@ void SubtitleFormat::RecombineOverlaps(LineList &lines) { // Is there a B part after the overlap? if (curdlg->End > prevdlg->End) { // Produce new entry with correct values - AssDialogue *newdlg = dynamic_cast(prevdlg->Clone()); + AssDialogue *newdlg = static_cast(prevdlg->Clone()); newdlg->Start = prevdlg->End; newdlg->End = curdlg->End; newdlg->Text = curdlg->Text; diff --git a/aegisub/src/subtitle_format_ebu3264.cpp b/aegisub/src/subtitle_format_ebu3264.cpp index ee5e3e6be..8f98f1b8d 100644 --- a/aegisub/src/subtitle_format_ebu3264.cpp +++ b/aegisub/src/subtitle_format_ebu3264.cpp @@ -112,11 +112,11 @@ namespace typedef std::vector EbuTextRow; /// Formatting character constants - const char EBU_FORMAT_ITALIC[] = "\x81\x80"; - const char EBU_FORMAT_UNDERLINE[] = "\x83\x82"; - const char EBU_FORMAT_BOXING[] = "\x85\x84"; - const char EBU_FORMAT_LINEBREAK = '\x8a'; - const char EBU_FORMAT_UNUSED_SPACE = '\x8f'; + const unsigned char EBU_FORMAT_ITALIC[] = "\x81\x80"; + const unsigned char EBU_FORMAT_UNDERLINE[] = "\x83\x82"; + const unsigned char EBU_FORMAT_BOXING[] = "\x85\x84"; + const unsigned char EBU_FORMAT_LINEBREAK = '\x8a'; + const unsigned char EBU_FORMAT_UNUSED_SPACE = '\x8f'; /// intermediate format class EbuSubtitle diff --git a/aegisub/src/threaded_frame_source.cpp b/aegisub/src/threaded_frame_source.cpp index b303782ed..d888fa504 100644 --- a/aegisub/src/threaded_frame_source.cpp +++ b/aegisub/src/threaded_frame_source.cpp @@ -187,7 +187,9 @@ ThreadedFrameSource::ThreadedFrameSource(wxString videoFileName, wxEvtHandler *p , provider(get_subs_provider(parent)) , videoProvider(VideoProviderFactory::GetProvider(videoFileName)) , parent(parent) +, nextFrame(-1) , nextTime(-1.) +, singleFrame(-1) , jobReady(jobMutex) , run(true) { diff --git a/aegisub/src/utils.cpp b/aegisub/src/utils.cpp index a36d084ea..8a64227b8 100644 --- a/aegisub/src/utils.cpp +++ b/aegisub/src/utils.cpp @@ -93,9 +93,9 @@ wxString PrettySize(int bytes) { const char *suffix[] = { "", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" }; // Set size - int i = 0; + size_t i = 0; double size = bytes; - while (size > 1024 && i < 9) { + while (size > 1024 && i + 1 < sizeof(suffix) / sizeof(suffix[0])) { size /= 1024.0; i++; } diff --git a/aegisub/src/validators.cpp b/aegisub/src/validators.cpp index 4b3b0a85b..664c5d617 100644 --- a/aegisub/src/validators.cpp +++ b/aegisub/src/validators.cpp @@ -44,12 +44,13 @@ #include "validators.h" NumValidator::NumValidator(wxString val, bool isfloat, bool issigned) -: isFloat(isfloat) +: fValue(0) +, iValue(0) +, isFloat(isfloat) , isSigned(issigned) { if (isFloat) { - if (!val.ToDouble(&fValue)) - fValue = 0; + val.ToDouble(&fValue); } else { long tLong = 0; @@ -59,14 +60,16 @@ NumValidator::NumValidator(wxString val, bool isfloat, bool issigned) } NumValidator::NumValidator(int val, bool issigned) -: iValue(val) +: fValue(0) +, iValue(val) , isFloat(false) , isSigned(issigned) { } NumValidator::NumValidator(int64_t val, bool issigned) -: iValue((int)val) +: fValue(0) +, iValue((int)val) , isFloat(false) , isSigned(issigned) { @@ -74,6 +77,7 @@ NumValidator::NumValidator(int64_t val, bool issigned) NumValidator::NumValidator(double val, bool issigned) : fValue(val) +, iValue(0) , isFloat(true) , isSigned(issigned) { diff --git a/aegisub/src/video_out_gl.cpp b/aegisub/src/video_out_gl.cpp index f6eb762e7..088335c92 100644 --- a/aegisub/src/video_out_gl.cpp +++ b/aegisub/src/video_out_gl.cpp @@ -94,18 +94,19 @@ static bool TestTexture(int width, int height, GLint format) { } VideoOutGL::VideoOutGL() -: maxTextureSize(0), - supportsRectangularTextures(false), - internalFormat(0), - frameWidth(0), - frameHeight(0), - frameFormat(0), - frameFlipped(false), - textureIdList(), - textureList(), - textureCount(0), - textureRows(0), - textureCols(0) +: maxTextureSize(0) +, supportsRectangularTextures(false) +, internalFormat(0) +, frameWidth(0) +, frameHeight(0) +, frameFormat(0) +, frameFlipped(false) +, textureIdList() +, textureList() +, dl(0) +, textureCount(0) +, textureRows(0) +, textureCols(0) { } /// @brief Runtime detection of required OpenGL capabilities diff --git a/aegisub/src/video_provider_yuv4mpeg.cpp b/aegisub/src/video_provider_yuv4mpeg.cpp index ca2f436ad..fb5499b51 100644 --- a/aegisub/src/video_provider_yuv4mpeg.cpp +++ b/aegisub/src/video_provider_yuv4mpeg.cpp @@ -81,7 +81,7 @@ YUV4MPEGVideoProvider::YUV4MPEGVideoProvider(wxString fname) CheckFileFormat(); - ParseFileHeader(ReadHeader(0, false)); + ParseFileHeader(ReadHeader(0)); if (w <= 0 || h <= 0) throw VideoOpenError("Invalid resolution"); @@ -145,8 +145,7 @@ void YUV4MPEGVideoProvider::CheckFileFormat() { /// @param startpos The byte offset at where to start reading /// @param reset_pos If true, the function will reset the file position to what it was before the function call before returning /// @return A list of parameters -std::vector YUV4MPEGVideoProvider::ReadHeader(int64_t startpos, bool reset_pos) { - int64_t oldpos = ftello(sf); +std::vector YUV4MPEGVideoProvider::ReadHeader(int64_t startpos) { std::vector tags; wxString curtag; int bytesread = 0; @@ -159,12 +158,8 @@ std::vector YUV4MPEGVideoProvider::ReadHeader(int64_t startpos, bool r while ((buf = fgetc(sf)) != 0x0A) { if (ferror(sf)) throw VideoOpenError("ReadHeader: Failed to read from file"); - if (feof(sf)) { - // you know, this is one of the places where it would be really nice - // to be able to throw an exception object that tells the caller that EOF was reached - LOG_D("provider/video/yuv4mpeg") << "ReadHeader: Reached EOF, returning"; - break; - } + if (feof(sf)) + throw VideoOpenError("ReadHeader: Reached eof while reading header"); // some basic low-effort sanity checking if (buf == 0x00) @@ -187,9 +182,6 @@ std::vector YUV4MPEGVideoProvider::ReadHeader(int64_t startpos, bool r curtag.Clear(); } - if (reset_pos) - fseeko(sf, oldpos, SEEK_SET); - return tags; } @@ -313,9 +305,14 @@ int YUV4MPEGVideoProvider::IndexFile() { // the file header for us and set the seek position correctly while (true) { int64_t curpos = ftello(sf); // update position + if (curpos < 0) + throw VideoOpenError("IndexFile: ftello failed"); + // continue reading headers until no more are found - std::vector tags = ReadHeader(curpos, false); + std::vector tags = ReadHeader(curpos); curpos = ftello(sf); + if (curpos < 0) + throw VideoOpenError("IndexFile: ftello failed"); if (tags.empty()) break; // no more headers diff --git a/aegisub/src/video_provider_yuv4mpeg.h b/aegisub/src/video_provider_yuv4mpeg.h index 91b19b61d..4e73fc168 100644 --- a/aegisub/src/video_provider_yuv4mpeg.h +++ b/aegisub/src/video_provider_yuv4mpeg.h @@ -134,7 +134,7 @@ class YUV4MPEGVideoProvider : public VideoProvider { void CheckFileFormat(); void ParseFileHeader(const std::vector& tags); Y4M_FrameFlags ParseFrameHeader(const std::vector& tags); - std::vector ReadHeader(int64_t startpos, bool reset_pos=false); + std::vector ReadHeader(int64_t startpos); int IndexFile(); public: diff --git a/aegisub/src/visual_tool_drag.cpp b/aegisub/src/visual_tool_drag.cpp index 9e701752f..9f7d737e2 100644 --- a/aegisub/src/visual_tool_drag.cpp +++ b/aegisub/src/visual_tool_drag.cpp @@ -169,14 +169,17 @@ void VisualToolDrag::OnSelectedSetChanged(const SubtitleSelection &added, const c->selectionController->GetSelectedSet(selection); bool any_changed = false; - for (feature_iterator it = features.begin(); it != features.end(); ++it) { + for (feature_iterator it = features.begin(); it != features.end(); ) { if (removed.count(it->line)) { - sel_features.erase(it); + sel_features.erase(it++); any_changed = true; } - else if (added.count(it->line) && it->type == DRAG_START && line_not_present(sel_features, it)) { - sel_features.insert(it); - any_changed = true; + else { + if (added.count(it->line) && it->type == DRAG_START && line_not_present(sel_features, it)) { + sel_features.insert(it); + any_changed = true; + } + ++it; } } diff --git a/aegisub/src/visual_tool_rotatexy.cpp b/aegisub/src/visual_tool_rotatexy.cpp index 7230a8731..e3f9cfd5f 100644 --- a/aegisub/src/visual_tool_rotatexy.cpp +++ b/aegisub/src/visual_tool_rotatexy.cpp @@ -30,6 +30,11 @@ VisualToolRotateXY::VisualToolRotateXY(VideoDisplay *parent, agi::Context *context) : VisualTool(parent, context) +, angle_x(0) +, angle_y(0) +, angle_z(0) +, orig_x(0) +, orig_y(0) { features.resize(1); org = &features.back(); diff --git a/aegisub/src/visual_tool_rotatez.cpp b/aegisub/src/visual_tool_rotatez.cpp index eee258a63..551bf930b 100644 --- a/aegisub/src/visual_tool_rotatez.cpp +++ b/aegisub/src/visual_tool_rotatez.cpp @@ -35,6 +35,10 @@ static const float rad2deg = 180.f / 3.1415926536f; VisualToolRotateZ::VisualToolRotateZ(VideoDisplay *parent, agi::Context *context) : VisualTool(parent, context) +, angle(0) +, orig_angle(0) +, rotation_x(0) +, rotation_y(0) { features.resize(1); org = &features.back(); diff --git a/aegisub/src/visual_tool_scale.cpp b/aegisub/src/visual_tool_scale.cpp index 2995bec50..118598ab8 100644 --- a/aegisub/src/visual_tool_scale.cpp +++ b/aegisub/src/visual_tool_scale.cpp @@ -32,6 +32,9 @@ VisualToolScale::VisualToolScale(VideoDisplay *parent, agi::Context *context) : VisualTool(parent, context) +, rx(0) +, ry(0) +, rz(0) { } diff --git a/aegisub/src/visual_tool_vector_clip.cpp b/aegisub/src/visual_tool_vector_clip.cpp index d84204c55..78a0e53a3 100644 --- a/aegisub/src/visual_tool_vector_clip.cpp +++ b/aegisub/src/visual_tool_vector_clip.cpp @@ -51,6 +51,9 @@ enum { VisualToolVectorClip::VisualToolVectorClip(VideoDisplay *parent, agi::Context *context) : VisualTool(parent, context) , spline(*this) +, toolBar(0) +, mode(0) +, inverse(false) { }