This is an automated email from the ASF dual-hosted git repository.

ligd pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 96900845a52c88433dea9e0bef8216d7d2bb49f4
Author: Xiang Xiao <[email protected]>
AuthorDate: Sun Jul 28 15:29:22 2024 +0800

    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]>
---
 fs/romfs/fs_romfsutil.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/romfs/fs_romfsutil.c b/fs/romfs/fs_romfsutil.c
index d597d157ae..3b14516b41 100644
--- a/fs/romfs/fs_romfsutil.c
+++ b/fs/romfs/fs_romfsutil.c
@@ -605,7 +605,7 @@ static int romfs_cachenode(FAR struct romfs_mountpt_s *rm,
   FAR struct romfs_nodeinfo_s **child;
   FAR struct romfs_nodeinfo_s *nodeinfo;
   char childname[NAME_MAX + 1];
-  uint8_t num = 0;
+  uint16_t count = 0;
   uint32_t info;
   size_t nsize;
   int ret;
@@ -670,21 +670,21 @@ static int romfs_cachenode(FAR struct romfs_mountpt_s *rm,
           return ret;
         }
 
-      if (child == NULL || nodeinfo->rn_count == num - 1)
+      if (child == NULL || nodeinfo->rn_count == count - 1)
         {
           FAR void *tmp;
 
           tmp = fs_heap_realloc(nodeinfo->rn_child,
-                (num + NODEINFO_NINCR) * sizeof(*nodeinfo->rn_child));
+                (count + NODEINFO_NINCR) * sizeof(*nodeinfo->rn_child));
           if (tmp == NULL)
             {
               return -ENOMEM;
             }
 
           nodeinfo->rn_child = tmp;
-          memset(nodeinfo->rn_child + num, 0, NODEINFO_NINCR *
+          memset(nodeinfo->rn_child + count, 0, NODEINFO_NINCR *
                   sizeof(*nodeinfo->rn_child));
-          num += NODEINFO_NINCR;
+          count += NODEINFO_NINCR;
         }
 
       child = &nodeinfo->rn_child[nodeinfo->rn_count++];

Reply via email to