X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9c9691ba241768af0cc050e021c8323b7d16fe5a..4871d34290873072ca2783074d4779ba5ecb2052:/utils/tex2rtf/src/tex2any.cpp?ds=sidebyside diff --git a/utils/tex2rtf/src/tex2any.cpp b/utils/tex2rtf/src/tex2any.cpp index 33466d1a93..488a200c85 100644 --- a/utils/tex2rtf/src/tex2any.cpp +++ b/utils/tex2rtf/src/tex2any.cpp @@ -25,10 +25,8 @@ #include #include -#if !WXWIN_COMPATIBILITY_2_4 static inline wxChar* copystring(const wxChar* s) { return wxStrcpy(new wxChar[wxStrlen(s) + 1], s); } -#endif /* * Variables accessible from clients @@ -285,13 +283,13 @@ void ForbidWarning(TexMacroDef *def) case FORBID_WARN: { informBuf.Printf(_T("Warning: it is recommended that command %s is not used."), def->name); - OnInform((const wxChar *)informBuf.c_str()); + OnInform(informBuf); break; } case FORBID_ABSOLUTELY: { informBuf.Printf(_T("Error: command %s cannot be used and will lead to errors."), def->name); - OnInform((const wxChar *)informBuf.c_str()); + OnInform(informBuf); break; } default: @@ -451,7 +449,7 @@ bool read_a_line(wxChar *buf) wxString errBuf; errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."), LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(), MAX_LINE_BUFFER_SIZE); - OnError((wxChar *)errBuf.c_str()); + OnError(errBuf); return false; } @@ -473,7 +471,7 @@ bool read_a_line(wxChar *buf) { wxString errBuf; errBuf.Printf(_T("An extra right Curly brace ('}') was detected at line %lu inside file %s"), LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str()); - OnError((wxChar *)errBuf.c_str()); + OnError(errBuf); // Reduce the count of right Curly braces, so the mismatched count // isn't reported on every line that has a '}' after the first mismatch @@ -502,7 +500,7 @@ bool read_a_line(wxChar *buf) wxString errBuf; errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."), LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); - OnError((wxChar *)errBuf.c_str()); + OnError(errBuf); return false; } wxStrcat(buf, _T("\\par")); @@ -517,7 +515,7 @@ bool read_a_line(wxChar *buf) wxString errBuf; errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."), LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); - OnError((wxChar *)errBuf.c_str()); + OnError(errBuf); return false; } @@ -542,7 +540,7 @@ bool read_a_line(wxChar *buf) wxString errBuf; errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."), LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); - OnError((wxChar *)errBuf.c_str()); + OnError(errBuf); return false; } buf[bufIndex++]='\\'; @@ -565,7 +563,7 @@ bool read_a_line(wxChar *buf) wxString errBuf; errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."), LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); - OnError((wxChar *)errBuf.c_str()); + OnError(errBuf); return false; } buf[bufIndex++]='\\'; @@ -580,7 +578,7 @@ bool read_a_line(wxChar *buf) wxString errBuf; errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."), LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); - OnError((wxChar *)errBuf.c_str()); + OnError(errBuf); return false; } // If the current character read in is a '_', we need to check @@ -601,7 +599,7 @@ bool read_a_line(wxChar *buf) // wxString errBuf; // errBuf.Printf(_T("An underscore ('_') was detected at line %lu inside file %s that should NOT have a '\\' before it."), // LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str()); -// OnError((wxChar *)errBuf.c_str()); +// OnError(errBuf); } } else @@ -612,7 +610,7 @@ bool read_a_line(wxChar *buf) wxString errBuf; errBuf.Printf(_T("An underscore ('_') was detected at line %lu inside file %s that may need a '\\' before it."), LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str()); - OnError((wxChar *)errBuf.c_str()); + OnError(errBuf); } else if ((buf[bufIndex-1] != '\\') && (buf[0] != '%') && // If it is a comment line, then no warnings (wxStrncmp(buf, _T("\\input"), 6))) // do not report filenames that have underscores in them @@ -620,7 +618,7 @@ bool read_a_line(wxChar *buf) wxString errBuf; errBuf.Printf(_T("An underscore ('_') was detected at line %lu inside file %s that may need a '\\' before it."), LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str()); - OnError((wxChar *)errBuf.c_str()); + OnError(errBuf); } } } @@ -645,7 +643,7 @@ bool read_a_line(wxChar *buf) wxString errBuf; errBuf.Printf(_T("Curly braces do not match inside file %s\n%lu opens, %lu closes"), (const wxChar*) currentFileName.c_str(),leftCurly,rightCurly); - OnError((wxChar *)errBuf.c_str()); + OnError(errBuf); } leftCurly = 0; rightCurly = 0; @@ -696,13 +694,13 @@ bool read_a_line(wxChar *buf) { wxString errBuf; errBuf.Printf(_T("Could not find file: %s"),fileName); - OnError((wxChar *)errBuf.c_str()); + OnError(errBuf); } else { wxString informStr; informStr.Printf(_T("Processing: %s"),actualFile.c_str()); - OnInform((wxChar *)informStr.c_str()); + OnInform(informStr); CurrentInputIndex ++; Inputs[CurrentInputIndex] = wxFopen(actualFile, _T("r")); @@ -760,7 +758,7 @@ bool read_a_line(wxChar *buf) fileNameStr.Replace(_T("\\"), _T("")); // Ignore some types of input files (e.g. macro definition files) - wxChar *fileOnly = wxFileNameFromPath((wxChar*) (const wxChar*) fileNameStr); + wxString fileOnly = wxFileNameFromPath(fileNameStr); currentFileName = fileOnly; if (IgnorableInputFiles.Member(fileOnly)) return read_a_line(buf); @@ -778,7 +776,7 @@ bool read_a_line(wxChar *buf) { wxString errBuf; errBuf.Printf(_T("Could not find file: %s"),fileName); - OnError((wxChar *)errBuf.c_str()); + OnError(errBuf); } else { @@ -788,7 +786,7 @@ bool read_a_line(wxChar *buf) wxString informStr; informStr.Printf(_T("Processing: %s"),actualFile.c_str()); - OnInform((wxChar *)informStr.c_str()); + OnInform(informStr); CurrentInputIndex ++; Inputs[CurrentInputIndex] = wxFopen(actualFile, _T("r")); @@ -802,7 +800,7 @@ bool read_a_line(wxChar *buf) wxString errBuf; errBuf.Printf(_T("Could not open include file %s"), (const wxChar*) actualFile); CurrentInputIndex --; - OnError((wxChar *)errBuf.c_str()); + OnError(errBuf); } } bool succ = read_a_line(buf); @@ -835,7 +833,7 @@ bool read_a_line(wxChar *buf) LineNumbers[CurrentInputIndex], currentFileName.c_str()); } - OnError((wxChar *)errBuf.c_str()); + OnError(errBuf); } } } @@ -855,7 +853,7 @@ bool read_a_line(wxChar *buf) wxString errBuf; errBuf.Printf(_T("Curly braces do not match inside file %s\n%lu opens, %lu closes"), (const wxChar*) currentFileName.c_str(),leftCurly,rightCurly); - OnError((wxChar *)errBuf.c_str()); + OnError(errBuf); } } @@ -953,7 +951,7 @@ void MacroError(wxChar *buffer) errBuf.Printf(_T("Could not find macro: %s at line %d, file %s"), macroBuf, (int)(LineNumbers[CurrentInputIndex]-1), FileNames[CurrentInputIndex]); - OnError((wxChar *)errBuf.c_str()); + OnError(errBuf); if (wxStrcmp(macroBuf,_T("\\end{document}")) == 0) { @@ -1636,7 +1634,7 @@ int ParseMacroBody(const wxChar *WXUNUSED(macro_name), TexChunk *parent, tmpBuffer = tmpBuffer.Mid(0,tmpBuffer.length()-4); } errBuf.Printf(_T("Missing macro argument in the line:\n\t%s\n"),tmpBuffer.c_str()); - OnError((wxChar *)errBuf.c_str()); + OnError(errBuf); } } @@ -3251,7 +3249,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) { wxString informBuf; informBuf.Printf(_T("Warning: unresolved reference '%s'"), refName); - OnInform((wxChar *)informBuf.c_str()); + OnInform(informBuf); } } else TexOutput(_T("??"), true); @@ -3405,7 +3403,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) { wxString informBuf; informBuf.Printf(_T("Warning: unresolved citation %s."), citeKey); - OnInform((wxChar *)informBuf.c_str()); + OnInform(informBuf); } } citeKey = ParseMultifieldString(citeKeys, &pos); @@ -3546,14 +3544,14 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) { wxString errBuf; errBuf.Printf(_T(".bib file %s not found or malformed"), (const wxChar*) actualFile); - OnError((wxChar *)errBuf.c_str()); + OnError(errBuf); } } else { wxString errBuf; errBuf.Printf(_T(".bib file %s not found"), fileBuf); - OnError((wxChar *)errBuf.c_str()); + OnError(errBuf); } bibFile = ParseMultifieldString(allFiles, &pos); }