mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
sys/fs/constfs: allow to host arbitrary data
Don't require data to be a uint8_t array to to be casted into one.
This commit is contained in:
parent
d797b74b0b
commit
148651a94d
@ -197,7 +197,7 @@ static ssize_t constfs_read(vfs_file_t *filp, void *dest, size_t nbytes)
|
||||
if (nbytes > (fp->size - filp->pos)) {
|
||||
nbytes = fp->size - filp->pos;
|
||||
}
|
||||
memcpy(dest, fp->data + filp->pos, nbytes);
|
||||
memcpy(dest, (const uint8_t *)fp->data + filp->pos, nbytes);
|
||||
DEBUG("constfs_read: read %lu bytes\n", (long unsigned)nbytes);
|
||||
filp->pos += nbytes;
|
||||
return nbytes;
|
||||
|
@ -37,9 +37,9 @@ extern "C" {
|
||||
* @brief A file in ConstFS (file name + contents)
|
||||
*/
|
||||
typedef struct {
|
||||
const char *path; /**< file system relative path to file */
|
||||
const char *path; /**< file system relative path to file */
|
||||
const size_t size; /**< length of @c data */
|
||||
const uint8_t *data; /**< pointer to file contents */
|
||||
const void *data; /**< pointer to file contents */
|
||||
} constfs_file_t;
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user