Fixes for 'Implicit conversion loses integer precision' warnings.
This commit is contained in:
@@ -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 @@ nextname:
|
||||
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 @@ nextname:
|
||||
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 = ntag ^ ((lfs_tag_t)(0x80 & ~eperturb) << 24);
|
||||
// reset crc for next commit
|
||||
commit->crc = 0xffffffff;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user