[Extractor-gtk-cvslog] SF.net SVN: extractor-gtk: [73] trunk/extractor
Extract files from unusual archive formats
Brought to you by:
someone-guy
From: <som...@us...> - 2008-04-06 20:08:52
|
Revision: 73 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=73&view=rev Author: someone-guy Date: 2008-04-06 13:08:48 -0700 (Sun, 06 Apr 2008) Log Message: ----------- Add read_be16 helper Modified Paths: -------------- trunk/extractor/helpers.c trunk/extractor/helpers.h Modified: trunk/extractor/helpers.c =================================================================== --- trunk/extractor/helpers.c 2008-03-08 21:14:45 UTC (rev 72) +++ trunk/extractor/helpers.c 2008-04-06 20:08:48 UTC (rev 73) @@ -60,6 +60,13 @@ return t[1] << 8 | t[0]; } +//! read a 16 bit big-endian value from file +uint16_t read_be16(FILE *f) { + unsigned char t[2]; + fread(t, 2, 1, f); + return t[0] << 8 | t[1]; +} + #define BLOCK_SIZE 4096 /** * \brief copy data from one file into another Modified: trunk/extractor/helpers.h =================================================================== --- trunk/extractor/helpers.h 2008-03-08 21:14:45 UTC (rev 72) +++ trunk/extractor/helpers.h 2008-04-06 20:08:48 UTC (rev 73) @@ -5,6 +5,7 @@ uint32_t read_le32(FILE *f); uint32_t peek_le32(FILE *f); uint32_t read_be32(FILE *f); +uint16_t read_be16(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))) #define HUGETAG(a, b, c, d, e, f, g, h) (((uint64_t)(TAG(a, b, c, d)) << 32) | TAG(e, f, g, h)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |