]> git.lyx.org Git - lyx.git/blobdiff - src/support/lyxsum.C
one small private fix in mathed, put noncopyable and tie into boost namespace
[lyx.git] / src / support / lyxsum.C
index fbf532d34daadae856b2ad3995102649b28f36cd..8980a3f8ae91843a0357cd8c5406fbe4311fa7fb 100644 (file)
 
 #include <fstream>
 
-#ifdef HAVE_SSTREAM
-#include <sstream>
-using std::ostringstream;
-#else
-#include <strstream>
-#endif
+#include "Lsstream.h"
 
 #include "support/lyxlib.h"
 
@@ -111,27 +106,16 @@ unsigned long do_crc(InputIterator first, InputIterator last)
 
 
 // And this would be the file interface.
-unsigned long lyx::sum(char const * file)
+unsigned long lyx::sum(string const & file)
 {
-       ifstream ifs(file);
+       ifstream ifs(file.c_str());
        if (!ifs) return 0;
        ifs.unsetf(ios::skipws);
-#ifdef HAVE_SSTREAM
        ostringstream ostr;
        ostr << ifs.rdbuf();
        // The .c_str() is here in case we use our lyxstring class
        // instead of standard string. 
        string w = ostr.str().c_str();
        return do_crc(w.begin(), w.end());
-#else
-       ostrstream ostr;
-       ostr << ifs.rdbuf();
-       ostr << '\0';
-       char * tmp = ostr.str();
-       if (!tmp) return 0; // empty file
-       string w(tmp, ostr.tellp());
-       unsigned long crc = do_crc(w.begin(), w.end());
-       delete tmp;
-       return crc;
-#endif
 }
+