You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/08/29 07:44:14 UTC
[nuttx-apps] branch master updated: testing: fix visual studio Compiler Error C2057
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-apps.git
The following commit(s) were added to refs/heads/master by this push:
new 6923c9cf5 testing: fix visual studio Compiler Error C2057
6923c9cf5 is described below
commit 6923c9cf578213cfa0f6793f74b243b124597807
Author: chao an <an...@xiaomi.com>
AuthorDate: Mon Aug 28 11:23:11 2023 +0800
testing: fix visual studio Compiler Error C2057
expected constant expression
The context requires a constant expression, an expression whose value is known at compile time.
The compiler must know the size of a type at compile time in order to allocate space for an instance of that type.
Reference:
https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2057?view=msvc-170
Signed-off-by: chao an anchao@xiaomi.com
Signed-off-by: chao an <an...@xiaomi.com>
---
testing/ostest/mqueue.c | 2 +-
testing/ostest/timedmqueue.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/testing/ostest/mqueue.c b/testing/ostest/mqueue.c
index ea1617c13..000b42679 100644
--- a/testing/ostest/mqueue.c
+++ b/testing/ostest/mqueue.c
@@ -49,7 +49,7 @@
#else
/* Message length is the size of the message plus the null terminator */
-# define TEST_MSGLEN (strlen(TEST_MESSAGE)+1)
+# define TEST_MSGLEN sizeof(TEST_MESSAGE)
#endif
#define TEST_SEND_NMSGS (10)
diff --git a/testing/ostest/timedmqueue.c b/testing/ostest/timedmqueue.c
index 8d6a7b0f4..d2c487d42 100644
--- a/testing/ostest/timedmqueue.c
+++ b/testing/ostest/timedmqueue.c
@@ -49,7 +49,7 @@
#else
/* Message length is the size of the message plus the null terminator */
-# define TEST_MSGLEN (strlen(TEST_MESSAGE)+1)
+# define TEST_MSGLEN sizeof(TEST_MESSAGE)
#endif
#define TEST_SEND_NMSGS (10)