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

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


The following commit(s) were added to refs/heads/master by this push:
     new 8ef5f02b66 libs: fix visual studio Compiler Error C2036
8ef5f02b66 is described below

commit 8ef5f02b66f8af756e423332c519c33ec9d046ae
Author: chao an <[email protected]>
AuthorDate: Thu Jul 13 22:21:47 2023 +0800

    libs: fix visual studio Compiler Error C2036
    
    D:\code\nuttx\include\nuttx\net\netfilter\ip_tables.h(288,42): error C2036: 
"void *" : unknown size
    
    Reference:
    
https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2036?view=msvc-170
    
    Signed-off-by: chao an <[email protected]>
---
 include/nuttx/net/netfilter/ip_tables.h | 2 +-
 mm/mempool/mempool_multiple.c           | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/nuttx/net/netfilter/ip_tables.h 
b/include/nuttx/net/netfilter/ip_tables.h
index e3750a6310..d5017fa6ea 100644
--- a/include/nuttx/net/netfilter/ip_tables.h
+++ b/include/nuttx/net/netfilter/ip_tables.h
@@ -285,7 +285,7 @@ struct ipt_get_entries
 static inline FAR struct xt_entry_target *
 ipt_get_target(FAR struct ipt_entry *e)
 {
-  return (FAR void *)e + e->target_offset;
+  return (FAR char *)e + e->target_offset;
 }
 
 #endif /* __INCLUDE_NUTTX_NET_NETFILTER_IP_TABLES_H */
diff --git a/mm/mempool/mempool_multiple.c b/mm/mempool/mempool_multiple.c
index 1885a9b568..67cf1a8416 100644
--- a/mm/mempool/mempool_multiple.c
+++ b/mm/mempool/mempool_multiple.c
@@ -193,13 +193,13 @@ retry:
     }
 
   ret = (FAR void *)ALIGN_UP(chunk->next, align);
-  if (chunk->end - ret < size)
+  if ((uintptr_t)chunk->end - (uintptr_t)ret < size)
     {
       goto retry;
     }
 
   chunk->used++;
-  chunk->next = ret + size;
+  chunk->next = (FAR char *)ret + size;
   return ret;
 }
 
@@ -738,7 +738,7 @@ mempool_multiple_mallinfo(FAR struct mempool_multiple_s 
*mpool)
       FAR struct mpool_chunk_s *chunk;
 
       chunk = (FAR struct mpool_chunk_s *)sq_peek(&mpool->chunk_queue);
-      info.fordblks += chunk->end - chunk->next;
+      info.fordblks += (uintptr_t)chunk->end - (uintptr_t)chunk->next;
     }
 
   nxmutex_unlock(&mpool->lock);

Reply via email to