[Extractor-gtk-cvslog] SF.net SVN: extractor-gtk: [22] trunk/extractor
Extract files from unusual archive formats
Brought to you by:
someone-guy
From: <som...@us...> - 2007-08-01 02:37:00
|
Revision: 22 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=22&view=rev Author: someone-guy Date: 2007-07-31 19:36:56 -0700 (Tue, 31 Jul 2007) Log Message: ----------- Add read_be32 function Modified Paths: -------------- trunk/extractor/helpers.c trunk/extractor/helpers.h Modified: trunk/extractor/helpers.c =================================================================== --- trunk/extractor/helpers.c 2007-08-01 02:08:45 UTC (rev 21) +++ trunk/extractor/helpers.c 2007-08-01 02:36:56 UTC (rev 22) @@ -37,6 +37,13 @@ return (t[3] << 8 | t[2]) << 16 | (t[1] << 8 | t[0]); } +//! read a 32 bit big-endian value from file +uint32_t read_be32(FILE *f) { + unsigned char t[4]; + fread(t, 4, 1, f); + return (t[0] << 8 | t[1]) << 16 | (t[2] << 8 | t[3]); +} + //! read a 16 bit little-endian value from file uint16_t read_le16(FILE *f) { unsigned char t[2]; Modified: trunk/extractor/helpers.h =================================================================== --- trunk/extractor/helpers.h 2007-08-01 02:08:45 UTC (rev 21) +++ trunk/extractor/helpers.h 2007-08-01 02:36:56 UTC (rev 22) @@ -3,6 +3,7 @@ char *read_cstring(FILE *f); uint16_t read_le16(FILE *f); uint32_t read_le32(FILE *f); +uint32_t read_be32(FILE *f); int fcopy(FILE *in, FILE *out, int len); #define TAG(a, b, c, d) ((uint32_t)(a << 8 | b) << 16 | (c << 8 | d)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |