X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5526e819eca4465ed5520d49bccfebc6a28045e0..c765e6fb9df639bb4e65a8824ed13a42f457027b:/src/html/search.cpp diff --git a/src/html/search.cpp b/src/html/search.cpp index aab3906fd5..5d30b48227 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 ///////////////////////////////////////////////////////////////////////////// @@ -12,21 +13,19 @@ #pragma implementation #endif -#include +#include "wx/wxprec.h" -#include -#if wxUSE_HTML - -#ifdef __BORDLANDC__ -#pragma hdrstop +#ifdef __BORLANDC__ + #pragma hdrstop #endif +#include "wx/defs.h" +#if wxUSE_HTML + #ifndef WXPRECOMP -#include #endif -#include "search.h" - +#include "wx/html/helpdata.h" //-------------------------------------------------------------------------------- @@ -35,12 +34,12 @@ void wxSearchEngine::LookFor(const wxString& keyword) { - if (m_Keyword) free(m_Keyword); - m_Keyword = (char*) malloc(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')) - m_Keyword[i] += 'a' - 'A'; + if (m_Keyword) delete[] m_Keyword; + m_Keyword = new wxChar[keyword.Length() + 1]; + wxStrcpy(m_Keyword, keyword.c_str()); + for (int i = wxStrlen(m_Keyword) - 1; i >= 0; i--) + if ((m_Keyword[i] >= wxT('A')) && (m_Keyword[i] <= wxT('Z'))) + m_Keyword[i] += wxT('a') - wxT('A'); } @@ -50,10 +49,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 wrd = strlen(m_Keyword); + int lng = stream ->GetSize(); + int wrd = wxStrlen(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 +65,7 @@ bool wxSearchEngine::Scan(wxInputStream *stream) if (j == wrd) {found = TRUE; break;} } - free(buf); + delete[] buf; return found; }