[Bf-committers] New file magic and proposed change

GSR gsr.b3d at infernal-iceberg.com
Mon Nov 27 18:14:48 CET 2006


Hi:

New blend files include subversion numbers, with a human readable
string and computer fields. Thus changing the string format should be
no problem, and help with the file magic printing. Required change is
zero padding like in main version data (add a . in the correct
sprintf, see patch).

Anybody can see the string by hand with hexdump -C file.blend | less
and looking for a readable four byte sequence in 00000050. But if you
are using Unix you can get the info via file. Current file DB only
provides the basic info, so please test the attached file magic with
file -m blender.magic file.blend. Use new and old files, 32 or 64 bit,
little or big endian. Then we can send it to the file maintainers so
new data is reported too.

GSR
 
-------------- next part --------------
Index: ./source/blender/blenloader/intern/writefile.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/blenloader/intern/writefile.c,v
retrieving revision 1.87
diff -u -p -r1.87 writefile.c
--- ./source/blender/blenloader/intern/writefile.c	27 Nov 2006 10:43:00 -0000	1.87
+++ ./source/blender/blenloader/intern/writefile.c	27 Nov 2006 16:03:36 -0000
@@ -1845,7 +1845,7 @@ static void write_global(WriteData *wd)
 	fg.fileflags= (G.fileflags & ~G_FILE_NO_UI);	// prevent to save this, is not good convention, and feature with concerns...
 	fg.globalf= G.f;
 	/* note, this will print byte nr 5, but that's corrected */
-	sprintf(fg.subvstr, "%4d", BLENDER_SUBVERSION);
+	sprintf(fg.subvstr, "%.4d", BLENDER_SUBVERSION);
 	fg.subversion= BLENDER_SUBVERSION;
 	fg.minversion= BLENDER_MINVERSION;
 	fg.minsubversion= BLENDER_MINSUBVERSION;
-------------- next part --------------
# blender: file(1) magic for Blender 3D data files
#
# Rule version: 1.2. For questions use the developers list 
# http://projects.blender.org/mailman/listinfo/bf-committers
# Since 2.42 GLOB chunk moved near start and got subversion info

0       string  =BLENDER        Blender3D,
>7      string  =_              saved as 32-bits
>>8     string  =v              little endian
>>8     string  =V              big endian
>>9     byte    x               with version %c.
>>10    byte    x               \b%c
>>11    byte    x               \b%c
>>0x40  string  =GLOB           \b.
>>>0x54 byte    x               \b%c
>>>0x55 byte    x               \b%c
>>>0x56 byte    x               \b%c
>>>0x57 byte    x               \b%c
>7      string  =-              saved as 64-bits
>>8     string  =v              little endian
>>8     string  =V              big endian
>>9     byte    x               with version %c.
>>10    byte    x               \b%c
>>11    byte    x               \b%c
>>0x44  string  =GLOB           \b.
>>>0x5c byte    x               \b%c
>>>0x5d byte    x               \b%c
>>>0x5e byte    x               \b%c
>>>0x5f byte    x               \b%c


More information about the Bf-committers mailing list