diff --git a/src/EmbeddedFiles.cpp b/src/EmbeddedFiles.cpp index 1feac87295..666cb7acf2 100644 --- a/src/EmbeddedFiles.cpp +++ b/src/EmbeddedFiles.cpp @@ -112,7 +112,7 @@ void EmbeddedFile::setEmbed(bool embed) } -void EmbeddedFile::enable(bool enabled, Buffer const * buf, bool updateFile) +void EmbeddedFile::enable(bool enabled, Buffer const & buf, bool updateFile) { // This function will be called when // 1. through EmbeddedFiles::enable() when a file is read. Files @@ -126,7 +126,7 @@ void EmbeddedFile::enable(bool enabled, Buffer const * buf, bool updateFile) << (updateFile ? " (update file)." : " (no update).")); if (enabled) { - temp_path_ = buf->temppath(); + temp_path_ = buf.temppath(); if (!suffixIs(temp_path_, '/')) temp_path_ += '/'; if (embedded() && updateFile) @@ -254,11 +254,11 @@ bool EmbeddedFile::updateFromExternalFile() const } -EmbeddedFile EmbeddedFile::copyTo(Buffer const * buf) +EmbeddedFile EmbeddedFile::copyTo(Buffer const & buf) { - EmbeddedFile file = EmbeddedFile(absFilename(), buf->filePath()); + EmbeddedFile file = EmbeddedFile(absFilename(), buf.filePath()); file.setEmbed(embedded()); - file.enable(buf->embedded(), buf, false); + file.enable(buf.embedded(), buf, false); // use external file. if (!embedded()) @@ -459,7 +459,7 @@ void EmbeddedFileList::enable(bool enabled, Buffer & buffer, bool updateFile) iterator it_end = end(); // an exception may be thrown for (; it != it_end; ++it) { - it->enable(enabled, &buffer, updateFile); + it->enable(enabled, buffer, updateFile); if (it->embedded()) ++count_embedded; else @@ -570,7 +570,7 @@ void EmbeddedFileList::validate(Buffer const & buffer) for (; e_it != e_end; ++e_it) { EmbeddedFile file = EmbeddedFile(*e_it, buffer.filePath()); // do not update from external file - file.enable(true, &buffer, false); + file.enable(true, buffer, false); // but we do need to check file existence. if (!FileName(file.embeddedFile()).exists()) throw ExceptionMessage(ErrorException, _("Failed to open file"), @@ -594,7 +594,7 @@ void EmbeddedFileList::update(Buffer const & buffer) for (; it != it_end; ++it) { EmbeddedFile file = EmbeddedFile(*it, buffer.filePath()); file.setEmbed(true); - file.enable(buffer.embedded(), &buffer, false); + file.enable(buffer.embedded(), buffer, false); insert(end(), file); } } diff --git a/src/EmbeddedFiles.h b/src/EmbeddedFiles.h index 46c5c5b725..e5136cd0d0 100644 --- a/src/EmbeddedFiles.h +++ b/src/EmbeddedFiles.h @@ -153,14 +153,14 @@ public: */ bool isEnabled() const { return !temp_path_.empty(); } /// enable embedding of this file - void enable(bool enabled, Buffer const * buf, bool updateFile); + void enable(bool enabled, Buffer const & buf, bool updateFile); /// extract file, does not change embedding status bool extract() const; /// update embedded file from external file, does not change embedding status bool updateFromExternalFile() const; /// copy an embedded file to another buffer - EmbeddedFile copyTo(Buffer const * buf); + EmbeddedFile copyTo(Buffer const & buf); /// /// After the embedding status is changed, update all insets related /// to this file item. For example, a graphic inset may need to monitor diff --git a/src/frontends/qt4/GuiExternal.cpp b/src/frontends/qt4/GuiExternal.cpp index 997928e7ce..460a103c4c 100644 --- a/src/frontends/qt4/GuiExternal.cpp +++ b/src/frontends/qt4/GuiExternal.cpp @@ -643,7 +643,7 @@ void GuiExternal::applyView() EmbeddedFile file(fromqstr(fileED->text()), buf.filePath()); file.setEmbed(embedCB->checkState() == Qt::Checked); // move file around if needed, an exception may be raised. - file.enable(buf.embedded(), &buf, true); + file.enable(buf.embedded(), buf, true); // if things are OK..., embed params_.filename params_.filename.setEmbed(file.embedded()); } catch (ExceptionMessage const & message) { diff --git a/src/frontends/qt4/GuiGraphics.cpp b/src/frontends/qt4/GuiGraphics.cpp index cda6c4efa9..a96e1a795f 100644 --- a/src/frontends/qt4/GuiGraphics.cpp +++ b/src/frontends/qt4/GuiGraphics.cpp @@ -578,7 +578,7 @@ void GuiGraphics::applyView() EmbeddedFile file(fromqstr(filename->text()), buf.filePath()); file.setEmbed(embedCB->checkState() == Qt::Checked); // move file around if needed, an exception may be raised. - file.enable(buf.embedded(), &buf, true); + file.enable(buf.embedded(), buf, true); // if things are OK..., embed igp.filename igp.filename.setEmbed(file.embedded()); } catch (ExceptionMessage const & message) { diff --git a/src/frontends/qt4/GuiInclude.cpp b/src/frontends/qt4/GuiInclude.cpp index eedc1536b0..9cdad1dfa7 100644 --- a/src/frontends/qt4/GuiInclude.cpp +++ b/src/frontends/qt4/GuiInclude.cpp @@ -250,7 +250,7 @@ void GuiInclude::applyView() EmbeddedFile file(to_utf8(params_["filename"]), buf.filePath()); file.setEmbed(embedCB->checkState() == Qt::Checked); // move file around if needed, an exception may be raised. - file.enable(buf.embedded(), &buf, true); + file.enable(buf.embedded(), buf, true); // if things are OK..., set params_["embed"] params_["embed"] = file.embedded() ? from_utf8(file.inzipName()) : docstring(); } catch (ExceptionMessage const & message) { diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp index 2977c60658..28971be46c 100644 --- a/src/insets/InsetBibtex.cpp +++ b/src/insets/InsetBibtex.cpp @@ -60,7 +60,7 @@ void InsetBibtex::setBuffer(Buffer & buffer) EmbeddedFileList::iterator en = bibfiles_.end(); for (; it != en; ++it) { try { - *it = it->copyTo(&buffer); + *it = it->copyTo(buffer); } catch (ExceptionMessage const & message) { Alert::error(message.title_, message.details_); // failed to embed @@ -781,7 +781,7 @@ void InsetBibtex::updateBibFiles() const efp->setEmbed(new_status); try { // copy file if embedding status changed. - efp->enable(buffer().embedded(), &buffer(), old_status != new_status); + efp->enable(buffer().embedded(), buffer(), old_status != new_status); } catch (ExceptionMessage const & message) { Alert::error(message.title_, message.details_); // failed to change embeddeing status @@ -792,7 +792,7 @@ void InsetBibtex::updateBibFiles() const EmbeddedFile file(bib.absFilename(), buffer().filePath()); file.setEmbed(!embfile.empty()); try { - file.enable(buffer().embedded(), &buffer(), true); + file.enable(buffer().embedded(), buffer(), true); } catch (ExceptionMessage const & message) { Alert::error(message.title_, message.details_); // failed to embed diff --git a/src/insets/InsetExternal.cpp b/src/insets/InsetExternal.cpp index 7b23d9df79..daddd7134a 100644 --- a/src/insets/InsetExternal.cpp +++ b/src/insets/InsetExternal.cpp @@ -434,7 +434,7 @@ void InsetExternal::setBuffer(Buffer & buffer) try { // a file may not be copied successfully when, e.g. buffer_ // has already been closed. - params_.filename = params_.filename.copyTo(&buffer); + params_.filename = params_.filename.copyTo(buffer); } catch (ExceptionMessage const & message) { Alert::error(message.title_, message.details_); // failed to embed @@ -742,7 +742,7 @@ void InsetExternal::read(Lexer & lex) InsetExternalParams params; if (params.read(buffer(), lex)) { // exception handling is not needed as long as embedded files are in place. - params.filename.enable(buffer().embedded(), &buffer(), false); + params.filename.enable(buffer().embedded(), buffer(), false); setParams(params); } } diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp index 704f57f053..39e2019e0d 100644 --- a/src/insets/InsetGraphics.cpp +++ b/src/insets/InsetGraphics.cpp @@ -188,7 +188,7 @@ void InsetGraphics::setBuffer(Buffer & buffer) try { // a file may not be copied successfully when, e.g. buffer_ // has already been closed. - params_.filename = params_.filename.copyTo(&buffer); + params_.filename = params_.filename.copyTo(buffer); } catch (ExceptionMessage const & message) { Alert::error(message.title_, message.details_); // failed to embed @@ -308,7 +308,7 @@ void InsetGraphics::read(Lexer & lex) else LYXERR(Debug::GRAPHICS, "Not a Graphics inset!"); - params_.filename.enable(buffer().embedded(), &buffer(), false); + params_.filename.enable(buffer().embedded(), buffer(), false); graphic_->update(params().as_grfxParams()); } diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index b8012001b4..7f55c65339 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -146,7 +146,7 @@ EmbeddedFile const includedFilename(Buffer const & buffer, onlyPath(parentFilename(buffer))); file.setEmbed(!params["embed"].empty()); file.setInzipName(to_utf8(params["embed"])); - file.enable(buffer.embedded(), &buffer, false); + file.enable(buffer.embedded(), buffer, false); return file; } @@ -219,7 +219,7 @@ void InsetInclude::setBuffer(Buffer & buffer) if (buffer_) { try { EmbeddedFile file_from = includedFilename(*buffer_, params()); - EmbeddedFile file_to = file_from.copyTo(&buffer); + EmbeddedFile file_to = file_from.copyTo(buffer); if (file_to.embedded()) setParam("embed", from_utf8(file_to.inzipName())); } catch (ExceptionMessage const & message) {