Fix some issues found by cppcheck.

This commit is contained in:
bruvzg 2022-04-05 13:40:26 +03:00
parent 72407a9cfb
commit f851c4aa33
No known key found for this signature in database
GPG key ID: 7960FCF39844EC38
163 changed files with 776 additions and 767 deletions

View file

@ -35,11 +35,11 @@
#include "core/io/stream_peer_ssl.h"
int PacketPeerMbedDTLS::bio_send(void *ctx, const unsigned char *buf, size_t len) {
if (buf == nullptr || len <= 0) {
if (buf == nullptr || len == 0) {
return 0;
}
PacketPeerMbedDTLS *sp = (PacketPeerMbedDTLS *)ctx;
PacketPeerMbedDTLS *sp = static_cast<PacketPeerMbedDTLS *>(ctx);
ERR_FAIL_COND_V(sp == nullptr, 0);
@ -53,11 +53,11 @@ int PacketPeerMbedDTLS::bio_send(void *ctx, const unsigned char *buf, size_t len
}
int PacketPeerMbedDTLS::bio_recv(void *ctx, unsigned char *buf, size_t len) {
if (buf == nullptr || len <= 0) {
if (buf == nullptr || len == 0) {
return 0;
}
PacketPeerMbedDTLS *sp = (PacketPeerMbedDTLS *)ctx;
PacketPeerMbedDTLS *sp = static_cast<PacketPeerMbedDTLS *>(ctx);
ERR_FAIL_COND_V(sp == nullptr, 0);

View file

@ -34,11 +34,11 @@
#include "core/io/stream_peer_tcp.h"
int StreamPeerMbedTLS::bio_send(void *ctx, const unsigned char *buf, size_t len) {
if (buf == nullptr || len <= 0) {
if (buf == nullptr || len == 0) {
return 0;
}
StreamPeerMbedTLS *sp = (StreamPeerMbedTLS *)ctx;
StreamPeerMbedTLS *sp = static_cast<StreamPeerMbedTLS *>(ctx);
ERR_FAIL_COND_V(sp == nullptr, 0);
@ -54,11 +54,11 @@ int StreamPeerMbedTLS::bio_send(void *ctx, const unsigned char *buf, size_t len)
}
int StreamPeerMbedTLS::bio_recv(void *ctx, unsigned char *buf, size_t len) {
if (buf == nullptr || len <= 0) {
if (buf == nullptr || len == 0) {
return 0;
}
StreamPeerMbedTLS *sp = (StreamPeerMbedTLS *)ctx;
StreamPeerMbedTLS *sp = static_cast<StreamPeerMbedTLS *>(ctx);
ERR_FAIL_COND_V(sp == nullptr, 0);