From: George Tasker Date: Mon, 14 Aug 2000 12:05:13 +0000 (+0000) Subject: Typecasting added to prevent warnings. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/241c426ca8eb7ca99f27eb39e02af054f40e131e?hp=405c846fc4de5c81689d04c9af6403573bc87139 Typecasting added to prevent warnings. Instead of copying the temp file, if the temp file directory and output file directory for RTF are the same, program does a rename instead of a copy. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8099 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/utils/tex2rtf/src/rtfutils.cpp b/utils/tex2rtf/src/rtfutils.cpp index 93a6356748..735745b2c4 100644 --- a/utils/tex2rtf/src/rtfutils.cpp +++ b/utils/tex2rtf/src/rtfutils.cpp @@ -210,7 +210,7 @@ void OutputSectionKeyword(FILE *fd) { OutputCurrentSectionToString(wxBuffer); - int i; + unsigned int i; for (i = 0; i < strlen(wxBuffer); i++) if (wxBuffer[i] == ':') wxBuffer[i] = ' '; @@ -349,7 +349,7 @@ void GenerateKeywordsForTopic(char *topic) SplitIndexEntry(s, buf1, buf2); // Check for ':' which messes up index - int i; + unsigned int i; for (i = 0; i < strlen(buf1) ; i++) if (buf1[i] == ':') buf1[i] = ' '; @@ -5219,7 +5219,21 @@ bool RTFGo(void) wxConcatFiles("header.rtf", "chapters.rtf", "tmp1.rtf"); Tex2RTFYield(TRUE); if (FileExists(OutputFile)) wxRemoveFile(OutputFile); - wxCopyFile("tmp1.rtf", OutputFile); + wxString cwdStr, outputDirStr; + cwdStr = wxGetWorkingDirectory(); + 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 + { + wxRenameFile("tmp1.rtf", OutputFile); + } + else + { + wxCopyFile("tmp1.rtf", OutputFile); + } Tex2RTFYield(TRUE); wxRemoveFile("tmp1.rtf"); } diff --git a/utils/tex2rtf/src/tex2any.cpp b/utils/tex2rtf/src/tex2any.cpp index 5f134ea588..a408e8a738 100644 --- a/utils/tex2rtf/src/tex2any.cpp +++ b/utils/tex2rtf/src/tex2any.cpp @@ -1471,7 +1471,8 @@ bool TexLoadFile(char *filename) if (Inputs[0]) fclose(Inputs[0]); return TRUE; } - else return FALSE; + + return FALSE; } TexMacroDef::TexMacroDef(int the_id, char *the_name, int n, bool ig, bool forbidLevel)