[Extractor-gtk-cvslog] SF.net SVN: extractor-gtk:[119] trunk/extractor
Extract files from unusual archive formats
Brought to you by:
someone-guy
From: <som...@us...> - 2009-09-03 14:11:27
|
Revision: 119 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=119&view=rev Author: someone-guy Date: 2009-09-03 14:11:18 +0000 (Thu, 03 Sep 2009) Log Message: ----------- Add or improve code documentation Modified Paths: -------------- trunk/extractor/dsnpk.c trunk/extractor/generic.c trunk/extractor/helpers.c trunk/extractor/solid.c trunk/extractor/solidsub.c Modified: trunk/extractor/dsnpk.c =================================================================== --- trunk/extractor/dsnpk.c 2009-07-31 13:42:18 UTC (rev 118) +++ trunk/extractor/dsnpk.c 2009-09-03 14:11:18 UTC (rev 119) @@ -18,6 +18,12 @@ return read_le32(in) == TAG('N', 'P', 'K', '0'); } +/** + * \brief reads a tag header into tag and end file offset + * \param in file to read tag header from at current position + * \param tag returns the tag read + * \param end file offset where this tag's data ends + */ static inline void get_tag(FILE *in, uint32_t *tag, uint64_t *end) { *tag = read_le32(in); *end = read_le32(in); Modified: trunk/extractor/generic.c =================================================================== --- trunk/extractor/generic.c 2009-07-31 13:42:18 UTC (rev 118) +++ trunk/extractor/generic.c 2009-09-03 14:11:18 UTC (rev 119) @@ -14,9 +14,15 @@ #include "helpers.h" static int check_file(FILE *in) { + // no autodetection return 0; } +/** + * \brief checks if the given value would be a valid FOURCC as used in AVI files + * \param id value to check + * \return 1 if it would be a valid FOURCC, 0 otherwise + */ static int is_valid_fourcc(uint32_t id) { static const char valid_chars[] = "0123456789abcdefghijklmnopqrstuvwxyz" @@ -31,38 +37,46 @@ typedef uint64_t buffer_t; + +//! size of data buffered at least in RAM (twice as much memory is used) #define RAMBUF_SZ (256 * 1024) +//! read an unsigned 16-bit little-endian value and advance pointer static inline uint16_t get_le16(uint8_t **p) { uint16_t res = *(*p)++; res += *(*p)++ << 8; return res; } +//! read an unsigned 16-bit big-endian value and advance pointer static inline uint16_t get_be16(uint8_t **p) { uint16_t res = *(*p)++ << 8; res += *(*p)++; return res; } +//! read an unsigned 32-bit little-endian value and advance pointer static inline uint32_t get_le32(uint8_t **p) { uint32_t res = get_le16(p); res += get_le16(p) << 16; return res; } +//! read an unsigned 32-bit big-endian value and advance pointer static inline uint32_t get_be32(uint8_t **p) { uint32_t res = get_be16(p) << 16; res += get_be16(p); return res; } +//! read an unsigned 64-bit little-endian value and advance pointer static inline uint64_t get_le64(uint8_t **p) { uint64_t res = get_le32(p); res += (uint64_t)get_le32(p) << 32; return res; } +//! read an unsigned 64-bit big-endian value and advance pointer static inline uint64_t get_be64(uint8_t **p) { uint64_t res = (uint64_t)get_be32(p) << 32; res += get_be32(p); Modified: trunk/extractor/helpers.c =================================================================== --- trunk/extractor/helpers.c 2009-07-31 13:42:18 UTC (rev 118) +++ trunk/extractor/helpers.c 2009-09-03 14:11:18 UTC (rev 119) @@ -33,6 +33,11 @@ return name; } +/** + * \brief append an empty, zero-initialized entry + * \param list file list to append to + * \param cnt current number of entries in list + */ void add_entry_empty(struct file_s **list, int cnt) { file_t *l = *list; l = realloc(l, (cnt + 2) * sizeof(file_t)); @@ -41,7 +46,7 @@ } /** - * \brief append a new entry to a file list + * \brief append a new numbered entry to a file list * \param list file list to append to * \param cnt current number of entries in list * \param namenr number to base file name on Modified: trunk/extractor/solid.c =================================================================== --- trunk/extractor/solid.c 2009-07-31 13:42:18 UTC (rev 118) +++ trunk/extractor/solid.c 2009-09-03 14:11:18 UTC (rev 119) @@ -28,6 +28,12 @@ LANG_JA = 7, }; + +/** + * \brief get string matching the language id + * \param lang language id + * \return pointer to corresponding string constant + */ static const char *langstr(int lang) { switch (lang) { case LANG_ANY: return ""; @@ -51,6 +57,11 @@ TYPE_PADDING = 0xf0, }; +/** + * \brief get string matching the type id + * \param lang type id + * \return pointer to corresponding string constant + */ static const char *typestr(int type) { switch (type) { case TYPE_AUDIO : return "ogg"; @@ -64,6 +75,14 @@ return "bin"; } +/** + * \brief reads a block header + * \param in file to read block header from at current position + * \param lang language id of block + * \param type type id of block + * \param len length of block + * \return 0 if reading failed, 1 otherwise + */ static inline int read_block_header(FILE *in, int *lang, int *type, uint32_t *len) { *lang = read_be16(in); *type = read_be16(in); Modified: trunk/extractor/solidsub.c =================================================================== --- trunk/extractor/solidsub.c 2009-07-31 13:42:18 UTC (rev 118) +++ trunk/extractor/solidsub.c 2009-09-03 14:11:18 UTC (rev 119) @@ -38,6 +38,7 @@ return list; } +//! header for writing a PBM file static const char pbm_string[] = "P4\n" "# PBM header added by extractor, original data follows the third newline\n" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |