From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chris Moore Newsgroups: gmane.emacs.devel Subject: Re: C file recoginzed as image file Date: Sat, 06 Jan 2007 13:42:14 +0100 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1168087359 1281 80.91.229.12 (6 Jan 2007 12:42:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 6 Jan 2007 12:42:39 +0000 (UTC) Cc: c.a.rendle@gmail.com, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 06 13:42:38 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1H3Asd-0001Hq-R2 for ged-emacs-devel@m.gmane.org; Sat, 06 Jan 2007 13:42:36 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H3Asd-0002Dm-Ab for ged-emacs-devel@m.gmane.org; Sat, 06 Jan 2007 07:42:35 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H3AsR-0002Dh-Sh for emacs-devel@gnu.org; Sat, 06 Jan 2007 07:42:23 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H3AsQ-0002CO-BT for emacs-devel@gnu.org; Sat, 06 Jan 2007 07:42:23 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H3AsQ-0002CJ-95 for emacs-devel@gnu.org; Sat, 06 Jan 2007 07:42:22 -0500 Original-Received: from [66.249.92.174] (helo=ug-out-1314.google.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1H3AsP-00005U-TO for emacs-devel@gnu.org; Sat, 06 Jan 2007 07:42:22 -0500 Original-Received: by ug-out-1314.google.com with SMTP id j3so6606318ugf for ; Sat, 06 Jan 2007 04:42:20 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:to:cc:references:from:date:in-reply-to:message-id:user-agent:mime-version:content-type:x-sa-exim-connect-ip:x-sa-exim-mail-from:x-spam-checker-version:x-spam-level:x-spam-status:subject:x-sa-exim-version:x-sa-exim-scanned:sender; b=ts/IzDOPcQzvtBCXg0qfCpS2cYvyGZzfP3Z41T2lnxYkJCVh/mJReW0/KpbNkHZdC6zr7CN3cnE44iZV3k/ruEMNKYleq5aIReKIbJUmGT+UPrxc8mn378SnzS5bL8P/xQ3YtefkO9GH3w7JU3kfmsiSzZipNW08D6bLfS04KYg= Original-Received: by 10.67.19.20 with SMTP id w20mr19420736ugi.1168087340683; Sat, 06 Jan 2007 04:42:20 -0800 (PST) Original-Received: from chrislap.local ( [89.176.28.156]) by mx.google.com with ESMTP id i39sm36889749ugd.2007.01.06.04.42.19; Sat, 06 Jan 2007 04:42:19 -0800 (PST) Original-Received: from localhost ([127.0.0.1] helo=chrislap.local) by chrislap.local with esmtp (Exim 4.63) (envelope-from ) id 1H3AsI-0001My-KJ; Sat, 06 Jan 2007 13:42:16 +0100 Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Fri\, 05 Jan 2007 21\:55\:08 -0500") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (gnu/linux) X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: dooglus@gmail.com X-SA-Exim-Version: 4.2.1 (built Sun, 03 Dec 2006 00:39:09 +0000) X-SA-Exim-Scanned: Yes (on chrislap.local) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:64877 Archived-At: Richard Stallman writes: > Similarly, any text file which starts with the 4 characters "GIF8" is > treated as if it was an image. > > Is there anything else we could check for > to distinguish real GIF files from other files? > Would someone please check the spec? http://www.w3.org/Graphics/GIF/spec-gif89a.txt tells me that the first 3 bytes contain the fixed value 'GIF', and the next 3 bytes contain the version number: Version Numbers as of 10 July 1990 : "87a" - May 1987 "89a" - July 1989 Version numbers are ordered numerically increasing on the first two digits starting with 87 (87,88,...,99,00,...,85,86) and alphabetically increasing on the third character (a,...,z). Immediately after this 6 byte header comes the logical screen descriptor, which doesn't contain anything we can use to recognise a valid image. So a better image-type-header-regexps entry would be: ("\\`GIF[0-9][0-9][a-z]" . gif)