git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3256 
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
     wxString doc;
 
     if (s == NULL) return wxEmptyString;
     wxString doc;
 
     if (s == NULL) return wxEmptyString;
-    src = (char*) malloc(s -> GetSize() + 1);
+    src = new char[s -> GetSize() + 1];
     src[s -> GetSize()] = 0;
     s -> Read(src, s -> GetSize());
     doc = src;
     src[s -> GetSize()] = 0;
     s -> Read(src, s -> GetSize());
     doc = src;
 
     delete m_ContentsImageList;
     if (m_Contents) {
         for (i = 0; i < m_ContentsCnt; i++) {
     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_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;
     fsys.ChangePathTo(bookFull);
     s = fi -> GetStream();
     sz = s -> GetSize();
     fsys.ChangePathTo(bookFull);
     s = fi -> GetStream();
     sz = s -> GetSize();
-    buff = (char*) malloc(sz+1);
     buff[sz] = 0;
     s -> Read(buff, sz);
     lineptr = buff;
     buff[sz] = 0;
     s -> Read(buff, sz);
     lineptr = buff;
         if (strstr(linebuf, "Contents file=") == linebuf)
             contents = linebuf + strlen("Contents file=");
     }
         if (strstr(linebuf, "Contents file=") == linebuf)
             contents = linebuf + strlen("Contents file=");
     }
 
     bookr = new HtmlBookRecord(fsys.GetPath(), title, start);
 
 
     bookr = new HtmlBookRecord(fsys.GetPath(), title, start);
 
         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 = (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());
     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++;
     strcpy(m_Contents[m_ContentsCnt].m_Name, title.c_str());
     m_Contents[m_ContentsCnt].m_Book = bookr;
     m_ContentsCnt++;
 
     if (m_Frame) {
         m_Frame -> Raise();
 
     if (m_Frame) {
         m_Frame -> Raise();
 
                 m_Items = (HtmlContentsItem*) realloc(m_Items, (m_ItemsCnt + HTML_REALLOC_STEP) * sizeof(HtmlContentsItem));
             m_Items[m_ItemsCnt].m_Level = m_Level;
             m_Items[m_ItemsCnt].m_ID = m_ID;
                 m_Items = (HtmlContentsItem*) realloc(m_Items, (m_ItemsCnt + HTML_REALLOC_STEP) * sizeof(HtmlContentsItem));
             m_Items[m_ItemsCnt].m_Level = m_Level;
             m_Items[m_ItemsCnt].m_ID = m_ID;
-            m_Items[m_ItemsCnt].m_Page = (char*) malloc(m_Page.Length() + 1);
+            m_Items[m_ItemsCnt].m_Page = new char[m_Page.Length() + 1];
             strcpy(m_Items[m_ItemsCnt].m_Page, m_Page.c_str());
             strcpy(m_Items[m_ItemsCnt].m_Page, m_Page.c_str());
-            m_Items[m_ItemsCnt].m_Name = (char*) malloc(m_Name.Length() + 1);
+            m_Items[m_ItemsCnt].m_Name = new char [m_Name.Length() + 1];
             strcpy(m_Items[m_ItemsCnt].m_Name, m_Name.c_str());
             m_Items[m_ItemsCnt].m_Book = m_Book;
             m_ItemsCnt++;
             strcpy(m_Items[m_ItemsCnt].m_Name, m_Name.c_str());
             m_Items[m_ItemsCnt].m_Book = m_Book;
             m_ItemsCnt++;
     f = fsys.OpenFile(contentsfile);
     if (f) {
         sz = f -> GetStream() -> GetSize();
     f = fsys.OpenFile(contentsfile);
     if (f) {
         sz = f -> GetStream() -> GetSize();
-        buf = (char*) malloc(sz+1);
         buf[sz] = 0;
         f -> GetStream() -> Read(buf, sz);
         delete f;
         handler -> ReadIn(m_Contents, m_ContentsCnt);
         parser.Parse(buf);
         handler -> WriteOut(m_Contents, m_ContentsCnt);
         buf[sz] = 0;
         f -> GetStream() -> Read(buf, sz);
         delete f;
         handler -> ReadIn(m_Contents, m_ContentsCnt);
         parser.Parse(buf);
         handler -> WriteOut(m_Contents, m_ContentsCnt);
     }
 
     f = fsys.OpenFile(indexfile);
     if (f) {
         sz = f -> GetStream() -> GetSize();
     }
 
     f = fsys.OpenFile(indexfile);
     if (f) {
         sz = f -> GetStream() -> GetSize();
-        buf = (char*) malloc(sz+1);
         buf[sz] = 0;
         f -> GetStream() -> Read(buf, sz);
         delete f;
         handler -> ReadIn(m_Index, m_IndexCnt);
         parser.Parse(buf);
         handler -> WriteOut(m_Index, m_IndexCnt);
         buf[sz] = 0;
         f -> GetStream() -> Read(buf, sz);
         delete f;
         handler -> ReadIn(m_Index, m_IndexCnt);
         parser.Parse(buf);
         handler -> WriteOut(m_Index, m_IndexCnt);
     }
     if (show_wait_msg) delete busyinfo;
 }
     }
     if (show_wait_msg) delete busyinfo;
 }
         f -> Read(&x, sizeof(x));
         m_Contents[i].m_ID = x;
         f -> Read(&x, sizeof(x));
         f -> Read(&x, sizeof(x));
         m_Contents[i].m_ID = x;
         f -> Read(&x, sizeof(x));
