Skip to content

Commit 9690084

Browse files
xiaoxiang781216GUIDINGLI
authored andcommitted
fs/romfs: Change the type of num from uint8_t to uint16_t
to support the directory with more than 255 files Signed-off-by: Xiang Xiao <[email protected]>
1 parent 4ebcc13 commit 9690084

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

fs/romfs/fs_romfsutil.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ static int romfs_cachenode(FAR struct romfs_mountpt_s *rm,
605605
FAR struct romfs_nodeinfo_s **child;
606606
FAR struct romfs_nodeinfo_s *nodeinfo;
607607
char childname[NAME_MAX + 1];
608-
uint8_t num = 0;
608+
uint16_t count = 0;
609609
uint32_t info;
610610
size_t nsize;
611611
int ret;
@@ -670,21 +670,21 @@ static int romfs_cachenode(FAR struct romfs_mountpt_s *rm,
670670
return ret;
671671
}
672672

673-
if (child == NULL || nodeinfo->rn_count == num - 1)
673+
if (child == NULL || nodeinfo->rn_count == count - 1)
674674
{
675675
FAR void *tmp;
676676

677677
tmp = fs_heap_realloc(nodeinfo->rn_child,
678-
(num + NODEINFO_NINCR) * sizeof(*nodeinfo->rn_child));
678+
(count + NODEINFO_NINCR) * sizeof(*nodeinfo->rn_child));
679679
if (tmp == NULL)
680680
{
681681
return -ENOMEM;
682682
}
683683

684684
nodeinfo->rn_child = tmp;
685-
memset(nodeinfo->rn_child + num, 0, NODEINFO_NINCR *
685+
memset(nodeinfo->rn_child + count, 0, NODEINFO_NINCR *
686686
sizeof(*nodeinfo->rn_child));
687-
num += NODEINFO_NINCR;
687+
count += NODEINFO_NINCR;
688688
}
689689

690690
child = &nodeinfo->rn_child[nodeinfo->rn_count++];

0 commit comments

Comments
 (0)