X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FBuffer.cpp;h=54da9b24ea394bc0f7dbfa3f5b685bc4d00565a6;hb=8aa2d6b18415659e147bfb4039e371a3277226d5;hp=bb85fb512cfb390291047875b167c19500714f0f;hpb=36c3495a3aea43e7dcda53eafadcc6592073b17e;p=lyx.git diff --git a/src/Buffer.cpp b/src/Buffer.cpp index bb85fb512c..54da9b24ea 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -219,7 +219,13 @@ public: mutable TocBackend toc_backend; /// macro tables - typedef pair ScopeMacro; + struct ScopeMacro { + ScopeMacro() {} + ScopeMacro(DocIterator const & s, MacroData const & m) + : scope(s), macro(m) {} + DocIterator scope; + MacroData macro; + }; typedef map PositionScopeMacroMap; typedef map NamePositionScopeMacroMap; /// map from the macro name to the position map, @@ -230,7 +236,13 @@ public: /// positions of child buffers in the buffer typedef map BufferPositionMap; - typedef pair ScopeBuffer; + struct ScopeBuffer { + ScopeBuffer() {} + ScopeBuffer(DocIterator const & s,Buffer const * b) + : scope(s), buffer(b) {} + DocIterator scope; + Buffer const * buffer; + }; typedef map PositionScopeBufferMap; /// position of children buffers in this buffer BufferPositionMap children_positions; @@ -385,9 +397,10 @@ Buffer::Impl::Impl(Buffer * owner, FileName const & file, bool readonly_, file_fully_loaded(false), ignore_parent(false), toc_backend(owner), macro_lock(false), timestamp_(0), checksum_(0), wa_(0), gui_(0), undo_(*owner), bibinfo_cache_valid_(false), bibfile_cache_valid_(false), - cite_labels_valid_(false), preview_loader_(0), + cite_labels_valid_(false), inset(0), preview_loader_(0), cloned_buffer_(cloned_buffer), clone_list_(0), - doing_export(false), parent_buffer(0) + doing_export(false), parent_buffer(0), + word_count_(0), char_count_(0), blank_count_(0) { if (!cloned_buffer_) { temppath = createBufferTmpDir(); @@ -558,7 +571,7 @@ void Buffer::cloneWithChildren(BufferMap & bufmap, CloneList * clones) const for (; it != end; ++it) { DocIterator dit = it->first.clone(buffer_clone); dit.setBuffer(buffer_clone); - Buffer * child = const_cast(it->second.second); + Buffer * child = const_cast(it->second.buffer); child->cloneWithChildren(bufmap, clones); BufferMap::iterator const bit = bufmap.find(child); @@ -775,7 +788,7 @@ string Buffer::logName(LogType * type) const // Also consider the master buffer log file FileName masterfname = fname; - LogType mtype; + LogType mtype = latexlog; if (masterBuffer() != this) { string const mlogfile = masterBuffer()->logName(&mtype); masterfname = FileName(mlogfile); @@ -1851,7 +1864,7 @@ void Buffer::writeDocBookSource(odocstream & os, string const & fname, d->texrow.reset(); DocumentClass const & tclass = params().documentClass(); - string const top_element = tclass.latexname(); + string const & top_element = tclass.latexname(); bool const output_preamble = output == FullSource || output == OnlyPreamble; @@ -3121,12 +3134,12 @@ MacroData const * Buffer::Impl::getBufferMacro(docstring const & name, if (it != nameIt->second.end()) { while (true) { // scope ends behind pos? - if (pos < it->second.first) { + if (pos < it->second.scope) { // Looks good, remember this. If there // is no external macro behind this, // we found the right one already. bestPos = it->first; - bestData = &it->second.second; + bestData = &it->second.macro; break; } @@ -3151,13 +3164,13 @@ MacroData const * Buffer::Impl::getBufferMacro(docstring const & name, break; // scope ends behind pos? - if (pos < it->second.first + if (pos < it->second.scope && (cloned_buffer_ || - theBufferList().isLoaded(it->second.second))) { + theBufferList().isLoaded(it->second.buffer))) { // look for macro in external file macro_lock = true; MacroData const * data - = it->second.second->getMacro(name, false); + = it->second.buffer->getMacro(name, false); macro_lock = false; if (data) { bestPos = it->first; @@ -3584,7 +3597,7 @@ void Buffer::getSourceCode(odocstream & os, string const & format, setMathFlavor(runparams); xhtmlParagraphs(text(), *this, xs, runparams); } else if (runparams.flavor == OutputParams::TEXT) { - bool dummy; + bool dummy = false; // FIXME Handles only one paragraph, unlike the others. // Probably should have some routine with a signature like them. writePlaintextParagraph(*this,