X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f705f97d31756e00d3553210a5623e07df48cd81..c0cc7004a6ec1c53c0fd974898ef9ffd3739bef4:/utils/tex2rtf/src/htmlutil.cpp diff --git a/utils/tex2rtf/src/htmlutil.cpp b/utils/tex2rtf/src/htmlutil.cpp index c78636b467..553a563c87 100644 --- a/utils/tex2rtf/src/htmlutil.cpp +++ b/utils/tex2rtf/src/htmlutil.cpp @@ -251,18 +251,15 @@ void ReopenSectionContentsFile(void) struct textreplace { wxChar *text; - int text_length; + size_t text_length; wxChar *replace; - int replace_length; + size_t replace_length; }; #define tr(x,y) {x, sizeof(x)-1, y, sizeof(y)-1} static textreplace notverb_array[] = { - tr(_T("\r\n\r\n"), _T("

\n\n")), // unix - tr(_T("\n\n"), _T("

\n\n")), // dos - tr(_T("\r\r"), _T("

\n\n")), // mac tr(_T("``"), _T("“")), tr(_T("''"), _T("”")), tr(_T("`"), _T("‘")), @@ -285,7 +282,7 @@ void ProcessText2HTML(TexChunk *chunk) int ptr = 0; int i = 0; wxChar ch = 1; - int len = wxStrlen(chunk->value); + size_t len = wxStrlen(chunk->value); while (ch != 0) { ch = chunk->value[i]; @@ -313,24 +310,30 @@ void ProcessText2HTML(TexChunk *chunk) bool replaced = false; if (!inVerbatim) { - int x,y; - for (x = 0; x < sizeof (notverb_array) / sizeof(textreplace); x++) + for (size_t x = 0; x < WXSIZEOF(notverb_array); x++) { textreplace& tr = notverb_array[x]; - if (ch != tr.text[0]) continue; - if (len < tr.text_length) continue; + if (ch != tr.text[0]) + continue; + if (len < tr.text_length) + continue; + size_t y; for (y = 1; y < tr.text_length; y++) { - if (chunk->value[y] != tr.text[y]) break; + if (chunk->value[y] != tr.text[y]) + break; } - if (y != tr.text_length) continue; + + if (y != tr.text_length) + continue; // can now copy it over. for (y = 0; y < tr.replace_length; y++) { BigBuffer[ptr++] = tr.replace[y]; } + len -= tr.text_length; i += tr.text_length; replaced = true; @@ -1874,7 +1877,7 @@ static bool CheckTypeRef() label.Trim(true); label.Trim(false); wxString typeName = label; label.MakeLower(); - TexRef *texRef = FindReference((wxChar*)label.c_str()); + TexRef *texRef = FindReference(label); if (texRef && texRef->refFile && wxStrcmp(texRef->refFile, _T("??")) != 0) { int a = typeDecl.Find(typeName); @@ -2150,7 +2153,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start) { wxString errBuf; errBuf.Printf(_T("Warning: unresolved reference '%s'"), refName); - OnInform((wxChar *)errBuf.c_str()); + OnInform(errBuf); } } } @@ -2302,7 +2305,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start) if (f != _T("")) { // The default HTML file to go to is THIS file (so a no-op) - SHGToMap((wxChar *)f.c_str(), currentFileName); + SHGToMap(f, currentFileName); } wxChar *mapName = GetArgData();