mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-09 10:47:57 +00:00
fix slowness in lyxsum
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_1_6@2091 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5df0b887fb
commit
947777dfc0
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
|||||||
|
2001-05-30 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||||
|
|
||||||
|
* configure.in:
|
||||||
|
* src/support/lyxsum.C (sum): use istreambuf_iterator when
|
||||||
|
available.
|
||||||
|
|
||||||
|
2001-05-29 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||||
|
|
||||||
|
* src/support/lyxsum.C (sum): don't use sstream anymore, use
|
||||||
|
istream_iterator directly instead.
|
||||||
|
|
||||||
2001-05-23 Angus Leeming <a.leeming@ic.ac.uk>
|
2001-05-23 Angus Leeming <a.leeming@ic.ac.uk>
|
||||||
|
|
||||||
* src/frontends/xforms/FormInset.C (createInset): fixed bug
|
* src/frontends/xforms/FormInset.C (createInset): fixed bug
|
||||||
|
@ -253,6 +253,7 @@ fi
|
|||||||
AC_CHECK_FUNCS(snprintf vsnprintf)
|
AC_CHECK_FUNCS(snprintf vsnprintf)
|
||||||
LYX_CHECK_DECL(snprintf, stdio.h)
|
LYX_CHECK_DECL(snprintf, stdio.h)
|
||||||
LYX_CHECK_DECL(vsnprintf, stdio.h)
|
LYX_CHECK_DECL(vsnprintf, stdio.h)
|
||||||
|
LYX_CHECK_DECL(istreambuf_iterator, iterator)
|
||||||
|
|
||||||
AC_CHECK_FUNCS(memmove memset strchr putenv setenv mkfifo \
|
AC_CHECK_FUNCS(memmove memset strchr putenv setenv mkfifo \
|
||||||
mkstemp mktemp)
|
mkstemp mktemp)
|
||||||
|
@ -16,8 +16,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <iterator>
|
||||||
#include "Lsstream.h"
|
|
||||||
|
|
||||||
#include "support/lyxlib.h"
|
#include "support/lyxlib.h"
|
||||||
|
|
||||||
@ -108,14 +107,20 @@ unsigned long do_crc(InputIterator first, InputIterator last)
|
|||||||
// And this would be the file interface.
|
// And this would be the file interface.
|
||||||
unsigned long lyx::sum(string const & file)
|
unsigned long lyx::sum(string const & file)
|
||||||
{
|
{
|
||||||
ifstream ifs(file.c_str());
|
std::ifstream ifs(file.c_str());
|
||||||
if (!ifs) return 0;
|
if (!ifs) return 0;
|
||||||
ifs.unsetf(ios::skipws);
|
|
||||||
ostringstream ostr;
|
#ifdef HAVE_DECL_ISTREAMBUF_ITERATOR
|
||||||
ostr << ifs.rdbuf();
|
// This is a lot faster...
|
||||||
// The .c_str() is here in case we use our lyxstring class
|
std::istreambuf_iterator<char> beg(ifs);
|
||||||
// instead of standard string.
|
std::istreambuf_iterator<char> end;
|
||||||
string w = ostr.str().c_str();
|
#else
|
||||||
return do_crc(w.begin(), w.end());
|
// than this.
|
||||||
|
ifs.unsetf(std::ios::skipws);
|
||||||
|
std::istream_iterator<char> beg(ifs);
|
||||||
|
std::istream_iterator<char> end;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return do_crc(beg, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user