]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
Try another way to signal a false positive to coverity
[lyx.git] / src / Buffer.cpp
index 09b7b4a24c09c655645b005082c9bf77f399b3b2..86da237eec9bb3736dfa9f573b0064a287b7884f 100644 (file)
@@ -423,7 +423,8 @@ Buffer::Impl::Impl(Buffer * owner, FileName const & file, bool readonly_,
          checksum_(0), wa_(0),  gui_(0), undo_(*owner), bibinfo_cache_valid_(false),
          bibfile_cache_valid_(false), cite_labels_valid_(false), preview_error_(false),
          inset(0), preview_loader_(0), cloned_buffer_(cloned_buffer),
-         clone_list_(0), doing_export(false), parent_buffer(0),
+         clone_list_(0), doing_export(false),
+         tracked_changes_present_(0), parent_buffer(0),
          word_count_(0), char_count_(0), blank_count_(0)
 {
        if (!cloned_buffer_) {
@@ -912,6 +913,10 @@ int Buffer::readHeader(Lexer & lex)
        params().output_sync_macro.erase();
        params().setLocalLayout(docstring(), false);
        params().setLocalLayout(docstring(), true);
+       params().biblio_opts.erase();
+       params().biblatex_bibstyle.erase();
+       params().biblatex_citestyle.erase();
+       params().multibib.erase();
 
        for (int i = 0; i < 4; ++i) {
                params().user_defined_bullet(i) = ITEMIZE_DEFAULTS[i];
@@ -2529,7 +2534,8 @@ bool Buffer::getStatus(FuncRequest const & cmd, FuncStatus & flag)
                        enable = true;
                        break;
                }
-               string format = to_utf8(arg);
+               string format =
+                       arg.empty() ? params().getDefaultOutputFormat() : to_utf8(arg);
                size_t pos = format.find(' ');
                if (pos != string::npos)
                        format = format.substr(0, pos);
@@ -2637,11 +2643,13 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
                break;
 
        case LFUN_BUFFER_EXPORT: {
-               ExportStatus const status = doExport(argument, false);
+               string const format =
+                       argument.empty() ? params().getDefaultOutputFormat() : argument;
+               ExportStatus const status = doExport(format, false);
                dr.setError(status != ExportSuccess);
                if (status != ExportSuccess)
                        dr.setMessage(bformat(_("Error exporting to format: %1$s."),
-                                             func.argument()));
+                                             from_utf8(format)));
                break;
        }
 
@@ -4637,7 +4645,7 @@ Buffer::ReadStatus Buffer::loadThisLyXFile(FileName const & fn)
 void Buffer::bufferErrors(TeXErrors const & terr, ErrorList & errorList) const
 {
        for (auto const & err : terr) {
-               TexRow::TextEntry start, end = TexRow::text_none;
+               TexRow::TextEntry start = TexRow::text_none, end = TexRow::text_none;
                int errorRow = err.error_in_line;
                Buffer const * buf = 0;
                Impl const * p = d;
@@ -4730,14 +4738,16 @@ void Buffer::updateBuffer(UpdateScope scope, UpdateType utype) const
        ParIterator parit = cbuf.par_iterator_begin();
        updateBuffer(parit, utype);
 
+       /// FIXME: Perf
+       /// Update the tocBackend for any buffer. The outliner uses the master's,
+       /// and the navigation menu uses the child's.
+       cbuf.tocBackend().update(true, utype);
+
        if (master != this)
-               // TocBackend update will be done later.
                return;
 
        d->bibinfo_cache_valid_ = true;
        d->cite_labels_valid_ = true;
-       /// FIXME: Perf
-       cbuf.tocBackend().update(true, utype);
        if (scope == UpdateMaster)
                cbuf.structureChanged();
 }