>>>>> "Jos�" == Jos� Ab�lio Oliveira Matos <[EMAIL PROTECTED]> writes:
Jos�> On Thursday 12 September 2002 15:12, Jean-Marc Lasgouttes wrote:
>> And the file contains the string JFIF, right?
Jos�> Yes, but only in position 0x430 (I had to use a hex editor to
Jos�> see it. :-)
Does the following completely untested patch help?
Note that it only fixes your case, and that the function should be
completely rewritten to be table-driven to fix all the questionable
uses of contains().
JMarc
Index: src/support/filetools.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/filetools.C,v
retrieving revision 1.134
diff -u -p -r1.134 filetools.C
--- src/support/filetools.C 28 Jul 2002 22:50:13 -0000 1.134
+++ src/support/filetools.C 12 Sep 2002 14:46:48 -0000
@@ -1106,6 +1106,10 @@ string const getExtFromContents(string c
} else if (prefixIs(str,"GIF")) {
format = "gif";
+ } else if (str.size() >= 11
+ && str.substr(6,4) == "JFIF") {
+ format = "jpg";
+
} else if (str.size() > 3) {
int const c = ((str[0] << 24) & (str[1] << 16) &
(str[2] << 8) & str[3]);
@@ -1126,9 +1130,6 @@ string const getExtFromContents(string c
else if (contains(str,"Grace"))
format = "agr";
-
- else if (contains(str,"JFIF"))
- format = "jpg";
else if (contains(str,"%PDF"))
format = "pdf";