Merge pull request #91454 from akien-mga/coverity-checks

Fix Steam input "crc" errors, and some other Coverity reports of uninitialized scalar variable
This commit is contained in:
Rémi Verschelde 2024-06-03 10:35:38 +02:00
commit 41e762ca29
No known key found for this signature in database
GPG key ID: C3336907360768E1
5 changed files with 25 additions and 25 deletions

View file

@ -1504,6 +1504,7 @@ void Input::parse_mapping(const String &p_mapping) {
JoyAxis output_axis = _get_output_axis(output); JoyAxis output_axis = _get_output_axis(output);
if (output_button == JoyButton::INVALID && output_axis == JoyAxis::INVALID) { if (output_button == JoyButton::INVALID && output_axis == JoyAxis::INVALID) {
print_verbose(vformat("Unrecognized output string \"%s\" in mapping:\n%s", output, p_mapping)); print_verbose(vformat("Unrecognized output string \"%s\" in mapping:\n%s", output, p_mapping));
continue;
} }
ERR_CONTINUE_MSG(output_button != JoyButton::INVALID && output_axis != JoyAxis::INVALID, ERR_CONTINUE_MSG(output_button != JoyButton::INVALID && output_axis != JoyAxis::INVALID,
vformat("Output string \"%s\" matched both button and axis in mapping:\n%s", output, p_mapping)); vformat("Output string \"%s\" matched both button and axis in mapping:\n%s", output, p_mapping));

View file

@ -130,14 +130,11 @@ void RasterizerGLES3::clear_depth(float p_depth) {
#ifdef CAN_DEBUG #ifdef CAN_DEBUG
static void GLAPIENTRY _gl_debug_print(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const GLvoid *userParam) { static void GLAPIENTRY _gl_debug_print(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const GLvoid *userParam) {
if (type == _EXT_DEBUG_TYPE_OTHER_ARB) { // These are ultimately annoying, so removing for now.
if (type == _EXT_DEBUG_TYPE_OTHER_ARB || type == _EXT_DEBUG_TYPE_PERFORMANCE_ARB) {
return; return;
} }
if (type == _EXT_DEBUG_TYPE_PERFORMANCE_ARB) {
return; //these are ultimately annoying, so removing for now
}
char debSource[256], debType[256], debSev[256]; char debSource[256], debType[256], debSev[256];
if (source == _EXT_DEBUG_SOURCE_API_ARB) { if (source == _EXT_DEBUG_SOURCE_API_ARB) {
@ -152,6 +149,8 @@ static void GLAPIENTRY _gl_debug_print(GLenum source, GLenum type, GLuint id, GL
strcpy(debSource, "Application"); strcpy(debSource, "Application");
} else if (source == _EXT_DEBUG_SOURCE_OTHER_ARB) { } else if (source == _EXT_DEBUG_SOURCE_OTHER_ARB) {
strcpy(debSource, "Other"); strcpy(debSource, "Other");
} else {
ERR_FAIL_MSG(vformat("GL ERROR: Invalid or unhandled source '%d' in debug callback.", source));
} }
if (type == _EXT_DEBUG_TYPE_ERROR_ARB) { if (type == _EXT_DEBUG_TYPE_ERROR_ARB) {
@ -162,10 +161,8 @@ static void GLAPIENTRY _gl_debug_print(GLenum source, GLenum type, GLuint id, GL
strcpy(debType, "Undefined behavior"); strcpy(debType, "Undefined behavior");
} else if (type == _EXT_DEBUG_TYPE_PORTABILITY_ARB) { } else if (type == _EXT_DEBUG_TYPE_PORTABILITY_ARB) {
strcpy(debType, "Portability"); strcpy(debType, "Portability");
} else if (type == _EXT_DEBUG_TYPE_PERFORMANCE_ARB) { } else {
strcpy(debType, "Performance"); ERR_FAIL_MSG(vformat("GL ERROR: Invalid or unhandled type '%d' in debug callback.", type));
} else if (type == _EXT_DEBUG_TYPE_OTHER_ARB) {
strcpy(debType, "Other");
} }
if (severity == _EXT_DEBUG_SEVERITY_HIGH_ARB) { if (severity == _EXT_DEBUG_SEVERITY_HIGH_ARB) {
@ -174,6 +171,8 @@ static void GLAPIENTRY _gl_debug_print(GLenum source, GLenum type, GLuint id, GL
strcpy(debSev, "Medium"); strcpy(debSev, "Medium");
} else if (severity == _EXT_DEBUG_SEVERITY_LOW_ARB) { } else if (severity == _EXT_DEBUG_SEVERITY_LOW_ARB) {
strcpy(debSev, "Low"); strcpy(debSev, "Low");
} else {
ERR_FAIL_MSG(vformat("GL ERROR: Invalid or unhandled severity '%d' in debug callback.", severity));
} }
String output = String() + "GL ERROR: Source: " + debSource + "\tType: " + debType + "\tID: " + itos(id) + "\tSeverity: " + debSev + "\tMessage: " + message; String output = String() + "GL ERROR: Source: " + debSource + "\tType: " + debType + "\tID: " + itos(id) + "\tSeverity: " + debSev + "\tMessage: " + message;

View file

@ -100,10 +100,10 @@ public:
}; };
struct Breakpoint { struct Breakpoint {
int id; int id = 0;
bool verified; bool verified = false;
Source source; Source source;
int line; int line = 0;
bool operator==(const Breakpoint &p_other) const { bool operator==(const Breakpoint &p_other) const {
return source.path == p_other.source.path && line == p_other.line; return source.path == p_other.source.path && line == p_other.line;
@ -121,7 +121,7 @@ struct Breakpoint {
}; };
struct BreakpointLocation { struct BreakpointLocation {
int line; int line = 0;
int endLine = -1; int endLine = -1;
_FORCE_INLINE_ Dictionary to_json() const { _FORCE_INLINE_ Dictionary to_json() const {
@ -169,10 +169,10 @@ struct Capabilities {
}; };
struct Message { struct Message {
int id; int id = 0;
String format; String format;
bool sendTelemetry = false; // Just in case :) bool sendTelemetry = false; // Just in case :)
bool showUser; bool showUser = false;
Dictionary variables; Dictionary variables;
_FORCE_INLINE_ Dictionary to_json() const { _FORCE_INLINE_ Dictionary to_json() const {
@ -190,8 +190,8 @@ struct Message {
struct Scope { struct Scope {
String name; String name;
String presentationHint; String presentationHint;
int variablesReference; int variablesReference = 0;
bool expensive; bool expensive = false;
_FORCE_INLINE_ Dictionary to_json() const { _FORCE_INLINE_ Dictionary to_json() const {
Dictionary dict; Dictionary dict;
@ -205,7 +205,7 @@ struct Scope {
}; };
struct SourceBreakpoint { struct SourceBreakpoint {
int line; int line = 0;
_FORCE_INLINE_ void from_json(const Dictionary &p_params) { _FORCE_INLINE_ void from_json(const Dictionary &p_params) {
line = p_params["line"]; line = p_params["line"];
@ -213,11 +213,11 @@ struct SourceBreakpoint {
}; };
struct StackFrame { struct StackFrame {
int id; int id = 0;
String name; String name;
Source source; Source source;
int line; int line = 0;
int column; int column = 0;
static uint32_t hash(const StackFrame &p_frame) { static uint32_t hash(const StackFrame &p_frame) {
return hash_murmur3_one_32(p_frame.id); return hash_murmur3_one_32(p_frame.id);
@ -247,7 +247,7 @@ struct StackFrame {
}; };
struct Thread { struct Thread {
int id; int id = 0;
String name; String name;
_FORCE_INLINE_ Dictionary to_json() const { _FORCE_INLINE_ Dictionary to_json() const {

View file

@ -236,7 +236,7 @@ struct ReferenceContext {
/** /**
* Include the declaration of the current symbol. * Include the declaration of the current symbol.
*/ */
bool includeDeclaration; bool includeDeclaration = false;
}; };
struct ReferenceParams : TextDocumentPositionParams { struct ReferenceParams : TextDocumentPositionParams {

View file

@ -265,8 +265,8 @@ public:
class TerrainsPattern { class TerrainsPattern {
bool valid = false; bool valid = false;
int terrain = -1; int terrain = -1;
int bits[TileSet::CELL_NEIGHBOR_MAX]; int bits[TileSet::CELL_NEIGHBOR_MAX] = {};
bool is_valid_bit[TileSet::CELL_NEIGHBOR_MAX]; bool is_valid_bit[TileSet::CELL_NEIGHBOR_MAX] = {};
int not_empty_terrains_count = 0; int not_empty_terrains_count = 0;