Skip to content

Commit dbe96d0

Browse files
committed
Fixes for 'Implicit conversion loses integer precision' warnings.
1 parent adad0fb commit dbe96d0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lfs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ static int lfs_bd_erase(lfs_t *lfs, lfs_block_t block) {
286286

287287
// some operations on paths
288288
static inline lfs_size_t lfs_path_namelen(const char *path) {
289-
return strcspn(path, "/");
289+
return (lfs_size_t)strcspn(path, "/");
290290
}
291291

292292
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,
15011501
if (lfs_tag_type3(tag) == LFS_TYPE_DIR) {
15021502
name += strspn(name, "/");
15031503
}
1504-
lfs_size_t namelen = strcspn(name, "/");
1504+
lfs_size_t namelen = (lfs_size_t)strcspn(name, "/");
15051505

15061506
// skip '.'
15071507
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,
15201520
int depth = 1;
15211521
while (true) {
15221522
suffix += strspn(suffix, "/");
1523-
sufflen = strcspn(suffix, "/");
1523+
sufflen = (lfs_size_t)strcspn(suffix, "/");
15241524
if (sufflen == 0) {
15251525
break;
15261526
}
@@ -1761,7 +1761,7 @@ static int lfs_dir_commitcrc(lfs_t *lfs, struct lfs_commit *commit) {
17611761

17621762
commit->off = noff;
17631763
// perturb valid bit?
1764-
commit->ptag = ntag ^ ((0x80UL & ~eperturb) << 24);
1764+
commit->ptag = ntag ^ ((lfs_tag_t)(0x80 & ~eperturb) << 24);
17651765
// reset crc for next commit
17661766
commit->crc = 0xffffffff;
17671767

0 commit comments

Comments
 (0)