]> git.lyx.org Git - lyx.git/blobdiff - src/support/filetools.C
remove commented HAVE_SSTREAM code
[lyx.git] / src / support / filetools.C
index e4c2ee6096f221f08874d4f244a81612ec5cde65..287a7e5860feac6f67e59f036beadfb6197866d3 100644 (file)
 #include <utility>
 #include <fstream>
 
-#ifdef HAVE_SSTREAM
-#include <sstream>
-#else
-#include <strstream>
-#endif
+#include "Lsstream.h"
 
 #ifdef __GNUG__
 #pragma implementation "filetools.h"
@@ -739,24 +735,11 @@ string const GetFileContents(string const & fname)
        FileInfo finfo(fname);
        if (finfo.exist()) {
                ifstream ifs(fname.c_str());
-#ifdef HAVE_SSTREAM
                std::ostringstream ofs;
-#else
-#warning The rumour goes that this might leak, but who really cares?
-               ostrstream ofs;
-#endif
                if (ifs && ofs) {
                        ofs << ifs.rdbuf();
                        ifs.close();
-#ifdef HAVE_SSTREAM
                        return ofs.str().c_str();
-#else
-                       ofs << '\0';
-                       char const * tmp = ofs.str();
-                       string ret(tmp);
-                       delete[] tmp;
-                       return ret;
-#endif
                }
        }
        lyxerr << "LyX was not able to read file '" << fname << "'" << endl;
@@ -964,8 +947,9 @@ ChangeExtension(string const & oldname, string const & extension)
        return CleanupPath(oldname.substr(0, last_dot) + ext);
 }
 
+
 /// Return the extension of the file (not including the .)
-string GetExtension(string const & name)
+string const GetExtension(string const & name)
 {
        string::size_type last_slash = name.rfind('/');
        string::size_type last_dot = name.rfind('.');
@@ -977,6 +961,7 @@ string GetExtension(string const & name)
                return string();
 }
 
+
 // Creates a nice compact path for displaying
 string const
 MakeDisplayPath (string const & path, unsigned int threshold)
@@ -1109,6 +1094,7 @@ findtexfile(string const & fil, string const & /*format*/)
         return c.first != -1 ? strip(c.second, '\n') : string();
 }
 
+
 void removeAutosaveFile(string const & filename)
 {
        string a = OnlyPath(filename);