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
This commit is contained in:
José Matox 2000-07-02 09:52:44 +00:00
parent 38f5ce268a
commit 6cce4fd31b
2 changed files with 24 additions and 18 deletions

View File

@ -1,4 +1,11 @@
2000-07-02 José Abílio Matos <jamatos@fep.up.pt>
* src/insets/insetinclude.C (InsetInclude): fixed
initialization of include_label.
(unique_id): now returns a string.
2000-07-01 José Abílio Matos <jamatos@fep.up.pt>
* src/LaTeXFeatures.h: new member IncludedFiles, for
a map of key, included file name.

View File

@ -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) {