Change ff_open to explicit memcpy()

This commit is contained in:
Sergey Lyubka 2022-07-11 18:13:46 +01:00
parent f40b272eeb
commit 46af09f776
2 changed files with 2 additions and 2 deletions

View File

@ -986,7 +986,7 @@ static void *ff_open(const char *path, int flags) {
if (flags & MG_FS_WRITE) mode |= FA_WRITE | FA_OPEN_ALWAYS | FA_OPEN_APPEND;
if (f_open(&f, path, mode) == 0) {
FIL *fp = calloc(1, sizeof(*fp));
*fp = f;
memcpy(fp, &f, sizeof(*fp));
return fp;
} else {
return NULL;

View File

@ -74,7 +74,7 @@ static void *ff_open(const char *path, int flags) {
if (flags & MG_FS_WRITE) mode |= FA_WRITE | FA_OPEN_ALWAYS | FA_OPEN_APPEND;
if (f_open(&f, path, mode) == 0) {
FIL *fp = calloc(1, sizeof(*fp));
*fp = f;
memcpy(fp, &f, sizeof(*fp));
return fp;
} else {
return NULL;