From 7b8bd139d09368cf0492d87b0e69899b4b03364a Mon Sep 17 00:00:00 2001 From: Jon Shallow Date: Mon, 15 Mar 2021 16:01:21 +0000 Subject: [PATCH] General: Fix minor issues src/coap_tinydtls.c: Replace UNUSED with COAP_UNUSED that got missed from a merge. man/examples-code-check.c: src/pdu.c: tests/oss-fuzz/pdu_parse_target.c: Fix trailing white space. win32/libcoap.vcxproj: win32/testdriver/testdriver.vcxproj: Correct include/coap2 paths. --- man/examples-code-check.c | 2 +- src/coap_tinydtls.c | 12 +++--------- src/pdu.c | 2 +- tests/oss-fuzz/pdu_parse_target.c | 2 +- win32/libcoap.vcxproj | 16 ++++++++-------- win32/testdriver/testdriver.vcxproj | 16 ++++++++-------- 6 files changed, 22 insertions(+), 28 deletions(-) diff --git a/man/examples-code-check.c b/man/examples-code-check.c index 4741a411..646c52bb 100644 --- a/man/examples-code-check.c +++ b/man/examples-code-check.c @@ -225,7 +225,7 @@ int main(int argc, char* argv[]) if (!ecp) ecp = strchr(cp, ')'); } else { - ecp = NULL; + ecp = NULL; } } if (*cp) { diff --git a/src/coap_tinydtls.c b/src/coap_tinydtls.c index 86cf86f3..927abb3f 100644 --- a/src/coap_tinydtls.c +++ b/src/coap_tinydtls.c @@ -34,12 +34,6 @@ typedef struct coap_tiny_context_t { #endif /* DTLS_ECC */ } coap_tiny_context_t; -#ifdef __GNUC__ -#define UNUSED __attribute__((unused)) -#else /* __GNUC__ */ -#define UNUSED -#endif /* __GNUC__ */ - static dtls_tick_t dtls_tick_0 = 0; static coap_tick_t coap_tick_0 = 0; @@ -332,7 +326,7 @@ error: #ifdef DTLS_ECC static int get_ecdsa_key(struct dtls_context_t *dtls_context, - const session_t *dtls_session UNUSED, + const session_t *dtls_session COAP_UNUSED, const dtls_ecdsa_key_t **result) { static dtls_ecdsa_key_t ecdsa_key; coap_tiny_context_t *t_context = @@ -362,8 +356,8 @@ static const unsigned char cert_asn1_header[] = { #define DTLS_EC_SUBJECTPUBLICKEY_SIZE (2 * key_size + sizeof(cert_asn1_header)) static int -verify_ecdsa_key(struct dtls_context_t *dtls_context UNUSED, - const session_t *dtls_session UNUSED, +verify_ecdsa_key(struct dtls_context_t *dtls_context COAP_UNUSED, + const session_t *dtls_session COAP_UNUSED, const uint8_t *other_pub_x, const uint8_t *other_pub_y, size_t key_size) { diff --git a/src/pdu.c b/src/pdu.c index ea4ed4da..27f09a15 100644 --- a/src/pdu.c +++ b/src/pdu.c @@ -943,7 +943,7 @@ write_prefix(char **obp, size_t *len, const char *prf, size_t prflen) { memcpy(*obp, prf, prflen); *obp += prflen; *len -= prflen; - return 1; + return 1; } static int diff --git a/tests/oss-fuzz/pdu_parse_target.c b/tests/oss-fuzz/pdu_parse_target.c index a4db0531..57d8325f 100644 --- a/tests/oss-fuzz/pdu_parse_target.c +++ b/tests/oss-fuzz/pdu_parse_target.c @@ -10,7 +10,7 @@ LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { coap_string_t *uri_path = coap_get_uri_path(pdu); coap_show_pdu(LOG_DEBUG, pdu); coap_pdu_encode_header(pdu, COAP_PROTO_UDP); - + coap_delete_string(query); coap_delete_string(uri_path); coap_delete_pdu(pdu); diff --git a/win32/libcoap.vcxproj b/win32/libcoap.vcxproj index 1c609aea..c9876ada 100644 --- a/win32/libcoap.vcxproj +++ b/win32/libcoap.vcxproj @@ -313,7 +313,7 @@ TYPE %(FullPath) >> "$(IntDir)$(TargetName).def" Disabled _CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;%(PreprocessorDefinitions) ProgramDatabase - ../include/coap2;..;$(OpenSSLIncludeDirDbg) + ../include;..;$(OpenSSLIncludeDirDbg) $(IntDir)$(TargetName).pdb false CompileAsC @@ -352,7 +352,7 @@ copy /Y ..\include\coap2\coap.h.windows ..\include\coap2\coap.h Disabled _CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;%(PreprocessorDefinitions) ProgramDatabase - ../include/coap2;..;$(OpenSSLIncludeDirDbg) + ../include;..;$(OpenSSLIncludeDirDbg) false CompileAsC @@ -395,7 +395,7 @@ copy /Y ..\include\coap2\coap.h.windows ..\include\coap2\coap.h Disabled _CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;%(PreprocessorDefinitions) ProgramDatabase - ../include/coap2;..;$(OpenSSLIncludeDirDbg) + ../include;..;$(OpenSSLIncludeDirDbg) NotSet CompileAsC false @@ -417,7 +417,7 @@ copy /Y ..\include\coap2\coap.h.windows ..\include\coap2\coap.h Disabled _CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;%(PreprocessorDefinitions) ProgramDatabase - ../include/coap2;..;$(OpenSSLIncludeDirDbg) + ../include;..;$(OpenSSLIncludeDirDbg) NotSet CompileAsC false @@ -443,7 +443,7 @@ copy /Y ..\include\coap2\coap.h.windows ..\include\coap2\coap.h true true _CRT_SECURE_NO_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions) - ../include/coap2;..;$(OpenSSLIncludeDir) + ../include;..;$(OpenSSLIncludeDir) $(IntDir)$(TargetName).pdb CompileAsC @@ -484,7 +484,7 @@ copy /Y ..\include\coap2\coap.h.windows ..\include\coap2\coap.h true true _CRT_SECURE_NO_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions) - ../include/coap2;..;$(OpenSSLIncludeDir) + ../include;..;$(OpenSSLIncludeDir) CompileAsC @@ -529,7 +529,7 @@ copy /Y ..\include\coap2\coap.h.windows ..\include\coap2\coap.h true true _CRT_SECURE_NO_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions) - ../include/coap2;..;$(OpenSSLIncludeDir) + ../include;..;$(OpenSSLIncludeDir) NotSet CompileAsC $(IntDir)$(TargetName).pdb @@ -553,7 +553,7 @@ copy /Y ..\include\coap2\coap.h.windows ..\include\coap2\coap.h true true _CRT_SECURE_NO_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions) - ../include/coap2;..;$(OpenSSLIncludeDir) + ../include;..;$(OpenSSLIncludeDir) NotSet CompileAsC diff --git a/win32/testdriver/testdriver.vcxproj b/win32/testdriver/testdriver.vcxproj index 83827fb1..b236a093 100644 --- a/win32/testdriver/testdriver.vcxproj +++ b/win32/testdriver/testdriver.vcxproj @@ -184,7 +184,7 @@ _CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ProgramDatabase false - ../../include/coap;../..;..;$(CUnitIncludeDirDbg);$(OpenSSLIncludeDirDbg) + ../../include;../..;..;$(CUnitIncludeDirDbg);$(OpenSSLIncludeDirDbg) CompileAsC @@ -203,7 +203,7 @@ _CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ProgramDatabase false - ../../include/coap;../..;..;$(CUnitIncludeDirDbg);$(OpenSSLIncludeDirDbg) + ../../include;../..;..;$(CUnitIncludeDirDbg);$(OpenSSLIncludeDirDbg) CompileAsC @@ -220,7 +220,7 @@ Level3 Disabled _CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - ../../include/coap;../..;..;$(CUnitIncludeDirDbg);$(OpenSSLIncludeDirDbg) + ../../include;../..;..;$(CUnitIncludeDirDbg);$(OpenSSLIncludeDirDbg) ProgramDatabase @@ -237,7 +237,7 @@ Level3 Disabled _CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - ../../include/coap;../..;..;$(CUnitIncludeDirDbg);$(OpenSSLIncludeDirDbg) + ../../include;../..;..;$(CUnitIncludeDirDbg);$(OpenSSLIncludeDirDbg) ProgramDatabase @@ -256,7 +256,7 @@ true true _CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - ../../include/coap;../..;..;$(CUnitIncludeDir);$(OpenSSLIncludeDir) + ../../include;../..;..;$(CUnitIncludeDir);$(OpenSSLIncludeDir) CompileAsC @@ -277,7 +277,7 @@ true true _CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - ../../include/coap;../..;..;$(CUnitIncludeDir);$(OpenSSLIncludeDir) + ../../include;../..;..;$(CUnitIncludeDir);$(OpenSSLIncludeDir) CompileAsC @@ -298,7 +298,7 @@ true true _CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - ../../include/coap;../..;..;$(CUnitIncludeDir);$(OpenSSLIncludeDir) + ../../include;../..;..;$(CUnitIncludeDir);$(OpenSSLIncludeDir) Console @@ -318,7 +318,7 @@ true true _CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - ../../include/coap;../..;..;$(CUnitIncludeDir);$(OpenSSLIncludeDir) + ../../include;../..;..;$(CUnitIncludeDir);$(OpenSSLIncludeDir) Console