From 46c0d05216563be74d38f8720326c48ef654fade Mon Sep 17 00:00:00 2001 From: Mike Jerris Date: Wed, 2 Sep 2015 13:06:29 -0400 Subject: [PATCH] FS-7966: fix more msvc 2015 build warnings. --- libs/esl/src/esl.2015.vcxproj | 8 ++++---- libs/libdingaling/libdingaling.2015.vcxproj | 16 ++++++++-------- libs/libteletone/libteletone.2015.vcxproj | 4 ++++ src/include/switch_log.h | 2 +- src/mod/applications/mod_avmd/mod_avmd.c | 2 +- src/mod/applications/mod_enum/mod_enum.c | 2 +- src/mod/applications/mod_expr/exprval.c | 5 ++++- src/mod/applications/mod_fsv/mod_fsv.c | 2 +- .../mod_spandsp/mod_spandsp.2015.vcxproj | 8 ++++---- .../mod_dingaling/mod_dingaling.2015.vcxproj | 3 +++ src/mod/endpoints/mod_rtc/mod_rtc.2015.vcxproj | 4 ++++ src/mod/endpoints/mod_rtmp/handshake.h | 11 ++++++++--- src/mod/endpoints/mod_rtmp/mod_rtmp.2015.vcxproj | 8 ++++---- .../mod_skypopen/mod_skypopen.2015.vcxproj | 8 ++++---- src/mod/endpoints/mod_verto/mcast/mcast.c | 10 +++++----- src/mod/endpoints/mod_verto/mcast/mcast_cpp.cpp | 2 +- src/mod/endpoints/mod_verto/mod_verto.c | 12 ++++++------ .../mod_event_socket/mod_event_socket.c | 2 +- src/mod/languages/mod_lua/mod_lua_wrap.cpp | 2 +- src/switch_buffer.c | 4 +++- 20 files changed, 68 insertions(+), 47 deletions(-) diff --git a/libs/esl/src/esl.2015.vcxproj b/libs/esl/src/esl.2015.vcxproj index 9a7d2978d7..b35f24a25c 100644 --- a/libs/esl/src/esl.2015.vcxproj +++ b/libs/esl/src/esl.2015.vcxproj @@ -80,7 +80,7 @@ MultiThreadedDebugDLL Level4 false - 6031;4267;4244;4706;4100;%(DisableSpecificWarnings) + 28253;28252;6031;4267;4244;4706;4100;%(DisableSpecificWarnings) true @@ -97,7 +97,7 @@ MultiThreadedDebugDLL Level4 false - 6031;4267;4244;4706;4100;%(DisableSpecificWarnings) + 28253;28252;6031;4267;4244;4706;4100;%(DisableSpecificWarnings) true @@ -108,7 +108,7 @@ MultiThreadedDLL Level4 false - 6031;4267;4244;4706;4100;%(DisableSpecificWarnings) + 28253;28252;6031;4267;4244;4706;4100;%(DisableSpecificWarnings) true @@ -122,7 +122,7 @@ MultiThreadedDLL Level4 false - 6031;4267;4244;4706;4100;%(DisableSpecificWarnings) + 28253;28252;6031;4267;4244;4706;4100;%(DisableSpecificWarnings) true diff --git a/libs/libdingaling/libdingaling.2015.vcxproj b/libs/libdingaling/libdingaling.2015.vcxproj index 1c4683b916..e050221330 100644 --- a/libs/libdingaling/libdingaling.2015.vcxproj +++ b/libs/libdingaling/libdingaling.2015.vcxproj @@ -137,7 +137,7 @@ EnableFastChecks MultiThreadedDebugDLL Level4 - 4456;4457;4701;4702;4703;4100;4706;%(DisableSpecificWarnings) + 4718;4456;4457;4701;4702;4703;4100;4706;%(DisableSpecificWarnings) @@ -146,7 +146,7 @@ WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) MultiThreadedDLL Level4 - 4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings) + 4718;4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings) @@ -161,7 +161,7 @@ Level4 EditAndContinue - 4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings) + 4718;4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings) libapr-1.lib;libaprutil-1.lib;iksemel.lib;Ws2_32.lib;%(AdditionalDependencies) @@ -184,7 +184,7 @@ Level4 ProgramDatabase - 4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings) + 4718;4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings) libapr-1.lib;libaprutil-1.lib;iksemel.lib;Ws2_32.lib;%(AdditionalDependencies) @@ -207,7 +207,7 @@ EnableFastChecks MultiThreadedDebugDLL Level4 - 4456;4457;4701;4702;4703;4100;4706;%(DisableSpecificWarnings) + 4718;4456;4457;4701;4702;4703;4100;4706;%(DisableSpecificWarnings) @@ -219,7 +219,7 @@ WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) MultiThreadedDLL Level4 - 4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings) + 4718;4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings) @@ -237,7 +237,7 @@ Level4 ProgramDatabase - 4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings) + 4718;4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings) libapr-1.lib;libaprutil-1.lib;iksemel.lib;Ws2_32.lib;%(AdditionalDependencies) @@ -264,7 +264,7 @@ Level4 ProgramDatabase - 4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings) + 4718;4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings) libapr-1.lib;libaprutil-1.lib;iksemel.lib;Ws2_32.lib;%(AdditionalDependencies) diff --git a/libs/libteletone/libteletone.2015.vcxproj b/libs/libteletone/libteletone.2015.vcxproj index 5a69746dc5..e7faadecde 100644 --- a/libs/libteletone/libteletone.2015.vcxproj +++ b/libs/libteletone/libteletone.2015.vcxproj @@ -81,6 +81,7 @@ Level4 false true + 28252;28253 false @@ -103,6 +104,7 @@ Level4 false true + 28252;28253 false @@ -120,6 +122,7 @@ Level4 false true + 28252;28253 false @@ -136,6 +139,7 @@ Level4 false true + 28252;28253 false diff --git a/src/include/switch_log.h b/src/include/switch_log.h index e2244ac51e..62a9e42f15 100644 --- a/src/include/switch_log.h +++ b/src/include/switch_log.h @@ -141,7 +141,7 @@ SWITCH_DECLARE(switch_status_t) switch_log_unbind_logger(_In_ switch_log_functio SWITCH_DECLARE(switch_log_level_t) switch_log_str2level(_In_z_ const char *str); SWITCH_DECLARE(uint32_t) switch_log_str2mask(_In_z_ const char *str); -#define switch_log_check_mask(_mask, _level) (_mask & (1 << _level)) +#define switch_log_check_mask(_mask, _level) (_mask & ((size_t)1 << _level)) SWITCH_DECLARE(switch_log_node_t *) switch_log_node_dup(const switch_log_node_t *node); diff --git a/src/mod/applications/mod_avmd/mod_avmd.c b/src/mod/applications/mod_avmd/mod_avmd.c index 610ed1caaf..3722365397 100644 --- a/src/mod/applications/mod_avmd/mod_avmd.c +++ b/src/mod/applications/mod_avmd/mod_avmd.c @@ -137,7 +137,7 @@ static void init_avmd_session_data(avmd_session_t *avmd_session, switch_core_se { /*! This is a worst case sample rate estimate */ avmd_session->rate = 48000; - INIT_CIRC_BUFFER(&avmd_session->b, BEEP_LEN(avmd_session->rate), FRAME_LEN(avmd_session->rate), fs_session); + INIT_CIRC_BUFFER(&avmd_session->b, (size_t)BEEP_LEN(avmd_session->rate), (size_t)FRAME_LEN(avmd_session->rate), fs_session); avmd_session->session = fs_session; avmd_session->pos = 0; diff --git a/src/mod/applications/mod_enum/mod_enum.c b/src/mod/applications/mod_enum/mod_enum.c index d7cc9e5156..42126f3009 100644 --- a/src/mod/applications/mod_enum/mod_enum.c +++ b/src/mod/applications/mod_enum/mod_enum.c @@ -280,7 +280,7 @@ static void free_results(enum_record_t ** results) static ldns_rdf *ldns_rdf_new_addr_frm_str(const char *str) { - ldns_rdf *a; + ldns_rdf *a = NULL; ldns_str2rdf_a(&a, str); diff --git a/src/mod/applications/mod_expr/exprval.c b/src/mod/applications/mod_expr/exprval.c index b0efaa8453..6939c9567f 100644 --- a/src/mod/applications/mod_expr/exprval.c +++ b/src/mod/applications/mod_expr/exprval.c @@ -213,12 +213,15 @@ int exprValListGetAddress(exprValList * vlist, char *name, EXPRTYPE ** addr) exprVal *cur; int result; - if (vlist == NULL || addr == NULL) + if (addr == NULL) return EXPR_ERROR_NULLPOINTER; /* Not found yet */ *addr = NULL; + if (vlist == NULL) + return EXPR_ERROR_NULLPOINTER; + if (name == NULL || name[0] == '\0') return EXPR_ERROR_NOTFOUND; diff --git a/src/mod/applications/mod_fsv/mod_fsv.c b/src/mod/applications/mod_fsv/mod_fsv.c index 860d8b7ae2..c709458dd9 100644 --- a/src/mod/applications/mod_fsv/mod_fsv.c +++ b/src/mod/applications/mod_fsv/mod_fsv.c @@ -950,7 +950,7 @@ end: static switch_status_t fsv_file_write(switch_file_handle_t *handle, void *data, size_t *len) { - uint32_t datalen = *len * sizeof(int16_t); + uint32_t datalen = (uint32_t)(*len * sizeof(int16_t)); size_t size; switch_status_t status; int16_t *xdata = data; diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.2015.vcxproj b/src/mod/applications/mod_spandsp/mod_spandsp.2015.vcxproj index 25cc04caec..d519a7bcec 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.2015.vcxproj +++ b/src/mod/applications/mod_spandsp/mod_spandsp.2015.vcxproj @@ -89,7 +89,7 @@ %(RootDir)%(Directory)..\..\..\..\libs\spandsp\src\msvc;%(RootDir)%(Directory)..\..\..\..\libs\spandsp\src;%(RootDir)%(Directory)..\..\..\..\libs\tiff-4.0.2\libtiff;%(RootDir)%(Directory)..\..\..\..\libs\jpeg-8d;%(AdditionalIncludeDirectories) - 6031;4456;4024;4047;4324;6340;6246;6011;6387;%(DisableSpecificWarnings) + 4189;6031;4456;4024;4047;4324;6340;6246;6011;6387;%(DisableSpecificWarnings) false @@ -107,7 +107,7 @@ %(RootDir)%(Directory)..\..\..\..\libs\spandsp\src\msvc;%(RootDir)%(Directory)..\..\..\..\libs\spandsp\src;%(RootDir)%(Directory)..\..\..\..\libs\tiff-4.0.2\libtiff;%(RootDir)%(Directory)..\..\..\..\libs\jpeg-8d;%(AdditionalIncludeDirectories) - 6031;4456;4024;4047;4324;6340;6246;6011;6387;%(DisableSpecificWarnings) + 4189;6031;4456;4024;4047;4324;6340;6246;6011;6387;%(DisableSpecificWarnings) false @@ -123,7 +123,7 @@ %(RootDir)%(Directory)..\..\..\..\libs\spandsp\src\msvc;%(RootDir)%(Directory)..\..\..\..\libs\spandsp\src;%(RootDir)%(Directory)..\..\..\..\libs\tiff-4.0.2\libtiff;%(RootDir)%(Directory)..\..\..\..\libs\jpeg-8d;%(AdditionalIncludeDirectories) - 6031;4456;4024;4047;4324;6340;6246;6011;6387;%(DisableSpecificWarnings) + 4189;6031;4456;4024;4047;4324;6340;6246;6011;6387;%(DisableSpecificWarnings) false @@ -141,7 +141,7 @@ %(RootDir)%(Directory)..\..\..\..\libs\spandsp\src\msvc;%(RootDir)%(Directory)..\..\..\..\libs\spandsp\src;%(RootDir)%(Directory)..\..\..\..\libs\tiff-4.0.2\libtiff;%(RootDir)%(Directory)..\..\..\..\libs\jpeg-8d;%(AdditionalIncludeDirectories) - 6031;4456;4024;4047;4324;6340;6246;6011;6387;%(DisableSpecificWarnings) + 4189;6031;4456;4024;4047;4324;6340;6246;6011;6387;%(DisableSpecificWarnings) false diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.2015.vcxproj b/src/mod/endpoints/mod_dingaling/mod_dingaling.2015.vcxproj index 2f567679fb..7ff672d214 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.2015.vcxproj +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.2015.vcxproj @@ -73,6 +73,7 @@ %(RootDir)%(Directory)..\..\..\..\libs\libdingaling\src;%(AdditionalIncludeDirectories) + 4718;6340;6246;6011;6387;%(DisableSpecificWarnings) /NODEFAULTLIB:LIMBCTD %(AdditionalOptions) @@ -90,6 +91,7 @@ %(RootDir)%(Directory)..\..\..\..\libs\libdingaling\src;%(AdditionalIncludeDirectories) + 4718;6340;6246;6011;6387;%(DisableSpecificWarnings) /NODEFAULTLIB:LIMBCTD %(AdditionalOptions) @@ -105,6 +107,7 @@ %(RootDir)%(Directory)..\..\..\..\libs\libdingaling\src;%(AdditionalIncludeDirectories) + 4718;6340;6246;6011;6387;%(DisableSpecificWarnings) $(ProjectDir)..\..\..\..\libs\libdingaling\$(OutDir);$(ProjectDir)..\..\..\..\libs\iksemel\$(OutDir);%(AdditionalLibraryDirectories) diff --git a/src/mod/endpoints/mod_rtc/mod_rtc.2015.vcxproj b/src/mod/endpoints/mod_rtc/mod_rtc.2015.vcxproj index 95a4b5954c..ed07ba9eb3 100644 --- a/src/mod/endpoints/mod_rtc/mod_rtc.2015.vcxproj +++ b/src/mod/endpoints/mod_rtc/mod_rtc.2015.vcxproj @@ -72,6 +72,7 @@ + 4189;6340;6246;6011;6387;%(DisableSpecificWarnings) false @@ -86,6 +87,7 @@ + 4189;6340;6246;6011;6387;%(DisableSpecificWarnings) false @@ -98,6 +100,7 @@ + 4189;6340;6246;6011;6387;%(DisableSpecificWarnings) false @@ -112,6 +115,7 @@ + 4189;6340;6246;6011;6387;%(DisableSpecificWarnings) false diff --git a/src/mod/endpoints/mod_rtmp/handshake.h b/src/mod/endpoints/mod_rtmp/handshake.h index 5d513ecd28..f33ad9fd08 100644 --- a/src/mod/endpoints/mod_rtmp/handshake.h +++ b/src/mod/endpoints/mod_rtmp/handshake.h @@ -27,6 +27,11 @@ #ifndef _RTMP_VIDEO_H #define _RTMP_VIDEO_H +#include +#include +#ifdef WIN32 +#include +#endif #include #include @@ -149,7 +154,7 @@ static void HMACsha256(const uint8_t *message, size_t messageLen, const uint8_t unsigned int digestLen; HMAC_CTX ctx; - HMAC_setup(ctx, key, keylen); + HMAC_setup(ctx, key, (int)keylen); HMAC_crunch(ctx, message, messageLen); HMAC_finish(ctx, digest, digestLen); @@ -603,7 +608,7 @@ static int ReadN(void * user_data, void * out_buffer, size_t size) memcpy(out_buffer, helper->r_buf + helper->r_pos, len); helper->r_pos += len; - return len; + return (int)len; } static int WriteN(void * user_data, void * buffer, size_t size) @@ -615,7 +620,7 @@ static int WriteN(void * user_data, void * buffer, size_t size) memcpy(helper->w_buf + helper->w_pos, buffer, len); helper->w_pos += len; - return len; + return (int)len; } static int SHandShake0(handshake_helper_t * r) diff --git a/src/mod/endpoints/mod_rtmp/mod_rtmp.2015.vcxproj b/src/mod/endpoints/mod_rtmp/mod_rtmp.2015.vcxproj index d696a1973d..0abae49fb9 100644 --- a/src/mod/endpoints/mod_rtmp/mod_rtmp.2015.vcxproj +++ b/src/mod/endpoints/mod_rtmp/mod_rtmp.2015.vcxproj @@ -96,7 +96,7 @@ WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;%(PreprocessorDefinitions) - 4456;4221;4127;6001;6011;6385;6244;6259;4090;4306;4244;4100;4101;%(DisableSpecificWarnings) + 4189;4456;4221;4127;6001;6011;6385;6244;6259;4090;4306;4244;4100;4101;%(DisableSpecificWarnings) false @@ -114,7 +114,7 @@ _DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;%(PreprocessorDefinitions) - 4456;4221;4127;6001;6011;6385;6244;6259;4090;4306;4244;4100;4101;%(DisableSpecificWarnings) + 4189;4456;4221;4127;6001;6011;6385;6244;6259;4090;4306;4244;4100;4101;%(DisableSpecificWarnings) false @@ -132,7 +132,7 @@ WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;%(PreprocessorDefinitions) - 4456;4221;4127;6001;6011;6385;6244;6259;4090;4306;4244;4100;4101;%(DisableSpecificWarnings) + 4189;4456;4221;4127;6001;6011;6385;6244;6259;4090;4306;4244;4100;4101;%(DisableSpecificWarnings) false @@ -149,7 +149,7 @@ NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;%(PreprocessorDefinitions) - 4456;4221;4127;6001;6011;6385;6244;6259;4090;4306;4244;4100;4101;%(DisableSpecificWarnings) + 4189;4456;4221;4127;6001;6011;6385;6244;6259;4090;4306;4244;4100;4101;%(DisableSpecificWarnings) false diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.2015.vcxproj b/src/mod/endpoints/mod_skypopen/mod_skypopen.2015.vcxproj index 7d2aad6932..bbadaa5a50 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.2015.vcxproj +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.2015.vcxproj @@ -75,7 +75,7 @@ Level4 false - 4456;6031;4324;6340;6246;6011;6387;%(DisableSpecificWarnings) + 28252;28253;4456;6031;4324;6340;6246;6011;6387;%(DisableSpecificWarnings) rpcrt4.lib "..\..\..\..\libs\spandsp\src\Win32\Debug\libtiff.lib" "..\..\..\..\Win32\Debug\libspandsp.lib" %(AdditionalOptions) @@ -91,7 +91,7 @@ Level4 false - 4456;6031;4324;6340;6246;6011;6387;%(DisableSpecificWarnings) + 28183;28252;28253;4456;6031;4324;6340;6246;6011;6387;%(DisableSpecificWarnings) rpcrt4.lib "..\..\..\..\libs\spandsp\src\x64\Debug\libtiff.lib" "..\..\..\..\x64\Debug\libspandsp.lib" %(AdditionalOptions) @@ -105,7 +105,7 @@ %(RootDir)%(Directory)..\..\..\..\libs\spandsp\src\msvc;%(RootDir)%(Directory)..\..\..\..\libs\spandsp\src;%(RootDir)%(Directory)..\..\..\..\libs\tiff-4.0.2\libtiff;%(RootDir)%(Directory)..\..\..\..\libs\jpeg-8d;%(AdditionalIncludeDirectories) - 4456;6031;4324;6340;6246;6011;6387;%(DisableSpecificWarnings) + 28252;28253;4456;6031;4324;6340;6246;6011;6387;%(DisableSpecificWarnings) rpcrt4.lib "..\..\..\..\libs\spandsp\src\Win32\Release\libtiff.lib" "..\..\..\..\Win32\Release\libspandsp.lib" %(AdditionalOptions) @@ -119,7 +119,7 @@ %(RootDir)%(Directory)..\..\..\..\libs\spandsp\src\msvc;%(RootDir)%(Directory)..\..\..\..\libs\spandsp\src;%(RootDir)%(Directory)..\..\..\..\libs\tiff-4.0.2\libtiff;%(RootDir)%(Directory)..\..\..\..\libs\jpeg-8d;%(AdditionalIncludeDirectories) - 4456;6031;4324;6340;6246;6011;6387;%(DisableSpecificWarnings) + 28252;28253;4456;6031;4324;6340;6246;6011;6387;%(DisableSpecificWarnings) rpcrt4.lib "..\..\..\..\libs\spandsp\src\x64\Release\libtiff.lib" "..\..\..\..\x64\Release\libspandsp.lib" %(AdditionalOptions) diff --git a/src/mod/endpoints/mod_verto/mcast/mcast.c b/src/mod/endpoints/mod_verto/mcast/mcast.c index 9da4088ccd..722a3d75ca 100644 --- a/src/mod/endpoints/mod_verto/mcast/mcast.c +++ b/src/mod/endpoints/mod_verto/mcast/mcast.c @@ -67,7 +67,7 @@ int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle, family = AF_INET6; } - if ((!(flags & MCAST_SEND) && !(flags & MCAST_RECV)) || (handle->sock = socket(family, SOCK_DGRAM, 0)) <= 0 ) { + if ((!(flags & MCAST_SEND) && !(flags & MCAST_RECV)) || (handle->sock = (int)socket(family, SOCK_DGRAM, 0)) <= 0 ) { return -1; } @@ -203,9 +203,9 @@ ssize_t mcast_socket_send(mcast_handle_t *handle, void *data, size_t datalen) } if (handle->family == AF_INET6) { - return sendto(handle->sock, data, datalen, 0, (struct sockaddr *) &handle->send_addr6, sizeof(handle->send_addr6)); + return sendto(handle->sock, data, (int)datalen, 0, (struct sockaddr *) &handle->send_addr6, sizeof(handle->send_addr6)); } else { - return sendto(handle->sock, data, datalen, 0, (struct sockaddr *) &handle->send_addr, sizeof(handle->send_addr)); + return sendto(handle->sock, data, (int)datalen, 0, (struct sockaddr *) &handle->send_addr, sizeof(handle->send_addr)); } } @@ -227,8 +227,8 @@ ssize_t mcast_socket_recv(mcast_handle_t *handle, void *data, size_t datalen, in } if (handle->family == AF_INET6) { - return recvfrom(handle->sock, data, datalen, 0, (struct sockaddr *) &handle->recv_addr6, &addrlen); + return recvfrom(handle->sock, data, (int)datalen, 0, (struct sockaddr *) &handle->recv_addr6, &addrlen); } else { - return recvfrom(handle->sock, data, datalen, 0, (struct sockaddr *) &handle->recv_addr, &addrlen); + return recvfrom(handle->sock, data, (int)datalen, 0, (struct sockaddr *) &handle->recv_addr, &addrlen); } } diff --git a/src/mod/endpoints/mod_verto/mcast/mcast_cpp.cpp b/src/mod/endpoints/mod_verto/mcast/mcast_cpp.cpp index f087baf343..f4b3d74f30 100644 --- a/src/mod/endpoints/mod_verto/mcast/mcast_cpp.cpp +++ b/src/mod/endpoints/mod_verto/mcast/mcast_cpp.cpp @@ -55,7 +55,7 @@ int McastHandle::send(const char *data) char *McastHandle::recv(int ms) { - int r; + ssize_t r; if ((r = mcast_socket_recv(&handle, NULL, 0, ms)) > 0) { *((char *)handle.buffer + r) = '\0'; diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 3781d47285..7d0d003103 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1416,7 +1416,7 @@ static uint8_t *http_stream_read(switch_stream_handle_t *handle, int *len) return NULL; } - *len = r->bytes_buffered - r->bytes_read; + *len = (int)(r->bytes_buffered - r->bytes_read); if (*len > 0) { // we already read part of the body uint8_t *data = (uint8_t *)wsh->buffer + r->bytes_read; @@ -1429,10 +1429,10 @@ static uint8_t *http_stream_read(switch_stream_handle_t *handle, int *len) return NULL; } - *len = r->content_length - (r->bytes_read - r->bytes_header); + *len = (int)(r->content_length - (r->bytes_read - r->bytes_header)); *len = *len > sizeof(wsh->buffer) ? sizeof(wsh->buffer) : *len; - if ((*len = ws_raw_read(wsh, wsh->buffer, *len, wsh->block)) < 0) { + if ((*len = (int)ws_raw_read(wsh, wsh->buffer, *len, wsh->block)) < 0) { *len = 0; return NULL; } @@ -1464,7 +1464,7 @@ static switch_status_t http_stream_write(switch_stream_handle_t *handle, const c if (data) { if (ret) { - ret = ws_raw_write(&jsock->ws, data, (uint32_t)strlen(data)); + ret =(int) ws_raw_write(&jsock->ws, data, (uint32_t)strlen(data)); } switch_safe_free(data); } @@ -1559,7 +1559,7 @@ new_req: } request.headers = stream.param_event; - if (switch_http_parse_header(jsock->ws.buffer, jsock->ws.datalen, &request) != SWITCH_STATUS_SUCCESS) { + if (switch_http_parse_header(jsock->ws.buffer, (uint32_t)jsock->ws.datalen, &request) != SWITCH_STATUS_SUCCESS) { switch_event_destroy(&stream.param_event); goto err; } @@ -3995,7 +3995,7 @@ static void handle_mcast_sub(verto_profile_t *profile) return; } - bytes = mcast_socket_recv(&profile->mcast_sub, NULL, 0, 0); + bytes = (int)mcast_socket_recv(&profile->mcast_sub, NULL, 0, 0); if (bytes > 0) { cJSON *json; diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index 66f8e6cbb2..8d1b1d5567 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -395,7 +395,7 @@ static void event_handler(switch_event_t *event) SWITCH_STANDARD_APP(socket_function) { char *host, *port_name, *path; - switch_socket_t *new_sock; + switch_socket_t *new_sock = NULL; switch_sockaddr_t *sa; switch_port_t port = 8084; listener_t *listener; diff --git a/src/mod/languages/mod_lua/mod_lua_wrap.cpp b/src/mod/languages/mod_lua/mod_lua_wrap.cpp index f3ca51cbc2..4bce79aff4 100644 --- a/src/mod/languages/mod_lua/mod_lua_wrap.cpp +++ b/src/mod/languages/mod_lua/mod_lua_wrap.cpp @@ -1405,7 +1405,7 @@ SWIGINTERN int SWIG_Lua_class_tostring(lua_State* L) /* there should be 1 param passed in (1) userdata (not the metatable) */ assert(lua_isuserdata(L,1)); /* just in case */ - unsigned long userData = (unsigned long)lua_touserdata(L,1); /* get the userdata address for later */ + unsigned long userData = (unsigned long)(intptr_t)lua_touserdata(L,1); /* get the userdata address for later */ lua_getmetatable(L,1); /* get the meta table */ assert(lua_istable(L,-1)); /* just in case */ diff --git a/src/switch_buffer.c b/src/switch_buffer.c index 56b0b94bb1..b2fd1482fe 100644 --- a/src/switch_buffer.c +++ b/src/switch_buffer.c @@ -115,6 +115,7 @@ SWITCH_DECLARE(switch_status_t) switch_buffer_create_dynamic(switch_buffer_t **b if (start_len) { if (!(new_buffer->data = malloc(start_len))) { free(new_buffer); + *buffer = NULL; return SWITCH_STATUS_MEMERR; } memset(new_buffer->data, 0, start_len); @@ -130,7 +131,7 @@ SWITCH_DECLARE(switch_status_t) switch_buffer_create_dynamic(switch_buffer_t **b *buffer = new_buffer; return SWITCH_STATUS_SUCCESS; } - + *buffer = NULL; return SWITCH_STATUS_MEMERR; } @@ -268,6 +269,7 @@ SWITCH_DECLARE(switch_size_t) switch_buffer_peek_zerocopy(switch_buffer_t *buffe if (buffer->used < 1) { buffer->used = 0; + *ptr = NULL; return 0; } else { reading = buffer->used;