[Extractor-gtk-cvslog] SF.net SVN: extractor-gtk: [74] trunk/extractor
Extract files from unusual archive formats
Brought to you by:
someone-guy
From: <som...@us...> - 2008-04-06 20:09:23
|
Revision: 74 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=74&view=rev Author: someone-guy Date: 2008-04-06 13:09:20 -0700 (Sun, 06 Apr 2008) Log Message: ----------- Move add_entry to global helpers.c/h Modified Paths: -------------- trunk/extractor/generic.c trunk/extractor/helpers.c trunk/extractor/helpers.h Modified: trunk/extractor/generic.c =================================================================== --- trunk/extractor/generic.c 2008-04-06 20:08:48 UTC (rev 73) +++ trunk/extractor/generic.c 2008-04-06 20:09:20 UTC (rev 74) @@ -17,15 +17,6 @@ return 0; } -static void add_entry(file_t **list, int cnt, const char *ext) { - file_t *l = *list; - l = realloc(l, (cnt + 2) * sizeof(file_t)); - memset(&l[cnt + 1], 0, sizeof(file_t)); - l[cnt].name = malloc(50); - snprintf(l[cnt].name, 50, "%i.%s", cnt, ext); - *list = l; -} - static int is_valid_fourcc(uint32_t id) { static const char valid_chars[] = "0123456789abcdefghijklmnopqrstuvwxyz" Modified: trunk/extractor/helpers.c =================================================================== --- trunk/extractor/helpers.c 2008-04-06 20:08:48 UTC (rev 73) +++ trunk/extractor/helpers.c 2008-04-06 20:09:20 UTC (rev 74) @@ -7,6 +7,7 @@ */ #include <stdlib.h> #include <stdio.h> +#include <string.h> #include <inttypes.h> #include "helpers.h" #include "formats.h" @@ -67,6 +68,21 @@ return t[0] << 8 | t[1]; } +/** + * \brief append a new entry to a file list + * \param list file list to append to + * \param cnt current number of entries in list + * \param ext extension of entry to add + */ +void add_entry(struct file_s **list, int cnt, const char *ext) { + file_t *l = *list; + l = realloc(l, (cnt + 2) * sizeof(file_t)); + memset(&l[cnt + 1], 0, sizeof(file_t)); + l[cnt].name = malloc(50); + snprintf(l[cnt].name, 50, "%i.%s", cnt, ext); + *list = l; +} + #define BLOCK_SIZE 4096 /** * \brief copy data from one file into another Modified: trunk/extractor/helpers.h =================================================================== --- trunk/extractor/helpers.h 2008-04-06 20:08:48 UTC (rev 73) +++ trunk/extractor/helpers.h 2008-04-06 20:09:20 UTC (rev 74) @@ -11,6 +11,7 @@ #define HUGETAG(a, b, c, d, e, f, g, h) (((uint64_t)(TAG(a, b, c, d)) << 32) | TAG(e, f, g, h)) struct file_s; +void add_entry(struct file_s **list, int cnt, const char *ext); void default_free_list(struct file_s *list); void default_free_ignorepriv(struct file_s *list); int default_extract_file(FILE *in, const struct file_s *file, FILE *out); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |