X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f705f97d31756e00d3553210a5623e07df48cd81..c0cc7004a6ec1c53c0fd974898ef9ffd3739bef4:/utils/tex2rtf/src/texutils.cpp diff --git a/utils/tex2rtf/src/texutils.cpp b/utils/tex2rtf/src/texutils.cpp index 44e97bf267..5bf4838829 100644 --- a/utils/tex2rtf/src/texutils.cpp +++ b/utils/tex2rtf/src/texutils.cpp @@ -29,6 +29,7 @@ #undef new #endif +#include "wx/beforestd.h" #if wxUSE_IOSTREAMH #include #include @@ -37,6 +38,7 @@ #include using namespace std; #endif +#include "wx/afterstd.h" #include #include "tex2any.h" @@ -207,7 +209,7 @@ wxChar *FindTopicName(TexChunk *chunk) * */ -void StartSimulateArgument(wxChar *data) +void StartSimulateArgument(const wxChar *data) { wxStrcpy(currentArgData, data); haveArgData = true; @@ -223,8 +225,11 @@ void EndSimulateArgument(void) * */ -int ParseUnitArgument(wxChar *unitArg) +int ParseUnitArgument(const wxChar *unitArg_) { + wxWxCharBuffer unitBuf(unitArg_); + wxChar *unitArg = unitBuf.data(); + float conversionFactor = 1.0; float unitValue = 0.0; int len = wxStrlen(unitArg); @@ -448,7 +453,7 @@ void ReadTexReferences(wxChar *filename) // were massive memory leaks TexReferences.DeleteContents(true); TexReferences.Put( - labelStr.c_str(), + labelStr, new TexRef( labelStr.c_str(), fileStr.c_str(), @@ -470,15 +475,15 @@ void BibEatWhiteSpace(wxString& line) { while(!line.empty() && (line[0] == _T(' ') || line[0] == _T('\t') || line[0] == (wxChar)EOF)) { - if (line[0] == 10) + if (line[0] == '\r') BibLine ++; line = line.substr(1); } // Ignore end-of-line comments - if (line[0] == _T('%') || line[0] == _T(';') || line[0] == _T('#')) + if ( !line.empty() && (line[0] == _T('%') || line[0] == _T(';') || line[0] == _T('#'))) { - line = wxEmptyString; + line.clear(); } } @@ -560,13 +565,13 @@ wxString BibReadToEOL(wxString& line) // If in quotes, read white space too. If not, // stop at white space or comment. while (!line.empty() && line[0] != _T('"') && - (inQuotes || ((line[0] != _T(' ')) && (line[0] != 9) && + (inQuotes || ((line[0] != _T(' ')) && (line[0] != '\t') && (line[0] != _T(';')) && (line[0] != _T('%')) && (line[0] != _T('#'))))) { val << line[0]; line = line.substr(1); } - if (line[0] == '"') + if (!line.empty() && line[0] == '"') line = line.substr(1); return val; @@ -704,7 +709,7 @@ void BibReadValue(wxSTD istream& istr, wxChar *buffer, bool ignoreBraces = true, wxUnusedVar(stopping); } -bool ReadBib(wxChar *filename) +bool ReadBib(const wxChar *filename) { if (!wxFileExists(filename)) return false; @@ -1156,7 +1161,7 @@ void ResolveBibReferences(void) } // Remember we need to resolve this citation -void AddCitation(wxChar *citeKey) +void AddCitation(const wxChar *citeKey) { if (!CitationList.Member(citeKey)) CitationList.Add(citeKey); @@ -1167,7 +1172,7 @@ void AddCitation(wxChar *citeKey) } } -TexRef *FindReference(wxChar *key) +TexRef *FindReference(const wxChar *key) { return (TexRef *)TexReferences.Get(key); } @@ -1523,7 +1528,7 @@ bool ReadCustomMacros(const wxString& filename) macro->macroBody = copystring(macroBody.c_str()); BibEatWhiteSpace(line); - CustomMacroList.Append(macroName.c_str(), macro); + CustomMacroList.Append(macroName, macro); AddMacroDef(ltCUSTOM_MACRO, macroName.c_str(), noArgs); }