]> git.saurik.com Git - wxWidgets.git/blobdiff - src/html/htmlpars.cpp
Replace deprecated wxNB_* flags with wxBK_* used in last commit.
[wxWidgets.git] / src / html / htmlpars.cpp
index 1cd58d06f6059a7750165a4c4eec47580fa7236d..d6b6ab4c3230b96678f2e3c588c9405e6bc5c450 100644 (file)
@@ -7,11 +7,6 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "htmlpars.h"
-#endif
-
 #include "wx/wxprec.h"
 
 #include "wx/defs.h"
@@ -57,7 +52,7 @@ public:
 };
 
 WX_DECLARE_OBJARRAY(wxHtmlTextPiece, wxHtmlTextPieces);
-WX_DEFINE_OBJARRAY(wxHtmlTextPieces);
+WX_DEFINE_OBJARRAY(wxHtmlTextPieces)
 
 class wxHtmlParserState
 {
@@ -309,14 +304,10 @@ void wxHtmlParser::DoParsing(int begin_pos, int end_pos)
         }
         else if (m_CurTag)
         {
-            // Add tag:
-            if (m_CurTag)
-            {
-                if (m_CurTag->HasEnding())
-                    begin_pos = m_CurTag->GetEndPos2();
-                else
-                    begin_pos = m_CurTag->GetBeginPos();
-            }
+            if (m_CurTag->HasEnding())
+                begin_pos = m_CurTag->GetEndPos2();
+            else
+                begin_pos = m_CurTag->GetBeginPos();
             wxHtmlTag *t = m_CurTag;
             m_CurTag = m_CurTag->GetNextTag();
             AddTag(*t);
@@ -360,7 +351,7 @@ void wxHtmlParser::AddTagHandler(wxHtmlTagHandler *handler)
     handler->SetParser(this);
 }
 
-void wxHtmlParser::PushTagHandler(wxHtmlTagHandler *handler, wxString tags)
+void wxHtmlParser::PushTagHandler(wxHtmlTagHandler *handler, const wxString& tags)
 {
     wxStringTokenizer tokenizer(tags, wxT(", "));
     wxString key;
@@ -922,9 +913,13 @@ bool wxMetaTagHandler::HandleTag(const wxHtmlTag& tag)
 wxString wxHtmlParser::ExtractCharsetInformation(const wxString& markup)
 {
     wxString charset;
-    wxMetaTagParser parser;
-    parser.AddTagHandler(new wxMetaTagHandler(&charset));
-    parser.Parse(markup);
+    wxMetaTagParser *parser = new wxMetaTagParser();
+    if(parser)
+    {
+        parser->AddTagHandler(new wxMetaTagHandler(&charset));
+        parser->Parse(markup);
+        delete parser;
+    }
     return charset;
 }