Lots more memory/resource leak fixes. There are still more, but this solves about 75% of them.
These fixes also speed up tex2rtf greatly. I can now build all the RTF version of the wxWindows manual in under 30 seconds, when before it took around 90 seconds. Curley Brace matching is turned back on again. I cannot find any places where it does not work. If you find one, let me know git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8773 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -58,6 +58,11 @@ extern FILE *WinHelpContentsFile;
|
||||
extern char *RTFCharset;
|
||||
// This is defined in the Tex2Any library and isn't in use after parsing
|
||||
extern char *BigBuffer;
|
||||
|
||||
|
||||
extern wxHashTable TexReferences;
|
||||
|
||||
|
||||
// Are we in verbatim mode? If so, format differently.
|
||||
static bool inVerbatim = FALSE;
|
||||
|
||||
@@ -3482,6 +3487,8 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
|
||||
// Convert points to TWIPS (1 twip = 1/20th of point)
|
||||
imageWidth = (int)(20*(tok1 ? ParseUnitArgument(tok1) : 0));
|
||||
imageHeight = (int)(20*(tok2 ? ParseUnitArgument(tok2) : 0));
|
||||
if (imageDimensions) // glt
|
||||
delete [] imageDimensions;
|
||||
return FALSE;
|
||||
}
|
||||
else if (start && (arg_no == 2 ))
|
||||
@@ -3556,6 +3563,8 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
|
||||
sprintf(buf, "Warning: could not find a BMP or WMF equivalent for %s.", filename);
|
||||
OnInform(buf);
|
||||
}
|
||||
if (filename) // glt
|
||||
delete [] filename;
|
||||
}
|
||||
else // linear RTF
|
||||
{
|
||||
@@ -5218,15 +5227,20 @@ bool RTFGo(void)
|
||||
{
|
||||
wxConcatFiles("header.rtf", "chapters.rtf", "tmp1.rtf");
|
||||
Tex2RTFYield(TRUE);
|
||||
if (FileExists(OutputFile)) wxRemoveFile(OutputFile);
|
||||
wxString cwdStr, outputDirStr;
|
||||
if (FileExists(OutputFile))
|
||||
wxRemoveFile(OutputFile);
|
||||
|
||||
char *cwdStr;
|
||||
cwdStr = wxGetWorkingDirectory();
|
||||
|
||||
wxString outputDirStr;
|
||||
outputDirStr = wxPathOnly(OutputFile);
|
||||
|
||||
// Determine if the temp file and the output file are in the same directory,
|
||||
// and if they are, then just rename the temp file rather than copying
|
||||
// it, as this is much faster when working with large (multi-megabyte files)
|
||||
if ((wxStrcmp(wxPathOnly(OutputFile),"") == 0) || // no path specified on output file
|
||||
(wxStrcmp(wxGetWorkingDirectory(),wxPathOnly(OutputFile)) == 0)) // paths do not match
|
||||
if ((wxStrcmp(outputDirStr.c_str(),"") == 0) || // no path specified on output file
|
||||
(wxStrcmp(cwdStr,outputDirStr.c_str()) == 0)) // paths do not match
|
||||
{
|
||||
wxRenameFile("tmp1.rtf", OutputFile);
|
||||
}
|
||||
@@ -5234,6 +5248,7 @@ bool RTFGo(void)
|
||||
{
|
||||
wxCopyFile("tmp1.rtf", OutputFile);
|
||||
}
|
||||
delete [] cwdStr;
|
||||
Tex2RTFYield(TRUE);
|
||||
wxRemoveFile("tmp1.rtf");
|
||||
}
|
||||
|
Reference in New Issue
Block a user