From 7adbe07b4eaa2089616aec57153e6173b4175d1d Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Mon, 26 Dec 2011 22:20:49 +0000 Subject: [PATCH] Silence a bunch of PREFast warnings Originally committed to SVN as r6162. --- aegisub/libaegisub/common/option.cpp | 5 +-- aegisub/src/ass_file.cpp | 54 ++++++++---------------- aegisub/src/ass_override.cpp | 10 ++--- aegisub/src/ass_style.cpp | 36 ++++++++-------- aegisub/src/ass_style.h | 2 +- aegisub/src/audio_karaoke.cpp | 8 ++-- aegisub/src/audio_provider_convert.cpp | 2 +- aegisub/src/audio_provider_pcm.cpp | 12 +----- aegisub/src/auto4_lua_assfile.cpp | 4 +- aegisub/src/command/subtitle.cpp | 2 +- aegisub/src/dialog_colorpicker.cpp | 9 ++++ aegisub/src/dialog_search_replace.cpp | 7 ++- aegisub/src/dialog_version_check.cpp | 5 ++- aegisub/src/menu.cpp | 4 +- aegisub/src/mkv_wrap.cpp | 6 ++- aegisub/src/preferences_base.cpp | 3 +- aegisub/src/subs_edit_box.cpp | 5 ++- aegisub/src/subs_edit_ctrl.cpp | 5 +-- aegisub/src/subtitle_format_microdvd.cpp | 12 +++--- aegisub/src/subtitle_format_ttxt.cpp | 17 ++++---- aegisub/src/toolbar.cpp | 6 +-- aegisub/src/video_provider_avs.cpp | 2 +- aegisub/src/visual_tool.cpp | 2 +- 23 files changed, 101 insertions(+), 117 deletions(-) diff --git a/aegisub/libaegisub/common/option.cpp b/aegisub/libaegisub/common/option.cpp index 892184891..4e9c76151 100644 --- a/aegisub/libaegisub/common/option.cpp +++ b/aegisub/libaegisub/common/option.cpp @@ -65,9 +65,8 @@ namespace { void put_array(json::Object &obj, const std::string &path, const char *element_key, std::vector const& value) { json::Array array; for (typename std::vector::const_iterator it = value.begin(); it != value.end(); ++it) { - json::Object obj; - obj[element_key] = *it; - array.push_back(obj); + array.push_back(json::Object()); + static_cast(array.back())[element_key] = *it; } put_option(obj, path, array); diff --git a/aegisub/src/ass_file.cpp b/aegisub/src/ass_file.cpp index 01fe798e2..6fa333aa1 100644 --- a/aegisub/src/ass_file.cpp +++ b/aegisub/src/ass_file.cpp @@ -303,10 +303,9 @@ void AssFile::AddLine(wxString data,wxString group,int &version,wxString *outGro if (data.empty()) return; // Group - AssEntry *entry = NULL; wxString origGroup = group; static wxString keepGroup; - if (!keepGroup.IsEmpty()) group = keepGroup; + if (!keepGroup.empty()) group = keepGroup; if (outGroup) *outGroup = group; wxString lowGroup = group.Lower(); @@ -355,7 +354,7 @@ void AssFile::AddLine(wxString data,wxString group,int &version,wxString *outGro keepGroup.Clear(); group = origGroup; lowGroup = group.Lower(); - entry = attach; + Line.push_back(attach); attach = NULL; } @@ -365,34 +364,24 @@ void AssFile::AddLine(wxString data,wxString group,int &version,wxString *outGro } } } - // Dialogue else if (lowGroup == "[events]") { - if (data.StartsWith("Dialogue:") || data.StartsWith("Comment:")) { - AssDialogue *diag = new AssDialogue(data,version); - //diag->ParseASSTags(); - entry = diag; - entry->group = group; - } - else if (data.StartsWith("Format:")) { - entry = new AssEntry("Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text"); - entry->group = group; - } + if (data.StartsWith("Dialogue:") || data.StartsWith("Comment:")) + Line.push_back(new AssDialogue(data,version)); + else if (data.StartsWith("Format:")) + Line.push_back(new AssEntry("Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text", group)); + else + Line.push_back(new AssEntry(data, group)); } - // Style else if (lowGroup == "[v4+ styles]") { - if (data.StartsWith("Style:")) { - AssStyle *style = new AssStyle(data,version); - entry = style; - entry->group = group; - } - if (data.StartsWith("Format:")) { - entry = new AssEntry("Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding"); - entry->group = group; - } + if (data.StartsWith("Style:")) + Line.push_back(new AssStyle(data,version)); + else if (data.StartsWith("Format:")) + Line.push_back(new AssEntry("Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding", group)); + else + Line.push_back(new AssEntry(data, group)); } - // Script info else if (lowGroup == "[script info]") { // Comment @@ -420,19 +409,12 @@ void AssFile::AddLine(wxString data,wxString group,int &version,wxString *outGro } // Everything - entry = new AssEntry(data); - entry->group = group; + Line.push_back(new AssEntry(data, group)); } - - // Common entry - if (entry == NULL) { - entry = new AssEntry(data); - entry->group = group; + // Unrecognized group + else { + Line.push_back(new AssEntry(data, group)); } - - // Insert the line - Line.push_back(entry); - return; } void AssFile::Clear() { diff --git a/aegisub/src/ass_override.cpp b/aegisub/src/ass_override.cpp index 4cc63ad85..5a1386566 100644 --- a/aegisub/src/ass_override.cpp +++ b/aegisub/src/ass_override.cpp @@ -363,7 +363,7 @@ std::vector tokenize(const wxString &text) { return paramList; } -void AssOverrideTag::ParseParameters(const wxString &text, AssOverrideTagProto::iterator proto) { +void AssOverrideTag::ParseParameters(const wxString &text, AssOverrideTagProto::iterator proto_it) { Clear(); // Tokenize text, attempting to find all parameters @@ -371,14 +371,14 @@ void AssOverrideTag::ParseParameters(const wxString &text, AssOverrideTagProto:: size_t totalPars = paramList.size(); int parsFlag = 1 << (totalPars - 1); // Get optional parameters flag - // vector (i)clip is the second clip prototype in the list + // vector (i)clip is the second clip proto_ittype in the list if ((Name == "\\clip" || Name == "\\iclip") && totalPars != 4) { - ++proto; + ++proto_it; } unsigned curPar = 0; - for (size_t n = 0; n < proto->params.size(); n++) { - AssOverrideParamProto *curproto = &proto->params[n]; + for (size_t n = 0; n < proto_it->params.size(); n++) { + AssOverrideParamProto *curproto = &proto_it->params[n]; // Create parameter AssOverrideParameter *newparam = new AssOverrideParameter; diff --git a/aegisub/src/ass_style.cpp b/aegisub/src/ass_style.cpp index 58bd9a4d8..7abb19436 100644 --- a/aegisub/src/ass_style.cpp +++ b/aegisub/src/ass_style.cpp @@ -66,36 +66,36 @@ AssColor::AssColor (const wxColour &color) { /// @brief Parse from SSA/ASS /// @param value -void AssColor::Parse(const wxString value) { - if (value.Len() > 0 && value[0] == '#') { +void AssColor::Parse(wxString const& value) { + if (value.size() > 0 && value[0] == '#') { // HTML colour SetWXColor(wxColor(value)); return; } // Prepare - char c,ostr[12]; - unsigned long outval; - int oindex=11; - bool ishex=false; + char ostr[12]; + int oindex = 11; + bool ishex = false; - ostr[11]=0; + ostr[11] = 0; - for(unsigned char i = value.Len(); i > 0 && oindex >= 0; i--) { - c=value[i - 1]; - if (isxdigit(c) || c=='-') { + for(size_t i = value.size(); i > 0 && oindex >= 0; i--) { + unsigned char c = value[i - 1]; + if (isxdigit(c) || c == '-') { ostr[--oindex] = c; - if (c>='A') ishex = true; + if (c >= 'A') + ishex = true; } - else if (c == 'H' || c == 'h') ishex = true; + else if (c == 'H' || c == 'h') + ishex = true; } - - outval=strtoul(ostr+oindex,0,ishex?16:10); - r = outval & 0xFF; - g = (outval>>8) & 0xFF; - b = (outval>>16)& 0xFF; - a = (outval>>24)& 0xFF; + unsigned long outval = strtoul(ostr + oindex, 0, ishex ? 16 : 10); + r = outval & 0xFF; + g = (outval>>8) & 0xFF; + b = (outval>>16) & 0xFF; + a = (outval>>24) & 0xFF; } /// @brief Gets a wxColour diff --git a/aegisub/src/ass_style.h b/aegisub/src/ass_style.h index 4e422199e..0101c25b6 100644 --- a/aegisub/src/ass_style.h +++ b/aegisub/src/ass_style.h @@ -60,7 +60,7 @@ struct AssColor { wxColor GetWXColor(); // Return as a wxColor void SetWXColor(const wxColor &color); // Sets from a wxColor - void Parse(const wxString value); // Parse SSA or ASS-style color + void Parse(wxString const& value); // Parse SSA or ASS-style color wxString GetASSFormatted(bool alpha,bool stripped=false,bool isStyle=false) const; // Gets color formated in ASS format wxString GetSSAFormatted() const; }; diff --git a/aegisub/src/audio_karaoke.cpp b/aegisub/src/audio_karaoke.cpp index 0204c59e2..94647ba91 100644 --- a/aegisub/src/audio_karaoke.cpp +++ b/aegisub/src/audio_karaoke.cpp @@ -73,21 +73,21 @@ AudioKaraoke::AudioKaraoke(wxWindow *parent, agi::Context *c) { using std::tr1::bind; - wxSizer *main_sizer = new wxBoxSizer(wxHORIZONTAL); cancel_button = new wxBitmapButton(this, -1, GETIMAGE(kara_split_cancel_16)); cancel_button->SetToolTip(_("Discard all uncommitted splits")); cancel_button->Bind(wxEVT_COMMAND_BUTTON_CLICKED, bind(&AudioKaraoke::CancelSplit, this)); - main_sizer->Add(cancel_button); accept_button = new wxBitmapButton(this, -1, GETIMAGE(kara_split_accept_16)); accept_button->SetToolTip(_("Commit splits")); accept_button->Bind(wxEVT_COMMAND_BUTTON_CLICKED, bind(&AudioKaraoke::AcceptSplit, this)); - main_sizer->Add(accept_button); split_area = new wxPanel(this); - main_sizer->Add(split_area, wxSizerFlags(1).Expand()); + wxSizer *main_sizer = new wxBoxSizer(wxHORIZONTAL); + main_sizer->Add(cancel_button); + main_sizer->Add(accept_button); + main_sizer->Add(split_area, wxSizerFlags(1).Expand()); SetSizerAndFit(main_sizer); /// @todo subscribe diff --git a/aegisub/src/audio_provider_convert.cpp b/aegisub/src/audio_provider_convert.cpp index a465afdb0..010165b86 100644 --- a/aegisub/src/audio_provider_convert.cpp +++ b/aegisub/src/audio_provider_convert.cpp @@ -150,7 +150,7 @@ public: void GetAudio(void *buf, int64_t start, int64_t count) const { if (count == 0) return; - bool not_end = start + count < num_samples; + int not_end = start + count < num_samples; int64_t src_count = count / 2; source->GetAudio(buf, start / 2, src_count + not_end); diff --git a/aegisub/src/audio_provider_pcm.cpp b/aegisub/src/audio_provider_pcm.cpp index ba1df2c65..83a316902 100644 --- a/aegisub/src/audio_provider_pcm.cpp +++ b/aegisub/src/audio_provider_pcm.cpp @@ -306,16 +306,8 @@ class RiffWavPCMAudioProvider : public PCMAudioProvider { // either way, as the fields can depend on the compression. }; - - /// @brief DOCME - /// @param str1[] - /// @param str2[] - /// @return - /// - static bool CheckFourcc(const char str1[], const char str2[]) + static bool CheckFourcc(const char (&str1)[4], const char (&str2)[5]) { - assert(str1); - assert(str2); return (str1[0] == str2[0]) && (str1[1] == str2[1]) && @@ -519,7 +511,7 @@ public: /// @param _filename /// Wave64AudioProvider(const wxString &_filename) - : PCMAudioProvider(_filename) + : PCMAudioProvider(_filename) { filename = _filename; diff --git a/aegisub/src/auto4_lua_assfile.cpp b/aegisub/src/auto4_lua_assfile.cpp index d1b9e6dc4..dcba38e23 100644 --- a/aegisub/src/auto4_lua_assfile.cpp +++ b/aegisub/src/auto4_lua_assfile.cpp @@ -362,8 +362,10 @@ namespace Automation4 { dia->Effect = get_string_field(L, "effect", "dialogue"); dia->Text = get_string_field(L, "text", "dialogue"); } - else + else { luaL_error(L, "Found line with unknown class: %s", lclass.utf8_str().data()); + return 0; + } if (result->group.empty()) result->group = section; diff --git a/aegisub/src/command/subtitle.cpp b/aegisub/src/command/subtitle.cpp index 35c2018f3..28ff6f82c 100644 --- a/aegisub/src/command/subtitle.cpp +++ b/aegisub/src/command/subtitle.cpp @@ -135,7 +135,7 @@ static void insert_subtitle_at_video(agi::Context *c, bool after) { // Insert it c->subsGrid->BeginBatch(); c->subsGrid->InsertLine(def, n, after); - c->subsGrid->SelectRow(n + after); + c->subsGrid->SelectRow(n + (int)after); c->subsGrid->SetActiveLine(def); c->subsGrid->EndBatch(); } diff --git a/aegisub/src/dialog_colorpicker.cpp b/aegisub/src/dialog_colorpicker.cpp index 0c44a8063..389ba87bb 100644 --- a/aegisub/src/dialog_colorpicker.cpp +++ b/aegisub/src/dialog_colorpicker.cpp @@ -1034,6 +1034,8 @@ wxBitmap *DialogColorPicker::MakeGBSpectrum() unsigned char *ospec, *spec; ospec = spec = (unsigned char *)malloc(256*256*3); + if (!spec) throw std::bad_alloc(); + for (int g = 0; g < 256; g++) { for (int b = 0; b < 256; b++) { *spec++ = cur_color.Red(); @@ -1052,6 +1054,8 @@ wxBitmap *DialogColorPicker::MakeRBSpectrum() unsigned char *ospec, *spec; ospec = spec = (unsigned char *)malloc(256*256*3); + if (!spec) throw std::bad_alloc(); + for (int r = 0; r < 256; r++) { for (int b = 0; b < 256; b++) { *spec++ = r; @@ -1070,6 +1074,8 @@ wxBitmap *DialogColorPicker::MakeRGSpectrum() unsigned char *ospec, *spec; ospec = spec = (unsigned char *)malloc(256*256*3); + if (!spec) throw std::bad_alloc(); + for (int r = 0; r < 256; r++) { for (int g = 0; g < 256; g++) { *spec++ = r; @@ -1088,6 +1094,8 @@ wxBitmap *DialogColorPicker::MakeHSSpectrum() unsigned char *ospec, *spec; ospec = spec = (unsigned char *)malloc(256*256*3); + if (!spec) throw std::bad_alloc(); + int l = hsl_input[2]->GetValue(); for (int h = 0; h < 256; h++) { @@ -1111,6 +1119,7 @@ wxBitmap *DialogColorPicker::MakeSVSpectrum() unsigned char *ospec, *spec; ospec = spec = (unsigned char *)malloc(256*256*3); + if (!spec) throw std::bad_alloc(); int h = hsv_input[0]->GetValue(); unsigned char maxr, maxg, maxb; diff --git a/aegisub/src/dialog_search_replace.cpp b/aegisub/src/dialog_search_replace.cpp index 6b40f7429..707d82e56 100644 --- a/aegisub/src/dialog_search_replace.cpp +++ b/aegisub/src/dialog_search_replace.cpp @@ -278,12 +278,11 @@ void SearchReplaceEngine::ReplaceNext(bool DoReplace) { // Normal else { - int textPos = tempPos; wxString src = Text->Mid(tempPos); if (!matchCase) src.MakeLower(); - int tempPos = src.Find(LookFor); - if (tempPos != -1) { - pos = textPos+tempPos; + int textPos = src.Find(LookFor); + if (textPos != -1) { + pos = tempPos+textPos; found = true; matchLen = LookFor.Length(); } diff --git a/aegisub/src/dialog_version_check.cpp b/aegisub/src/dialog_version_check.cpp index 0597b893b..8482de5d6 100644 --- a/aegisub/src/dialog_version_check.cpp +++ b/aegisub/src/dialog_version_check.cpp @@ -282,6 +282,8 @@ static wxString GetSystemLanguage() // Try using Win 6+ functions if available HMODULE kernel32 = LoadLibraryW(L"kernel32.dll"); + if (!kernel32) + goto getsyslang_fallback; PGetUserPreferredUILanguages gupuil = (PGetUserPreferredUILanguages)GetProcAddress(kernel32, "GetUserPreferredUILanguages"); if (gupuil) { @@ -309,7 +311,8 @@ getsyslang_fallback: res = wxString::Format("x-win%04x", langid); } - FreeModule(kernel32); + if (kernel32) + FreeModule(kernel32); return res; } diff --git a/aegisub/src/menu.cpp b/aegisub/src/menu.cpp index fe347e090..14f72d603 100644 --- a/aegisub/src/menu.cpp +++ b/aegisub/src/menu.cpp @@ -411,7 +411,7 @@ namespace menu { void GetMenuBar(std::string const& name, wxFrame *window, agi::Context *c) { menu_items const& items = get_menu(name); - CommandMenuBar *menu = new CommandMenuBar(c); + std::auto_ptr menu(new CommandMenuBar(c)); for (menu_items::const_iterator it = items.begin(); it != items.end(); ++it) { std::string submenu, disp; read_entry(*it, "submenu", &submenu); @@ -426,9 +426,9 @@ namespace menu { } } - window->SetMenuBar(menu); window->Bind(wxEVT_MENU_OPEN, &CommandManager::OnMenuOpen, &menu->cm); window->Bind(wxEVT_COMMAND_MENU_SELECTED, &CommandManager::OnMenuClick, &menu->cm); + window->SetMenuBar(menu.release()); } wxMenu *GetMenu(std::string const& name, agi::Context *c) { diff --git a/aegisub/src/mkv_wrap.cpp b/aegisub/src/mkv_wrap.cpp index f0fe30799..6d82e03b1 100644 --- a/aegisub/src/mkv_wrap.cpp +++ b/aegisub/src/mkv_wrap.cpp @@ -85,10 +85,12 @@ static void read_subtitles(agi::ProgressSink *ps, MatroskaFile *file, MkvStdIO * // Read to temp if (frameSize > readBufSize) { - delete readBuf; + delete[] readBuf; readBufSize = frameSize * 2; readBuf = new char[readBufSize]; } + else if (frameSize == 0) + continue; fseek(input->fp, filePos, SEEK_SET); fread(readBuf, 1, frameSize, input->fp); @@ -121,7 +123,7 @@ static void read_subtitles(agi::ProgressSink *ps, MatroskaFile *file, MkvStdIO * ps->SetProgress(startTime / timecodeScaleLow, totalTime); } - delete readBuf; + delete[] readBuf; // Insert into file wxString group = "[Events]"; diff --git a/aegisub/src/preferences_base.cpp b/aegisub/src/preferences_base.cpp index 000e68d7a..209458d9f 100644 --- a/aegisub/src/preferences_base.cpp +++ b/aegisub/src/preferences_base.cpp @@ -101,6 +101,7 @@ static void font_button(Preferences *parent, wxTextCtrl *name, wxSpinCtrl *size) OptionPage::OptionPage(wxTreebook *book, Preferences *parent, wxString name, int style) : wxScrolled(book, -1, wxDefaultPosition, wxDefaultSize, wxVSCROLL) +, sizer(new wxBoxSizer(wxVERTICAL)) , parent(parent) { if (style & PAGE_SUB) @@ -112,8 +113,6 @@ OptionPage::OptionPage(wxTreebook *book, Preferences *parent, wxString name, int SetScrollbars(0, 20, 0, 50); else SetScrollbars(0, 0, 0, 0); - - sizer = new wxBoxSizer(wxVERTICAL); } template diff --git a/aegisub/src/subs_edit_box.cpp b/aegisub/src/subs_edit_box.cpp index a33d4028e..8fad30ae8 100644 --- a/aegisub/src/subs_edit_box.cpp +++ b/aegisub/src/subs_edit_box.cpp @@ -742,7 +742,7 @@ void SubsEditBox::SetTag(wxString tag, wxString value, bool atEnd) { shift += 2; line->ParseASSTags(); } - else { + else if(ovr) { wxString alt; if (tag == "\\c") alt = "\\1c"; // Remove old of same @@ -769,6 +769,9 @@ void SubsEditBox::SetTag(wxString tag, wxString value, bool atEnd) { line->UpdateText(); } + else + assert(false); + TextEdit->SetTextTo(line->Text); if (!atEnd) TextEdit->SetSelectionU(selstart+shift,selend+shift); TextEdit->SetFocus(); diff --git a/aegisub/src/subs_edit_ctrl.cpp b/aegisub/src/subs_edit_ctrl.cpp index 70b1950bb..c3554a83f 100644 --- a/aegisub/src/subs_edit_ctrl.cpp +++ b/aegisub/src/subs_edit_ctrl.cpp @@ -429,16 +429,13 @@ void SubsTextEditCtrl::UpdateCallTip(wxStyledTextEvent &) { wxString text = GetText(); // Find the start and end of current tag - wxChar curChar = 0; wxChar prevChar = 0; int depth = 0; int inDepth = 0; int tagStart = -1; int tagEnd = -1; for (unsigned int i=0;igroup = "[Events]"; - line->Style = "Default"; - line->Start = fps.TimeAtFrame(f1, agi::vfr::START); - line->End = fps.TimeAtFrame(f2, agi::vfr::END); - line->Text = text; - Line->push_back(line); + AssDialogue *diag = new AssDialogue; + diag->Start = fps.TimeAtFrame(f1, agi::vfr::START); + diag->End = fps.TimeAtFrame(f2, agi::vfr::END); + diag->Text = text; + Line->push_back(diag); } } } diff --git a/aegisub/src/subtitle_format_ttxt.cpp b/aegisub/src/subtitle_format_ttxt.cpp index 40d526a96..ed224baf9 100644 --- a/aegisub/src/subtitle_format_ttxt.cpp +++ b/aegisub/src/subtitle_format_ttxt.cpp @@ -229,13 +229,15 @@ void TTXTSubtitleFormat::WriteHeader(wxXmlNode *root) { root = node; // Write font table + node = new wxXmlNode(wxXML_ELEMENT_NODE, "FontTable"); + root->AddChild(node); + wxXmlNode *subNode = new wxXmlNode(wxXML_ELEMENT_NODE, "FontTableEntry"); subNode->AddAttribute("fontName", "Sans"); subNode->AddAttribute("fontID", "1"); node->AddChild(subNode); - root->AddChild(node); - + // Write text box node = new wxXmlNode(wxXML_ELEMENT_NODE, "TextBox"); node->AddAttribute("top", "0"); @@ -255,23 +257,20 @@ void TTXTSubtitleFormat::WriteHeader(wxXmlNode *root) { void TTXTSubtitleFormat::WriteLine(wxXmlNode *root, AssDialogue *line) { // If it doesn't start at the end of previous, add blank - wxXmlNode *node, *subNode; if (prev && prev->End != line->Start) { - node = new wxXmlNode(wxXML_ELEMENT_NODE, "TextSample"); + wxXmlNode *node = new wxXmlNode(wxXML_ELEMENT_NODE, "TextSample"); node->AddAttribute("sampleTime", "0" + prev->End.GetASSFormated(true)); node->AddAttribute("xml:space", "preserve"); - subNode = new wxXmlNode(wxXML_TEXT_NODE, "", ""); - node->AddChild(subNode); root->AddChild(node); + node->AddChild(new wxXmlNode(wxXML_TEXT_NODE, "", "")); } // Generate and insert node - node = new wxXmlNode(wxXML_ELEMENT_NODE, "TextSample"); + wxXmlNode *node = new wxXmlNode(wxXML_ELEMENT_NODE, "TextSample"); node->AddAttribute("sampleTime", "0" + line->Start.GetASSFormated(true)); node->AddAttribute("xml:space", "preserve"); - subNode = new wxXmlNode(wxXML_TEXT_NODE, "", line->Text); - node->AddChild(subNode); root->AddChild(node); + node->AddChild(new wxXmlNode(wxXML_TEXT_NODE, "", line->Text)); // Set as previous prev = line; diff --git a/aegisub/src/toolbar.cpp b/aegisub/src/toolbar.cpp index 5bd31fc0e..c9484ea94 100644 --- a/aegisub/src/toolbar.cpp +++ b/aegisub/src/toolbar.cpp @@ -97,15 +97,15 @@ namespace { /// Populate the toolbar with buttons void Populate() { json::Object const& root = get_root(); - json::Object::const_iterator it = root.find(name); - if (it == root.end()) { + json::Object::const_iterator root_it = root.find(name); + if (root_it == root.end()) { // Toolbar names are all hardcoded so this should never happen throw agi::InternalError("Toolbar named " + name + " not found.", 0); } int icon_size = OPT_GET("App/Toolbar Icon Size")->GetInt(); - json::Array const& arr = it->second; + json::Array const& arr = root_it->second; commands.reserve(arr.size()); bool needs_onidle = false; diff --git a/aegisub/src/video_provider_avs.cpp b/aegisub/src/video_provider_avs.cpp index eb9776a63..b3eaf67dc 100644 --- a/aegisub/src/video_provider_avs.cpp +++ b/aegisub/src/video_provider_avs.cpp @@ -119,7 +119,7 @@ AvisynthVideoProvider::AvisynthVideoProvider(wxString filename) try } AVISTREAMINFO avis; - if (AVIStreamInfo(ppavi,&avis,sizeof(avis))) { + if (FAILED(AVIStreamInfo(ppavi,&avis,sizeof(avis)))) { warning = "Unable to read keyframes from AVI file:\nCould not get stream information."; goto stream_release; } diff --git a/aegisub/src/visual_tool.cpp b/aegisub/src/visual_tool.cpp index ea5b0df66..c46bb4eb2 100644 --- a/aegisub/src/visual_tool.cpp +++ b/aegisub/src/visual_tool.cpp @@ -490,7 +490,7 @@ void VisualToolBase::GetLineRotation(AssDialogue *diag, float &rx, float &ry, fl ry = tag->front()->Get(ry); if (param_vec tag = find_tag(diag, "\\frz")) rz = tag->front()->Get(rz); - else if (param_vec tag = find_tag(diag, "\\fr")) + else if (tag = find_tag(diag, "\\fr")) rz = tag->front()->Get(rz); }