diff --git a/lfs.c b/lfs.c index da4bfca4..fe97e336 100644 --- a/lfs.c +++ b/lfs.c @@ -286,7 +286,7 @@ static int lfs_bd_erase(lfs_t *lfs, lfs_block_t block) { // some operations on paths static inline lfs_size_t lfs_path_namelen(const char *path) { - return strcspn(path, "/"); + return (lfs_size_t)strcspn(path, "/"); } static inline bool lfs_path_islast(const char *path) { @@ -1501,7 +1501,7 @@ static lfs_stag_t lfs_dir_find(lfs_t *lfs, lfs_mdir_t *dir, if (lfs_tag_type3(tag) == LFS_TYPE_DIR) { name += strspn(name, "/"); } - lfs_size_t namelen = strcspn(name, "/"); + lfs_size_t namelen = (lfs_size_t)strcspn(name, "/"); // skip '.' if (namelen == 1 && memcmp(name, ".", 1) == 0) { @@ -1520,7 +1520,7 @@ static lfs_stag_t lfs_dir_find(lfs_t *lfs, lfs_mdir_t *dir, int depth = 1; while (true) { suffix += strspn(suffix, "/"); - sufflen = strcspn(suffix, "/"); + sufflen = (lfs_size_t)strcspn(suffix, "/"); if (sufflen == 0) { break; } @@ -1761,7 +1761,7 @@ static int lfs_dir_commitcrc(lfs_t *lfs, struct lfs_commit *commit) { commit->off = noff; // perturb valid bit? - commit->ptag = ntag ^ ((0x80UL & ~eperturb) << 24); + commit->ptag = (lfs_tag_t)(ntag ^ ((0x80UL & ~eperturb) << 24)); // reset crc for next commit commit->crc = 0xffffffff;