mirror of
https://github.com/godotengine/godot
synced 2024-09-05 13:18:38 +00:00
Fix invalid comparison warnings: [-Wbool-compare] and [-Wenum-compare]
Fixes the following GCC 5 warnings and actual bugs: ``` drivers/unix/net_socket_posix.cpp:562:28: warning: comparison between 'enum IP::Type' and 'enum NetSocket::Type' [-Wenum-compare] modules/gdscript/gdscript_function.cpp:792:26: warning: comparison of constant '17' with boolean expression is always true [-Wbool-compare] modules/gdscript/gdscript_function.cpp:792:26: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses] modules/gdscript/gdscript_parser.cpp:5082:58: warning: comparison of constant '6' with boolean expression is always false [-Wbool-compare] modules/gdscript/gdscript_parser.cpp:5082:58: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses] modules/mbedtls/stream_peer_mbed_tls.cpp:286:45: warning: comparison between 'enum StreamPeerTCP::Status' and 'enum StreamPeerSSL::Status' [-Wenum-compare] modules/mbedtls/stream_peer_mbed_tls.cpp:313:45: warning: comparison between 'enum StreamPeerTCP::Status' and 'enum StreamPeerSSL::Status' [-Wenum-compare] ```
This commit is contained in:
parent
e5bbcb8bcf
commit
bca2d3ad40
|
@ -559,7 +559,7 @@ void NetSocketPosix::set_ipv6_only_enabled(bool p_enabled) {
|
|||
|
||||
void NetSocketPosix::set_tcp_no_delay_enabled(bool p_enabled) {
|
||||
ERR_FAIL_COND(!is_open());
|
||||
ERR_FAIL_COND(_ip_type != TYPE_TCP);
|
||||
ERR_FAIL_COND(!_is_stream); // Not TCP
|
||||
|
||||
int par = p_enabled ? 1 : 0;
|
||||
if (setsockopt(_sock, IPPROTO_TCP, TCP_NODELAY, SOCK_CBUF(&par), sizeof(int)) < 0) {
|
||||
|
|
|
@ -789,7 +789,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||
#ifdef DEBUG_ENABLED
|
||||
GDScriptNativeClass *nc = Object::cast_to<GDScriptNativeClass>(type->operator Object *());
|
||||
GD_ERR_BREAK(!nc);
|
||||
if (!src->get_type() != Variant::OBJECT && !src->get_type() != Variant::NIL) {
|
||||
if (src->get_type() != Variant::OBJECT && src->get_type() != Variant::NIL) {
|
||||
err_text = "Trying to assign value of type '" + Variant::get_type_name(src->get_type()) +
|
||||
"' to a variable of type '" + nc->get_name() + "'.";
|
||||
OPCODE_BREAK;
|
||||
|
|
|
@ -5079,7 +5079,7 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class) {
|
|||
if (found) continue;
|
||||
|
||||
if (p->constant_expressions.has(base)) {
|
||||
if (!p->constant_expressions[base].expression->type == Node::TYPE_CONSTANT) {
|
||||
if (p->constant_expressions[base].expression->type != Node::TYPE_CONSTANT) {
|
||||
_set_error("Could not resolve constant '" + base + "'.", p_class->line);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -29,9 +29,11 @@
|
|||
/*************************************************************************/
|
||||
|
||||
#include "stream_peer_mbed_tls.h"
|
||||
|
||||
#include "core/io/stream_peer_tcp.h"
|
||||
#include "core/os/file_access.h"
|
||||
#include "mbedtls/platform_util.h"
|
||||
|
||||
#include <mbedtls/platform_util.h>
|
||||
|
||||
static void my_debug(void *ctx, int level,
|
||||
const char *file, int line,
|
||||
|
@ -283,7 +285,7 @@ void StreamPeerMbedTLS::poll() {
|
|||
}
|
||||
|
||||
Ref<StreamPeerTCP> tcp = base;
|
||||
if (tcp.is_valid() && tcp->get_status() != STATUS_CONNECTED) {
|
||||
if (tcp.is_valid() && tcp->get_status() != StreamPeerTCP::STATUS_CONNECTED) {
|
||||
disconnect_from_stream();
|
||||
return;
|
||||
}
|
||||
|
@ -310,7 +312,7 @@ void StreamPeerMbedTLS::disconnect_from_stream() {
|
|||
return;
|
||||
|
||||
Ref<StreamPeerTCP> tcp = base;
|
||||
if (tcp.is_valid() && tcp->get_status() == STATUS_CONNECTED) {
|
||||
if (tcp.is_valid() && tcp->get_status() == StreamPeerTCP::STATUS_CONNECTED) {
|
||||
// We are still connected on the socket, try to send close notity.
|
||||
mbedtls_ssl_close_notify(&ssl);
|
||||
}
|
||||
|
|
|
@ -33,12 +33,12 @@
|
|||
|
||||
#include "core/io/stream_peer_ssl.h"
|
||||
|
||||
#include "mbedtls/config.h"
|
||||
#include "mbedtls/ctr_drbg.h"
|
||||
#include "mbedtls/debug.h"
|
||||
#include "mbedtls/entropy.h"
|
||||
#include "mbedtls/net.h"
|
||||
#include "mbedtls/ssl.h"
|
||||
#include <mbedtls/config.h>
|
||||
#include <mbedtls/ctr_drbg.h>
|
||||
#include <mbedtls/debug.h>
|
||||
#include <mbedtls/entropy.h>
|
||||
#include <mbedtls/net.h>
|
||||
#include <mbedtls/ssl.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
Loading…
Reference in a new issue