I attach a patch that should fix the current compilation problems for
figinset.C

Although I started messing around with that file I am fairly sure 
that the current state is not my fault.

Moreover, I have to say that I am not happy with the use of conditional
compilation depending on whether stringstreams are available or not.
The patch was intended to make figinset.C's structure a bit clearer and
all I got was code that looks almost as ugly as the unpatched version.

If we really want to force the use of stringstreams at a time when they
are not yet widely supported, we should to that in a transparent manner
that is not as intrusive in the sources as #ifdef HAVE_SSTREAM constructs.

Why don't we just provide a stringstream class of our own in case there
isn't a native one similarly to what happens with strings? Even a fixed
size buffer should do for starters...

Andre'


------------------------------- snip -------------------------------

Index: figinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/figinset.C,v
retrieving revision 1.60
diff -u -r1.60 figinset.C
--- figinset.C  2000/04/24 20:58:22     1.60
+++ figinset.C  2000/04/25 07:01:23
@@ -540,12 +540,12 @@
                        ostringstream t2;
 #else
                        char tbuf2[80];
-                       ostrstream t2(tbuf2, sizeof(tbuf));
+                       ostrstream t2(tbuf2, sizeof(tbuf2));
 #endif
                        t2 << "GHOSTVIEW=" << fl_get_canvas_id(figinset_canvas)
                           << ' ' << p->data->bitmap;
 #ifndef HAVE_SSTREAM
-                       << '\0';
+                       t2 << '\0';
 #endif
                        // now set up ghostview property on a window
                        // #warning BUG seems that the only bug here
@@ -559,7 +559,7 @@
                        t1 << "0 0 0 0 " << p->data->wid << ' '
                           << p->data->hgh << " 72 72 0 0 0 0";
 #ifndef HAVE_SSTREAM
-                       << '\0';
+                       t1 << '\0';
 #endif
                        
                        if (lyxerr.debugging()) {
@@ -614,16 +614,22 @@
                                        XInternAtom(tempdisp, "GHOSTVIEW", false),
                                        XInternAtom(tempdisp, "STRING", false),
                                        8, PropModeAppend, 
+#ifdef HAVE_SSTREAM
                                        reinterpret_cast<unsigned 
char*>(const_cast<char*>(t1.str().c_str())),
-                                       t1.str().size());
+                                       t1.str().size()
+#else
+                                       reinterpret_cast<unsigned 
+char*>(const_cast<char*>(t1.str())),
+                                       strlen(t1.str())
+#endif
+                               );
                        XUngrabServer(tempdisp);
                        XFlush(tempdisp);
 
 #ifdef HAVE_SSTREAM
                        ostringstream t3;
 #else
-                       char tbuf[384];
-                       ostrstream t3(tbuf, sizeof(tbuf));
+                       char tbuf3[384];
+                       ostrstream t3(tbuf3, sizeof(tbuf3));
 #endif
                        switch (p->data->flags & 3) {
                        case 0: t3 << 'H'; break; // Hidden
@@ -640,7 +646,7 @@
                        t3 << ' ' << 
BlackPixelOfScreen(DefaultScreenOfDisplay(tempdisp))
                           << ' ' << background_pixel;
 #ifndef HAVE_SSTREAM
-                       << '\0';
+                       t3 << '\0';
 #endif
 
                        XGrabServer(tempdisp);
@@ -650,8 +656,14 @@
                                                    "GHOSTVIEW_COLORS", false),
                                        XInternAtom(tempdisp, "STRING", false),
                                        8, PropModeReplace, 
+#ifdef HAVE_SSTREAM
                                        reinterpret_cast<unsigned 
char*>(const_cast<char*>(t3.str().c_str())),
-                                       t3.str().size());
+                                       t3.str().size()
+#else
+                                       reinterpret_cast<unsigned 
+char*>(const_cast<char*>(t3.str())),
+                                       strlen(t3.str())
+#endif
+                               );
                        XUngrabServer(tempdisp);
                        XFlush(tempdisp);
                        
------------------------------- snip -------------------------------


-- 
It'll take a long time to eat 63.000 peanuts.
André Pönitz ......................... [EMAIL PROTECTED]

Reply via email to