Skip to content

Commit 2e60ec0

Browse files
moyamartinRobertGalatNordic
authored andcommitted
utils: json_printer: fix -Wwrite-string ISO C++ warnings
While working with the sidewalk SDK in C++, the compiler emits a warning (-Wwrite-string) that the ISO C++ forbids converting a string constant to 'char*' when using the error to string converter of sidTypes2str.h Signed-off-by: Martin Moya <[email protected]>
1 parent 12140ac commit 2e60ec0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

utils/include/json_printer/sidTypes2str.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#define SID_ERROR_T_STR(err) \
1111
(((-(err)) > -(SID_ERROR_INVALID_STATE)) || ((-(err)) < 0)) ? \
1212
"UNKNOWN" : \
13-
((char *[]){ \
13+
((const char *[]){ \
1414
"SID_ERROR_NONE", \
1515
"SID_ERROR_GENERIC", \
1616
"SID_ERROR_TIMEOUT", \
@@ -55,7 +55,7 @@
5555
}[(-(err))])
5656

5757
#define SID_MSG_TYPE_STR(val) \
58-
((char *[]){ "SID_MSG_TYPE_GET", "SID_MSG_TYPE_SET", "SID_MSG_TYPE_NOTIFY", \
58+
((const char *[]){ "SID_MSG_TYPE_GET", "SID_MSG_TYPE_SET", "SID_MSG_TYPE_NOTIFY", \
5959
"SID_MSG_TYPE_RESPONSE" }[(val)])
6060

6161
#define SID_LINK_MODE_STR(val) \
@@ -83,7 +83,7 @@
8383
#define SIDEWALK_APP_EVENT_T_STR(val) \
8484
((val) > (SID_EVENT_LAST)) ? \
8585
"UNKNOWN" : \
86-
((char *[]){ "DUT_EVENT_INIT", "DUT_EVENT_DEINIT", "DUT_EVENT_START", \
86+
((const char *[]){ "DUT_EVENT_INIT", "DUT_EVENT_DEINIT", "DUT_EVENT_START", \
8787
"DUT_EVENT_STOP", "DUT_EVENT_GET_MTU", "DUT_EVENT_GET_TIME", \
8888
"DUT_EVENT_GET_STATUS", "DUT_EVENT_GET_OPTION", \
8989
"DUT_EVENT_SET_OPTION", "DUT_EVENT_SET_DEST_ID", \
@@ -97,7 +97,7 @@
9797
"UNKNOWN" : \
9898
((val) >= (SID_EVENT_LAST)) ? \
9999
SIDEWALK_APP_EVENT_T_STR(val) : \
100-
((char *[]){ "SID_EVENT_SIDEWALK", "SID_EVENT_FACTORY_RESET", \
100+
((const char *[]){ "SID_EVENT_SIDEWALK", "SID_EVENT_FACTORY_RESET", \
101101
"SID_EVENT_NEW_STATUS", "SID_EVENT_SEND_MSG", "SID_EVENT_CONNECT", \
102102
"SID_EVENT_LINK_SWITCH", "SID_EVENT_NORDIC_DFU", \
103103
"SID_EVENT_FILE_TRANSFER", "SID_EVENT_LAST" }[val])

0 commit comments

Comments
 (0)