[Xfce4-commits] r22638 - xarchiver/trunk/src

Giuseppe Torelli colossus at xfce.org
Thu Aug 3 11:54:28 UTC 2006


Author: colossus
Date: 2006-08-03 11:54:28 +0000 (Thu, 03 Aug 2006)
New Revision: 22638

Modified:
   xarchiver/trunk/src/archive.h
   xarchiver/trunk/src/callbacks.c
Log:
Initial support for for opening BIN images; added magic header to the DetectArchiveType() routine.


Modified: xarchiver/trunk/src/archive.h
===================================================================
--- xarchiver/trunk/src/archive.h	2006-08-03 11:35:29 UTC (rev 22637)
+++ xarchiver/trunk/src/archive.h	2006-08-03 11:54:28 UTC (rev 22638)
@@ -26,6 +26,7 @@
 	XARCHIVETYPE_BZIP2,
 	XARCHIVETYPE_GZIP,
 	XARCHIVETYPE_ISO,
+	XARCHIVETYPE_BIN,
 	XARCHIVETYPE_RAR,
 	XARCHIVETYPE_RPM,
 	XARCHIVETYPE_TAR,

Modified: xarchiver/trunk/src/callbacks.c
===================================================================
--- xarchiver/trunk/src/callbacks.c	2006-08-03 11:35:29 UTC (rev 22637)
+++ xarchiver/trunk/src/callbacks.c	2006-08-03 11:54:28 UTC (rev 22638)
@@ -859,7 +859,7 @@
 {
 	FILE *dummy_ptr = NULL;
     int xx = -1;
-	unsigned char magic[6];
+	unsigned char magic[12];
 	dummy_ptr = fopen ( filename , "r" );
 	
 	if (dummy_ptr == NULL)
@@ -873,7 +873,7 @@
 		g_free (utf8_path);
 		return -2;
 	 }
-	if ( fread ( magic, 1, 6, dummy_ptr ) == 0 )
+	if ( fread ( magic, 1, 12, dummy_ptr ) == 0 )
 	{
 		fclose ( dummy_ptr);
 		return -2;
@@ -896,6 +896,7 @@
     else if ( memcmp ( magic,"\x37\x7a\xbc\xaf\x27\x1c",6 ) == 0 ) xx = XARCHIVETYPE_7ZIP;
     else if ( isTar ( dummy_ptr ) ) xx = XARCHIVETYPE_TAR;
     else if ( isISO ( dummy_ptr ) ) xx = XARCHIVETYPE_ISO;
+	else if ( memcmp (magic,"\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00",12) == 0 ) xx = XARCHIVETYPE_BIN;
 	fclose ( dummy_ptr );
 	return xx;
 }



More information about the Xfce4-commits mailing list