Mercurial > pidgin.yaz
changeset 17729:0a4238600947
Fixed recognition of the extension of certain JPG files. The 4th character may be anything between e0 and ef; the first 3 should be sufficient for a magic number, though a more 'complete' solution would verify that (e0 <= data[3] <= ef). Also, added recognition of TIF files (magic number: MM or II). Refs #725, which gave examples of several JPGs with (data[3] == e1).
author | Evan Schoenberg <evan.s@dreskin.net> |
---|---|
date | Tue, 05 Jun 2007 12:04:09 +0000 |
parents | 9b1148aef5fa |
children | 647bfc2b2a7b |
files | libpurple/util.c |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/util.c Tue Jun 05 07:06:09 2007 +0000 +++ b/libpurple/util.c Tue Jun 05 12:04:09 2007 +0000 @@ -2654,14 +2654,17 @@ if (len >= 4) { - if (!strncmp((char *)data, "BM", 2)) - return "bmp"; - else if (!strncmp((char *)data, "GIF8", 4)) + if (!strncmp((char *)data, "GIF8", 4)) return "gif"; - else if (!strncmp((char *)data, "\xff\xd8\xff\xe0", 4)) + else if (!strncmp((char *)data, "\xff\xd8\xff", 3)) /* 4th may be e0 through ef */ return "jpg"; else if (!strncmp((char *)data, "\x89PNG", 4)) return "png"; + else if (!strncmp((char *)data, "MM", 2) || + !strncmp((char *)data, "II", 2)) + return "tif"; + ekse if (!strncmp((char *)data, "BM", 2)) + return "bmp"; } return "icon";