diff --git a/src/associatedialog.cpp b/src/associatedialog.cpp index 0d19ddf..30959d4 100644 --- a/src/associatedialog.cpp +++ b/src/associatedialog.cpp @@ -114,26 +114,25 @@ void AssociateDialog::OnOk ( wxCommandEvent& e ) void AssociateDialog::OnContextHelp ( wxHelpEvent& e ) { - wxTipWindow *tw; int id = e.GetId(); if ( id == ID_URL ) - tw = new wxTipWindow ( + new wxTipWindow ( this, _ ( "Provides a space for you to type the path of the file" ) ); else if ( id == ID_BROWSE ) - tw = new wxTipWindow ( + new wxTipWindow ( this, _ ( "Opens a standard file dialog" ) ); else if ( id == ID_AUX ) - tw = new wxTipWindow ( + new wxTipWindow ( this, _ ( "Provides a space for you to type additional information" ) ); else if ( id == wxID_CANCEL ) - tw = new wxTipWindow ( + new wxTipWindow ( this, _ ( "Closes this dialog without making any changes" ) ); else if ( id == wxID_OK ) - tw = new wxTipWindow ( + new wxTipWindow ( this, _ ( "Selects the file specified" ) ); else diff --git a/src/contexthandler.cpp b/src/contexthandler.cpp index 2c7eee6..59976a3 100644 --- a/src/contexthandler.cpp +++ b/src/contexthandler.cpp @@ -21,12 +21,12 @@ #include "contexthandler.h" ContextMatch ContextHandler::getContext ( - char *s, + const char *s, int len, - char *origin, + const char *origin, int context ) { - char *t, *u; + const char *t, *u; int maxrange = context * 20; int range = context + 1, i = 0; diff --git a/src/contexthandler.h b/src/contexthandler.h index f2b88d8..7522278 100644 --- a/src/contexthandler.h +++ b/src/contexthandler.h @@ -41,9 +41,9 @@ class ContextHandler { public: static ContextMatch getContext ( - char *s, + const char *s, int len, - char *origin, + const char *origin, int context ); }; diff --git a/src/exportdialog.cpp b/src/exportdialog.cpp index 29c23b0..045ca10 100644 --- a/src/exportdialog.cpp +++ b/src/exportdialog.cpp @@ -156,7 +156,6 @@ ExportDialog::~ExportDialog() void ExportDialog::OnOk ( wxCommandEvent& e ) { - std::string urlUtf8, urlParamsUtf8; #ifdef __WXMSW__ url = urlCtrl->GetTextCtrlValue(); #else @@ -171,30 +170,27 @@ void ExportDialog::OnOk ( wxCommandEvent& e ) rtf = rtfCheckbox->IsChecked(); doc = docCheckbox->IsChecked(); fullDaisy = fullDaisyCheckbox->IsChecked(); - urlUtf8 = ( const char * ) url.mb_str ( wxConvUTF8 ); e.Skip(); } void ExportDialog::OnContextHelp ( wxHelpEvent& e ) { - wxTipWindow *tw; - int id = e.GetId(); if ( id == ID_URL ) - tw = new wxTipWindow ( + new wxTipWindow ( this, _ ( "Provides a space for you to enter or select a stylesheet for conversion to canonical XHTML" ) ); if ( id == ID_FOLDER ) - tw = new wxTipWindow ( + new wxTipWindow ( this, _ ( "Provides a space for you to enter or select the output folder" ) ); else if ( id == wxID_OK ) - tw = new wxTipWindow ( + new wxTipWindow ( this, _ ( "Starts the export" ) ); else if ( id == wxID_CANCEL ) - tw = new wxTipWindow ( + new wxTipWindow ( this, _ ( "Closes the dialog box without exporting the file" ) ); else diff --git a/src/exportdialog.h b/src/exportdialog.h index f6adc45..e0399ca 100644 --- a/src/exportdialog.h +++ b/src/exportdialog.h @@ -71,7 +71,6 @@ class ExportDialog : public wxDialog }; private: - wxStaticText *urlLabel, *folderLabel; wxString url, folder; wxCheckBox *quietCheckbox, *suppressOptionalCheckbox, diff --git a/src/globalreplacedialog.cpp b/src/globalreplacedialog.cpp index c518620..db3dfef 100644 --- a/src/globalreplacedialog.cpp +++ b/src/globalreplacedialog.cpp @@ -138,35 +138,33 @@ void GlobalReplaceDialog::OnOk ( wxCommandEvent& e ) void GlobalReplaceDialog::OnContextHelp ( wxHelpEvent& e ) { - wxTipWindow *tw; - int id = e.GetId(); if ( id == ID_FIND ) - tw = new wxTipWindow ( + new wxTipWindow ( this, _ ( "Provides a space for you to type the text you want to find" ) ); else if ( id == ID_REPLACE ) - tw = new wxTipWindow ( + new wxTipWindow ( this, _ ( "Provides a space for you to type the text you want to replace the text you typed in Find what" ) ); else if ( id == ID_MATCHCASE ) - tw = new wxTipWindow ( + new wxTipWindow ( this, _ ( "Finds only text with lowercase and uppercase letters as specified in Find what" ) ); else if ( id == ID_ALLDOCUMENTS ) - tw = new wxTipWindow ( + new wxTipWindow ( this, _ ( "Extends the scope to all open documents" ) ); else if ( id == ID_REGEX ) - tw = new wxTipWindow ( + new wxTipWindow ( this, _ ( "Interprets the text specified in Find what as a regular expression" ) ); else if ( id == wxID_OK ) - tw = new wxTipWindow ( + new wxTipWindow ( this, _ ( "Finds all instances of the text specified in Find what and replaces them with the text in Replace with" ) ); else if ( id == wxID_CANCEL ) - tw = new wxTipWindow ( + new wxTipWindow ( this, _ ( "Closes the dialog box without saving any changes you have made" ) ); else diff --git a/src/globalreplacedialog.h b/src/globalreplacedialog.h index b52cf04..7419785 100644 --- a/src/globalreplacedialog.h +++ b/src/globalreplacedialog.h @@ -53,7 +53,6 @@ class GlobalReplaceDialog : public wxDialog private: wxTextCtrl *findCtrl, *replaceCtrl; - wxStaticText *findLabel, *replaceLabel; wxCheckBox *matchCaseBox, *allDocumentsBox, *regexBox; wxString find, replace; bool matchCase, allDocuments, regex; diff --git a/src/locationpanel.cpp b/src/locationpanel.cpp index 5fcbbb1..2c783e7 100644 --- a/src/locationpanel.cpp +++ b/src/locationpanel.cpp @@ -67,10 +67,9 @@ LocationPanel::LocationPanel ( wxWindow *parentWindowParameter, int id ) : } void LocationPanel::update ( - XmlDoc *docParameter, + XmlDoc *doc, const wxString& parentParameter ) { - doc = docParameter; parent = parentParameter; wxString previous = edit->GetValue(); diff --git a/src/locationpanel.h b/src/locationpanel.h index f1f5d31..6155cb6 100644 --- a/src/locationpanel.h +++ b/src/locationpanel.h @@ -36,7 +36,6 @@ class LocationPanel : public wxPanel private: void indentStructure ( wxString& structure ); MyFrame *parentWindow; - XmlDoc *doc; wxBoxSizer *sizer; wxTextCtrl *edit; wxStyledTextCtrl *structureEdit; diff --git a/src/mp3album.cpp b/src/mp3album.cpp index bdf339b..50cbda5 100644 --- a/src/mp3album.cpp +++ b/src/mp3album.cpp @@ -47,7 +47,6 @@ void XMLCALL Mp3Album::start ( void *data, Mp3AlbumData *ad; ad = ( Mp3AlbumData * ) data; - std::string value; char noArray[5]; int currentNo; diff --git a/src/mypropertysheet.cpp b/src/mypropertysheet.cpp index 1ea032b..3693bf1 100644 --- a/src/mypropertysheet.cpp +++ b/src/mypropertysheet.cpp @@ -32,15 +32,15 @@ MyPropertySheet::MyPropertySheet ( wxWindow *parent, XmlCtrlProperties& propertiesParameter, wxString& applicationDirParameter, - bool rememberOpenTabsParameter, - bool libxmlNetAccessParameter, - bool singleInstanceCheckParameter, - bool saveBomParameter, - bool unlimitedUndoParameter, - bool restoreLayoutParameter, - bool expandInternalEntitiesParameter, - bool showFullPathOnFrameParameter, - int lang, + bool &rememberOpenTabsParameter, + bool &libxmlNetAccessParameter, + bool &singleInstanceCheckParameter, + bool &saveBomParameter, + bool &unlimitedUndoParameter, + bool &restoreLayoutParameter, + bool &expandInternalEntitiesParameter, + bool &showFullPathOnFrameParameter, + int &lang, const std::set &translations, wxWindowID id, wxString title, @@ -51,6 +51,15 @@ MyPropertySheet::MyPropertySheet ( : wxPropertySheetDialog ( parent, id, title, position, size, style ) , properties ( propertiesParameter ) , applicationDir ( applicationDirParameter ) + , rememberOpenTabs ( rememberOpenTabsParameter ) + , libxmlNetAccess ( libxmlNetAccessParameter ) + , singleInstanceCheck ( singleInstanceCheckParameter ) + , saveBom ( saveBomParameter ) + , unlimitedUndo ( unlimitedUndoParameter ) + , restoreLayout ( restoreLayoutParameter ) + , expandInternalEntities ( expandInternalEntitiesParameter ) + , showFullPathOnFrame ( showFullPathOnFrameParameter ) + , lang ( lang ) { CreateButtons ( wxOK | wxCANCEL ); @@ -241,6 +250,15 @@ MyPropertySheet::~MyPropertySheet() void MyPropertySheet::OnOk ( wxCommandEvent& e ) { + wxString testDir = applicationDirEdit->GetValue(); + if ( !wxFileName::DirExists ( testDir ) ) + { + wxMessageBox ( _ ( "Cannot access application directory" ), _ ( "Options" ) ); + // tbd: show general tab + return; + } + applicationDir = testDir; + properties.completion = completionBox->GetValue(); properties.fold = foldBox->GetValue(); properties.number = numberBox->GetValue(); @@ -255,16 +273,6 @@ void MyPropertySheet::OnOk ( wxCommandEvent& e ) properties.font = fontBox->GetStringSelection(); properties.highlightSyntax = highlightSyntaxBox->GetValue(); - wxString testDir = applicationDirEdit->GetValue(); - if ( !wxFileName::DirExists ( testDir ) ) - { - wxMessageBox ( _ ( "Cannot access application directory" ), _ ( "Options" ) ); - // tbd: show general tab - return; - } - else - applicationDir = testDir; - singleInstanceCheck = singleInstanceCheckBox->GetValue(); restoreLayout = restoreLayoutBox->GetValue(); rememberOpenTabs = rememberOpenTabsBox->GetValue(); @@ -276,7 +284,7 @@ void MyPropertySheet::OnOk ( wxCommandEvent& e ) int languageChoice = languageBox->GetSelection(); if ( languageChoice != wxNOT_FOUND ) - lang = (wxIntPtr)languageBox->GetClientData(languageChoice); + lang = ( wxIntPtr ) languageBox->GetClientData ( languageChoice ); else lang = wxLANGUAGE_DEFAULT; @@ -289,58 +297,3 @@ void MyPropertySheet::OnApplicationDirBrowse ( wxCommandEvent& e ) if ( browseDialog->ShowModal() == wxID_OK ) applicationDirEdit->SetValue ( browseDialog->GetPath() ); } - -XmlCtrlProperties MyPropertySheet::getProperties() -{ - return properties; -} - -wxString MyPropertySheet::getApplicationDir() -{ - return applicationDir; -} - -bool MyPropertySheet::getSingleInstanceCheck() -{ - return singleInstanceCheck; -} - -bool MyPropertySheet::getRememberOpenTabs() -{ - return rememberOpenTabs; -} - -bool MyPropertySheet::getLibxmlNetAccess() -{ - return libxmlNetAccess; -} - -bool MyPropertySheet::getSaveBom() -{ - return saveBom; -} - -bool MyPropertySheet::getUnlimitedUndo() -{ - return unlimitedUndo; -} - -int MyPropertySheet::getLang() -{ - return lang; -} - -bool MyPropertySheet::getRestoreLayout() -{ - return restoreLayout; -} - -bool MyPropertySheet::getExpandInternalEntities() -{ - return expandInternalEntities; -} - -bool MyPropertySheet::getShowFullPathOnFrame() -{ - return showFullPathOnFrame; -} diff --git a/src/mypropertysheet.h b/src/mypropertysheet.h index 3b5dc94..6042219 100644 --- a/src/mypropertysheet.h +++ b/src/mypropertysheet.h @@ -38,15 +38,15 @@ class MyPropertySheet : public wxPropertySheetDialog wxWindow *parent, XmlCtrlProperties& propertiesParameter, wxString& applicationDirParameter, - bool rememberOpenTabsParameter, - bool libxmlNetAccess, - bool singleInstanceCheck, - bool saveBom, - bool unlimitedUndo, - bool restoreLayout, - bool expandInternalEntities, - bool showFullPathOnFrame, - int lang, + bool &rememberOpenTabsParameter, + bool &libxmlNetAccess, + bool &singleInstanceCheck, + bool &saveBom, + bool &unlimitedUndo, + bool &restoreLayout, + bool &expandInternalEntities, + bool &showFullPathOnFrame, + int &lang, const std::set &translations, wxWindowID id = wxID_ANY, wxString title = _T ( "" ), @@ -56,19 +56,8 @@ class MyPropertySheet : public wxPropertySheetDialog ~MyPropertySheet(); void OnOk ( wxCommandEvent& e ); void OnApplicationDirBrowse ( wxCommandEvent& e ); - XmlCtrlProperties getProperties(); - wxString getApplicationDir(); - bool getSingleInstanceCheck(); - bool getRememberOpenTabs(); - bool getLibxmlNetAccess(); - bool getSaveBom(); - bool getUnlimitedUndo(); - bool getRestoreLayout(); - bool getExpandInternalEntities(); - bool getShowFullPathOnFrame(); - int getLang(); private: - int lang; + int ⟨ wxCheckBox *completionBox, *currentLineBox, *foldBox, @@ -91,17 +80,17 @@ class MyPropertySheet : public wxPropertySheetDialog *insertCloseTagBox; wxChoice *languageBox, *fontBox; wxTextCtrl *applicationDirEdit; - XmlCtrlProperties properties; - wxString applicationDir; - bool singleInstanceCheck, - rememberOpenTabs, - libxmlNetAccess, - saveBom, - unlimitedUndo, - restoreLayout, - expandInternalEntities, - showFullPathOnFrame, - insertCloseTag; + XmlCtrlProperties &properties; + wxString &applicationDir; + bool &singleInstanceCheck, + &rememberOpenTabs, + &libxmlNetAccess, + &saveBom, + &unlimitedUndo, + &restoreLayout, + &expandInternalEntities, + &showFullPathOnFrame; + DECLARE_EVENT_TABLE() }; diff --git a/src/parserdata.h b/src/parserdata.h index 01e9c48..9bbd26f 100644 --- a/src/parserdata.h +++ b/src/parserdata.h @@ -28,6 +28,7 @@ class ParserData public: ParserData() { + state = 0; count = 0; } ~ParserData() diff --git a/src/rule.cpp b/src/rule.cpp index c20cb0c..a23c430 100644 --- a/src/rule.cpp +++ b/src/rule.cpp @@ -31,7 +31,9 @@ Rule::Rule ( matchCase, replace, arrayLength ) -{ } +{ + adjustCaseAttribute = tentativeAttribute = false; +} bool Rule::getAdjustCaseAttribute() { diff --git a/src/stringset.h b/src/stringset.h index b2fe2ae..9c18745 100644 --- a/src/stringset.h +++ b/src/stringset.h @@ -30,9 +30,10 @@ #ifdef __WXMSW__ #include #endif +#include template -class StringSetNode +class StringSetNode : private boost::noncopyable { public: StringSetNode ( T *keyParameter, size_t lenParameter ) diff --git a/src/styledialog.cpp b/src/styledialog.cpp index 0cf6343..e09aab4 100644 --- a/src/styledialog.cpp +++ b/src/styledialog.cpp @@ -103,6 +103,7 @@ StyleDialog::StyleDialog ( position, size, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX ), + indexForContextMenu ( -1 ), bufferUtf8 ( bufferParameterUtf8 ), #if !defined(USE_ENCHANT) && defined(__WXMSW__) aspellDataPath ( aspellDataPathParameter ), diff --git a/src/wraplibxml.cpp b/src/wraplibxml.cpp index e3d32b6..80cddb1 100644 --- a/src/wraplibxml.cpp +++ b/src/wraplibxml.cpp @@ -96,6 +96,7 @@ void WrapLibxml::Init ( const wxString &catalogPath ) throw() WrapLibxml::WrapLibxml ( bool netAccessParameter ) : netAccess ( netAccessParameter ) + , errorLine ( 0 ) { WrapLibxml::Init(); } @@ -117,19 +118,13 @@ bool WrapLibxml::validate ( const std::string& fileName ) return false; } - bool returnValue = false; - docPtr = xmlCtxtReadFile ( ctxt, fileName.c_str(), NULL, ( netAccess ) ? XML_PARSE_DTDVALID : XML_PARSE_DTDVALID | XML_PARSE_NONET ); - if ( docPtr == NULL ) - ; - else if ( ctxt->valid == 0 ) - ; - else - returnValue = true; + + bool returnValue = docPtr != NULL && ctxt->valid != 0; xmlFreeDoc ( docPtr ); xmlFreeParserCtxt ( ctxt ); diff --git a/src/wrapregex.cpp b/src/wrapregex.cpp index 9db8403..a19b80f 100644 --- a/src/wrapregex.cpp +++ b/src/wrapregex.cpp @@ -33,11 +33,15 @@ WrapRegex::WrapRegex ( const string& replaceParameter, const int arrayLengthParameter ) : replace ( replaceParameter ), - arrayLength ( arrayLengthParameter ) + arrayLength ( arrayLengthParameter ), + returnValue ( 0 ) { if ( pattern.empty() || pattern == ".*" ) { disabled = true; + matchArray = NULL; + patternStructure = NULL; + patternExtraStructure = NULL; return; } disabled = false; @@ -67,16 +71,9 @@ WrapRegex::~WrapRegex() if ( disabled ) return; - try - { - pcre_free ( patternStructure ); - pcre_free ( patternExtraStructure ); - delete[] matchArray; - } - catch ( ... ) - { - throw runtime_error ( "Wrapregex::~WrapRegex" ); - } + pcre_free ( patternStructure ); + pcre_free ( patternExtraStructure ); + delete[] matchArray; } int WrapRegex::matchPatternGlobal ( @@ -105,7 +102,7 @@ string WrapRegex::replaceGlobal ( if ( disabled ) return buffer; - char *s = ( char * ) buffer.c_str(); + const char *s = buffer.c_str(); string output, match; @@ -143,12 +140,12 @@ int WrapRegex::matchPatternGlobal_ ( if ( disabled ) return 0; - char *s, *origin; + const char *s, *origin; int matchcount; size_t offset; ContextMatch match; - s = origin = ( char * ) buffer; + s = origin = buffer; matchcount = 0; offset = 0; @@ -193,13 +190,12 @@ int WrapRegex::matchPatternGlobal_ ( return matchcount; } -string WrapRegex::getInterpolatedString_ ( char *buffer, char *source ) +string WrapRegex::getInterpolatedString_ ( const char *buffer, const char *source ) { if ( disabled ) return ""; - char *s, *origin; - s = origin = ( char * ) source; + const char *s = source; string interpol_string; @@ -213,7 +209,7 @@ string WrapRegex::getInterpolatedString_ ( char *buffer, char *source ) { if ( isdigit ( * ( s + 1 ) ) ) { - char *number, *it; + const char *number, *it; number = s + 1; for ( it = number; *it && isdigit ( * ( it + 1 ) ); ++it ) ; @@ -253,7 +249,7 @@ string WrapRegex::getInterpolatedString_ ( char *buffer, char *source ) return interpol_string; } -string WrapRegex::getSubpattern_ ( char *s, unsigned subpattern ) +string WrapRegex::getSubpattern_ ( const char *s, unsigned subpattern ) { if ( disabled ) return ""; @@ -263,6 +259,6 @@ string WrapRegex::getSubpattern_ ( char *s, unsigned subpattern ) if ( ret == PCRE_ERROR_NOSUBSTRING || ret == PCRE_ERROR_NOMEMORY ) return ""; string subString ( sub ); - pcre_free ( ( char * ) sub ); + pcre_free_substring ( sub ); return subString; } diff --git a/src/wrapregex.h b/src/wrapregex.h index d7d4d64..3b5483b 100644 --- a/src/wrapregex.h +++ b/src/wrapregex.h @@ -24,11 +24,12 @@ #include #include #include +#include #include "contexthandler.h" using namespace std; -class WrapRegex +class WrapRegex : private boost::noncopyable { public: WrapRegex ( @@ -55,8 +56,9 @@ class WrapRegex pcre_extra *patternExtraStructure; int *matchArray; - string getInterpolatedString_ ( char *buffer, char *source ); - string getSubpattern_ ( char *buffer, unsigned subpattern ); + string getInterpolatedString_ ( const char *buffer, + const char *source ); + string getSubpattern_ ( const char *buffer, unsigned subpattern ); int matchPatternGlobal_ ( const char *buffer, size_t buflen, diff --git a/src/wrapxerces.h b/src/wrapxerces.h index aa0752a..db55c15 100644 --- a/src/wrapxerces.h +++ b/src/wrapxerces.h @@ -25,6 +25,7 @@ #include #include #include +#include #if !wxCHECK_GCC_VERSION(4,7) #define XERCES_TMPLSINC @@ -36,7 +37,7 @@ using namespace xercesc; -class WrapXerces +class WrapXerces : private boost::noncopyable { public: static void Init() throw (); diff --git a/src/xmlassociatexsd.cpp b/src/xmlassociatexsd.cpp index 8436c8c..782d419 100644 --- a/src/xmlassociatexsd.cpp +++ b/src/xmlassociatexsd.cpp @@ -104,7 +104,7 @@ void XMLCALL XmlAssociateXsd::start ( void *data, !strcmp ( *attr, "xmlns" ) || !strcmp ( *attr, "xsi:noNamespaceSchemaLocation" ) || !strcmp ( *attr, "xsi:schemaLocation" ) ) - ; + {} else { d->buffer += " "; diff --git a/src/xmlcopyeditor.cpp b/src/xmlcopyeditor.cpp index 8c80bc1..cd6a6b0 100644 --- a/src/xmlcopyeditor.cpp +++ b/src/xmlcopyeditor.cpp @@ -388,7 +388,7 @@ bool MyApp::OnInit() getAvailableTranslations ( &prefixes, &catalog ); if ( !myLocale.AddCatalog ( catalog ) ) - ; + {} #ifndef __WXMSW__ { @@ -862,7 +862,6 @@ MyFrame::MyFrame ( commandString = wxEmptyString; exportStylesheet = exportFolder = wxEmptyString; - exportQuiet = exportMp3Album = false; exportQuiet = exportMp3Album = exportSuppressOptional = exportHtml = exportEpub = exportRtf = exportDoc = exportFullDaisy = true; @@ -894,7 +893,6 @@ MyFrame::MyFrame ( largeFileProperties.indentLines = false; largeFileProperties.protectHiddenElements = false; largeFileProperties.toggleLineBackground = false; - largeFileProperties.toggleLineBackground = false; largeFileProperties.insertCloseTag = false; largeFileProperties.deleteWholeTag = false; largeFileProperties.highlightSyntax = false; @@ -1437,7 +1435,8 @@ void MyFrame::OnPageClosing ( wxAuiNotebookEvent& event ) //wxNotebookEvent& eve { int selection; wxString fileName; - if ( ( selection = mainBook->GetSelection() ) != -1 ) + selection = mainBook->GetSelection(); + if ( selection != -1 ) fileName = doc->getShortFileName(); int answer = wxMessageBox ( @@ -1962,10 +1961,9 @@ void MyFrame::OnDialogReplace ( wxFindDialogEvent& event ) if ( !doc->GetSelectedText().IsEmpty() ) { - int regexWidth = 0; if ( findReplacePanel->getRegex() ) { - regexWidth = doc->ReplaceTargetRE ( event.GetReplaceString() ); + doc->ReplaceTargetRE ( event.GetReplaceString() ); } else { @@ -2049,7 +2047,7 @@ void MyFrame::OnPrintPreview ( wxCommandEvent &WXUNUSED ( event ) ) wxString htmlBuffer = getHtmlBuffer(); statusProgress ( wxEmptyString ); if ( ! ( htmlPrinting->PreviewText ( htmlBuffer ) ) ) - ; + {} } void MyFrame::OnPrint ( wxCommandEvent &WXUNUSED ( event ) ) @@ -2070,7 +2068,7 @@ void MyFrame::OnPrint ( wxCommandEvent &WXUNUSED ( event ) ) wxString htmlBuffer = getHtmlBuffer(); statusProgress ( wxEmptyString ); if ( ! ( htmlPrinting->PrintText ( htmlBuffer ) ) ) - ; + {} } wxString MyFrame::getHtmlBuffer() @@ -2632,18 +2630,7 @@ void MyFrame::OnOptions ( wxCommandEvent& WXUNUSED ( event ) ) title ) ); if ( mpsd->ShowModal() == wxID_OK ) { - properties = mpsd->getProperties(); applyEditorProperties(); - applicationDir = mpsd->getApplicationDir(); - rememberOpenTabs = mpsd->getRememberOpenTabs(); - libxmlNetAccess = mpsd->getLibxmlNetAccess(); - singleInstanceCheck = mpsd->getSingleInstanceCheck(); - saveBom = mpsd->getSaveBom(); - unlimitedUndo = mpsd->getUnlimitedUndo(); - restoreLayout = mpsd->getRestoreLayout(); - expandInternalEntities = mpsd->getExpandInternalEntities(); - showFullPathOnFrame = mpsd->getShowFullPathOnFrame(); - lang = mpsd->getLang(); updatePaths(); } if ( doc ) @@ -2734,8 +2721,7 @@ void MyFrame::OnFindReplace ( wxCommandEvent& WXUNUSED ( event ) ) void MyFrame::OnGlobalReplace ( wxCommandEvent& event ) { - XmlDoc *doc; - if ( ( doc = getActiveDocument() ) == NULL ) + if ( getActiveDocument() == NULL ) return; size_t flags = findData.GetFlags(); @@ -3052,7 +3038,6 @@ bool MyFrame::openFile ( wxString& fileName, bool largeFile ) } wxString wideError; - std::string buffer; pair posPair; XmlDoc *doc; @@ -3363,7 +3348,7 @@ bool MyFrame::openFile ( wxString& fileName, bool largeFile ) std::string MyFrame::getApproximateEncoding ( char *docBuffer, size_t docBufferLen ) { - std::string line, encoding; + std::string line; char *it; size_t i; @@ -3573,7 +3558,7 @@ void MyFrame::save() } if ( !saveFile ( doc, fileName, true ) ) - ; // handle messages in saveFile + {} // handle messages in saveFile } void MyFrame::OnReload ( wxCommandEvent& event ) @@ -3679,13 +3664,7 @@ void MyFrame::OnUpdateReload ( wxUpdateUIEvent& event ) void MyFrame::OnUpdateCutCopy ( wxUpdateUIEvent& event ) { - XmlDoc *doc; - if ( ( doc = getActiveDocument() ) == NULL ) - { - event.Enable ( false ); - return; - } - event.Enable ( true ); + event.Enable ( getActiveDocument() != NULL ); } void MyFrame::OnUpdateLocationPaneVisible ( wxUpdateUIEvent& event ) @@ -3704,30 +3683,17 @@ void MyFrame::OnUpdateSavedOnly ( wxUpdateUIEvent& event ) event.Enable ( false ); return; } - event.Enable ( - ( doc->getFullFileName().empty() ) ? false : true ); + event.Enable ( !doc->getFullFileName().empty() ); } void MyFrame::OnUpdateDocRange ( wxUpdateUIEvent& event ) { - XmlDoc *doc; - if ( ( doc = getActiveDocument() ) == NULL ) - { - event.Enable ( false ); - return; - } - event.Enable ( true ); + event.Enable ( getActiveDocument() != NULL ); } void MyFrame::OnUpdateReplaceRange ( wxUpdateUIEvent& event ) { - XmlDoc *doc; - if ( ( doc = getActiveDocument() ) == NULL ) // || protectTags) - { - event.Enable ( false ); - return; - } - event.Enable ( true ); + event.Enable ( getActiveDocument() != NULL ); } void MyFrame::OnUpdateFindAgain ( wxUpdateUIEvent& event ) @@ -3768,13 +3734,7 @@ void MyFrame::OnUpdateRedo ( wxUpdateUIEvent& event ) void MyFrame::OnUpdatePaste ( wxUpdateUIEvent& event ) { - XmlDoc *doc; - if ( ( doc = getActiveDocument() ) == NULL ) - { - event.Enable ( false ); - return; - } - event.Enable ( true ); + event.Enable ( getActiveDocument() != NULL ); } void MyFrame::OnUpdatePreviousDocument ( wxUpdateUIEvent& event ) @@ -3992,7 +3952,7 @@ void MyFrame::OnValidateSchema ( wxCommandEvent& event ) // XMLCatalogResolver #ifdef __WXMSW__ { - std::string rawBuffer, schemaLocation; + std::string rawBuffer; getRawText ( doc, rawBuffer ); if ( !XmlEncodingHandler::setUtf8 ( rawBuffer ) ) { @@ -4010,7 +3970,6 @@ void MyFrame::OnValidateSchema ( wxCommandEvent& event ) #endif wxString fileName; - std::string tempFileNameLocal; fileName = doc->getFullFileName(); WrapTempFileName wtfn ( fileName ); diff --git a/src/xmlctrl.cpp b/src/xmlctrl.cpp index 1e69de5..f83d743 100644 --- a/src/xmlctrl.cpp +++ b/src/xmlctrl.cpp @@ -1291,13 +1291,11 @@ bool XmlCtrl::canMoveLeftAt ( int pos ) void XmlCtrl::adjustPosRight() { int pos, max; - bool canInsert = false; pos = GetCurrentPos(); max = GetLength(); for ( ; pos <= max; pos++ ) if ( canInsertAt ( pos ) ) { - canInsert = true; break; } SetSelection ( pos, pos ); @@ -1306,7 +1304,6 @@ void XmlCtrl::adjustPosRight() void XmlCtrl::adjustPosLeft() { int pos; - bool canInsert = false; pos = GetCurrentPos() - 1; if ( pos < 0 ) { @@ -1316,7 +1313,6 @@ void XmlCtrl::adjustPosLeft() for ( ; pos > 0; pos-- ) if ( canInsertAt ( pos ) ) { - canInsert = true; break; } SetSelection ( pos, pos ); diff --git a/src/xmlpromptgenerator.cpp b/src/xmlpromptgenerator.cpp index 1fab3d1..1820cff 100644 --- a/src/xmlpromptgenerator.cpp +++ b/src/xmlpromptgenerator.cpp @@ -165,8 +165,8 @@ void XMLCALL XmlPromptGenerator::doctypedeclstarthandler ( const XML_Char *pubid, int has_internal_subset ) { - PromptGeneratorData *d; - d = ( PromptGeneratorData * ) data; + //PromptGeneratorData *d; + //d = ( PromptGeneratorData * ) data; } void XMLCALL XmlPromptGenerator::doctypedeclendhandler ( void *data ) diff --git a/src/xmlrulereader.cpp b/src/xmlrulereader.cpp index 4949656..b37a0d5 100644 --- a/src/xmlrulereader.cpp +++ b/src/xmlrulereader.cpp @@ -35,6 +35,7 @@ RuleData::RuleData ( passiveDictionary ( passiveDictionaryParameter ), ruleVector ( ruleVectorParameter ) { + cipher = false; dictionaryFound = false; initialiseAttributes(); ruleCount = 0; diff --git a/src/xmlschemagenerator.cpp b/src/xmlschemagenerator.cpp index 80f3bb4..e493565 100644 --- a/src/xmlschemagenerator.cpp +++ b/src/xmlschemagenerator.cpp @@ -252,7 +252,7 @@ void XmlSchemaGenerator::generateSchema ( ElmtData &data, size_t nIndent ) { wxString &schema = data.schema; - if ( data.children.size() == 0 && data.attrMap.size() == 0 ) + if ( data.children.empty() && data.attrMap.empty() ) { if ( !mInlineSimpleType ) { @@ -267,7 +267,7 @@ void XmlSchemaGenerator::generateSchema ( ElmtData &data, size_t nIndent ) addIndent ( schema, nIndent++ ); schema << _T("") << getEOL(); - if ( data.children.size() > 0 ) + if ( !data.children.empty() ) { addIndent ( schema, nIndent++ ); schema << _T("") << getEOL(); @@ -305,8 +305,8 @@ void XmlSchemaGenerator::generateSchema ( ElmtData &data, size_t nIndent ) if ( mInlineSimpleType ) { // Check if it's a simple type const ElmtData *childElmt = &mElements[*seqItr]; - if ( childElmt->children.size() == 0 - && childElmt->attrMap.size() == 0 ) + if ( childElmt->children.empty() + && childElmt->attrMap.empty() ) { schema << _T("") << getEOL(); @@ -338,7 +338,7 @@ void XmlSchemaGenerator::generateSchema ( ElmtData &data, size_t nIndent ) schema << _T("") << getEOL(); } } - else if ( data.attrMap.size() != 0 ) + else if ( !data.attrMap.empty() ) { addIndent ( schema, nIndent++ ); schema << _T("") << getEOL(); diff --git a/src/xmlshallowvalidator.h b/src/xmlshallowvalidator.h index 57fb252..b126768 100644 --- a/src/xmlshallowvalidator.h +++ b/src/xmlshallowvalidator.h @@ -32,7 +32,12 @@ struct XmlShallowValidatorData : public ParserData { XmlShallowValidatorData() - {} + { + isValid = segmentOnly = false; + depth = maxLine = 0; + p = 0; + overrideFailure = false; + } std::map > elementMap; std::map > > attributeMap;