diff options
author | Dr.Smile <vabnick@gmail.com> | 2021-05-02 00:46:32 +0300 |
---|---|---|
committer | Dr.Smile <vabnick@gmail.com> | 2021-05-08 20:52:33 +0300 |
commit | a2e56bf9a36f84e094067cf45d2f1f9dbd57f291 (patch) | |
tree | f72e53af639d2b80391de070e321cc6ae4be83a5 /compare | |
parent | 0e7d2dd37a6531379049fff9f310642e3e02f4c5 (diff) | |
download | libass-a2e56bf9a36f84e094067cf45d2f1f9dbd57f291.tar.bz2 libass-a2e56bf9a36f84e094067cf45d2f1f9dbd57f291.tar.xz |
compare: fix compilation under MinGW
Replace missing strndup() with its standard C equivalent
and circumvent unimplemented second argument of mkdir().
Diffstat (limited to 'compare')
-rw-r--r-- | compare/compare.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compare/compare.c b/compare/compare.c index b93aef74..24d78298 100644 --- a/compare/compare.c +++ b/compare/compare.c @@ -23,6 +23,10 @@ #include <dirent.h> #include <string.h> +#if defined(_WIN32) && !defined(__CYGWIN__) +#define mkdir(path, mode) _mkdir(path) +#endif + #define FFMAX(a,b) ((a) > (b) ? (a) : (b)) #define FFMIN(a,b) ((a) > (b) ? (b) : (a)) @@ -407,9 +411,11 @@ static bool add_sub_item(ItemList *list, const char *file, size_t len) return false; Item *item = &list->items[list->n_items]; - item->name = strndup(file, len); + item->name = malloc(len + 1); if (!item->name) return out_of_memory(); + memcpy(item->name, file, len); + item->name[len] = '\0'; item->time = -1; list->n_items++; return true; |