Herbert Voss wrote: > this seems easier to me ... > do a mv ... /dev/null if it's nonsense
should not be the truth ... ;-) here is the right one ..., sorry Herbert -- http://www.lyx.org/help/
Index: src/support/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/ChangeLog,v retrieving revision 1.93 diff -u -r1.93 ChangeLog --- src/support/ChangeLog 6 Apr 2002 13:01:03 -0000 1.93 +++ src/support/ChangeLog 6 Apr 2002 17:53:44 -0000 @@ -1,3 +1,8 @@ +2002-04-07 Herbert Voss <[EMAIL PROTECTED]> + + * filetools.C: (getExtFromContents) read less bytes to find + the file type + 2002-04-06 Lars Gullik Bjønnes <[EMAIL PROTECTED]> * lyxstring.C (operator>>): use the better solution, this fixes a Index: src/support/filetools.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/filetools.C,v retrieving revision 1.113 diff -u -r1.113 filetools.C --- src/support/filetools.C 6 Apr 2002 12:42:42 -0000 1.113 +++ src/support/filetools.C 6 Apr 2002 17:53:45 -0000 @@ -1013,11 +1013,18 @@ if (filename.empty() || !IsFileReadable(filename)) return string(); + ifstream ifs(filename.c_str()); if (!ifs) // Couldn't open file... return string(); + // get the filesize + ifs.seekg(0,ios::end); + int filesize = (int)ifs.tellg(); + ifs.seekg(0,ios::beg); + lyxerr[Debug::GRAPHICS] << "filesize = " << filesize << endl; + // gnuzip string const gzipStamp = "\037\213\010\010"; @@ -1032,6 +1039,7 @@ int count = 0; string str, format; + int const bytes_to_read = 64; bool firstLine = true; while ((count++ < max_count) && format.empty()) { if (ifs.eof()) { @@ -1041,8 +1049,11 @@ << endl; break; } - - ifs >> str; + int read_bytes = (filesize > bytes_to_read) ? bytes_to_read : filesize; + char char_array[read_bytes]; + ifs.read(char_array, read_bytes); + string str(char_array, read_bytes); + filesize -= bytes_to_read; lyxerr[Debug::GRAPHICS] << "Scanstring: " << str << endl; string const stamp = str.substr(0,2);