summaryrefslogtreecommitdiff
path: root/lib/bitio.c
diff options
context:
space:
mode:
authorMatthias Kramm <kramm@quiss.org>2010-01-03 23:46:01 -0800
committerMatthias Kramm <kramm@quiss.org>2010-01-03 23:46:01 -0800
commit131881aa4c31c77d8ad1b915dbe267760b429573 (patch)
tree7658d41f4c762fd374edd338afc0a12b171b16ac /lib/bitio.c
parentb6ebc39257e2814f08a17d8c179c3991c16053ba (diff)
added simple xml parser
Diffstat (limited to 'lib/bitio.c')
-rw-r--r--lib/bitio.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/bitio.c b/lib/bitio.c
index 442bf488..17d92939 100644
--- a/lib/bitio.c
+++ b/lib/bitio.c
@@ -71,6 +71,9 @@ static int reader_fileread(reader_t*reader, void* data, int len)
}
static void reader_fileread_dealloc(reader_t*r)
{
+ if(r->type == READER_TYPE_FILE2) {
+ close((ptroff_t)r->internal);
+ }
memset(r, 0, sizeof(reader_t));
}
void reader_init_filereader(reader_t*r, int handle)
@@ -83,6 +86,16 @@ void reader_init_filereader(reader_t*r, int handle)
r->bitpos = 8;
r->pos = 0;
}
+void reader_init_filereader2(reader_t*r, const char*filename)
+{
+ int fi = open(filename,
+#ifdef O_BINARY
+ O_BINARY|
+#endif
+ O_RDONLY);
+ reader_init_filereader(r, fi);
+ r->type = READER_TYPE_FILE2;
+}
/* ---------------------------- mem reader ------------------------------- */
@@ -294,7 +307,7 @@ void writer_init_filewriter(writer_t*w, int handle)
}
void writer_init_filewriter2(writer_t*w, char*filename)
{
- int fi = open("movie.swf",
+ int fi = open(filename,
#ifdef O_BINARY
O_BINARY|
#endif