Re: knitr and Sweave security
I learned \write18 from a quick search: http://stackoverflow.com/questions/3252957/how-to-execute-shell-script-from-latex Security problems exist in most software packages. In this case (knitr/Sweave), a pure technical solution does not seem to be possible... Sometimes I do want to execute system() commands. Regards, Yihui -- Yihui Xie xieyi...@gmail.com Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Sun, Oct 21, 2012 at 1:54 AM, Liviu Andronic landronim...@gmail.com wrote: On Sun, Oct 21, 2012 at 6:55 AM, Yihui Xie x...@yihui.name wrote: The blacklist-based solution can stop nothing as you showed, so I think we cannot do much except writing it in the documentation. What about an MS Excel style 'Do not execute scripts' option or dialogue? Basically we could introduce two modes when Sweave/knitr module is loaded: - Run scripts, all works as it does now. - Do not run scripts, where the scripty modules are being disabled (or similar) and some flag is being displayed somewhere, perhaps in the status bar (or the WM title bar). If scripts are detected then a dialogue pops up with a warning and asks the user how to proceed. This should provide a minimum of security. What do you think of this? Regards Liviu PS While we're on the subject of security, is it not possible to simply use LaTeX to write malicious code?
Re: Press about LyX
Jürgen Spitzmüller sp...@lyx.org writes: | Jerry wrote: Who among the LyX developers has the power to edit the press page, http://www.lyx.org/PressAboutLyX? Daniel has written an article about LyX for the HowToAnswer web site and would like to get it linked from the LyX press page. Surely this benefits the LyX community as well. | I've added it. Thanks for the review. I put it on G+ as well. -- Lgb
Re: branch warnings
Jean-Marc Lasgouttes lasgout...@lyx.org writes: | Le 09/10/2012 20:49, Lars Gullik Bjønnes a écrit : Jürgen Spitzmüller sp...@lyx.org writes: | Jean-Marc Lasgouttes wrote: ../boost/boost/config/stdlib/libstdcpp3.hpp:42:0: warning: BOOST_DISABLE_THREADS redefined [enabled by default] In file included from BiblioInfo.cpp:13:0: ../config.h:628:0: note: this is the location of the previous definition Is it only on branch? | Yes, I only see it on branch. Is branch the only place where you do --without-included-boost? | Actually, branch and trunk do not have the same boost version AFAIK | (1.43 vs 1.49). Then I think you should check the (generated) dependency files to see that you do not drag in unwanted (system) boost headers. Can be the case of missing files in the in-lyx boost copy. -- Lgb
Tests in cmake build
The target `test' should now emit output equivalent to the following: ... Running tests... /usr/bin/ctest --force-new-ctest-process Test project /usr/BUILD/BuildLyxGit Start 1: build_convert 1/11 Test #1: build_convert Passed0.49 sec Start 2: data_convert 2/11 Test #2: data_convert . Passed0.00 sec Start 3: compare_convert 3/11 Test #3: compare_convert .. Passed0.01 sec Start 4: build_filetools 4/11 Test #4: build_filetools .. Passed0.53 sec Start 5: data_filetools 5/11 Test #5: data_filetools ... Passed0.01 sec Start 6: compare_filetools 6/11 Test #6: compare_filetools Passed0.01 sec Start 7: build_lstrings 7/11 Test #7: build_lstrings ... Passed0.49 sec Start 8: data_lstrings 8/11 Test #8: data_lstrings Passed0.00 sec Start 9: compare_lstrings 9/11 Test #9: compare_lstrings . Passed0.01 sec Start 10: build_tex2lyx 10/11 Test #10: build_tex2lyx Passed0.94 sec Start 11: roundtrip_tex2lyx 11/11 Test #11: roundtrip_tex2lyx Passed5.33 sec 100% tests passed, 0 tests failed out of 11 Total Test time (real) = 7.82 sec ... build_convert: builds the check_convert executable data_convert: runs check_convert and creates the data compare_convert: compare the data from check_convert with revisioned file ... build_tex2lyx: builds tex2lyx roundtrip_tex2lyx: runs the script `runtests.py' The output of tests should be found in the build-dir under `Testing/Temporary/LastTest.log' Kornel signature.asc Description: This is a digitally signed message part.
Re: knitr and Sweave security
On Sun, Oct 21, 2012 at 3:08 AM, Yihui Xie x...@yihui.name wrote: I learned \write18 from a quick search: http://stackoverflow.com/questions/3252957/how-to-execute-shell-script-from-latex I didn't know about that. Then yes, if LyX allows security problems like that from LaTeX I should not be worrying about Sweave and knitr. Here's another useful discussion http://www.texdev.net/2009/10/06/what-does-write18-mean/ And since then there are now options to enable/disable write18. See, for example http://docs.miktex.org/manual/pdftex.html --disable-write18 Disable the \write18{command} construct. But I guess this is the job of the user and depends on the LaTeX distribution installed so it's not LyX's jurisdiction. Security problems exist in most software packages. In this case (knitr/Sweave), a pure technical solution does not seem to be possible... Sometimes I do want to execute system() commands. Same here. Best, Scott Regards, Yihui -- Yihui Xie xieyi...@gmail.com Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Sun, Oct 21, 2012 at 1:54 AM, Liviu Andronic landronim...@gmail.com wrote: On Sun, Oct 21, 2012 at 6:55 AM, Yihui Xie x...@yihui.name wrote: The blacklist-based solution can stop nothing as you showed, so I think we cannot do much except writing it in the documentation. What about an MS Excel style 'Do not execute scripts' option or dialogue? Basically we could introduce two modes when Sweave/knitr module is loaded: - Run scripts, all works as it does now. - Do not run scripts, where the scripty modules are being disabled (or similar) and some flag is being displayed somewhere, perhaps in the status bar (or the WM title bar). If scripts are detected then a dialogue pops up with a warning and asks the user how to proceed. This should provide a minimum of security. What do you think of this? Regards Liviu PS While we're on the subject of security, is it not possible to simply use LaTeX to write malicious code?
Re: [LyX master] Fix bug #8379: LyX Archive fails to include BibTeX files
On 10/20/2012 12:29 PM, Enrico Forestieri wrote: The branch, master, has been updated. - Log - commit f6fde4b55326c7fe3821c05d64fb00d2c36c4ef4 Author: Enrico Forestieri for...@lyx.org Date: Sat Oct 20 18:27:35 2012 +0200 Fix bug #8379: LyX Archive fails to include BibTeX files Good for branch. rh
[PATCH 01/13] Buffer.cpp: drop unused stack
--- src/Buffer.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 8b052ad..ebc5d3a 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -113,7 +113,6 @@ #include map #include set #include sstream -#include stack #include vector using namespace std; -- 1.8.0.rc3.16.g8ead1bf
[PATCH 02/13] WS cleanup, remove extraeneous spaces
--- src/BufferParams.h | 2 +- src/CutAndPaste.cpp | 2 +- src/LyX.h | 3 +-- src/graphics/GraphicsLoader.cpp | 5 ++--- src/tex2lyx/tex2lyx.cpp | 4 ++-- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/BufferParams.h b/src/BufferParams.h index 306e5bc..98f79a5 100644 --- a/src/BufferParams.h +++ b/src/BufferParams.h @@ -134,7 +134,7 @@ public: DocumentClass const documentClass() const; /// \return A pointer to the DocumentClass currently in use: the BaseClass /// as modified by modules. - DocumentClassConstPtr documentClassPtr() const; + DocumentClassConstPtr documentClassPtr() const; /// This bypasses the baseClass and sets the textClass directly. /// Should be called with care and would be better not being here, /// but it seems to be needed by CutAndPaste::putClipboard(). diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp index 4b95b9b..9a336a1 100644 --- a/src/CutAndPaste.cpp +++ b/src/CutAndPaste.cpp @@ -631,7 +631,7 @@ bool multipleCellsSelected(Cursor const cur) } -void switchBetweenClasses(DocumentClassConstPtr oldone, +void switchBetweenClasses(DocumentClassConstPtr oldone, DocumentClassConstPtr newone, InsetText in, ErrorList errorlist) { errorlist.clear(); diff --git a/src/LyX.h b/src/LyX.h index af43edc..70b8b7e 100644 --- a/src/LyX.h +++ b/src/LyX.h @@ -144,7 +144,7 @@ private: friend Messages const getGuiMessages(); friend KeyMap theTopLevelKeymap(); friend Movers theMovers(); - friend Mover const getMover(std::string const fmt); + friend Mover const getMover(std::string const fmt); friend void setMover(std::string const fmt, std::string const command); friend Movers theSystemMovers(); friend frontend::Application * theApp(); @@ -180,4 +180,3 @@ void dispatch(FuncRequest const action, DispatchResult dr); } // namespace lyx #endif // LYX_H - diff --git a/src/graphics/GraphicsLoader.cpp b/src/graphics/GraphicsLoader.cpp index 36f2839..bd81a50 100644 --- a/src/graphics/GraphicsLoader.cpp +++ b/src/graphics/GraphicsLoader.cpp @@ -96,11 +96,10 @@ void LoaderQueue::loadNext() if (ptr-status() == WaitingToLoad) ptr-startLoading(); } - if (!cache_queue_.empty()) { + if (!cache_queue_.empty()) startLoader(); - } else { + else stopLoader(); - } } diff --git a/src/tex2lyx/tex2lyx.cpp b/src/tex2lyx/tex2lyx.cpp index 360c126..7bac21e 100644 --- a/src/tex2lyx/tex2lyx.cpp +++ b/src/tex2lyx/tex2lyx.cpp @@ -254,7 +254,7 @@ bool checkModule(string const name, bool command) // This is needed since a module cannot be read on its own, only as // part of a document class. LayoutFile const baseClass = LayoutFileList::get()[textclass.name()]; - typedef mapstring, DocumentClassPtr ModuleMap; + typedef mapstring, DocumentClassPtr ModuleMap; static ModuleMap modules; static bool init = true; if (init) { @@ -289,7 +289,7 @@ bool checkModule(string const name, bool command) continue; if (findInsetLayoutWithoutModule(textclass, name, command)) continue; - DocumentClassConstPtr c = it-second; + DocumentClassConstPtr c = it-second; Layout const * layout = findLayoutWithoutModule(*c, name, command); InsetLayout const * insetlayout = layout ? 0 : findInsetLayoutWithoutModule(*c, name, command); -- 1.8.0.rc3.16.g8ead1bf
[PATCH 06/13] src/graphics/GraphicsLoader: use boost::scoped_ptr to hold the pimpl
--- src/graphics/GraphicsLoader.cpp | 1 - src/graphics/GraphicsLoader.h | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/graphics/GraphicsLoader.cpp b/src/graphics/GraphicsLoader.cpp index bd81a50..8f3a4cf 100644 --- a/src/graphics/GraphicsLoader.cpp +++ b/src/graphics/GraphicsLoader.cpp @@ -230,7 +230,6 @@ Loader::Loader(Loader const other) Loader::~Loader() { - delete pimpl_; } diff --git a/src/graphics/GraphicsLoader.h b/src/graphics/GraphicsLoader.h index 6521850..3258726 100644 --- a/src/graphics/GraphicsLoader.h +++ b/src/graphics/GraphicsLoader.h @@ -27,6 +27,7 @@ #include GraphicsTypes.h #include boost/signal.hpp +#include boost/smart_ptr/scoped_ptr.hpp namespace lyx { @@ -105,7 +106,7 @@ private: /// Use the Pimpl idiom to hide the internals. class Impl; /// The pointer never changes although *pimpl_'s contents may. - Impl * const pimpl_; + boost::scoped_ptrImpl pimpl_; }; } // namespace graphics -- 1.8.0.rc3.16.g8ead1bf
[PATCH 04/13] src/graphics/GraphicsCache: use boost::scoped_ptr to hold the pimpl
--- src/graphics/GraphicsCache.cpp | 1 - src/graphics/GraphicsCache.h | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/graphics/GraphicsCache.cpp b/src/graphics/GraphicsCache.cpp index d508563..f9eee10 100644 --- a/src/graphics/GraphicsCache.cpp +++ b/src/graphics/GraphicsCache.cpp @@ -59,7 +59,6 @@ Cache::Cache() Cache::~Cache() { - delete pimpl_; } diff --git a/src/graphics/GraphicsCache.h b/src/graphics/GraphicsCache.h index e6d810f..c66f72f 100644 --- a/src/graphics/GraphicsCache.h +++ b/src/graphics/GraphicsCache.h @@ -22,6 +22,8 @@ #include support/shared_ptr.h +#include boost/smart_ptr/scoped_ptr.hpp + #include vector #include string @@ -84,7 +86,7 @@ private: /// Use the Pimpl idiom to hide the internals. class Impl; /// The pointer never changes although *pimpl_'s contents may. - Impl * const pimpl_; + boost::scoped_ptrImpl pimpl_; }; } // namespace graphics -- 1.8.0.rc3.16.g8ead1bf
Re: [PATCH 01/13] Buffer.cpp: drop unused stack
This patch, and the others I saw, make sense. However, I only see numbers 1, 2, 4 and 6 (of supposedly 13 parts). JMarc
[PATCH 12/13] graphics/GraphicsImage.h: let newImage and Image::clone return a shared_ptr
--- src/frontends/qt4/GuiImage.cpp | 8 src/frontends/qt4/GuiImage.h | 2 +- src/graphics/GraphicsCacheItem.cpp | 2 +- src/graphics/GraphicsImage.h | 5 +++-- src/graphics/GraphicsLoader.cpp| 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/frontends/qt4/GuiImage.cpp b/src/frontends/qt4/GuiImage.cpp index 503ad52..f1643db 100644 --- a/src/frontends/qt4/GuiImage.cpp +++ b/src/frontends/qt4/GuiImage.cpp @@ -32,9 +32,9 @@ namespace lyx { namespace graphics { /// Implement factory method defined in GraphicsImage.h -Image * newImage() +shared_ptrImage newImage() { - return new GuiImage; + return make_sharedGuiImage(); } @@ -49,9 +49,9 @@ GuiImage::GuiImage(GuiImage const other) {} -Image * GuiImage::clone() const +shared_ptrImage GuiImage::clone() const { - return new GuiImage(*this); + return make_sharedGuiImage(*this); } diff --git a/src/frontends/qt4/GuiImage.h b/src/frontends/qt4/GuiImage.h index 6f60644..9e97241 100644 --- a/src/frontends/qt4/GuiImage.h +++ b/src/frontends/qt4/GuiImage.h @@ -34,7 +34,7 @@ public: private: /// Create a copy - Image * clone() const; + shared_ptrImage clone() const; /// Get the image width unsigned int width() const; /// Get the image height diff --git a/src/graphics/GraphicsCacheItem.cpp b/src/graphics/GraphicsCacheItem.cpp index 46b76c5..996b0b5 100644 --- a/src/graphics/GraphicsCacheItem.cpp +++ b/src/graphics/GraphicsCacheItem.cpp @@ -292,7 +292,7 @@ bool CacheItem::Impl::loadImage() { LYXERR(Debug::GRAPHICS, Loading image.); - image_.reset(newImage()); + image_ = newImage(); bool success = image_-load(file_to_load_); string const text = success ? succeeded : failed; diff --git a/src/graphics/GraphicsImage.h b/src/graphics/GraphicsImage.h index 5488a76..b0d93b4 100644 --- a/src/graphics/GraphicsImage.h +++ b/src/graphics/GraphicsImage.h @@ -25,6 +25,7 @@ #define GRAPHICSIMAGE_H #include Dimension.h +#include support/shared_ptr.h namespace lyx { @@ -40,7 +41,7 @@ public: virtual ~Image() {} /// Create a copy - virtual Image * clone() const = 0; + virtual shared_ptrImage clone() const = 0; /// Get the image width virtual unsigned int width() const = 0; @@ -66,7 +67,7 @@ public: /// Only way to create a new Image. /// Implemented in the frontend. -Image * newImage(); +shared_ptrImage newImage(); } // namespace graphics } // namespace lyx diff --git a/src/graphics/GraphicsLoader.cpp b/src/graphics/GraphicsLoader.cpp index 5260d50..89c1440 100644 --- a/src/graphics/GraphicsLoader.cpp +++ b/src/graphics/GraphicsLoader.cpp @@ -429,7 +429,7 @@ void Loader::Impl::createPixmap() return; } - image_.reset(cached_item_-image()-clone()); + image_ = cached_item_-image()-clone(); bool const success = image_-setPixmap(params_); -- 1.8.0.rc3.16.g8ead1bf
[PATCH 11/13] Use make_shared to create shared_ptr
Using std::make_shared (and in our case for the time being boost::make_shared) is the preferred way of creating a std::shared_ptr. This is mainly due to two aspects: - half the number of allocations required - potential of using less space, and better locality Also a failed creation of the reference counted part of the object will not make you leak the memory of the pointer object you just passed to the share_ptr member function. (i.e. exception in the shared_ptr member function). --- src/KeyMap.cpp | 2 +- src/OutputParams.cpp | 2 +- src/ServerSocket.cpp | 2 +- src/TextClass.cpp | 5 +++-- src/graphics/GraphicsCache.cpp | 2 +- src/graphics/PreviewLoader.cpp | 4 ++-- src/insets/InsetNote.cpp | 6 +++--- src/insets/InsetTabular.cpp| 8 src/support/ForkedCalls.cpp| 5 ++--- src/support/ForkedCalls.h | 2 +- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/KeyMap.cpp b/src/KeyMap.cpp index 50833c9..f2cecc8 100644 --- a/src/KeyMap.cpp +++ b/src/KeyMap.cpp @@ -141,7 +141,7 @@ void KeyMap::bind(KeySequence * seq, FuncRequest const func, unsigned int r) newone-func.setOrigin(FuncRequest::KEYBOARD); newone-prefixes.reset(); } else { - newone-prefixes.reset(new KeyMap); + newone-prefixes = make_sharedKeyMap(); newone-prefixes-bind(seq, func, r + 1); } } diff --git a/src/OutputParams.cpp b/src/OutputParams.cpp index f8af8ad..163622d 100644 --- a/src/OutputParams.cpp +++ b/src/OutputParams.cpp @@ -23,7 +23,7 @@ OutputParams::OutputParams(Encoding const * enc) moving_arg(false), inulemcmd(false), local_font(0), master_language(0), encoding(enc), free_spacing(false), use_babel(false), use_polyglossia(false), use_indices(false), use_japanese(false), linelen(0), depth(0), - exportdata(new ExportData), + exportdata(make_sharedExportData()), inComment(false), inTableCell(NO), inFloat(NONFLOAT), inIndexEntry(false), inIPA(false), inDeletedInset(0), changeOfDeletedInset(Change::UNCHANGED), diff --git a/src/ServerSocket.cpp b/src/ServerSocket.cpp index 4c34212..b18c837 100644 --- a/src/ServerSocket.cpp +++ b/src/ServerSocket.cpp @@ -112,7 +112,7 @@ void ServerSocket::serverCallback() // Register the new client. clients[client_fd] = - shared_ptrLyXDataSocket(new LyXDataSocket(client_fd)); + make_sharedLyXDataSocket(client_fd); theApp()-registerSocketCallback( client_fd, bind(ServerSocket::dataCallback, diff --git a/src/TextClass.cpp b/src/TextClass.cpp index 93eae96..9236ede 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -1434,8 +1434,9 @@ Layout TextClass::createBasicLayout(docstring const name, bool unknown) const DocumentClassPtr getDocumentClass( LayoutFile const baseClass, LayoutModuleList const modlist) { - DocumentClassPtr doc_class = - DocumentClassPtr(new DocumentClass(baseClass)); + // Since DocumentClass::DocumentClass(LayoutFile const ) is protected + // std::make_shared cannot be used here. + DocumentClassPtr doc_class(new DocumentClass(baseClass)); LayoutModuleList::const_iterator it = modlist.begin(); LayoutModuleList::const_iterator en = modlist.end(); for (; it != en; ++it) { diff --git a/src/graphics/GraphicsCache.cpp b/src/graphics/GraphicsCache.cpp index f9eee10..97a0c88 100644 --- a/src/graphics/GraphicsCache.cpp +++ b/src/graphics/GraphicsCache.cpp @@ -112,7 +112,7 @@ void Cache::add(FileName const file) const return; } - pimpl_-cache[file] = ItemPtr(new CacheItem(file)); + pimpl_-cache[file] = make_sharedCacheItem(file); } diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp index 6185681..82fb7ca 100644 --- a/src/graphics/PreviewLoader.cpp +++ b/src/graphics/PreviewLoader.cpp @@ -627,7 +627,7 @@ void PreviewLoader::Impl::startLoading(bool wait) // Initiate the conversion from LaTeX to bitmap images files. ForkedCall::SignalTypePtr - convert_ptr(new ForkedCall::SignalType); + convert_ptr = make_sharedForkedCall::SignalType(); convert_ptr-connect(bind(Impl::finishedGenerating, this, _1, _2)); ForkedCall call(buffer_.filePath()); @@ -683,7 +683,7 @@ void PreviewLoader::Impl::finishedGenerating(pid_t pid, int retval) // Add the image to the cache only if it's actually present if (file.isReadableFile()) { - PreviewImagePtr ptr(new PreviewImage(parent_, snip, file, af)); + PreviewImagePtr ptr = make_sharedPreviewImage(boost::ref(parent_), snip, file, af); cache_[snip] = ptr;
Re: [PATCH 01/13] Buffer.cpp: drop unused stack
Jean-Marc Lasgouttes lasgout...@lyx.org writes: | This patch, and the others I saw, make sense. However, I only see | numbers 1, 2, 4 and 6 (of supposedly 13 parts). For some reason the seem to be trickling in. I'll resend the missing once if they do no show up. -- Lgb
[PATCH 13/13] boost: changes to make it compile cleanly with gcc 4.8
--- boost/boost/lexical_cast.hpp | 1 - boost/boost/math/special_functions/fpclassify.hpp | 4 boost/boost/math/special_functions/sign.hpp | 2 -- boost/boost/regex/v4/regex_format.hpp | 2 -- boost/boost/regex/v4/regex_split.hpp | 1 - boost/boost/static_assert.hpp | 2 +- boost/boost/tuple/detail/tuple_basic.hpp | 1 - 7 files changed, 1 insertion(+), 12 deletions(-) diff --git a/boost/boost/lexical_cast.hpp b/boost/boost/lexical_cast.hpp index 5a3d4f0..17ce576 100644 --- a/boost/boost/lexical_cast.hpp +++ b/boost/boost/lexical_cast.hpp @@ -626,7 +626,6 @@ namespace boost #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS BOOST_STATIC_ASSERT(!std::numeric_limitsT::is_signed); #endif -typedef typename Traits::int_type int_type; CharT const czero = lcast_char_constantsCharT::zero; --end; value = 0; diff --git a/boost/boost/math/special_functions/fpclassify.hpp b/boost/boost/math/special_functions/fpclassify.hpp index 2abec5f..3ec1d71 100644 --- a/boost/boost/math/special_functions/fpclassify.hpp +++ b/boost/boost/math/special_functions/fpclassify.hpp @@ -311,7 +311,6 @@ inline bool (isfinite)(T x) { //! \brief return true if floating-point type t is finite. typedef typename detail::fp_traitsT::type traits; typedef typename traits::method method; - typedef typename boost::is_floating_pointT::type fp_tag; return detail::isfinite_impl(x, method()); } @@ -370,7 +369,6 @@ inline bool (isnormal)(T x) { typedef typename detail::fp_traitsT::type traits; typedef typename traits::method method; - typedef typename boost::is_floating_pointT::type fp_tag; return detail::isnormal_impl(x, method()); } @@ -447,7 +445,6 @@ inline bool (isinf)(T x) { typedef typename detail::fp_traitsT::type traits; typedef typename traits::method method; - typedef typename boost::is_floating_pointT::type fp_tag; return detail::isinf_impl(x, method()); } @@ -516,7 +513,6 @@ templateclass T bool (isnan)(T x) { //! \brief return true if floating-point type t is NaN (Not A Number). typedef typename detail::fp_traitsT::type traits; typedef typename traits::method method; - typedef typename boost::is_floating_pointT::type fp_tag; return detail::isnan_impl(x, method()); } diff --git a/boost/boost/math/special_functions/sign.hpp b/boost/boost/math/special_functions/sign.hpp index 6de88b2..feab787 100644 --- a/boost/boost/math/special_functions/sign.hpp +++ b/boost/boost/math/special_functions/sign.hpp @@ -110,7 +110,6 @@ templateclass T int (signbit)(T x) { typedef typename detail::fp_traitsT::type traits; typedef typename traits::method method; - typedef typename boost::is_floating_pointT::type fp_tag; return detail::signbit_impl(x, method()); } @@ -124,7 +123,6 @@ templateclass T T (changesign)(const T x) { //! \brief return unchanged binary pattern of x, except for change of sign bit. typedef typename detail::fp_traitsT::sign_change_type traits; typedef typename traits::method method; - typedef typename boost::is_floating_pointT::type fp_tag; return detail::changesign_impl(x, method()); } diff --git a/boost/boost/regex/v4/regex_format.hpp b/boost/boost/regex/v4/regex_format.hpp index e05862f..d2ac6b9 100644 --- a/boost/boost/regex/v4/regex_format.hpp +++ b/boost/boost/regex/v4/regex_format.hpp @@ -1058,7 +1058,6 @@ struct format_functor_c_string template class OutputIter OutputIter operator()(const Match m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits t = Traits()) { - typedef typename Match::char_type char_type; const charT* end = func; while(*end) ++end; return regex_format_imp(i, m, func, end, f, t); @@ -1077,7 +1076,6 @@ struct format_functor_container template class OutputIter OutputIter operator()(const Match m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits t = Traits()) { - typedef typename Match::char_type char_type; return re_detail::regex_format_imp(i, m, func.begin(), func.end(), f, t); } private: diff --git a/boost/boost/regex/v4/regex_split.hpp b/boost/boost/regex/v4/regex_split.hpp index a7ae350..dc3e43e 100644 --- a/boost/boost/regex/v4/regex_split.hpp +++ b/boost/boost/regex/v4/regex_split.hpp @@ -107,7 +107,6 @@ std::size_t regex_split(OutputIterator out, std::size_t max_split) { typedef typename std::basic_stringcharT, Traits1, Alloc1::const_iterator ci_t; - typedef typename match_resultsci_t::allocator_type match_allocator; ci_t last = s.begin(); std::size_t init_size = max_split; re_detail::split_predOutputIterator, charT, Traits1, Alloc1 pred(last, out, max_split); diff --git a/boost/boost/static_assert.hpp b/boost/boost/static_assert.hpp index 9fe9bc0..4522d01 100644 ---
[PATCH 08/13] support/shared_ptr.h: drop support of TR1 smart pointers
--- src/support/shared_ptr.h | 19 --- 1 file changed, 19 deletions(-) diff --git a/src/support/shared_ptr.h b/src/support/shared_ptr.h index 69e42da..792beb2 100644 --- a/src/support/shared_ptr.h +++ b/src/support/shared_ptr.h @@ -12,22 +12,6 @@ #ifndef LYX_SHARED_PTR_H #define LYX_SHARED_PTR_H -#ifdef LYX_USE_TR1 - -#include memory - -#ifdef __GNUC__ -#include tr1/memory -#endif - -namespace lyx -{ - using std::tr1::shared_ptr; - using std::tr1::const_pointer_cast; -} - -#else - #include boost/shared_ptr.hpp namespace lyx @@ -37,6 +21,3 @@ namespace lyx } #endif - - -#endif -- 1.8.0.rc3.16.g8ead1bf
[PATCH 05/13] src/graphics/GraphicsCacheItem: use boost::scoped_ptr to hold the pimpl
--- src/graphics/GraphicsCacheItem.cpp | 1 - src/graphics/GraphicsCacheItem.h | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/graphics/GraphicsCacheItem.cpp b/src/graphics/GraphicsCacheItem.cpp index fafa78b..60477cc 100644 --- a/src/graphics/GraphicsCacheItem.cpp +++ b/src/graphics/GraphicsCacheItem.cpp @@ -130,7 +130,6 @@ CacheItem::CacheItem(FileName const file) CacheItem::~CacheItem() { - delete pimpl_; } diff --git a/src/graphics/GraphicsCacheItem.h b/src/graphics/GraphicsCacheItem.h index 481e4b1..51f97d5 100644 --- a/src/graphics/GraphicsCacheItem.h +++ b/src/graphics/GraphicsCacheItem.h @@ -31,6 +31,7 @@ #include GraphicsTypes.h #include boost/signal.hpp +#include boost/smart_ptr/scoped_ptr.hpp namespace lyx { @@ -98,7 +99,7 @@ private: /// Use the Pimpl idiom to hide the internals. class Impl; /// The pointer never changes although *pimpl_'s contents may. - Impl * const pimpl_; + boost::scoped_ptrImpl const pimpl_; }; } // namespace graphics -- 1.8.0.rc3.16.g8ead1bf
[PATCH 09/13] support/shared_ptr.h: introduce boost::make_shared into ns lyx
--- src/support/shared_ptr.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/support/shared_ptr.h b/src/support/shared_ptr.h index 792beb2..3aa6492 100644 --- a/src/support/shared_ptr.h +++ b/src/support/shared_ptr.h @@ -12,12 +12,13 @@ #ifndef LYX_SHARED_PTR_H #define LYX_SHARED_PTR_H -#include boost/shared_ptr.hpp +#include boost/make_shared.hpp namespace lyx { using boost::shared_ptr; using boost::const_pointer_cast; + using boost::make_shared; } #endif -- 1.8.0.rc3.16.g8ead1bf
[PATCH 10/13] More idiomatic way of checking if a shared_ptr has an associated managed object
--- src/KeyMap.cpp | 17 - src/frontends/qt4/LayoutBox.cpp| 4 ++-- src/graphics/GraphicsCacheItem.cpp | 2 +- src/graphics/GraphicsLoader.cpp| 22 +++--- src/support/ForkedCalls.cpp| 2 +- 5 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/KeyMap.cpp b/src/KeyMap.cpp index ffd55c4..50833c9 100644 --- a/src/KeyMap.cpp +++ b/src/KeyMap.cpp @@ -115,13 +115,12 @@ void KeyMap::bind(KeySequence * seq, FuncRequest const func, unsigned int r) LYXERR(Debug::KBMAP, Warning: New binding for ' to_utf8(seq-print(KeySequence::Portable)) ' is overriding old binding...); - if (it-prefixes.get()) { + if (it-prefixes) it-prefixes.reset(); - } it-func = func; it-func.setOrigin(FuncRequest::KEYBOARD); return; - } else if (!it-prefixes.get()) { + } else if (!it-prefixes) { lyxerr Error: New binding for ' to_utf8(seq-print(KeySequence::Portable)) ' is overriding old binding... @@ -168,10 +167,10 @@ void KeyMap::unbind(KeySequence * seq, FuncRequest const func, unsigned int r) if (r + 1 == seq-length()) { if (it-func == func) { remove = it; - if (it-prefixes.get()) + if (it-prefixes) it-prefixes.reset(); } - } else if (it-prefixes.get()) { + } else if (it-prefixes) { it-prefixes-unbind(seq, func, r + 1); if (it-prefixes-empty()) remove = it; @@ -201,7 +200,7 @@ FuncRequest KeyMap::getBinding(KeySequence const seq, unsigned int r) mod2 == it-mod.second) { if (r + 1 == seq.length()) return it-func; - else if (it-prefixes.get()) + else if (it-prefixes) return it-prefixes-getBinding(seq, r + 1); } } @@ -441,7 +440,7 @@ FuncRequest const KeyMap::lookup(KeySymbol const key, if (cit-code == key cit-mod.first == check) { // match found - if (cit-prefixes.get()) { + if (cit-prefixes) { // this is a prefix key - set new map seq-curmap = cit-prefixes.get(); static FuncRequest prefix(LFUN_COMMAND_PREFIX); @@ -507,7 +506,7 @@ KeyMap::Bindings KeyMap::findBindings(FuncRequest const func, Table::const_iterator end = table.end(); for (Table::const_iterator cit = table.begin(); cit != end; ++cit) { - if (cit-prefixes.get()) { + if (cit-prefixes) { KeySequence seq = prefix; seq.addkey(cit-code, cit-mod.first); Bindings res2 = cit-prefixes-findBindings(func, seq); @@ -555,7 +554,7 @@ void KeyMap::listBindings(BindingList list, Table::const_iterator it_end = table.end(); for (; it != it_end; ++it) { // a LFUN_COMMAND_PREFIX - if (it-prefixes.get()) { + if (it-prefixes) { KeySequence seq = prefix; seq.addkey(it-code, it-mod.first); it-prefixes-listBindings(list, seq, tag); diff --git a/src/frontends/qt4/LayoutBox.cpp b/src/frontends/qt4/LayoutBox.cpp index aa22e60..e11a63d 100644 --- a/src/frontends/qt4/LayoutBox.cpp +++ b/src/frontends/qt4/LayoutBox.cpp @@ -536,7 +536,7 @@ void LayoutBox::set(docstring const layout) { d-resetFilter(); - if (!d-text_class_.get()) + if (!d-text_class_) return; if (!d-text_class_-hasLayout(layout)) @@ -691,7 +691,7 @@ void LayoutBox::selected(int index) d-model_-itemFromIndex(mindex)-text()); d-owner_.setFocus(); - if (!d-text_class_.get()) { + if (!d-text_class_) { updateContents(false); d-resetFilter(); return; diff --git a/src/graphics/GraphicsCacheItem.cpp b/src/graphics/GraphicsCacheItem.cpp index 60477cc..46b76c5 100644 --- a/src/graphics/GraphicsCacheItem.cpp +++
[PATCH 03/13] src/Lyx: use boost::scoped_ptr to hold the pimpl
--- src/LyX.cpp | 5 + src/LyX.h | 3 ++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/LyX.cpp b/src/LyX.cpp index 722f040..03caff3 100644 --- a/src/LyX.cpp +++ b/src/LyX.cpp @@ -64,7 +64,6 @@ #include support/Systemcall.h #include support/bind.h -#include boost/scoped_ptr.hpp #include algorithm #include iostream @@ -217,7 +216,6 @@ frontend::Application * theApp() LyX::~LyX() { - delete pimpl_; singleton_ = 0; WordList::cleanupWordLists(); } @@ -244,10 +242,9 @@ void lyx_exit(int exit_code) LyX::LyX() - : first_start(false) + : pimpl_(new Impl), first_start(false) { singleton_ = this; - pimpl_ = new Impl; } diff --git a/src/LyX.h b/src/LyX.h index 70b8b7e..97c9b4a 100644 --- a/src/LyX.h +++ b/src/LyX.h @@ -16,6 +16,7 @@ #include support/strfwd.h +#include boost/scoped_ptr.hpp #include vector namespace lyx { @@ -126,7 +127,7 @@ private: /// Use the Pimpl idiom to hide the internals. // Mostly used for singletons. struct Impl; - Impl * pimpl_; + boost::scoped_ptrstruct Impl pimpl_; /// has this user started lyx for the first time? bool first_start; -- 1.8.0.rc3.16.g8ead1bf
[PATCH 07/13] graphics/GraphicsLoader.cpp: use !empty() to check for non-emptyness not size()
--- src/graphics/GraphicsLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/graphics/GraphicsLoader.cpp b/src/graphics/GraphicsLoader.cpp index 8f3a4cf..04dd7bd 100644 --- a/src/graphics/GraphicsLoader.cpp +++ b/src/graphics/GraphicsLoader.cpp @@ -89,7 +89,7 @@ void LoaderQueue::loadNext() LYXERR(Debug::GRAPHICS, LoaderQueue: cache_queue_.size() items in the queue); int counter = s_numimages_; - while (cache_queue_.size() counter--) { + while (!cache_queue_.empty() counter--) { Cache::ItemPtr ptr = cache_queue_.front(); cache_set_.erase(ptr); cache_queue_.pop_front(); -- 1.8.0.rc3.16.g8ead1bf
Re: [PATCH 03/13] src/Lyx: use boost::scoped_ptr to hold the pimpl
On Sun, Oct 21, 2012 at 08:49:06PM +0200, Lars Gullik Bjønnes wrote: diff --git a/src/LyX.h b/src/LyX.h index 70b8b7e..97c9b4a 100644 --- a/src/LyX.h +++ b/src/LyX.h @@ -16,6 +16,7 @@ #include support/strfwd.h +#include boost/scoped_ptr.hpp #include vector namespace lyx { @@ -126,7 +127,7 @@ private: /// Use the Pimpl idiom to hide the internals. // Mostly used for singletons. struct Impl; - Impl * pimpl_; + boost::scoped_ptrstruct Impl pimpl_; The Empire strikes back. Bald-pointer-phobia accompanied by swift C style use of struct. What a deadly combination! Andre' PS: 1/2 ;-) for those who are missing one...
Re: [PATCH 03/13] src/Lyx: use boost::scoped_ptr to hold the pimpl
André Pönitz andre.poen...@mathematik.tu-chemnitz.de writes: | On Sun, Oct 21, 2012 at 08:49:06PM +0200, Lars Gullik Bjønnes wrote: diff --git a/src/LyX.h b/src/LyX.h index 70b8b7e..97c9b4a 100644 --- a/src/LyX.h +++ b/src/LyX.h @@ -16,6 +16,7 @@ #include support/strfwd.h +#include boost/scoped_ptr.hpp #include vector namespace lyx { @@ -126,7 +127,7 @@ private: /// Use the Pimpl idiom to hide the internals. // Mostly used for singletons. struct Impl; -Impl * pimpl_; +boost::scoped_ptrstruct Impl pimpl_; | The Empire strikes back. | Bald-pointer-phobia accompanied by swift C style | use of struct. What a deadly combination! Heh no... me writing way too much C the last years. Kindo flew out of my fingers without me even noticing. But of course it really should have been std::unique_ptr, but we are not quite there yet. As for the phobia... -- Lgb
Ad. using namespace std - ref prob in c9b9748c
It is mentioned in c9b9748c that using namespace std on msvc10 also drags in std::tr1 stuff. IMHO the soltion is not to use boost::shared_ptr etc. But to stop using using namespace std. I look briefly as to what was discussed in 2007 when the using namespace std was introduced all over, and afaikr this was done to get rid of the using std::stuff lines? Agree with the move to get rid of all the using lines, but not with the solution. IMHO a much better solution is to just use std:: prefix where required. I am willing to do the work to remove using namespace std and put std:: where required. This will also make declaration signatures cosistent with signatures on definitions, and without haveing a mixture of std:: and non-std:: in source files. -- Lgb
Re: Commercial support for LyX?
On Mon, 2012-10-22 at 02:32 +0200, Lars Gullik Bjønnes wrote: Is that what this is? http://aprenderlyx.com/ Fascinating link. It looks like a course about how to use LyX for writing a thesis. They have five or six modules which covers creating a document, typesetting a document, and entering mathematics. As part of their advanced plan, they have support via phone and email. From the video, and site, though, it looks to be editing support rather than technical support. Very interesting idea. Out of curiosity, do we have any idea how big LyX's user base really is? The other day I saw someone using it to take notes in a class, and I was elated. It's the first time I've seen someone using it in the wild where I hadn't introduced them to the program. Cheers, Rob
Re: knitr and Sweave security
I learned \write18 from a quick search: http://stackoverflow.com/questions/3252957/how-to-execute-shell-script-from-latex Security problems exist in most software packages. In this case (knitr/Sweave), a pure technical solution does not seem to be possible... Sometimes I do want to execute system() commands. Regards, Yihui -- Yihui XiePhone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Sun, Oct 21, 2012 at 1:54 AM, Liviu Andronic wrote: > On Sun, Oct 21, 2012 at 6:55 AM, Yihui Xie wrote: >> The blacklist-based solution can stop nothing as you showed, so I >> think we cannot do much except writing it in the documentation. >> > What about an MS Excel style 'Do not execute scripts' option or > dialogue? Basically we could introduce two modes when Sweave/knitr > module is loaded: > - Run scripts, all works as it does now. > - Do not run scripts, where the scripty modules are being disabled (or > similar) and some flag is being displayed somewhere, perhaps in the > status bar (or the WM title bar). > > If scripts are detected then a dialogue pops up with a warning and > asks the user how to proceed. This should provide a minimum of > security. > > What do you think of this? Regards > Liviu > > PS While we're on the subject of security, is it not possible to > simply use LaTeX to write malicious code?
Re: Press about LyX
Jürgen Spitzmüllerwrites: | Jerry wrote: >> Who among the LyX developers has the power to edit the press page, >> http://www.lyx.org/PressAboutLyX? Daniel has written an article about LyX >> for the HowToAnswer web site and would like to get it linked from the LyX >> press page. Surely this benefits the LyX community as well. > | I've added it. Thanks for the review. I put it on G+ as well. -- Lgb
Re: branch warnings
Jean-Marc Lasgoutteswrites: | Le 09/10/2012 20:49, Lars Gullik Bjønnes a écrit : >> Jürgen Spitzmüller writes: >> >> | Jean-Marc Lasgouttes wrote: > ../boost/boost/config/stdlib/libstdcpp3.hpp:42:0: warning: > "BOOST_DISABLE_THREADS" redefined [enabled by default] > In file included from BiblioInfo.cpp:13:0: > ../config.h:628:0: note: this is the location of the previous definition Is it only on branch? >>> >> | Yes, I only see it on branch. >> >> Is branch the only place where you do --without-included-boost? > | Actually, branch and trunk do not have the same boost version AFAIK | (1.43 vs 1.49). Then I think you should check the (generated) dependency files to see that you do not drag in unwanted (system) boost headers. Can be the case of missing files in the in-lyx boost copy. -- Lgb
Tests in cmake build
The target `test' should now emit output equivalent to the following: ... Running tests... /usr/bin/ctest --force-new-ctest-process Test project /usr/BUILD/BuildLyxGit Start 1: build_convert 1/11 Test #1: build_convert Passed0.49 sec Start 2: data_convert 2/11 Test #2: data_convert . Passed0.00 sec Start 3: compare_convert 3/11 Test #3: compare_convert .. Passed0.01 sec Start 4: build_filetools 4/11 Test #4: build_filetools .. Passed0.53 sec Start 5: data_filetools 5/11 Test #5: data_filetools ... Passed0.01 sec Start 6: compare_filetools 6/11 Test #6: compare_filetools Passed0.01 sec Start 7: build_lstrings 7/11 Test #7: build_lstrings ... Passed0.49 sec Start 8: data_lstrings 8/11 Test #8: data_lstrings Passed0.00 sec Start 9: compare_lstrings 9/11 Test #9: compare_lstrings . Passed0.01 sec Start 10: build_tex2lyx 10/11 Test #10: build_tex2lyx Passed0.94 sec Start 11: roundtrip_tex2lyx 11/11 Test #11: roundtrip_tex2lyx Passed5.33 sec 100% tests passed, 0 tests failed out of 11 Total Test time (real) = 7.82 sec ... build_convert: builds the check_convert executable data_convert: runs check_convert and creates the data compare_convert: compare the data from check_convert with revisioned file ... build_tex2lyx: builds tex2lyx roundtrip_tex2lyx: runs the script `runtests.py' The output of tests should be found in the build-dir under `Testing/Temporary/LastTest.log' Kornel signature.asc Description: This is a digitally signed message part.
Re: knitr and Sweave security
On Sun, Oct 21, 2012 at 3:08 AM, Yihui Xiewrote: > I learned \write18 from a quick search: > http://stackoverflow.com/questions/3252957/how-to-execute-shell-script-from-latex I didn't know about that. Then yes, if LyX allows security problems like that from LaTeX I should not be worrying about Sweave and knitr. Here's another useful discussion http://www.texdev.net/2009/10/06/what-does-write18-mean/ And since then there are now options to enable/disable write18. See, for example http://docs.miktex.org/manual/pdftex.html --disable-write18 Disable the \write18{command} construct. But I guess this is the job of the user and depends on the LaTeX distribution installed so it's not LyX's jurisdiction. > Security problems exist in most software packages. In this case > (knitr/Sweave), a pure technical solution does not seem to be > possible... Sometimes I do want to execute system() commands. Same here. Best, Scott > Regards, > Yihui > -- > Yihui Xie > Phone: 515-294-2465 Web: http://yihui.name > Department of Statistics, Iowa State University > 2215 Snedecor Hall, Ames, IA > > > On Sun, Oct 21, 2012 at 1:54 AM, Liviu Andronic > wrote: >> On Sun, Oct 21, 2012 at 6:55 AM, Yihui Xie wrote: >>> The blacklist-based solution can stop nothing as you showed, so I >>> think we cannot do much except writing it in the documentation. >>> >> What about an MS Excel style 'Do not execute scripts' option or >> dialogue? Basically we could introduce two modes when Sweave/knitr >> module is loaded: >> - Run scripts, all works as it does now. >> - Do not run scripts, where the scripty modules are being disabled (or >> similar) and some flag is being displayed somewhere, perhaps in the >> status bar (or the WM title bar). >> >> If scripts are detected then a dialogue pops up with a warning and >> asks the user how to proceed. This should provide a minimum of >> security. >> >> What do you think of this? Regards >> Liviu >> >> PS While we're on the subject of security, is it not possible to >> simply use LaTeX to write malicious code?
Re: [LyX master] Fix bug #8379: LyX Archive fails to include BibTeX files
On 10/20/2012 12:29 PM, Enrico Forestieri wrote: The branch, master, has been updated. - Log - commit f6fde4b55326c7fe3821c05d64fb00d2c36c4ef4 Author: Enrico ForestieriDate: Sat Oct 20 18:27:35 2012 +0200 Fix bug #8379: LyX Archive fails to include BibTeX files Good for branch. rh
[PATCH 01/13] Buffer.cpp: drop unused
--- src/Buffer.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 8b052ad..ebc5d3a 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -113,7 +113,6 @@ #include #include #include -#include #include using namespace std; -- 1.8.0.rc3.16.g8ead1bf
[PATCH 02/13] WS cleanup, remove extraeneous spaces
--- src/BufferParams.h | 2 +- src/CutAndPaste.cpp | 2 +- src/LyX.h | 3 +-- src/graphics/GraphicsLoader.cpp | 5 ++--- src/tex2lyx/tex2lyx.cpp | 4 ++-- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/BufferParams.h b/src/BufferParams.h index 306e5bc..98f79a5 100644 --- a/src/BufferParams.h +++ b/src/BufferParams.h @@ -134,7 +134,7 @@ public: DocumentClass const & documentClass() const; /// \return A pointer to the DocumentClass currently in use: the BaseClass /// as modified by modules. - DocumentClassConstPtr documentClassPtr() const; + DocumentClassConstPtr documentClassPtr() const; /// This bypasses the baseClass and sets the textClass directly. /// Should be called with care and would be better not being here, /// but it seems to be needed by CutAndPaste::putClipboard(). diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp index 4b95b9b..9a336a1 100644 --- a/src/CutAndPaste.cpp +++ b/src/CutAndPaste.cpp @@ -631,7 +631,7 @@ bool multipleCellsSelected(Cursor const & cur) } -void switchBetweenClasses(DocumentClassConstPtr oldone, +void switchBetweenClasses(DocumentClassConstPtr oldone, DocumentClassConstPtr newone, InsetText & in, ErrorList & errorlist) { errorlist.clear(); diff --git a/src/LyX.h b/src/LyX.h index af43edc..70b8b7e 100644 --- a/src/LyX.h +++ b/src/LyX.h @@ -144,7 +144,7 @@ private: friend Messages const & getGuiMessages(); friend KeyMap & theTopLevelKeymap(); friend Movers & theMovers(); - friend Mover const & getMover(std::string const & fmt); + friend Mover const & getMover(std::string const & fmt); friend void setMover(std::string const & fmt, std::string const & command); friend Movers & theSystemMovers(); friend frontend::Application * theApp(); @@ -180,4 +180,3 @@ void dispatch(FuncRequest const & action, DispatchResult & dr); } // namespace lyx #endif // LYX_H - diff --git a/src/graphics/GraphicsLoader.cpp b/src/graphics/GraphicsLoader.cpp index 36f2839..bd81a50 100644 --- a/src/graphics/GraphicsLoader.cpp +++ b/src/graphics/GraphicsLoader.cpp @@ -96,11 +96,10 @@ void LoaderQueue::loadNext() if (ptr->status() == WaitingToLoad) ptr->startLoading(); } - if (!cache_queue_.empty()) { + if (!cache_queue_.empty()) startLoader(); - } else { + else stopLoader(); - } } diff --git a/src/tex2lyx/tex2lyx.cpp b/src/tex2lyx/tex2lyx.cpp index 360c126..7bac21e 100644 --- a/src/tex2lyx/tex2lyx.cpp +++ b/src/tex2lyx/tex2lyx.cpp @@ -254,7 +254,7 @@ bool checkModule(string const & name, bool command) // This is needed since a module cannot be read on its own, only as // part of a document class. LayoutFile const & baseClass = LayoutFileList::get()[textclass.name()]; - typedef mapModuleMap; + typedef map ModuleMap; static ModuleMap modules; static bool init = true; if (init) { @@ -289,7 +289,7 @@ bool checkModule(string const & name, bool command) continue; if (findInsetLayoutWithoutModule(textclass, name, command)) continue; - DocumentClassConstPtr c = it->second; + DocumentClassConstPtr c = it->second; Layout const * layout = findLayoutWithoutModule(*c, name, command); InsetLayout const * insetlayout = layout ? 0 : findInsetLayoutWithoutModule(*c, name, command); -- 1.8.0.rc3.16.g8ead1bf
[PATCH 06/13] src/graphics/GraphicsLoader: use boost::scoped_ptr to hold the pimpl
--- src/graphics/GraphicsLoader.cpp | 1 - src/graphics/GraphicsLoader.h | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/graphics/GraphicsLoader.cpp b/src/graphics/GraphicsLoader.cpp index bd81a50..8f3a4cf 100644 --- a/src/graphics/GraphicsLoader.cpp +++ b/src/graphics/GraphicsLoader.cpp @@ -230,7 +230,6 @@ Loader::Loader(Loader const & other) Loader::~Loader() { - delete pimpl_; } diff --git a/src/graphics/GraphicsLoader.h b/src/graphics/GraphicsLoader.h index 6521850..3258726 100644 --- a/src/graphics/GraphicsLoader.h +++ b/src/graphics/GraphicsLoader.h @@ -27,6 +27,7 @@ #include "GraphicsTypes.h" #include +#include namespace lyx { @@ -105,7 +106,7 @@ private: /// Use the Pimpl idiom to hide the internals. class Impl; /// The pointer never changes although *pimpl_'s contents may. - Impl * const pimpl_; + boost::scoped_ptr pimpl_; }; } // namespace graphics -- 1.8.0.rc3.16.g8ead1bf
[PATCH 04/13] src/graphics/GraphicsCache: use boost::scoped_ptr to hold the pimpl
--- src/graphics/GraphicsCache.cpp | 1 - src/graphics/GraphicsCache.h | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/graphics/GraphicsCache.cpp b/src/graphics/GraphicsCache.cpp index d508563..f9eee10 100644 --- a/src/graphics/GraphicsCache.cpp +++ b/src/graphics/GraphicsCache.cpp @@ -59,7 +59,6 @@ Cache::Cache() Cache::~Cache() { - delete pimpl_; } diff --git a/src/graphics/GraphicsCache.h b/src/graphics/GraphicsCache.h index e6d810f..c66f72f 100644 --- a/src/graphics/GraphicsCache.h +++ b/src/graphics/GraphicsCache.h @@ -22,6 +22,8 @@ #include "support/shared_ptr.h" +#include + #include #include @@ -84,7 +86,7 @@ private: /// Use the Pimpl idiom to hide the internals. class Impl; /// The pointer never changes although *pimpl_'s contents may. - Impl * const pimpl_; + boost::scoped_ptr pimpl_; }; } // namespace graphics -- 1.8.0.rc3.16.g8ead1bf
Re: [PATCH 01/13] Buffer.cpp: drop unused
This patch, and the others I saw, make sense. However, I only see numbers 1, 2, 4 and 6 (of supposedly 13 parts). JMarc
[PATCH 12/13] graphics/GraphicsImage.h: let newImage and Image::clone return a shared_ptr
--- src/frontends/qt4/GuiImage.cpp | 8 src/frontends/qt4/GuiImage.h | 2 +- src/graphics/GraphicsCacheItem.cpp | 2 +- src/graphics/GraphicsImage.h | 5 +++-- src/graphics/GraphicsLoader.cpp| 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/frontends/qt4/GuiImage.cpp b/src/frontends/qt4/GuiImage.cpp index 503ad52..f1643db 100644 --- a/src/frontends/qt4/GuiImage.cpp +++ b/src/frontends/qt4/GuiImage.cpp @@ -32,9 +32,9 @@ namespace lyx { namespace graphics { /// Implement factory method defined in GraphicsImage.h -Image * newImage() +shared_ptr newImage() { - return new GuiImage; + return make_shared(); } @@ -49,9 +49,9 @@ GuiImage::GuiImage(GuiImage const & other) {} -Image * GuiImage::clone() const +shared_ptr GuiImage::clone() const { - return new GuiImage(*this); + return make_shared(*this); } diff --git a/src/frontends/qt4/GuiImage.h b/src/frontends/qt4/GuiImage.h index 6f60644..9e97241 100644 --- a/src/frontends/qt4/GuiImage.h +++ b/src/frontends/qt4/GuiImage.h @@ -34,7 +34,7 @@ public: private: /// Create a copy - Image * clone() const; + shared_ptr clone() const; /// Get the image width unsigned int width() const; /// Get the image height diff --git a/src/graphics/GraphicsCacheItem.cpp b/src/graphics/GraphicsCacheItem.cpp index 46b76c5..996b0b5 100644 --- a/src/graphics/GraphicsCacheItem.cpp +++ b/src/graphics/GraphicsCacheItem.cpp @@ -292,7 +292,7 @@ bool CacheItem::Impl::loadImage() { LYXERR(Debug::GRAPHICS, "Loading image."); - image_.reset(newImage()); + image_ = newImage(); bool success = image_->load(file_to_load_); string const text = success ? "succeeded" : "failed"; diff --git a/src/graphics/GraphicsImage.h b/src/graphics/GraphicsImage.h index 5488a76..b0d93b4 100644 --- a/src/graphics/GraphicsImage.h +++ b/src/graphics/GraphicsImage.h @@ -25,6 +25,7 @@ #define GRAPHICSIMAGE_H #include "Dimension.h" +#include "support/shared_ptr.h" namespace lyx { @@ -40,7 +41,7 @@ public: virtual ~Image() {} /// Create a copy - virtual Image * clone() const = 0; + virtual shared_ptr clone() const = 0; /// Get the image width virtual unsigned int width() const = 0; @@ -66,7 +67,7 @@ public: /// Only way to create a new Image. /// Implemented in the frontend. -Image * newImage(); +shared_ptr newImage(); } // namespace graphics } // namespace lyx diff --git a/src/graphics/GraphicsLoader.cpp b/src/graphics/GraphicsLoader.cpp index 5260d50..89c1440 100644 --- a/src/graphics/GraphicsLoader.cpp +++ b/src/graphics/GraphicsLoader.cpp @@ -429,7 +429,7 @@ void Loader::Impl::createPixmap() return; } - image_.reset(cached_item_->image()->clone()); + image_ = cached_item_->image()->clone(); bool const success = image_->setPixmap(params_); -- 1.8.0.rc3.16.g8ead1bf
[PATCH 11/13] Use make_shared to create shared_ptr
Using std::make_shared (and in our case for the time being boost::make_shared) is the preferred way of creating a std::shared_ptr. This is mainly due to two aspects: - half the number of allocations required - potential of using less space, and better locality Also a failed creation of the reference counted part of the object will not make you leak the memory of the pointer object you just passed to the share_ptr member function. (i.e. exception in the shared_ptr member function). --- src/KeyMap.cpp | 2 +- src/OutputParams.cpp | 2 +- src/ServerSocket.cpp | 2 +- src/TextClass.cpp | 5 +++-- src/graphics/GraphicsCache.cpp | 2 +- src/graphics/PreviewLoader.cpp | 4 ++-- src/insets/InsetNote.cpp | 6 +++--- src/insets/InsetTabular.cpp| 8 src/support/ForkedCalls.cpp| 5 ++--- src/support/ForkedCalls.h | 2 +- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/KeyMap.cpp b/src/KeyMap.cpp index 50833c9..f2cecc8 100644 --- a/src/KeyMap.cpp +++ b/src/KeyMap.cpp @@ -141,7 +141,7 @@ void KeyMap::bind(KeySequence * seq, FuncRequest const & func, unsigned int r) newone->func.setOrigin(FuncRequest::KEYBOARD); newone->prefixes.reset(); } else { - newone->prefixes.reset(new KeyMap); + newone->prefixes = make_shared(); newone->prefixes->bind(seq, func, r + 1); } } diff --git a/src/OutputParams.cpp b/src/OutputParams.cpp index f8af8ad..163622d 100644 --- a/src/OutputParams.cpp +++ b/src/OutputParams.cpp @@ -23,7 +23,7 @@ OutputParams::OutputParams(Encoding const * enc) moving_arg(false), inulemcmd(false), local_font(0), master_language(0), encoding(enc), free_spacing(false), use_babel(false), use_polyglossia(false), use_indices(false), use_japanese(false), linelen(0), depth(0), - exportdata(new ExportData), + exportdata(make_shared()), inComment(false), inTableCell(NO), inFloat(NONFLOAT), inIndexEntry(false), inIPA(false), inDeletedInset(0), changeOfDeletedInset(Change::UNCHANGED), diff --git a/src/ServerSocket.cpp b/src/ServerSocket.cpp index 4c34212..b18c837 100644 --- a/src/ServerSocket.cpp +++ b/src/ServerSocket.cpp @@ -112,7 +112,7 @@ void ServerSocket::serverCallback() // Register the new client. clients[client_fd] = - shared_ptr(new LyXDataSocket(client_fd)); + make_shared(client_fd); theApp()->registerSocketCallback( client_fd, bind(::dataCallback, diff --git a/src/TextClass.cpp b/src/TextClass.cpp index 93eae96..9236ede 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -1434,8 +1434,9 @@ Layout TextClass::createBasicLayout(docstring const & name, bool unknown) const DocumentClassPtr getDocumentClass( LayoutFile const & baseClass, LayoutModuleList const & modlist) { - DocumentClassPtr doc_class = - DocumentClassPtr(new DocumentClass(baseClass)); + // Since DocumentClass::DocumentClass(LayoutFile const &) is protected + // std::make_shared cannot be used here. + DocumentClassPtr doc_class(new DocumentClass(baseClass)); LayoutModuleList::const_iterator it = modlist.begin(); LayoutModuleList::const_iterator en = modlist.end(); for (; it != en; ++it) { diff --git a/src/graphics/GraphicsCache.cpp b/src/graphics/GraphicsCache.cpp index f9eee10..97a0c88 100644 --- a/src/graphics/GraphicsCache.cpp +++ b/src/graphics/GraphicsCache.cpp @@ -112,7 +112,7 @@ void Cache::add(FileName const & file) const return; } - pimpl_->cache[file] = ItemPtr(new CacheItem(file)); + pimpl_->cache[file] = make_shared(file); } diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp index 6185681..82fb7ca 100644 --- a/src/graphics/PreviewLoader.cpp +++ b/src/graphics/PreviewLoader.cpp @@ -627,7 +627,7 @@ void PreviewLoader::Impl::startLoading(bool wait) // Initiate the conversion from LaTeX to bitmap images files. ForkedCall::SignalTypePtr - convert_ptr(new ForkedCall::SignalType); + convert_ptr = make_shared(); convert_ptr->connect(bind(::finishedGenerating, this, _1, _2)); ForkedCall call(buffer_.filePath()); @@ -683,7 +683,7 @@ void PreviewLoader::Impl::finishedGenerating(pid_t pid, int retval) // Add the image to the cache only if it's actually present if (file.isReadableFile()) { - PreviewImagePtr ptr(new PreviewImage(parent_, snip, file, af)); + PreviewImagePtr ptr = make_shared(boost::ref(parent_), snip, file, af); cache_[snip] = ptr; newimages.push_back(ptr); diff --git a/src/insets/InsetNote.cpp b/src/insets/InsetNote.cpp index
Re: [PATCH 01/13] Buffer.cpp: drop unused
Jean-Marc Lasgoutteswrites: | This patch, and the others I saw, make sense. However, I only see | numbers 1, 2, 4 and 6 (of supposedly 13 parts). For some reason the seem to be trickling in. I'll resend the missing once if they do no show up. -- Lgb
[PATCH 13/13] boost: changes to make it compile cleanly with gcc 4.8
--- boost/boost/lexical_cast.hpp | 1 - boost/boost/math/special_functions/fpclassify.hpp | 4 boost/boost/math/special_functions/sign.hpp | 2 -- boost/boost/regex/v4/regex_format.hpp | 2 -- boost/boost/regex/v4/regex_split.hpp | 1 - boost/boost/static_assert.hpp | 2 +- boost/boost/tuple/detail/tuple_basic.hpp | 1 - 7 files changed, 1 insertion(+), 12 deletions(-) diff --git a/boost/boost/lexical_cast.hpp b/boost/boost/lexical_cast.hpp index 5a3d4f0..17ce576 100644 --- a/boost/boost/lexical_cast.hpp +++ b/boost/boost/lexical_cast.hpp @@ -626,7 +626,6 @@ namespace boost #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS BOOST_STATIC_ASSERT(!std::numeric_limits::is_signed); #endif -typedef typename Traits::int_type int_type; CharT const czero = lcast_char_constants::zero; --end; value = 0; diff --git a/boost/boost/math/special_functions/fpclassify.hpp b/boost/boost/math/special_functions/fpclassify.hpp index 2abec5f..3ec1d71 100644 --- a/boost/boost/math/special_functions/fpclassify.hpp +++ b/boost/boost/math/special_functions/fpclassify.hpp @@ -311,7 +311,6 @@ inline bool (isfinite)(T x) { //!< \brief return true if floating-point type t is finite. typedef typename detail::fp_traits::type traits; typedef typename traits::method method; - typedef typename boost::is_floating_point::type fp_tag; return detail::isfinite_impl(x, method()); } @@ -370,7 +369,6 @@ inline bool (isnormal)(T x) { typedef typename detail::fp_traits::type traits; typedef typename traits::method method; - typedef typename boost::is_floating_point::type fp_tag; return detail::isnormal_impl(x, method()); } @@ -447,7 +445,6 @@ inline bool (isinf)(T x) { typedef typename detail::fp_traits::type traits; typedef typename traits::method method; - typedef typename boost::is_floating_point::type fp_tag; return detail::isinf_impl(x, method()); } @@ -516,7 +513,6 @@ template bool (isnan)(T x) { //!< \brief return true if floating-point type t is NaN (Not A Number). typedef typename detail::fp_traits::type traits; typedef typename traits::method method; - typedef typename boost::is_floating_point::type fp_tag; return detail::isnan_impl(x, method()); } diff --git a/boost/boost/math/special_functions/sign.hpp b/boost/boost/math/special_functions/sign.hpp index 6de88b2..feab787 100644 --- a/boost/boost/math/special_functions/sign.hpp +++ b/boost/boost/math/special_functions/sign.hpp @@ -110,7 +110,6 @@ template int (signbit)(T x) { typedef typename detail::fp_traits::type traits; typedef typename traits::method method; - typedef typename boost::is_floating_point::type fp_tag; return detail::signbit_impl(x, method()); } @@ -124,7 +123,6 @@ template T (changesign)(const T& x) { //!< \brief return unchanged binary pattern of x, except for change of sign bit. typedef typename detail::fp_traits::sign_change_type traits; typedef typename traits::method method; - typedef typename boost::is_floating_point::type fp_tag; return detail::changesign_impl(x, method()); } diff --git a/boost/boost/regex/v4/regex_format.hpp b/boost/boost/regex/v4/regex_format.hpp index e05862f..d2ac6b9 100644 --- a/boost/boost/regex/v4/regex_format.hpp +++ b/boost/boost/regex/v4/regex_format.hpp @@ -1058,7 +1058,6 @@ struct format_functor_c_string template OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits& t = Traits()) { - typedef typename Match::char_type char_type; const charT* end = func; while(*end) ++end; return regex_format_imp(i, m, func, end, f, t); @@ -1077,7 +1076,6 @@ struct format_functor_container template OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits& t = Traits()) { - typedef typename Match::char_type char_type; return re_detail::regex_format_imp(i, m, func.begin(), func.end(), f, t); } private: diff --git a/boost/boost/regex/v4/regex_split.hpp b/boost/boost/regex/v4/regex_split.hpp index a7ae350..dc3e43e 100644 --- a/boost/boost/regex/v4/regex_split.hpp +++ b/boost/boost/regex/v4/regex_split.hpp @@ -107,7 +107,6 @@ std::size_t regex_split(OutputIterator out, std::size_t max_split) { typedef typename std::basic_string::const_iterator ci_t; - typedef typename match_results::allocator_type match_allocator; ci_t last = s.begin(); std::size_t init_size = max_split; re_detail::split_pred pred(, , _split); diff --git a/boost/boost/static_assert.hpp b/boost/boost/static_assert.hpp index 9fe9bc0..4522d01 100644 --- a/boost/boost/static_assert.hpp +++ b/boost/boost/static_assert.hpp @@ -122,7
[PATCH 08/13] support/shared_ptr.h: drop support of TR1 smart pointers
--- src/support/shared_ptr.h | 19 --- 1 file changed, 19 deletions(-) diff --git a/src/support/shared_ptr.h b/src/support/shared_ptr.h index 69e42da..792beb2 100644 --- a/src/support/shared_ptr.h +++ b/src/support/shared_ptr.h @@ -12,22 +12,6 @@ #ifndef LYX_SHARED_PTR_H #define LYX_SHARED_PTR_H -#ifdef LYX_USE_TR1 - -#include - -#ifdef __GNUC__ -#include -#endif - -namespace lyx -{ - using std::tr1::shared_ptr; - using std::tr1::const_pointer_cast; -} - -#else - #include namespace lyx @@ -37,6 +21,3 @@ namespace lyx } #endif - - -#endif -- 1.8.0.rc3.16.g8ead1bf
[PATCH 05/13] src/graphics/GraphicsCacheItem: use boost::scoped_ptr to hold the pimpl
--- src/graphics/GraphicsCacheItem.cpp | 1 - src/graphics/GraphicsCacheItem.h | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/graphics/GraphicsCacheItem.cpp b/src/graphics/GraphicsCacheItem.cpp index fafa78b..60477cc 100644 --- a/src/graphics/GraphicsCacheItem.cpp +++ b/src/graphics/GraphicsCacheItem.cpp @@ -130,7 +130,6 @@ CacheItem::CacheItem(FileName const & file) CacheItem::~CacheItem() { - delete pimpl_; } diff --git a/src/graphics/GraphicsCacheItem.h b/src/graphics/GraphicsCacheItem.h index 481e4b1..51f97d5 100644 --- a/src/graphics/GraphicsCacheItem.h +++ b/src/graphics/GraphicsCacheItem.h @@ -31,6 +31,7 @@ #include "GraphicsTypes.h" #include +#include namespace lyx { @@ -98,7 +99,7 @@ private: /// Use the Pimpl idiom to hide the internals. class Impl; /// The pointer never changes although *pimpl_'s contents may. - Impl * const pimpl_; + boost::scoped_ptr const pimpl_; }; } // namespace graphics -- 1.8.0.rc3.16.g8ead1bf
[PATCH 09/13] support/shared_ptr.h: introduce boost::make_shared into ns lyx
--- src/support/shared_ptr.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/support/shared_ptr.h b/src/support/shared_ptr.h index 792beb2..3aa6492 100644 --- a/src/support/shared_ptr.h +++ b/src/support/shared_ptr.h @@ -12,12 +12,13 @@ #ifndef LYX_SHARED_PTR_H #define LYX_SHARED_PTR_H -#include +#include namespace lyx { using boost::shared_ptr; using boost::const_pointer_cast; + using boost::make_shared; } #endif -- 1.8.0.rc3.16.g8ead1bf
[PATCH 10/13] More idiomatic way of checking if a shared_ptr has an associated managed object
--- src/KeyMap.cpp | 17 - src/frontends/qt4/LayoutBox.cpp| 4 ++-- src/graphics/GraphicsCacheItem.cpp | 2 +- src/graphics/GraphicsLoader.cpp| 22 +++--- src/support/ForkedCalls.cpp| 2 +- 5 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/KeyMap.cpp b/src/KeyMap.cpp index ffd55c4..50833c9 100644 --- a/src/KeyMap.cpp +++ b/src/KeyMap.cpp @@ -115,13 +115,12 @@ void KeyMap::bind(KeySequence * seq, FuncRequest const & func, unsigned int r) LYXERR(Debug::KBMAP, "Warning: New binding for '" << to_utf8(seq->print(KeySequence::Portable)) << "' is overriding old binding..."); - if (it->prefixes.get()) { + if (it->prefixes) it->prefixes.reset(); - } it->func = func; it->func.setOrigin(FuncRequest::KEYBOARD); return; - } else if (!it->prefixes.get()) { + } else if (!it->prefixes) { lyxerr << "Error: New binding for '" << to_utf8(seq->print(KeySequence::Portable)) << "' is overriding old binding..." @@ -168,10 +167,10 @@ void KeyMap::unbind(KeySequence * seq, FuncRequest const & func, unsigned int r) if (r + 1 == seq->length()) { if (it->func == func) { remove = it; - if (it->prefixes.get()) + if (it->prefixes) it->prefixes.reset(); } - } else if (it->prefixes.get()) { + } else if (it->prefixes) { it->prefixes->unbind(seq, func, r + 1); if (it->prefixes->empty()) remove = it; @@ -201,7 +200,7 @@ FuncRequest KeyMap::getBinding(KeySequence const & seq, unsigned int r) && mod2 == it->mod.second) { if (r + 1 == seq.length()) return it->func; - else if (it->prefixes.get()) + else if (it->prefixes) return it->prefixes->getBinding(seq, r + 1); } } @@ -441,7 +440,7 @@ FuncRequest const & KeyMap::lookup(KeySymbol const , if (cit->code == key && cit->mod.first == check) { // match found - if (cit->prefixes.get()) { + if (cit->prefixes) { // this is a prefix key - set new map seq->curmap = cit->prefixes.get(); static FuncRequest prefix(LFUN_COMMAND_PREFIX); @@ -507,7 +506,7 @@ KeyMap::Bindings KeyMap::findBindings(FuncRequest const & func, Table::const_iterator end = table.end(); for (Table::const_iterator cit = table.begin(); cit != end; ++cit) { - if (cit->prefixes.get()) { + if (cit->prefixes) { KeySequence seq = prefix; seq.addkey(cit->code, cit->mod.first); Bindings res2 = cit->prefixes->findBindings(func, seq); @@ -555,7 +554,7 @@ void KeyMap::listBindings(BindingList & list, Table::const_iterator it_end = table.end(); for (; it != it_end; ++it) { // a LFUN_COMMAND_PREFIX - if (it->prefixes.get()) { + if (it->prefixes) { KeySequence seq = prefix; seq.addkey(it->code, it->mod.first); it->prefixes->listBindings(list, seq, tag); diff --git a/src/frontends/qt4/LayoutBox.cpp b/src/frontends/qt4/LayoutBox.cpp index aa22e60..e11a63d 100644 --- a/src/frontends/qt4/LayoutBox.cpp +++ b/src/frontends/qt4/LayoutBox.cpp @@ -536,7 +536,7 @@ void LayoutBox::set(docstring const & layout) { d->resetFilter(); - if (!d->text_class_.get()) + if (!d->text_class_) return; if (!d->text_class_->hasLayout(layout)) @@ -691,7 +691,7 @@ void LayoutBox::selected(int index) d->model_->itemFromIndex(mindex)->text()); d->owner_.setFocus(); - if (!d->text_class_.get()) { + if (!d->text_class_) { updateContents(false); d->resetFilter(); return; diff --git a/src/graphics/GraphicsCacheItem.cpp b/src/graphics/GraphicsCacheItem.cpp index 60477cc..46b76c5
[PATCH 03/13] src/Lyx: use boost::scoped_ptr to hold the pimpl
--- src/LyX.cpp | 5 + src/LyX.h | 3 ++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/LyX.cpp b/src/LyX.cpp index 722f040..03caff3 100644 --- a/src/LyX.cpp +++ b/src/LyX.cpp @@ -64,7 +64,6 @@ #include "support/Systemcall.h" #include "support/bind.h" -#include #include #include @@ -217,7 +216,6 @@ frontend::Application * theApp() LyX::~LyX() { - delete pimpl_; singleton_ = 0; WordList::cleanupWordLists(); } @@ -244,10 +242,9 @@ void lyx_exit(int exit_code) LyX::LyX() - : first_start(false) + : pimpl_(new Impl), first_start(false) { singleton_ = this; - pimpl_ = new Impl; } diff --git a/src/LyX.h b/src/LyX.h index 70b8b7e..97c9b4a 100644 --- a/src/LyX.h +++ b/src/LyX.h @@ -16,6 +16,7 @@ #include "support/strfwd.h" +#include #include namespace lyx { @@ -126,7 +127,7 @@ private: /// Use the Pimpl idiom to hide the internals. // Mostly used for singletons. struct Impl; - Impl * pimpl_; + boost::scoped_ptr pimpl_; /// has this user started lyx for the first time? bool first_start; -- 1.8.0.rc3.16.g8ead1bf
[PATCH 07/13] graphics/GraphicsLoader.cpp: use !empty() to check for non-emptyness not size()
--- src/graphics/GraphicsLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/graphics/GraphicsLoader.cpp b/src/graphics/GraphicsLoader.cpp index 8f3a4cf..04dd7bd 100644 --- a/src/graphics/GraphicsLoader.cpp +++ b/src/graphics/GraphicsLoader.cpp @@ -89,7 +89,7 @@ void LoaderQueue::loadNext() LYXERR(Debug::GRAPHICS, "LoaderQueue: " << cache_queue_.size() << " items in the queue"); int counter = s_numimages_; - while (cache_queue_.size() && counter--) { + while (!cache_queue_.empty() && counter--) { Cache::ItemPtr ptr = cache_queue_.front(); cache_set_.erase(ptr); cache_queue_.pop_front(); -- 1.8.0.rc3.16.g8ead1bf
Re: [PATCH 03/13] src/Lyx: use boost::scoped_ptr to hold the pimpl
On Sun, Oct 21, 2012 at 08:49:06PM +0200, Lars Gullik Bjønnes wrote: > diff --git a/src/LyX.h b/src/LyX.h > index 70b8b7e..97c9b4a 100644 > --- a/src/LyX.h > +++ b/src/LyX.h > @@ -16,6 +16,7 @@ > > #include "support/strfwd.h" > > +#include > #include > > namespace lyx { > @@ -126,7 +127,7 @@ private: > /// Use the Pimpl idiom to hide the internals. > // Mostly used for singletons. > struct Impl; > - Impl * pimpl_; > + boost::scoped_ptr pimpl_; > The Empire strikes back. Bald-pointer-phobia accompanied by swift C style use of "struct". What a deadly combination! Andre' PS: 1/2 ;-) for those who are missing one...
Re: [PATCH 03/13] src/Lyx: use boost::scoped_ptr to hold the pimpl
André Pönitzwrites: | On Sun, Oct 21, 2012 at 08:49:06PM +0200, Lars Gullik Bjønnes wrote: >> diff --git a/src/LyX.h b/src/LyX.h >> index 70b8b7e..97c9b4a 100644 >> --- a/src/LyX.h >> +++ b/src/LyX.h >> @@ -16,6 +16,7 @@ >> >> #include "support/strfwd.h" >> >> +#include >> #include >> >> namespace lyx { >> @@ -126,7 +127,7 @@ private: >> /// Use the Pimpl idiom to hide the internals. >> // Mostly used for singletons. >> struct Impl; >> -Impl * pimpl_; >> +boost::scoped_ptr pimpl_; >> > | The Empire strikes back. > | Bald-pointer-phobia accompanied by swift C style | use of "struct". What a deadly combination! Heh no... me writing way too much C the last years. Kindo flew out of my fingers without me even noticing. But of course it really should have been std::unique_ptr, but we are not quite there yet. As for the phobia... -- Lgb
Ad. "using namespace std" - ref prob in c9b9748c
It is mentioned in c9b9748c that "using namespace std" on msvc10 also drags in std::tr1 stuff. IMHO the soltion is not to use boost::shared_ptr etc. But to stop using "using namespace std". I look briefly as to what was discussed in 2007 when the "using namespace std" was introduced all over, and afaikr this was done to get rid of the "using std::" lines? Agree with the move to get rid of all the "using" lines, but not with the solution. IMHO a much better solution is to just use "std::" prefix where required. I am willing to do the work to remove "using namespace std" and put std:: where required. This will also make declaration signatures cosistent with signatures on definitions, and without haveing a mixture of std:: and non-std:: in source files. -- Lgb
Re: Commercial support for LyX?
On Mon, 2012-10-22 at 02:32 +0200, Lars Gullik Bjønnes wrote: > Is that what this is? > > http://aprenderlyx.com/ > Fascinating link. It looks like a course about how to use LyX for writing a thesis. They have five or six modules which covers creating a document, typesetting a document, and entering mathematics. As part of their advanced plan, they have support via phone and email. From the video, and site, though, it looks to be editing support rather than "technical support." Very interesting idea. Out of curiosity, do we have any idea how big LyX's user base really is? The other day I saw someone using it to take notes in a class, and I was elated. It's the first time I've seen someone using it "in the wild" where I hadn't introduced them to the program. Cheers, Rob