Mercurial > libedl
diff README.md @ 12:0cc2555db371
*: make our string functions not stupid
strncat() made everything slow!
new addition internally: an EDL_header structure to make things
not stupid. if we were using C++ it wouldn't really be necessary,
but alas :)
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 27 Mar 2024 13:38:30 -0400 |
parents | 0c98b46eaf73 |
children |
line wrap: on
line diff
--- a/README.md Fri Mar 22 20:51:46 2024 -0400 +++ b/README.md Wed Mar 27 13:38:30 2024 -0400 @@ -18,9 +18,9 @@ #include <edl.h> -int file_get_contents(const char* file, char** contents, long* size) { +int file_get_contents(const char* f, char** contents, long* size) { /* open the file */ - FILE* file = fopen(file, "rb"); + FILE* file = fopen(f, "rb"); if (!file) return 1; @@ -37,7 +37,7 @@ /* hope and pray that `char` is 8-bit */ fread(*contents, *size, 1, file); - data[*size] = '\0'; + (*contents)[*size] = '\0'; fclose(file); } @@ -61,7 +61,7 @@ * * it is also perfectly valid to use mmap() or * variations of it (ex MapViewOfFile()) here... */ - EDL_parse(&edl, data, fsize + 1); + EDL_parse(&edl, data, size + 1); /* dump the data to a valid EDL string */ char* edl_str = EDL_dump(&edl);