X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5526e819eca4465ed5520d49bccfebc6a28045e0..f7a11f8c8e665992e2d1956b2b89d2f562c92669:/src/html/search.cpp?ds=inline diff --git a/src/html/search.cpp b/src/html/search.cpp index aab3906fd5..1c6e8c77fa 100644 --- a/src/html/search.cpp +++ b/src/html/search.cpp @@ -2,6 +2,7 @@ // Name: search.cpp // Purpose: search engine // Author: Vaclav Slavik +// RCS-ID: $Id$ // Copyright: (c) 1999 Vaclav Slavik // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -25,7 +26,7 @@ #include #endif -#include "search.h" +#include "wx/html/helpdata.h" @@ -35,8 +36,8 @@ void wxSearchEngine::LookFor(const wxString& keyword) { - if (m_Keyword) free(m_Keyword); - m_Keyword = (char*) malloc(keyword.Length() + 1); + if (m_Keyword) delete[] m_Keyword; + m_Keyword = new char[keyword.Length() + 1]; strcpy(m_Keyword, keyword.c_str()); for (int i = strlen(m_Keyword) - 1; i >= 0; i--) if ((m_Keyword[i] >= 'A') && (m_Keyword[i] <= 'Z')) @@ -50,10 +51,10 @@ bool wxSearchEngine::Scan(wxInputStream *stream) wxASSERT_MSG(m_Keyword != NULL, _("wxSearchEngine::LookFor must be called before scanning!")); int i, j; - int lng = stream -> StreamSize(); + int lng = stream ->GetSize(); int wrd = strlen(m_Keyword); bool found = FALSE; - char *buf = (char*) malloc(lng + 1); + char *buf = new char[lng + 1]; stream -> Read(buf, lng); buf[lng] = 0; @@ -66,7 +67,7 @@ bool wxSearchEngine::Scan(wxInputStream *stream) if (j == wrd) {found = TRUE; break;} } - free(buf); + delete[] buf; return found; }