-        m_Contents[i].m_Name = (char*) malloc(x);
+        m_Contents[i].m_Name = new char[x];
         f -> Read(m_Contents[i].m_Name, x);
         f -> Read(&x, sizeof(x));
         f -> Read(m_Contents[i].m_Name, x);
         f -> Read(&x, sizeof(x));
-        m_Contents[i].m_Page = (char*) malloc(x);
+        m_Contents[i].m_Page = new char[x];
         f -> Read(m_Contents[i].m_Page, x);
         m_Contents[i].m_Book = book;
     }
         f -> Read(m_Contents[i].m_Page, x);
         m_Contents[i].m_Book = book;
     }
     m_Index = (HtmlContentsItem*) realloc(m_Index, (m_IndexCnt / HTML_REALLOC_STEP + 1) * HTML_REALLOC_STEP * sizeof(HtmlContentsItem));
     for (i = st; i < m_IndexCnt; i++) {
         f -> Read(&x, sizeof(x));
     m_Index = (HtmlContentsItem*) realloc(m_Index, (m_IndexCnt / HTML_REALLOC_STEP + 1) * HTML_REALLOC_STEP * sizeof(HtmlContentsItem));
     for (i = st; i < m_IndexCnt; i++) {
         f -> Read(&x, sizeof(x));
-        m_Index[i].m_Name = (char*) malloc(x);
+        m_Index[i].m_Name = new char[x];
         f -> Read(m_Index[i].m_Name, x);
         f -> Read(&x, sizeof(x));
         f -> Read(m_Index[i].m_Name, x);
         f -> Read(&x, sizeof(x));
-        m_Index[i].m_Page = (char*) malloc(x);
+        m_Index[i].m_Page = new char[x];
         f -> Read(m_Index[i].m_Page, x);
         m_Index[i].m_Book = book;
     }
         f -> Read(m_Index[i].m_Page, x);
         m_Index[i].m_Book = book;
     }
 
-            m_Cache[tg].Name = (char*) malloc(i+1);
+            m_Cache[tg].Name = new char[i+1];
             memcpy(m_Cache[tg].Name, dummy, i+1);
 
             while (src[pos] != '>') pos++;
             memcpy(m_Cache[tg].Name, dummy, i+1);
 
             while (src[pos] != '>') pos++;
 
     // ok, we're done, now we'll free .Name members of cache - we don't need it anymore:
     for (i = 0; i < m_CacheSize; i++) {
 
     // ok, we're done, now we'll free .Name members of cache - we don't need it anymore:
     for (i = 0; i < m_CacheSize; i++) {
+        delete[] m_Cache[i].Name;
         m_Cache[i].Name = NULL;
     }
 }
         m_Cache[i].Name = NULL;
     }
 }
 
     m_CellInfo = (cellStruct**) realloc(m_CellInfo, sizeof(cellStruct*) * rows);
     if (m_NumCols != 0) {
         int x = rows - 1;
     m_CellInfo = (cellStruct**) realloc(m_CellInfo, sizeof(cellStruct*) * rows);
     if (m_NumCols != 0) {
         int x = rows - 1;
-        m_CellInfo[x] = (cellStruct*) malloc(sizeof(cellStruct) * m_NumCols);
+        m_CellInfo[x] = new cellStruct[m_NumCols];
         for (int i = 0; i < m_NumCols; i++)
             m_CellInfo[x][i].flag = cellFree;
     }
         for (int i = 0; i < m_NumCols; i++)
             m_CellInfo[x][i].flag = cellFree;
     }
 
     /* 3.  sub-layout all cells: */
     {
 
     /* 3.  sub-layout all cells: */
     {
-        int *ypos = (int*) malloc(sizeof(int) * (m_NumRows + 1));
+        int *ypos = new int[m_NumRows + 1];
 
         int actcol, actrow;
         int fullwid;
 
         int actcol, actrow;
         int fullwid;
 
         }
         m_Height = ypos[m_NumRows];
 
         }
         m_Height = ypos[m_NumRows];
 
 
 void wxSearchEngine::LookFor(const wxString& keyword)
 {
 
 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'))
     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'))
     int lng = stream ->GetSize();
     int wrd = strlen(m_Keyword);
     bool found = FALSE;
     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;
 
     stream -> Read(buf, lng);
     buf[lng] = 0;
 
         if (j == wrd) {found = TRUE; break;}
     }
 
         if (j == wrd) {found = TRUE; break;}
     }