From a6f843aacbc35a5ade5d7d81dcdc68ca5843e322 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Thu, 12 Jan 2012 19:48:08 +0000 Subject: [PATCH] get rid of dead code and silly function git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40605 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/support/FileName.cpp | 16 ++-------------- src/support/FileName.h | 6 ------ src/support/filetools.cpp | 22 +++++++++------------- 3 files changed, 11 insertions(+), 33 deletions(-) diff --git a/src/support/FileName.cpp b/src/support/FileName.cpp index a0ad86da69..4daa364736 100644 --- a/src/support/FileName.cpp +++ b/src/support/FileName.cpp @@ -1054,12 +1054,12 @@ DocFileName::DocFileName() DocFileName::DocFileName(string const & abs_filename, bool save_abs) - : FileName(abs_filename), save_abs_path_(save_abs), zipped_valid_(false) + : FileName(abs_filename), save_abs_path_(save_abs) {} DocFileName::DocFileName(FileName const & abs_filename, bool save_abs) - : FileName(abs_filename), save_abs_path_(save_abs), zipped_valid_(false) + : FileName(abs_filename), save_abs_path_(save_abs) {} @@ -1070,14 +1070,12 @@ void DocFileName::set(string const & name, string const & buffer_path) FileName::set(name); else FileName::set(makeAbsPath(name, buffer_path).absFileName()); - zipped_valid_ = false; } void DocFileName::erase() { FileName::erase(); - zipped_valid_ = false; } @@ -1156,16 +1154,6 @@ string DocFileName::mangledFileName(string const & dir) const } -bool DocFileName::isZipped() const -{ - if (!zipped_valid_) { - zipped_ = isZippedFile(); - zipped_valid_ = true; - } - return zipped_; -} - - string DocFileName::unzippedFileName() const { return support::unzippedFileName(absFileName()); diff --git a/src/support/FileName.h b/src/support/FileName.h index 23e6fd0d40..da1f75fbee 100644 --- a/src/support/FileName.h +++ b/src/support/FileName.h @@ -290,8 +290,6 @@ public: std::string mangledFileName(std::string const & dir = empty_string()) const; - /// \return true if the file is compressed. - bool isZipped() const; /// \return the absolute file name without its .gz, .z, .Z extension std::string unzippedFileName() const; @@ -299,10 +297,6 @@ private: /// Records whether we should save (or export) the filename as a relative /// or absolute path. bool save_abs_path_; - /// Cache for isZipped() because zippedFile() is expensive - mutable bool zipped_; - /// Is zipped_ valid? - mutable bool zipped_valid_; }; diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp index 5891e79fec..0dcb2edc57 100644 --- a/src/support/filetools.cpp +++ b/src/support/filetools.cpp @@ -1016,16 +1016,6 @@ FileName const findtexfile(string const & fil, string const & /*format*/) } -void readBB_lyxerrMessage(FileName const & file, bool & zipped, - string const & message) -{ - LYXERR(Debug::GRAPHICS, "[readBB_from_PSFile] " << message); - // FIXME: Why is this func deleting a file? (Lgb) - if (zipped) - file.removeFile(); -} - - string const readBB_from_PSFile(FileName const & file) { // in a (e)ps-file it's an entry like %%BoundingBox:23 45 321 345 @@ -1040,7 +1030,9 @@ string const readBB_from_PSFile(FileName const & file) string const format = file_.guessFormatFromContents(); if (format != "eps" && format != "ps") { - readBB_lyxerrMessage(file_, zipped,"no(e)ps-format"); + LYXERR(Debug::GRAPHICS, "[readBB_from_PSFile] no(e)ps-format"); + if (zipped) + file_.removeFile(); return string(); } @@ -1060,11 +1052,15 @@ string const readBB_from_PSFile(FileName const & file) os << what.str(1) << ' ' << what.str(2) << ' ' << what.str(3) << ' ' << what.str(4); string const bb = os.str(); - readBB_lyxerrMessage(file_, zipped, bb); + LYXERR(Debug::GRAPHICS, "[readBB_from_PSFile] " << bb); + if (zipped) + file_.removeFile(); return bb; } } - readBB_lyxerrMessage(file_, zipped, "no bb found"); + LYXERR(Debug::GRAPHICS, "[readBB_from_PSFile] no bb found"); + if (zipped) + file_.removeFile(); return string(); }