On Sun, Sep 08, 2002 at 04:23:04PM +0100, Angus Leeming wrote: > > On Saturday 07 September 2002 9:36 pm, Martin Vermeer wrote: > > Why in insets/insetgraphics.C: > > > > 686 string const message = file_exists ? > > 687 string() : string("bb = 0 0 200 100, draft, type=eps]"); > > > > ... > > > > 711 if (!opts.empty() && !message.empty()) > > 712 before += ("[%\n" + opts + ',' + message); > > 713 else if (!message.empty()) > > 714 before += ("[%\n" + message); > > 715 else if (!opts.empty()) > > 716 before += ("[%\n" + opts + ']'); > > > > ? > > > > Isn't it better to put out the final ']' always in the latter part? > > Would even allow simplification of the logic. > > > > Am I missing something? > > No. This is a clear example of obfuscated code. Feel free to make it obvious. > Angus
Here comes. 09/09/2002 Martin Vermeer <[EMAIL PROTECTED]> * insetgraphics.C: disfuscated use of ']' in built output string. Martin -- Martin Vermeer [EMAIL PROTECTED] Helsinki University of Technology Department of Surveying P.O. Box 1200, FIN-02015 HUT, Finland :wq
Index: insetgraphics.C =================================================================== RCS file: /cvs/lyx/lyx-devel/src/insets/insetgraphics.C,v retrieving revision 1.135 diff -u -p -r1.135 insetgraphics.C --- insetgraphics.C 2002/08/24 22:02:30 1.135 +++ insetgraphics.C 2002/09/08 16:25:56 @@ -684,7 +684,7 @@ int InsetGraphics::latex(Buffer const *b IsFileReadable(file_ + ".eps") || // original.eps IsFileReadable(file_ + ".ps")); // original.ps string const message = file_exists ? - string() : string("bb = 0 0 200 100, draft, type=eps]"); + string() : string("bb = 0 0 200 100, draft, type=eps"); // if !message.empty() than there was no existing file // "filename(.(e)ps)" found. In this case LaTeX // draws only a rectangle with the above bb and the @@ -709,11 +709,9 @@ int InsetGraphics::latex(Buffer const *b lyxerr[Debug::GRAPHICS] << "\tOpts = " << opts << endl; if (!opts.empty() && !message.empty()) - before += ("[%\n" + opts + ',' + message); - else if (!message.empty()) - before += ("[%\n" + message); - else if (!opts.empty()) - before += ("[%\n" + opts + ']'); + before += ("[%\n" + opts + ',' + message + ']'); + else if (!opts.empty() || !message.empty()) + before += ("[%\n" + opts + message + ']'); lyxerr[Debug::GRAPHICS] << "\tBefore = " << before
msg44274/pgp00000.pgp
Description: PGP signature