From 26fcbbdd26a389b6979a966ae8dd49a40a6a1d05 Mon Sep 17 00:00:00 2001 From: pixel Date: Wed, 11 Jul 2007 14:23:29 +0000 Subject: Adding comments. --- mpq-fs.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'mpq-fs.c') diff --git a/mpq-fs.c b/mpq-fs.c index b4c8fd7..ae9ed02 100644 --- a/mpq-fs.c +++ b/mpq-fs.c @@ -28,6 +28,9 @@ static char * strtoupper(char * _str) { return _str; } +/* + * The 'new' keyword is abusive: the function returns an existing entry if it matches, allowing overrites. + */ static directory_list * new_directory_list(directory_list * parent, struct mpq_archive_t * mpq_a, const char * name) { directory_list * r; @@ -49,6 +52,9 @@ static directory_list * new_directory_list(directory_list * parent, struct mpq_a return r; } +/* + * Recursively adds a new entry into our directory structure. + */ static directory_list * add_file_r(directory_list * parent, struct mpq_archive_t * mpq_a, char * fname, int entry) { char * bs; directory_list * r; @@ -81,6 +87,9 @@ static directory_list * add_file(struct mpq_archive_t * mpq_a, char * fname) { return add_file_r(root, mpq_a, fname, entry); } +/* + * Adds an opened archive file into the system, and try to automagically import the list file. + */ void mpqlib_fs_add_archive(struct mpq_archive_t * mpq_a) { struct mpq_file_t * listfile; char * buffer; @@ -105,6 +114,9 @@ void mpqlib_fs_add_archive(struct mpq_archive_t * mpq_a) { mpqlib_close(listfile); } +/* + * Generalistic function to add an archive to the directory structure using a custom listfile. + */ void mpqlib_fs_attach_listfile(struct mpq_archive_t * mpq_a, const char * listfile) { char fname[MAX_FNAME]; const char * p; @@ -112,6 +124,7 @@ void mpqlib_fs_attach_listfile(struct mpq_archive_t * mpq_a, const char * listfi for (p = listfile, fnp = fname; *p; p++) { switch (*p) { + /* Each entry in the listfile may be separated by CR, LF, and/or ';'. */ case '\r': case '\n': case ';': @@ -127,6 +140,9 @@ void mpqlib_fs_attach_listfile(struct mpq_archive_t * mpq_a, const char * listfi } } +/* + * Recursively find a file. + */ static directory_list * find_file_r(directory_list * parent, char * fname) { char * bs; directory_list * r; -- cgit v1.2.3