prevent the compiler from optimiying away support::Path variables

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17751 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2007-04-06 18:03:29 +00:00
parent bb44b23486
commit ed781c2afe
7 changed files with 31 additions and 28 deletions

View File

@ -1138,11 +1138,11 @@ int Buffer::runChktex()
busy(true);
// get LaTeX-Filename
string const path = temppath();
string const name = addName(path, getLatexName());
FileName const path(temppath());
string const name = addName(path.absFilename(), getLatexName());
string const org_path = filePath();
support::Path p(FileName(path)); // path to LaTeX file
support::Path p(path); // path to LaTeX file
message(_("Running chktex..."));
// Generate the LaTeX file if neccessary

View File

@ -49,7 +49,6 @@ using support::makeAbsPath;
using support::makeRelPath;
using support::onlyFilename;
using support::onlyPath;
using support::Path;
using support::prefixIs;
using support::quoteName;
using support::removeExtension;
@ -348,8 +347,10 @@ bool Converters::convert(Buffer const * buffer,
// This has the added benefit that all other files that may be
// generated by the converter are deleted when LyX closes and do not
// clutter the real working directory.
string path = onlyPath(from_file.absFilename());
Path p(FileName(path));
string const path(onlyPath(from_file.absFilename()));
// Prevent the compiler from optimizing away p
FileName pp(path);
support::Path p(pp);
// empty the error list before any new conversion takes place.
errorList.clear();
@ -431,7 +432,8 @@ bool Converters::convert(Buffer const * buffer,
Systemcall one;
int res;
if (conv.original_dir) {
Path p(FileName(buffer->filePath()));
FileName path(buffer->filePath());
support::Path p(path);
res = one.startscript(type,
to_filesystem8bit(from_utf8(command)));
} else

View File

@ -42,7 +42,6 @@ using support::getVectorFromString;
using support::libFileSearch;
using support::onlyFilename;
using support::package;
using support::Path;
using support::quoteName;
using support::split;
using support::Systemcall;
@ -53,7 +52,7 @@ namespace frontend {
void rescanTexStyles()
{
// Run rescan in user lyx directory
Path p(package().user_support());
support::Path p(package().user_support());
FileName const command = libFileSearch("scripts", "TeXFiles.py");
Systemcall one;
int const status = one.startscript(Systemcall::Wait,
@ -70,7 +69,7 @@ void rescanTexStyles()
void texhash()
{
// Run texhash in user lyx directory
Path p(package().user_support());
support::Path p(package().user_support());
//path to texhash through system
Systemcall one;

View File

@ -50,7 +50,6 @@ using support::latex_path;
using support::ltrim;
using support::makeAbsPath;
using support::makeRelPath;
using support::Path;
using support::prefixIs;
using support::removeExtension;
using support::rtrim;
@ -309,7 +308,8 @@ int InsetBibtex::latex(Buffer const & buffer, odocstream & os,
vector<FileName> const InsetBibtex::getFiles(Buffer const & buffer) const
{
Path p(FileName(buffer.filePath()));
FileName path(buffer.filePath());
support::Path p(path);
vector<FileName> vec;

View File

@ -1004,8 +1004,10 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
}
// Push directory path.
string const path = buffer->temppath();
support::Path p(FileName(path));
string const path(buffer->temppath());
// Prevent the compiler from optimizing away p
FileName pp(path);
support::Path p(pp);
// there are three cases here:
// 1. we print to a file

View File

@ -56,11 +56,11 @@ using std::ifstream;
namespace fs = boost::filesystem;
int VCS::doVCCommand(string const & cmd, string const & path)
int VCS::doVCCommand(string const & cmd, FileName const & path)
{
LYXERR(Debug::LYXVC) << "doVCCommand: " << cmd << endl;
Systemcall one;
support::Path p(FileName(path));
support::Path p(path);
int const ret = one.startscript(Systemcall::Wait, cmd);
return ret;
}
@ -102,7 +102,7 @@ void RCS::retrieve(FileName const & file)
{
LYXERR(Debug::LYXVC) << "LyXVC::RCS: retrieve.\n\t" << file << endl;
VCS::doVCCommand("co -q -r " + quoteName(file.toFilesystemEncoding()),
string());
FileName());
}
@ -176,7 +176,7 @@ void RCS::registrer(string const & msg)
cmd += msg;
cmd += "\" ";
cmd += quoteName(onlyFilename(owner_->fileName()));
doVCCommand(cmd, owner_->filePath());
doVCCommand(cmd, FileName(owner_->filePath()));
}
@ -184,7 +184,7 @@ void RCS::checkIn(string const & msg)
{
doVCCommand("ci -q -u -m\"" + msg + "\" "
+ quoteName(onlyFilename(owner_->fileName())),
owner_->filePath());
FileName(owner_->filePath()));
}
@ -192,7 +192,7 @@ void RCS::checkOut()
{
owner_->markClean();
doVCCommand("co -q -l " + quoteName(onlyFilename(owner_->fileName())),
owner_->filePath());
FileName(owner_->filePath()));
}
@ -200,7 +200,7 @@ void RCS::revert()
{
doVCCommand("co -f -u" + version() + " "
+ quoteName(onlyFilename(owner_->fileName())),
owner_->filePath());
FileName(owner_->filePath()));
// We ignore changes and just reload!
owner_->markClean();
}
@ -211,7 +211,7 @@ void RCS::undoLast()
LYXERR(Debug::LYXVC) << "LyXVC: undoLast" << endl;
doVCCommand("rcs -o" + version() + " "
+ quoteName(onlyFilename(owner_->fileName())),
owner_->filePath());
FileName(owner_->filePath()));
}
@ -219,7 +219,7 @@ void RCS::getLog(FileName const & tmpf)
{
doVCCommand("rlog " + quoteName(onlyFilename(owner_->fileName()))
+ " > " + tmpf.toFilesystemEncoding(),
owner_->filePath());
FileName(owner_->filePath()));
}
@ -306,7 +306,7 @@ void CVS::registrer(string const & msg)
{
doVCCommand("cvs -q add -m \"" + msg + "\" "
+ quoteName(onlyFilename(owner_->fileName())),
owner_->filePath());
FileName(owner_->filePath()));
}
@ -314,7 +314,7 @@ void CVS::checkIn(string const & msg)
{
doVCCommand("cvs -q commit -m \"" + msg + "\" "
+ quoteName(onlyFilename(owner_->fileName())),
owner_->filePath());
FileName(owner_->filePath()));
}
@ -332,7 +332,7 @@ void CVS::revert()
string const fil = quoteName(onlyFilename(owner_->fileName()));
doVCCommand("rm -f " + fil + "; cvs update " + fil,
owner_->filePath());
FileName(owner_->filePath()));
owner_->markClean();
}
@ -350,7 +350,7 @@ void CVS::getLog(FileName const & tmpf)
{
doVCCommand("cvs log " + quoteName(onlyFilename(owner_->fileName()))
+ " > " + tmpf.toFilesystemEncoding(),
owner_->filePath());
FileName(owner_->filePath()));
}

View File

@ -71,7 +71,7 @@ protected:
* @param path the path from which to execute
* @return exit status
*/
static int doVCCommand(std::string const & cmd, std::string const & path);
static int doVCCommand(std::string const & cmd, support::FileName const & path);
/**
* The master VC file. For RCS this is *,v or RCS/ *,v. master should