X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/602e68af586e9d729b9f30da210261aeb11a3079..ccf0b1d76ce28c0880df6d5c4866aaa548e2e56f:/src/html/htmlhelp.cpp diff --git a/src/html/htmlhelp.cpp b/src/html/htmlhelp.cpp index 0f75ef0580..d9bf5d2b11 100644 --- a/src/html/htmlhelp.cpp +++ b/src/html/htmlhelp.cpp @@ -7,12 +7,11 @@ #ifdef __GNUG__ -#pragma implementation +#pragma implementation "htmlhelp.h" #endif -#include +#include "wx/wxprec.h" -#include "wx/defs.h" #if wxUSE_HTML #ifdef __BORDLANDC__ @@ -155,15 +154,15 @@ wxHtmlHelpController::~wxHtmlHelpController() delete m_ContentsImageList; if (m_Contents) { for (i = 0; i < m_ContentsCnt; i++) { - free(m_Contents[i].m_Page); - free(m_Contents[i].m_Name); + delete[] m_Contents[i].m_Page; + delete[] m_Contents[i].m_Name; } free(m_Contents); } if (m_Index) { for (i = 0; i < m_IndexCnt; i++) { - free(m_Index[i].m_Page); - free(m_Index[i].m_Name); + delete[] m_Index[i].m_Page; + delete[] m_Index[i].m_Name; } free(m_Index); } @@ -243,8 +242,8 @@ bool wxHtmlHelpController::AddBook(const wxString& book, bool show_wait_msg) if (fi == NULL) return FALSE; fsys.ChangePathTo(bookFull); s = fi -> GetStream(); - sz = s -> StreamSize(); - buff = (char*) malloc(sz+1); + sz = s -> GetSize(); + buff = new char[sz+1]; buff[sz] = 0; s -> Read(buff, sz); lineptr = buff; @@ -260,7 +259,7 @@ bool wxHtmlHelpController::AddBook(const wxString& book, bool show_wait_msg) if (strstr(linebuf, "Contents file=") == linebuf) contents = linebuf + strlen("Contents file="); } - free(buff); + delete[] buff; bookr = new HtmlBookRecord(fsys.GetPath(), title, start); @@ -268,9 +267,9 @@ bool wxHtmlHelpController::AddBook(const wxString& book, bool show_wait_msg) m_Contents = (HtmlContentsItem*) realloc(m_Contents, (m_ContentsCnt + HTML_REALLOC_STEP) * sizeof(HtmlContentsItem)); m_Contents[m_ContentsCnt].m_Level = 0; m_Contents[m_ContentsCnt].m_ID = 0; - m_Contents[m_ContentsCnt].m_Page = (char*) malloc(start.Length() + 1); + m_Contents[m_ContentsCnt].m_Page = new char[start.Length() + 1]; strcpy(m_Contents[m_ContentsCnt].m_Page, start.c_str()); - m_Contents[m_ContentsCnt].m_Name = (char*) malloc(title.Length() + 1); + m_Contents[m_ContentsCnt].m_Name = new char [title.Length() + 1]; strcpy(m_Contents[m_ContentsCnt].m_Name, title.c_str()); m_Contents[m_ContentsCnt].m_Book = bookr; m_ContentsCnt++; @@ -528,7 +527,7 @@ void wxHtmlHelpController::CreateHelpWindow() if (m_Frame) { m_Frame -> Raise(); - m_Frame -> Show(TRUE); + m_Frame -> Show(TRUE); return; } @@ -724,7 +723,7 @@ void wxHtmlHelpController::ReadCustomization(wxConfigBase *cfg, wxString path) cfg -> SetPath(path); } - m_Cfg.navig_on = (bool) cfg -> Read("hcNavigPanel", m_Cfg.navig_on); + m_Cfg.navig_on = cfg -> Read("hcNavigPanel", m_Cfg.navig_on) != 0; m_Cfg.sashpos = cfg -> Read("hcSashPos", m_Cfg.sashpos); m_Cfg.x = cfg -> Read("hcX", m_Cfg.x); m_Cfg.y = cfg -> Read("hcY", m_Cfg.y);