From 6cce4fd31ba54acc6b8e19ec1fb43f255957823a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Matox?= Date: Sun, 2 Jul 2000 09:52:44 +0000 Subject: [PATCH] Fixed a bug related with the initialization of include_label. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@852 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 7 +++++++ src/insets/insetinclude.C | 35 +++++++++++++++++------------------ 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 71d09cef3d..ac75fbef9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,11 @@ +2000-07-02 José Abílio Matos + + * src/insets/insetinclude.C (InsetInclude): fixed + initialization of include_label. + (unique_id): now returns a string. + 2000-07-01 José Abílio Matos + * src/LaTeXFeatures.h: new member IncludedFiles, for a map of key, included file name. diff --git a/src/insets/insetinclude.C b/src/insets/insetinclude.C index 9bc670cf7b..440190bb54 100644 --- a/src/insets/insetinclude.C +++ b/src/insets/insetinclude.C @@ -188,6 +188,22 @@ extern "C" void include_cb(FL_OBJECT *, long arg) } +static string unique_id() { + static unsigned int seed=1000; + +#ifdef HAVE_SSTREAM + std::ostringstream ost; + ost << "file" << ++seed; +#else + char ctmp[16]; + ostrstream ost(ctmp,16); + ost << "file" << ++seed << '\0'; +#endif + + return ost.str(); +} + + InsetInclude::InsetInclude(string const & fname, Buffer * bf) : InsetCommand("include") { @@ -195,6 +211,7 @@ InsetInclude::InsetInclude(string const & fname, Buffer * bf) setContents(fname); flag = InsetInclude::INCLUDE; noload = false; + include_label = unique_id(); } @@ -477,27 +494,9 @@ int InsetInclude::DocBook(Buffer const *, ostream & os) const } -static unsigned int unique_id() { - static unsigned int seed=1000; - - return ++seed; -} - - void InsetInclude::Validate(LaTeXFeatures & features) const { -#ifdef HAVE_SSTREAM - std::ostringstream ost; - ost << "file" << unique_id(); - include_label = ost.str(); -#else - char ctmp[16]; - ostrstream ost(ctmp,16); - ost << "file" << unique_id() << '\0'; - include_label = ost.str(); -#endif - string incfile(getContents()); string writefile = ChangeExtension(getFileName(), ".sgml"); if (!master->tmppath.empty() && !master->niceFile) { -- 2.39.2