diff --git a/channels/sshagent/client/sshagent_main.c b/channels/sshagent/client/sshagent_main.c index a602bc332030..852a2696c710 100644 --- a/channels/sshagent/client/sshagent_main.c +++ b/channels/sshagent/client/sshagent_main.c @@ -334,6 +334,7 @@ static UINT sshagent_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelMa sshagent->listener_callback->iface.OnNewChannelConnection = sshagent_on_new_channel_connection; sshagent->listener_callback->plugin = pPlugin; sshagent->listener_callback->channel_mgr = pChannelMgr; + // NOLINTNEXTLINE(concurrency-mt-unsafe) sshagent->listener_callback->agent_uds_path = getenv("SSH_AUTH_SOCK"); if (sshagent->listener_callback->agent_uds_path == NULL) diff --git a/client/Wayland/wlfreerdp.c b/client/Wayland/wlfreerdp.c index e128dd490081..15d71f258816 100644 --- a/client/Wayland/wlfreerdp.c +++ b/client/Wayland/wlfreerdp.c @@ -581,6 +581,7 @@ static int wlfreerdp_run(freerdp* instance) static BOOL wlf_client_global_init(void) { + // NOLINTNEXTLINE(concurrency-mt-unsafe) (void)setlocale(LC_ALL, ""); if (freerdp_handle_signals() != 0) diff --git a/client/X11/xf_client.c b/client/X11/xf_client.c index 2b3240673d88..b71a9d244c0b 100644 --- a/client/X11/xf_client.c +++ b/client/X11/xf_client.c @@ -1814,6 +1814,7 @@ static void xf_PanningChangeEventHandler(void* context, const PanningChangeEvent static BOOL xfreerdp_client_global_init(void) { + // NOLINTNEXTLINE(concurrency-mt-unsafe) (void)setlocale(LC_ALL, ""); if (freerdp_handle_signals() != 0) diff --git a/client/X11/xf_keyboard.c b/client/X11/xf_keyboard.c index 9fc0060ab0b2..701d0d7bdde9 100644 --- a/client/X11/xf_keyboard.c +++ b/client/X11/xf_keyboard.c @@ -300,6 +300,7 @@ void xf_keyboard_send_key(xfContext* xfc, BOOL down, BOOL repeat, const XKeyEven else { char str[3 * ARRAYSIZE(buffer)] = { 0 }; + // NOLINTNEXTLINE(concurrency-mt-unsafe) const size_t rc = wcstombs(str, buffer, ARRAYSIZE(buffer)); WCHAR wbuffer[ARRAYSIZE(buffer)] = { 0 }; diff --git a/client/X11/xf_utils.c b/client/X11/xf_utils.c index 7355e25872d9..fe2eb2ea1a2a 100644 --- a/client/X11/xf_utils.c +++ b/client/X11/xf_utils.c @@ -172,6 +172,7 @@ int LogDynAndXGetWindowProperty_ex(wLog* log, const char* file, const char* fkt, BOOL IsGnome(void) { + // NOLINTNEXTLINE(concurrency-mt-unsafe) char* env = getenv("DESKTOP_SESSION"); return (env != NULL && strcmp(env, "gnome") == 0); } diff --git a/libfreerdp/codec/test/TestFreeRDPCodecProgressive.c b/libfreerdp/codec/test/TestFreeRDPCodecProgressive.c index 68dd1d228172..821907b8eefe 100644 --- a/libfreerdp/codec/test/TestFreeRDPCodecProgressive.c +++ b/libfreerdp/codec/test/TestFreeRDPCodecProgressive.c @@ -1180,6 +1180,7 @@ static WINPR_NORETURN(void usage(const char* name)) { FILE* fp = stdout; (void)fprintf(fp, "%s \n", name); + // NOLINTNEXTLINE(concurrency-mt-unsafe) exit(-1); } diff --git a/libfreerdp/core/capabilities.c b/libfreerdp/core/capabilities.c index a33a16a55da4..d0c27e4f61c5 100644 --- a/libfreerdp/core/capabilities.c +++ b/libfreerdp/core/capabilities.c @@ -4540,8 +4540,7 @@ BOOL rdp_recv_demand_active(rdpRdp* rdp, wStream* s, UINT16 pduSource, UINT16 le if (!Stream_CheckAndLogRequiredLength(TAG, s, 4)) return FALSE; - UINT32 SessionId = 0; - Stream_Read_UINT32(s, SessionId); /* SessionId */ + const UINT32 SessionId = Stream_Get_UINT32(s); /* SessionId */ { rdp_secondary_update_internal* secondary = secondary_update_cast(rdp->update->secondary); diff --git a/libfreerdp/core/rdp.c b/libfreerdp/core/rdp.c index 03f4232c1eed..26ee0d1c84f8 100644 --- a/libfreerdp/core/rdp.c +++ b/libfreerdp/core/rdp.c @@ -980,8 +980,6 @@ static BOOL rdp_recv_server_shutdown_denied_pdu(rdpRdp* rdp, wStream* s) static BOOL rdp_recv_server_set_keyboard_indicators_pdu(rdpRdp* rdp, wStream* s) { - UINT16 ledFlags = 0; - WINPR_ASSERT(rdp); WINPR_ASSERT(s); @@ -993,7 +991,7 @@ static BOOL rdp_recv_server_set_keyboard_indicators_pdu(rdpRdp* rdp, wStream* s) return FALSE; const uint16_t unitId = Stream_Get_UINT16(s); /* unitId (2 bytes) */ - Stream_Read_UINT16(s, ledFlags); /* ledFlags (2 bytes) */ + const UINT16 ledFlags = Stream_Get_UINT16(s); /* ledFlags (2 bytes) */ return IFCALLRESULT(TRUE, context->update->SetKeyboardIndicators, context, ledFlags); } diff --git a/libfreerdp/core/timezone.c b/libfreerdp/core/timezone.c index 3fbdfb6708ac..043b86e22b80 100644 --- a/libfreerdp/core/timezone.c +++ b/libfreerdp/core/timezone.c @@ -61,14 +61,14 @@ static char* systemtime2str(const SYSTEMTIME* t, char* buffer, size_t len) const SYSTEMTIME empty = { 0 }; if (memcmp(t, &empty, sizeof(SYSTEMTIME)) == 0) - _snprintf(buffer, len, "{ not set }"); + (void)_snprintf(buffer, len, "{ not set }"); else { - _snprintf(buffer, len, - "{ %" PRIu16 "-%" PRIu16 "-%" PRIu16 " [%s] %" PRIu16 ":%" PRIu16 ":%" PRIu16 - ".%" PRIu16 "}", - t->wYear, t->wMonth, t->wDay, weekday2str(t->wDayOfWeek), t->wHour, t->wMinute, - t->wSecond, t->wMilliseconds); + (void)_snprintf(buffer, len, + "{ %" PRIu16 "-%" PRIu16 "-%" PRIu16 " [%s] %" PRIu16 ":%" PRIu16 + ":%" PRIu16 ".%" PRIu16 "}", + t->wYear, t->wMonth, t->wDay, weekday2str(t->wDayOfWeek), t->wHour, + t->wMinute, t->wSecond, t->wMilliseconds); } return buffer; } diff --git a/libfreerdp/core/update.c b/libfreerdp/core/update.c index 125151d66baa..93bf179cbd46 100644 --- a/libfreerdp/core/update.c +++ b/libfreerdp/core/update.c @@ -203,14 +203,10 @@ static BOOL update_write_bitmap_data(rdpUpdate* update_pub, wStream* s, BITMAP_D WINPR_ASSERTING_INT_CAST( uint16_t, bitmapData->cbUncompressedSize)); /* cbUncompressedSize (2 bytes) */ } - - Stream_Write(s, bitmapData->bitmapDataStream, bitmapData->bitmapLength); - } - else - { - Stream_Write(s, bitmapData->bitmapDataStream, bitmapData->bitmapLength); } + Stream_Write(s, bitmapData->bitmapDataStream, bitmapData->bitmapLength); + return TRUE; } diff --git a/libfreerdp/utils/passphrase.c b/libfreerdp/utils/passphrase.c index 5d3c61b59d28..fb8cbf719fcc 100644 --- a/libfreerdp/utils/passphrase.c +++ b/libfreerdp/utils/passphrase.c @@ -255,6 +255,7 @@ static const char* freerdp_passphrase_read_askpass(const char* prompt, char* buf const char* freerdp_passphrase_read(rdpContext* context, const char* prompt, char* buf, size_t bufsiz, int from_stdin) { + // NOLINTNEXTLINE(concurrency-mt-unsafe) const char* askpass_env = getenv("FREERDP_ASKPASS"); if (askpass_env) diff --git a/libfreerdp/utils/signal.c b/libfreerdp/utils/signal.c index 346d21fa4884..2e7072113c8c 100644 --- a/libfreerdp/utils/signal.c +++ b/libfreerdp/utils/signal.c @@ -98,6 +98,7 @@ static void term_handler(int signum) if (!recursive) { recursive = TRUE; + // NOLINTNEXTLINE(concurrency-mt-unsafe) WLog_ERR(TAG, "Caught signal '%s' [%d]", strsignal(signum), signum); } @@ -107,7 +108,10 @@ static void term_handler(int signum) const cleanup_handler_t empty = { 0 }; cleanup_handler_t* cur = &cleanup_handlers[x]; if (cur->handler) + { + // NOLINTNEXTLINE(concurrency-mt-unsafe) cur->handler(signum, strsignal(signum), cur->context); + } *cur = empty; } cleanup_handler_count = 0; @@ -123,6 +127,7 @@ static void fatal_handler(int signum) if (!recursive) { recursive = TRUE; + // NOLINTNEXTLINE(concurrency-mt-unsafe) WLog_ERR(TAG, "Caught signal '%s' [%d]", strsignal(signum), signum); winpr_log_backtrace(TAG, WLOG_ERROR, 20); diff --git a/server/proxy/cli/freerdp_proxy.c b/server/proxy/cli/freerdp_proxy.c index 88abbda9d3fe..099cd35c219b 100644 --- a/server/proxy/cli/freerdp_proxy.c +++ b/server/proxy/cli/freerdp_proxy.c @@ -52,6 +52,7 @@ static const char* strsignal(int signum) // NOLINTBEGIN(bugprone-signal-handler,cert-msc54-cpp,cert-sig30-c) static void cleanup_handler(int signum) { + // NOLINTNEXTLINE(concurrency-mt-unsafe) WLog_INFO(TAG, "caught signal %s [%d], starting cleanup...", strsignal(signum), signum); WLog_INFO(TAG, "stopping all connections."); diff --git a/server/shadow/X11/x11_shadow.c b/server/shadow/X11/x11_shadow.c index 379e645ef634..61315d021b03 100644 --- a/server/shadow/X11/x11_shadow.c +++ b/server/shadow/X11/x11_shadow.c @@ -997,8 +997,12 @@ static int x11_shadow_subsystem_base_init(x11ShadowSubsystem* subsystem) if (subsystem->display) return 1; /* initialize once */ + // NOLINTNEXTLINE(concurrency-mt-unsafe) if (!getenv("DISPLAY")) + { + // NOLINTNEXTLINE(concurrency-mt-unsafe) setenv("DISPLAY", ":0", 1); + } if (!XInitThreads()) return -1; @@ -1196,8 +1200,12 @@ UINT32 x11_shadow_enum_monitors(MONITOR_DEF* monitors, UINT32 maxMonitors) int displayHeight = 0; int numMonitors = 0; + // NOLINTNEXTLINE(concurrency-mt-unsafe) if (!getenv("DISPLAY")) + { + // NOLINTNEXTLINE(concurrency-mt-unsafe) setenv("DISPLAY", ":0", 1); + } display = XOpenDisplay(NULL); diff --git a/uwac/libuwac/uwac-os.c b/uwac/libuwac/uwac-os.c index 71a76b0d251f..449252f50488 100644 --- a/uwac/libuwac/uwac-os.c +++ b/uwac/libuwac/uwac-os.c @@ -228,10 +228,10 @@ int uwac_create_anonymous_file(off_t size) static const char template[] = "/weston-shared-XXXXXX"; size_t length = 0; char* name = NULL; - const char* path = NULL; int fd = 0; int ret = 0; - path = getenv("XDG_RUNTIME_DIR"); + // NOLINTNEXTLINE(concurrency-mt-unsafe) + const char* path = getenv("XDG_RUNTIME_DIR"); if (!path) { diff --git a/uwac/libuwac/uwac-utils.c b/uwac/libuwac/uwac-utils.c index a3adc020952c..79d419bec7c6 100644 --- a/uwac/libuwac/uwac-utils.c +++ b/uwac/libuwac/uwac-utils.c @@ -40,6 +40,7 @@ static void* fail_on_null(void* p) if (p == NULL) { (void)fprintf(stderr, "out of memory\n"); + // NOLINTNEXTLINE(concurrency-mt-unsafe) exit(EXIT_FAILURE); } diff --git a/uwac/libuwac/uwac-window.c b/uwac/libuwac/uwac-window.c index 83818fd93668..69784702d514 100644 --- a/uwac/libuwac/uwac-window.c +++ b/uwac/libuwac/uwac-window.c @@ -528,6 +528,7 @@ UwacWindow* UwacCreateWindowShm(UwacDisplay* display, uint32_t width, uint32_t h #if BUILD_IVI uint32_t ivi_surface_id = 1; + // NOLINTNEXTLINE(concurrency-mt-unsafe) char* env = getenv("IVI_SURFACE_ID"); if (env) { diff --git a/winpr/include/winpr/asn1.h b/winpr/include/winpr/asn1.h index d4b6443c83cf..75556eb3def9 100644 --- a/winpr/include/winpr/asn1.h +++ b/winpr/include/winpr/asn1.h @@ -191,9 +191,9 @@ extern "C" WINPR_API size_t WinPrAsn1EncContextualOID(WinPrAsn1Encoder* enc, WinPrAsn1_tagId tagId, const WinPrAsn1_OID* oid); WINPR_API size_t WinPrAsn1EncOctetString(WinPrAsn1Encoder* enc, - const WinPrAsn1_OctetString* oid); + const WinPrAsn1_OctetString* octetstring); WINPR_API size_t WinPrAsn1EncContextualOctetString(WinPrAsn1Encoder* enc, WinPrAsn1_tagId tagId, - const WinPrAsn1_OctetString* oid); + const WinPrAsn1_OctetString* octetstring); WINPR_API size_t WinPrAsn1EncIA5String(WinPrAsn1Encoder* enc, WinPrAsn1_IA5STRING ia5); WINPR_API size_t WinPrAsn1EncGeneralString(WinPrAsn1Encoder* enc, WinPrAsn1_STRING str); WINPR_API size_t WinPrAsn1EncContextualIA5String(WinPrAsn1Encoder* enc, WinPrAsn1_tagId tagId, diff --git a/winpr/include/winpr/custom-crypto.h b/winpr/include/winpr/custom-crypto.h index e1d779ff7db4..d74f4e536f34 100644 --- a/winpr/include/winpr/custom-crypto.h +++ b/winpr/include/winpr/custom-crypto.h @@ -84,7 +84,7 @@ extern "C" WINPR_API BOOL winpr_HMAC_Init(WINPR_HMAC_CTX* ctx, WINPR_MD_TYPE md, const void* key, size_t keylen); WINPR_API BOOL winpr_HMAC_Update(WINPR_HMAC_CTX* ctx, const void* input, size_t ilen); - WINPR_API BOOL winpr_HMAC_Final(WINPR_HMAC_CTX* ctx, void* output, size_t ilen); + WINPR_API BOOL winpr_HMAC_Final(WINPR_HMAC_CTX* ctx, void* output, size_t olen); WINPR_API BOOL winpr_HMAC(WINPR_MD_TYPE md, const void* key, size_t keylen, const void* input, size_t ilen, void* output, size_t olen); @@ -111,7 +111,7 @@ extern "C" WINPR_API BOOL winpr_Digest_Init_Allow_FIPS(WINPR_DIGEST_CTX* ctx, WINPR_MD_TYPE md); WINPR_API BOOL winpr_Digest_Init(WINPR_DIGEST_CTX* ctx, WINPR_MD_TYPE md); WINPR_API BOOL winpr_Digest_Update(WINPR_DIGEST_CTX* ctx, const void* input, size_t ilen); - WINPR_API BOOL winpr_Digest_Final(WINPR_DIGEST_CTX* ctx, void* output, size_t ilen); + WINPR_API BOOL winpr_Digest_Final(WINPR_DIGEST_CTX* ctx, void* output, size_t olen); WINPR_API BOOL winpr_Digest_Allow_FIPS(WINPR_MD_TYPE md, const void* input, size_t ilen, void* output, size_t olen); diff --git a/winpr/include/winpr/print.h b/winpr/include/winpr/print.h index beb44f1a50d3..7710378b884d 100644 --- a/winpr/include/winpr/print.h +++ b/winpr/include/winpr/print.h @@ -35,9 +35,9 @@ extern "C" { #endif - WINPR_API void winpr_HexDump(const char* tag, UINT32 lvl, const void* data, size_t length); - WINPR_API void winpr_HexLogDump(wLog* log, UINT32 lvl, const void* data, size_t length); - WINPR_API void winpr_CArrayDump(const char* tag, UINT32 lvl, const void* data, size_t length, + WINPR_API void winpr_HexDump(const char* tag, UINT32 level, const void* data, size_t length); + WINPR_API void winpr_HexLogDump(wLog* log, UINT32 level, const void* data, size_t length); + WINPR_API void winpr_CArrayDump(const char* tag, UINT32 level, const void* data, size_t length, size_t width); WINPR_API char* winpr_BinToHexString(const BYTE* data, size_t length, BOOL space); diff --git a/winpr/include/winpr/string.h b/winpr/include/winpr/string.h index 45a4098ccfba..c77f56529bc3 100644 --- a/winpr/include/winpr/string.h +++ b/winpr/include/winpr/string.h @@ -318,12 +318,12 @@ extern "C" * The function does string conversions of any '\0' terminated input string * * \param wstr A '\0' terminated WCHAR string, may be NULL - * \param pSize Ignored if NULL, otherwise receives the length of the result string in + * \param pUtfCharLength Ignored if NULL, otherwise receives the length of the result string in * characters (strlen) * * \return An allocated zero terminated UTF-8 string or NULL in case of failure. */ - WINPR_API char* ConvertWCharToUtf8Alloc(const WCHAR* wstr, size_t* pSize); + WINPR_API char* ConvertWCharToUtf8Alloc(const WCHAR* wstr, size_t* pUtfCharLength); /** \brief Converts form UTF-16 to UTF-8, returns an allocated string * @@ -332,12 +332,13 @@ extern "C" * * \param wstr A WCHAR string of \b wlen length * \param wlen The (buffer) length in characters of \b wstr - * \param pSize Ignored if NULL, otherwise receives the length of the result string in + * \param pUtfCharLength Ignored if NULL, otherwise receives the length of the result string in * characters (strlen) * * \return An allocated zero terminated UTF-8 string or NULL in case of failure. */ - WINPR_API char* ConvertWCharNToUtf8Alloc(const WCHAR* wstr, size_t wlen, size_t* pSize); + WINPR_API char* ConvertWCharNToUtf8Alloc(const WCHAR* wstr, size_t wlen, + size_t* pUtfCharLength); /** \brief Converts multistring form UTF-16 to UTF-8, returns an allocated string * @@ -346,12 +347,13 @@ extern "C" * * \param wstr A WCHAR string of \b len character length * \param wlen The (buffer) length in characters of \b str - * \param pSize Ignored if NULL, otherwise receives the length of the result string in + * \param pUtfCharLength Ignored if NULL, otherwise receives the length of the result string in * characters (including any '\0' character) * * \return An allocated double zero terminated UTF-8 string or NULL in case of failure. */ - WINPR_API char* ConvertMszWCharNToUtf8Alloc(const WCHAR* wstr, size_t wlen, size_t* pSize); + WINPR_API char* ConvertMszWCharNToUtf8Alloc(const WCHAR* wstr, size_t wlen, + size_t* pUtfCharLength); /** \brief Converts form UTF-8 to UTF-16, returns an allocated string * diff --git a/winpr/include/winpr/synch.h b/winpr/include/winpr/synch.h index 809651c29a57..eb6289522ea0 100644 --- a/winpr/include/winpr/synch.h +++ b/winpr/include/winpr/synch.h @@ -296,7 +296,7 @@ extern "C" #define OpenWaitableTimer OpenWaitableTimerA #endif - WINPR_API int GetTimerFileDescriptor(HANDLE hEvent); + WINPR_API int GetTimerFileDescriptor(HANDLE hTimer); /** * Timer-Queue Timer diff --git a/winpr/libwinpr/comm/comm_serial_sys.c b/winpr/libwinpr/comm/comm_serial_sys.c index f7277956f370..16428e04144c 100644 --- a/winpr/libwinpr/comm/comm_serial_sys.c +++ b/winpr/libwinpr/comm/comm_serial_sys.c @@ -1557,6 +1557,7 @@ static BOOL set_break_off(WINPR_COMM* pComm) static BOOL set_xoff(WINPR_COMM* pComm) { WINPR_ASSERT(pComm); + // NOLINTNEXTLINE(concurrency-mt-unsafe) if (tcflow(pComm->fd, TCIOFF) < 0) { char ebuffer[256] = { 0 }; @@ -1572,6 +1573,7 @@ static BOOL set_xoff(WINPR_COMM* pComm) static BOOL set_xon(WINPR_COMM* pComm) { WINPR_ASSERT(pComm); + // NOLINTNEXTLINE(concurrency-mt-unsafe) if (tcflow(pComm->fd, TCION) < 0) { char ebuffer[256] = { 0 }; diff --git a/winpr/libwinpr/crt/string.c b/winpr/libwinpr/crt/string.c index 4dec0b1411df..2e4c60de2e21 100644 --- a/winpr/libwinpr/crt/string.c +++ b/winpr/libwinpr/crt/string.c @@ -361,7 +361,7 @@ WCHAR* _wcsstr(const WCHAR* str, const WCHAR* strSearch) /* _wcschr -> wcschr */ -WCHAR* _wcschr(const WCHAR* str, WCHAR value) +WCHAR* _wcschr(const WCHAR* str, WCHAR c) { union { @@ -370,10 +370,10 @@ WCHAR* _wcschr(const WCHAR* str, WCHAR value) } cnv; const WCHAR* p = str; - while (*p && (*p != value)) + while (*p && (*p != c)) p++; - cnv.cc = (*p == value) ? p : NULL; + cnv.cc = (*p == c) ? p : NULL; return cnv.c; } diff --git a/winpr/libwinpr/crypto/cipher.c b/winpr/libwinpr/crypto/cipher.c index c2ffa2b33b80..4233713f35b1 100644 --- a/winpr/libwinpr/crypto/cipher.c +++ b/winpr/libwinpr/crypto/cipher.c @@ -251,9 +251,9 @@ static int cipher_compare(const void* a, const void* b) return *cipher > map->md ? 1 : -1; } -const char* winpr_cipher_type_to_string(WINPR_CIPHER_TYPE cipher) +const char* winpr_cipher_type_to_string(WINPR_CIPHER_TYPE md) { - WINPR_CIPHER_TYPE lc = cipher; + WINPR_CIPHER_TYPE lc = md; const struct cipher_map* ret = bsearch(&lc, s_cipher_map, ARRAYSIZE(s_cipher_map), sizeof(struct cipher_map), cipher_compare); if (!ret) diff --git a/winpr/libwinpr/crypto/hash.c b/winpr/libwinpr/crypto/hash.c index 55d13d8c05ef..18af44cad538 100644 --- a/winpr/libwinpr/crypto/hash.c +++ b/winpr/libwinpr/crypto/hash.c @@ -672,12 +672,12 @@ BOOL winpr_Digest_Final(WINPR_DIGEST_CTX* ctx, void* output, size_t olen) return FALSE; } -BOOL winpr_DigestSign_Init(WINPR_DIGEST_CTX* ctx, WINPR_MD_TYPE digest, void* key) +BOOL winpr_DigestSign_Init(WINPR_DIGEST_CTX* ctx, WINPR_MD_TYPE md, void* key) { WINPR_ASSERT(ctx); #if defined(WITH_OPENSSL) - const EVP_MD* evp = winpr_openssl_get_evp_md(digest); + const EVP_MD* evp = winpr_openssl_get_evp_md(md); if (!evp) return FALSE; diff --git a/winpr/libwinpr/environment/environment.c b/winpr/libwinpr/environment/environment.c index 5efd0e2054cf..2aaa2959a090 100644 --- a/winpr/libwinpr/environment/environment.c +++ b/winpr/libwinpr/environment/environment.c @@ -152,9 +152,9 @@ DWORD GetEnvironmentVariableA(LPCSTR lpName, LPSTR lpBuffer, DWORD nSize) { #if !defined(_UWP) size_t length = 0; - char* env = NULL; - env = getenv(lpName); + // NOLINTNEXTLINE(concurrency-mt-unsafe) + char* env = getenv(lpName); if (!env) { @@ -191,11 +191,13 @@ BOOL SetEnvironmentVariableA(LPCSTR lpName, LPCSTR lpValue) if (lpValue) { + // NOLINTNEXTLINE(concurrency-mt-unsafe) if (0 != setenv(lpName, lpValue, 1)) return FALSE; } else { + // NOLINTNEXTLINE(concurrency-mt-unsafe) if (0 != unsetenv(lpName)) return FALSE; } diff --git a/winpr/libwinpr/file/file.c b/winpr/libwinpr/file/file.c index 7536a8a02cb6..657d1f37cebe 100644 --- a/winpr/libwinpr/file/file.c +++ b/winpr/libwinpr/file/file.c @@ -1057,24 +1057,23 @@ BOOL GetDiskFreeSpaceA(LPCSTR lpRootPathName, LPDWORD lpSectorsPerCluster, LPDWO return TRUE; } -BOOL GetDiskFreeSpaceW(LPCWSTR lpwRootPathName, LPDWORD lpSectorsPerCluster, +BOOL GetDiskFreeSpaceW(LPCWSTR lpRootPathName, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters) { - LPSTR lpRootPathName = NULL; BOOL ret = 0; - if (!lpwRootPathName) + if (!lpRootPathName) return FALSE; - lpRootPathName = ConvertWCharToUtf8Alloc(lpwRootPathName, NULL); - if (!lpRootPathName) + char* rootPathName = ConvertWCharToUtf8Alloc(lpRootPathName, NULL); + if (!rootPathName) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); return FALSE; } - ret = GetDiskFreeSpaceA(lpRootPathName, lpSectorsPerCluster, lpBytesPerSector, + ret = GetDiskFreeSpaceA(rootPathName, lpSectorsPerCluster, lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberOfClusters); - free(lpRootPathName); + free(rootPathName); return ret; } diff --git a/winpr/libwinpr/file/generic.c b/winpr/libwinpr/file/generic.c index cee2aaefee1e..e5d8635ad356 100644 --- a/winpr/libwinpr/file/generic.c +++ b/winpr/libwinpr/file/generic.c @@ -1118,6 +1118,7 @@ BOOL FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData) WIN32_FILE_SEARCH* pFileSearch = (WIN32_FILE_SEARCH*)hFindFile; struct dirent* pDirent = NULL; + // NOLINTNEXTLINE(concurrency-mt-unsafe) while ((pDirent = readdir(pFileSearch->pDir)) != NULL) { if (FilePatternMatchA(pDirent->d_name, pFileSearch->lpPattern)) diff --git a/winpr/libwinpr/input/keycode.c b/winpr/libwinpr/input/keycode.c index cf6172416362..a7867138afd5 100644 --- a/winpr/libwinpr/input/keycode.c +++ b/winpr/libwinpr/input/keycode.c @@ -877,7 +877,7 @@ DWORD GetVirtualKeyCodeFromKeycode(DWORD keycode, WINPR_KEYCODE_TYPE type) return vkcode; } -DWORD GetKeycodeFromVirtualKeyCode(DWORD vkcode, WINPR_KEYCODE_TYPE type) +DWORD GetKeycodeFromVirtualKeyCode(DWORD keycode, WINPR_KEYCODE_TYPE type) { DWORD* targetArray = NULL; size_t targetSize = 0; @@ -902,7 +902,7 @@ DWORD GetKeycodeFromVirtualKeyCode(DWORD vkcode, WINPR_KEYCODE_TYPE type) for (DWORD index = 0; index < targetSize; index++) { - if (vkcode == targetArray[index]) + if (keycode == targetArray[index]) return index; } diff --git a/winpr/libwinpr/library/library.c b/winpr/libwinpr/library/library.c index b167b17b8291..7c51a2f5b810 100644 --- a/winpr/libwinpr/library/library.c +++ b/winpr/libwinpr/library/library.c @@ -130,6 +130,7 @@ HMODULE LoadLibraryA(LPCSTR lpLibFileName) if (!library) { + // NOLINTNEXTLINE(concurrency-mt-unsafe) const char* err = dlerror(); WLog_ERR(TAG, "failed with %s", err); return NULL; @@ -190,6 +191,7 @@ FARPROC GetProcAddress(HMODULE hModule, LPCSTR lpProcName) if (proc == NULL) { + // NOLINTNEXTLINE(concurrency-mt-unsafe) WLog_ERR(TAG, "GetProcAddress: could not find procedure %s: %s", lpProcName, dlerror()); return (FARPROC)NULL; } diff --git a/winpr/libwinpr/path/shell.c b/winpr/libwinpr/path/shell.c index 81c70d045bdf..03edec242265 100644 --- a/winpr/libwinpr/path/shell.c +++ b/winpr/libwinpr/path/shell.c @@ -668,6 +668,7 @@ BOOL PathIsDirectoryEmptyA(LPCSTR pszPath) if (dir == NULL) /* Not a directory or doesn't exist */ return 1; + // NOLINTNEXTLINE(concurrency-mt-unsafe) while ((dp = readdir(dir)) != NULL) { if (strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0) diff --git a/winpr/libwinpr/rpc/rpc.c b/winpr/libwinpr/rpc/rpc.c index 16bcb97176ee..57bffef4154f 100644 --- a/winpr/libwinpr/rpc/rpc.c +++ b/winpr/libwinpr/rpc/rpc.c @@ -656,6 +656,7 @@ RPC_STATUS RpcBindingServerFromClient(RPC_BINDING_HANDLE ClientBinding, void RpcRaiseException(RPC_STATUS exception) { WLog_ERR(TAG, "RpcRaiseException: 0x%08luX", exception); + // NOLINTNEXTLINE(concurrency-mt-unsafe) exit((int)exception); } diff --git a/winpr/libwinpr/thread/process.c b/winpr/libwinpr/thread/process.c index 8c4281da754f..dc2ed7f5aa78 100644 --- a/winpr/libwinpr/thread/process.c +++ b/winpr/libwinpr/thread/process.c @@ -444,6 +444,7 @@ BOOL CreateProcessWithTokenW(HANDLE hToken, DWORD dwLogonFlags, LPCWSTR lpApplic VOID ExitProcess(UINT uExitCode) { + // NOLINTNEXTLINE(concurrency-mt-unsafe) exit((int)uExitCode); } diff --git a/winpr/libwinpr/timezone/TimeZoneIanaAbbrevMap.c b/winpr/libwinpr/timezone/TimeZoneIanaAbbrevMap.c index d1d604295d19..3346c3ad08c3 100644 --- a/winpr/libwinpr/timezone/TimeZoneIanaAbbrevMap.c +++ b/winpr/libwinpr/timezone/TimeZoneIanaAbbrevMap.c @@ -124,6 +124,7 @@ static void iterate_subdir_recursive(const char* base, const char* bname, const if (d) { struct dirent* dp = NULL; + // NOLINTNEXTLINE(concurrency-mt-unsafe) while ((dp = readdir(d)) != NULL) { switch (dp->d_type) diff --git a/winpr/libwinpr/timezone/TimeZoneNameMapUtils.c b/winpr/libwinpr/timezone/TimeZoneNameMapUtils.c index ba52b8d1ba9d..beddc595584e 100644 --- a/winpr/libwinpr/timezone/TimeZoneNameMapUtils.c +++ b/winpr/libwinpr/timezone/TimeZoneNameMapUtils.c @@ -176,7 +176,7 @@ static WINPR_JSON* load_timezones_from_file(const char* filename) goto end; } - jstr = calloc(jstrlen + 1, sizeof(char)); + jstr = calloc(WINPR_ASSERTING_INT_CAST(size_t, jstrlen + 1), sizeof(char)); if (!jstr) { WLog_WARN(TAG, "Timezone resource file '%s' failed to allocate buffer of size %" PRId64, @@ -184,14 +184,14 @@ static WINPR_JSON* load_timezones_from_file(const char* filename) goto end; } - if (fread(jstr, jstrlen, sizeof(char), fp) != 1) + if (fread(jstr, WINPR_ASSERTING_INT_CAST(size_t, jstrlen), sizeof(char), fp) != 1) { WLog_WARN(TAG, "Timezone resource file '%s' failed to read buffer of size %" PRId64, filename, jstrlen); goto end; } - json = WINPR_JSON_ParseWithLength(jstr, jstrlen); + json = WINPR_JSON_ParseWithLength(jstr, WINPR_ASSERTING_INT_CAST(size_t, jstrlen)); if (!json) WLog_WARN(TAG, "Timezone resource file '%s' is not a valid JSON file", filename); end: @@ -356,7 +356,8 @@ static char* get_wzid_icu(const UChar* utzid, size_t utzid_len) char* res = NULL; UErrorCode error = U_ZERO_ERROR; - int32_t rc = ucal_getWindowsTimeZoneID(utzid, utzid_len, NULL, 0, &error); + int32_t rc = ucal_getWindowsTimeZoneID(utzid, WINPR_ASSERTING_INT_CAST(int32_t, utzid_len), + NULL, 0, &error); if ((error == U_BUFFER_OVERFLOW_ERROR) && (rc > 0)) { rc++; // make space for '\0' @@ -364,7 +365,8 @@ static char* get_wzid_icu(const UChar* utzid, size_t utzid_len) if (wzid) { UErrorCode error2 = U_ZERO_ERROR; - int32_t rc2 = ucal_getWindowsTimeZoneID(utzid, utzid_len, wzid, rc, &error2); + int32_t rc2 = ucal_getWindowsTimeZoneID( + utzid, WINPR_ASSERTING_INT_CAST(int32_t, utzid_len), wzid, rc, &error2); if (U_SUCCESS(error2) && (rc2 > 0)) res = ConvertWCharNToUtf8Alloc(wzid, (size_t)rc, NULL); free(wzid); diff --git a/winpr/libwinpr/timezone/timezone.c b/winpr/libwinpr/timezone/timezone.c index ac5b90bb8e4b..a0d8c235b2df 100644 --- a/winpr/libwinpr/timezone/timezone.c +++ b/winpr/libwinpr/timezone/timezone.c @@ -752,7 +752,7 @@ static int dynamic_time_zone_from_localtime(const struct tm* local_time, return rc; } -DWORD GetDynamicTimeZoneInformation(PDYNAMIC_TIME_ZONE_INFORMATION tz) +DWORD GetDynamicTimeZoneInformation(PDYNAMIC_TIME_ZONE_INFORMATION pTimeZoneInformation) { const char** list = NULL; char* tzid = NULL; @@ -760,10 +760,11 @@ DWORD GetDynamicTimeZoneInformation(PDYNAMIC_TIME_ZONE_INFORMATION tz) DWORD res = TIME_ZONE_ID_UNKNOWN; const DYNAMIC_TIME_ZONE_INFORMATION empty = { 0 }; - WINPR_ASSERT(tz); + WINPR_ASSERT(pTimeZoneInformation); - *tz = empty; - (void)ConvertUtf8ToWChar(defaultName, tz->StandardName, ARRAYSIZE(tz->StandardName)); + *pTimeZoneInformation = empty; + (void)ConvertUtf8ToWChar(defaultName, pTimeZoneInformation->StandardName, + ARRAYSIZE(pTimeZoneInformation->StandardName)); const time_t t = time(NULL); struct tm tres = { 0 }; @@ -771,12 +772,12 @@ DWORD GetDynamicTimeZoneInformation(PDYNAMIC_TIME_ZONE_INFORMATION tz) if (!local_time) goto out_error; - tz->Bias = get_bias(local_time, FALSE); + pTimeZoneInformation->Bias = get_bias(local_time, FALSE); if (local_time->tm_isdst >= 0) - dynamic_time_zone_from_localtime(local_time, tz); + dynamic_time_zone_from_localtime(local_time, pTimeZoneInformation); tzid = winpr_guess_time_zone(); - if (!map_iana_id(tzid, tz)) + if (!map_iana_id(tzid, pTimeZoneInformation)) { const size_t len = TimeZoneIanaAbbrevGet(local_time->tm_zone, NULL, 0); list = (const char**)calloc(len, sizeof(const char*)); @@ -786,7 +787,7 @@ DWORD GetDynamicTimeZoneInformation(PDYNAMIC_TIME_ZONE_INFORMATION tz) for (size_t x = 0; x < size; x++) { const char* id = list[x]; - if (map_iana_id(id, tz)) + if (map_iana_id(id, pTimeZoneInformation)) { res = (local_time->tm_isdst) ? TIME_ZONE_ID_DAYLIGHT : TIME_ZONE_ID_STANDARD; break; @@ -800,7 +801,7 @@ DWORD GetDynamicTimeZoneInformation(PDYNAMIC_TIME_ZONE_INFORMATION tz) free(tzid); free((void*)list); - log_timezone(tz, res); + log_timezone(pTimeZoneInformation, res); return res; } diff --git a/winpr/libwinpr/utils/asn1/asn1.c b/winpr/libwinpr/utils/asn1/asn1.c index a5b34c73c1e8..440546eb3e87 100644 --- a/winpr/libwinpr/utils/asn1/asn1.c +++ b/winpr/libwinpr/utils/asn1/asn1.c @@ -566,9 +566,9 @@ static size_t WinPrAsn1EncIntegerLike(WinPrAsn1Encoder* enc, WinPrAsn1_tag b, return 1 + len; } -size_t WinPrAsn1EncInteger(WinPrAsn1Encoder* enc, WinPrAsn1_INTEGER value) +size_t WinPrAsn1EncInteger(WinPrAsn1Encoder* enc, WinPrAsn1_INTEGER integer) { - return WinPrAsn1EncIntegerLike(enc, ER_TAG_INTEGER, value); + return WinPrAsn1EncIntegerLike(enc, ER_TAG_INTEGER, integer); } size_t WinPrAsn1EncEnumerated(WinPrAsn1Encoder* enc, WinPrAsn1_ENUMERATED value) @@ -615,9 +615,9 @@ static size_t WinPrAsn1EncContextualIntegerLike(WinPrAsn1Encoder* enc, WinPrAsn1 } size_t WinPrAsn1EncContextualInteger(WinPrAsn1Encoder* enc, WinPrAsn1_tagId tagId, - WinPrAsn1_INTEGER value) + WinPrAsn1_INTEGER integer) { - return WinPrAsn1EncContextualIntegerLike(enc, ER_TAG_INTEGER, tagId, value); + return WinPrAsn1EncContextualIntegerLike(enc, ER_TAG_INTEGER, tagId, integer); } size_t WinPrAsn1EncContextualEnumerated(WinPrAsn1Encoder* enc, WinPrAsn1_tagId tagId, @@ -686,9 +686,9 @@ size_t WinPrAsn1EncOID(WinPrAsn1Encoder* enc, const WinPrAsn1_OID* oid) return WinPrAsn1EncMemoryChunk(enc, ER_TAG_OBJECT_IDENTIFIER, oid); } -size_t WinPrAsn1EncOctetString(WinPrAsn1Encoder* enc, const WinPrAsn1_OctetString* octets) +size_t WinPrAsn1EncOctetString(WinPrAsn1Encoder* enc, const WinPrAsn1_OctetString* octetstring) { - return WinPrAsn1EncMemoryChunk(enc, ER_TAG_OCTET_STRING, octets); + return WinPrAsn1EncMemoryChunk(enc, ER_TAG_OCTET_STRING, octetstring); } size_t WinPrAsn1EncIA5String(WinPrAsn1Encoder* enc, WinPrAsn1_IA5STRING ia5) @@ -742,9 +742,9 @@ size_t WinPrAsn1EncContextualOID(WinPrAsn1Encoder* enc, WinPrAsn1_tagId tagId, } size_t WinPrAsn1EncContextualOctetString(WinPrAsn1Encoder* enc, WinPrAsn1_tagId tagId, - const WinPrAsn1_OctetString* octets) + const WinPrAsn1_OctetString* octetstring) { - return WinPrAsn1EncContextualMemoryChunk(enc, ER_TAG_OCTET_STRING, tagId, octets); + return WinPrAsn1EncContextualMemoryChunk(enc, ER_TAG_OCTET_STRING, tagId, octetstring); } size_t WinPrAsn1EncContextualIA5String(WinPrAsn1Encoder* enc, WinPrAsn1_tagId tagId, @@ -1274,15 +1274,15 @@ static size_t readConstructed(WinPrAsn1Decoder* dec, wStream* s, WinPrAsn1_tag* return ret + len; } -size_t WinPrAsn1DecReadApp(WinPrAsn1Decoder* dec, WinPrAsn1_tagId* tagId, WinPrAsn1Decoder* target) +size_t WinPrAsn1DecReadApp(WinPrAsn1Decoder* dec, WinPrAsn1_tagId* tagId, WinPrAsn1Decoder* setDec) { WinPrAsn1_tag tag = 0; size_t ret = 0; WINPR_ASSERT(dec); - WINPR_ASSERT(target); + WINPR_ASSERT(setDec); - ret = readConstructed(dec, &dec->source, &tag, target); + ret = readConstructed(dec, &dec->source, &tag, setDec); if ((tag & ER_TAG_APP) != ER_TAG_APP) return 0; @@ -1290,30 +1290,30 @@ size_t WinPrAsn1DecReadApp(WinPrAsn1Decoder* dec, WinPrAsn1_tagId* tagId, WinPrA return ret; } -size_t WinPrAsn1DecReadSequence(WinPrAsn1Decoder* dec, WinPrAsn1Decoder* target) +size_t WinPrAsn1DecReadSequence(WinPrAsn1Decoder* dec, WinPrAsn1Decoder* seqDec) { WinPrAsn1_tag tag = 0; size_t ret = 0; WINPR_ASSERT(dec); - WINPR_ASSERT(target); + WINPR_ASSERT(seqDec); - ret = readConstructed(dec, &dec->source, &tag, target); + ret = readConstructed(dec, &dec->source, &tag, seqDec); if (tag != ER_TAG_SEQUENCE) return 0; return ret; } -size_t WinPrAsn1DecReadSet(WinPrAsn1Decoder* dec, WinPrAsn1Decoder* target) +size_t WinPrAsn1DecReadSet(WinPrAsn1Decoder* dec, WinPrAsn1Decoder* setDec) { WinPrAsn1_tag tag = 0; size_t ret = 0; WINPR_ASSERT(dec); - WINPR_ASSERT(target); + WINPR_ASSERT(setDec); - ret = readConstructed(dec, &dec->source, &tag, target); + ret = readConstructed(dec, &dec->source, &tag, setDec); if (tag != ER_TAG_SET) return 0; diff --git a/winpr/libwinpr/utils/collections/ListDictionary.c b/winpr/libwinpr/utils/collections/ListDictionary.c index 95e8a8653fe2..4e69a8678684 100644 --- a/winpr/libwinpr/utils/collections/ListDictionary.c +++ b/winpr/libwinpr/utils/collections/ListDictionary.c @@ -50,16 +50,16 @@ struct s_wListDictionary * Internal implementation uses a singly-linked list */ -WINPR_API wObject* ListDictionary_KeyObject(wListDictionary* _dictionary) +WINPR_API wObject* ListDictionary_KeyObject(wListDictionary* listDictionary) { - WINPR_ASSERT(_dictionary); - return &_dictionary->objectKey; + WINPR_ASSERT(listDictionary); + return &listDictionary->objectKey; } -WINPR_API wObject* ListDictionary_ValueObject(wListDictionary* _dictionary) +WINPR_API wObject* ListDictionary_ValueObject(wListDictionary* listDictionary) { - WINPR_ASSERT(_dictionary); - return &_dictionary->objectValue; + WINPR_ASSERT(listDictionary); + return &listDictionary->objectValue; } /** diff --git a/winpr/libwinpr/utils/print.c b/winpr/libwinpr/utils/print.c index 84bf937dccfa..4ab89edeb62e 100644 --- a/winpr/libwinpr/utils/print.c +++ b/winpr/libwinpr/utils/print.c @@ -40,7 +40,7 @@ void winpr_HexDump(const char* tag, UINT32 level, const void* data, size_t lengt winpr_HexLogDump(log, level, data, length); } -void winpr_HexLogDump(wLog* log, UINT32 lvl, const void* data, size_t length) +void winpr_HexLogDump(wLog* log, UINT32 level, const void* data, size_t length) { const BYTE* p = data; size_t line = 0; @@ -59,7 +59,7 @@ void winpr_HexLogDump(wLog* log, UINT32 lvl, const void* data, size_t length) char* buffer = NULL; - if (!WLog_IsLevelActive(log, lvl)) + if (!WLog_IsLevelActive(log, level)) return; if (!log) @@ -120,13 +120,13 @@ void winpr_HexLogDump(wLog* log, UINT32 lvl, const void* data, size_t length) pos += (size_t)rc; } - WLog_Print(log, lvl, "%s", buffer); + WLog_Print(log, level, "%s", buffer); offset += line; p += line; pos = 0; } - WLog_Print(log, lvl, "[length=%" PRIuz "] ", length); + WLog_Print(log, level, "[length=%" PRIuz "] ", length); fail: free(buffer); } diff --git a/winpr/libwinpr/utils/stream.c b/winpr/libwinpr/utils/stream.c index b8eaea5dc946..145b54f5eff1 100644 --- a/winpr/libwinpr/utils/stream.c +++ b/winpr/libwinpr/utils/stream.c @@ -463,39 +463,39 @@ BOOL Stream_CheckAndLogRequiredLengthWLogExVa(wLog* log, DWORD level, wStream* s return TRUE; } -SSIZE_T Stream_Write_UTF16_String_From_UTF8(wStream* s, size_t dlen, const char* src, size_t length, - BOOL fill) +SSIZE_T Stream_Write_UTF16_String_From_UTF8(wStream* s, size_t wcharLength, const char* src, + size_t length, BOOL fill) { WCHAR* str = Stream_PointerAs(s, WCHAR); if (length == 0) return 0; - if (!Stream_CheckAndLogRequiredCapacityOfSize(STREAM_TAG, s, dlen, sizeof(WCHAR))) + if (!Stream_CheckAndLogRequiredCapacityOfSize(STREAM_TAG, s, wcharLength, sizeof(WCHAR))) return -1; - SSIZE_T rc = ConvertUtf8NToWChar(src, length, str, dlen); + SSIZE_T rc = ConvertUtf8NToWChar(src, length, str, wcharLength); if (rc < 0) return -1; Stream_Seek(s, (size_t)rc * sizeof(WCHAR)); if (fill) - Stream_Zero(s, (dlen - (size_t)rc) * sizeof(WCHAR)); + Stream_Zero(s, (wcharLength - (size_t)rc) * sizeof(WCHAR)); return rc; } -char* Stream_Read_UTF16_String_As_UTF8(wStream* s, size_t dlen, size_t* psize) +char* Stream_Read_UTF16_String_As_UTF8(wStream* s, size_t wcharLength, size_t* pUtfCharLength) { const WCHAR* str = Stream_ConstPointer(s); - if (dlen > SIZE_MAX / sizeof(WCHAR)) + if (wcharLength > SIZE_MAX / sizeof(WCHAR)) return NULL; - if (!Stream_CheckAndLogRequiredLength(STREAM_TAG, s, dlen * sizeof(WCHAR))) + if (!Stream_CheckAndLogRequiredLength(STREAM_TAG, s, wcharLength * sizeof(WCHAR))) return NULL; - Stream_Seek(s, dlen * sizeof(WCHAR)); - return ConvertWCharNToUtf8Alloc(str, dlen, psize); + Stream_Seek(s, wcharLength * sizeof(WCHAR)); + return ConvertWCharNToUtf8Alloc(str, wcharLength, pUtfCharLength); } SSIZE_T Stream_Read_UTF16_String_As_UTF8_Buffer(wStream* s, size_t wcharLength, char* utfBuffer, diff --git a/winpr/libwinpr/winsock/winsock.c b/winpr/libwinpr/winsock/winsock.c index d6c114baab40..fc29cee3dedf 100644 --- a/winpr/libwinpr/winsock/winsock.c +++ b/winpr/libwinpr/winsock/winsock.c @@ -1118,6 +1118,7 @@ unsigned long _inet_addr(const char* cp) char* _inet_ntoa(struct in_addr in) { + // NOLINTNEXTLINE(concurrency-mt-unsafe) return inet_ntoa(in); } @@ -1247,14 +1248,15 @@ SOCKET _socket(int af, int type, int protocol) struct hostent* _gethostbyaddr(const char* addr, int len, int type) { struct hostent* host = NULL; + // NOLINTNEXTLINE(concurrency-mt-unsafe) host = gethostbyaddr((const void*)addr, (socklen_t)len, type); return host; } struct hostent* _gethostbyname(const char* name) { - struct hostent* host = NULL; - host = gethostbyname(name); + // NOLINTNEXTLINE(concurrency-mt-unsafe) + struct hostent* host = gethostbyname(name); return host; } @@ -1267,34 +1269,28 @@ int _gethostname(char* name, int namelen) struct servent* /* codespell:ignore servent */ _getservbyport(int port, const char* proto) { - struct servent* serv = NULL; // codespell:ignore servent - - serv = getservbyport(port, proto); - return serv; + // NOLINTNEXTLINE(concurrency-mt-unsafe) + return getservbyport(port, proto); } struct servent* /* codespell:ignore servent */ _getservbyname(const char* name, const char* proto) // codespell:ignore servent { - struct servent* serv = NULL; // codespell:ignore servent - - serv = getservbyname(name, proto); - return serv; + // NOLINTNEXTLINE(concurrency-mt-unsafe) + return getservbyname(name, proto); } struct protoent* _getprotobynumber(int number) { - struct protoent* proto = NULL; - proto = getprotobynumber(number); - return proto; + // NOLINTNEXTLINE(concurrency-mt-unsafe) + return getprotobynumber(number); } struct protoent* _getprotobyname(const char* name) { - struct protoent* proto = NULL; - proto = getprotobyname(name); - return proto; + // NOLINTNEXTLINE(concurrency-mt-unsafe) + return getprotobyname(name); } #endif /* _WIN32 */