[Gridflow-cvs] [svn] commit: r3988 - /trunk/format/main.c

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Mon Jul 7 12:45:32 EDT 2008


Author: claude
Date: Mon Jul  7 12:45:30 2008
New Revision: 3988

Log:
in C numeric character literals are octal not hex; now old (circa 2006) .grid files can be loaded again

Modified:
    trunk/format/main.c

Modified: trunk/format/main.c
==============================================================================
--- trunk/format/main.c (original)
+++ trunk/format/main.c Mon Jul  7 12:45:30 2008
@@ -137,7 +137,7 @@
 
 /* This is the Grid format I defined: */
 struct GridHeader {
-	char magic[5]; // = "\7fgrid" on little endian, "\x7fGRID" on big endian
+	char magic[5]; // = "\x7fgrid" on little endian, "\x7fGRID" on big endian
 	uint8 type; // number of bits.
 		   // the original doc said: "plus one of: 1:unsigned 2:float" but i don't recall what this means.
 	uint8 reserved; // set this to 0 all of the time.
@@ -153,7 +153,7 @@
 	P<Dim> headerless_dim; // if null: headerful; if Dim: it is the assumed dimensions of received grids
 	\grin 0
 	\constructor (t_symbol *mode, string filename) {
-		strncpy(head.magic,is_le()?"\7fgrid":"\7fGRID",5);
+		strncpy(head.magic,is_le()?"\177grid":"\177GRID",5);
 		head.type = 32;
 		_0_open(0,0,mode,filename);
 	}
@@ -176,8 +176,8 @@
 	} else {
 		fread(&head,1,8,f);
 		uint8 *m = (uint8 *)head.magic;
-		if (strncmp((char *)m,"\7fgrid",5)==0) endian=1; else
-		if (strncmp((char *)m,"\7fGRID",5)==0) endian=1; else
+		if (strncmp((char *)m,"\177grid",5)==0) endian=1; else
+		if (strncmp((char *)m,"\177GRID",5)==0) endian=1; else
 		RAISE("unknown header, can't read grid from file: "
 			"%02x %02x %02x %02x %02x %02x %02x %02x",
 			m[0],m[1],m[2],m[3],m[4],m[5],m[6],m[7]);



More information about the Gridflow-cvs mailing list