X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1693108cfeb77447c492714a0a7936c35a51c284..2ada746fb47bf68c9f2dab6399a6cd5510320984:/utils/tex2rtf/src/texutils.cpp

diff --git a/utils/tex2rtf/src/texutils.cpp b/utils/tex2rtf/src/texutils.cpp
index 58d5bb7076..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 <iostream.h>
 #include <fstream.h>
@@ -37,6 +38,7 @@
 #include <fstream>
 using namespace std;
 #endif
+#include "wx/afterstd.h"
 
 #include <ctype.h>
 #include "tex2any.h"
@@ -451,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(),
@@ -479,9 +481,9 @@ void BibEatWhiteSpace(wxString& line)
     }
 
     // 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();
     }
 }
 
@@ -569,7 +571,7 @@ wxString BibReadToEOL(wxString& line)
         val << line[0];
         line = line.substr(1);
     }
-    if (line[0] == '"')
+    if (!line.empty() && line[0] == '"')
         line = line.substr(1);
 
     return val;
@@ -1526,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);
         }