From 3e136fc57a2e509e5a4dd265a798b196205b0a80 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Sun, 4 Oct 2026 22:02:19 +0200 Subject: Fix more warnings --- xmpp-vala/src/core/stanza_node.vala | 2 +- xmpp-vala/src/core/stanza_reader.vala | 11 ++++- xmpp-vala/src/file_content_type.vala | 8 +++- xmpp-vala/src/module/xep/0004_data_forms.vala | 5 -- .../module/xep/0030_service_discovery/module.vala | 17 +++++-- xmpp-vala/src/module/xep/0084_user_avatars.vala | 9 ++-- .../xep/0261_jingle_in_band_bytestreams.vala | 4 -- xmpp-vala/src/module/xep/0272_muji.vala | 10 ++-- .../src/module/xep/0363_http_file_upload.vala | 36 ++++++++------- .../module/xep/0388_extensible_sasl_profile.vala | 24 ++++++---- .../module/xep/0392_consistent_color/hsluv.vala | 53 ++++++++++------------ xmpp-vala/src/module/xep/0410_muc_self_ping.vala | 18 +++++--- .../src/module/xep/0425_message_moderation.vala | 18 +++++--- .../module/xep/0447_stateless_file_sharing.vala | 2 +- .../0490_message_displayed_synchronization.vala | 37 ++++++++++----- 15 files changed, 149 insertions(+), 105 deletions(-) (limited to 'xmpp-vala/src') diff --git a/xmpp-vala/src/core/stanza_node.vala b/xmpp-vala/src/core/stanza_node.vala index 7a68da62..56f857d4 100644 --- a/xmpp-vala/src/core/stanza_node.vala +++ b/xmpp-vala/src/core/stanza_node.vala @@ -29,7 +29,7 @@ public abstract class StanzaEntry { case '\'': result_builder.append("'"); break; case '<': result_builder.append("<"); break; case '>': result_builder.append(">"); break; - default: error("Unreachable"); break; + default: error("Unreachable"); } return false; }); diff --git a/xmpp-vala/src/core/stanza_reader.vala b/xmpp-vala/src/core/stanza_reader.vala index ff512497..4828600d 100644 --- a/xmpp-vala/src/core/stanza_reader.vala +++ b/xmpp-vala/src/core/stanza_reader.vala @@ -38,8 +38,15 @@ public class StanzaReader { if (cancellable != null && cancellable.is_cancelled()) throw new IOError.CANCELLED("Input stream is canceled."); try { buffer_fill = (int) yield ((!)input).read_async(buffer, GLib.Priority.DEFAULT, cancellable); - } catch (TlsError.EOF e) { - throw new IOError.CLOSED("End of TLS stream reached"); + } catch (Error e) { + if (e is IOError) { + throw (IOError) e; + } else if (e is TlsError.EOF) { + // The error can be TlsError.EOF instead of IOError.CLOSED, fixing that + throw new IOError.CLOSED("End of TLS stream reached"); + } else { + throw new IOError.FAILED("Unknown error: %s", e.message); + } } if (buffer_fill == 0) throw new IOError.CLOSED("End of input stream reached."); buffer_pos = 0; diff --git a/xmpp-vala/src/file_content_type.vala b/xmpp-vala/src/file_content_type.vala index 3656435e..bae493f6 100644 --- a/xmpp-vala/src/file_content_type.vala +++ b/xmpp-vala/src/file_content_type.vala @@ -14,8 +14,12 @@ namespace Xmpp { } public FileContentType.from_file(File file) { - FileInfo file_info = file.query_info("*", FileQueryInfoFlags.NONE); - this.from_file_info(file_info); + try { + FileInfo file_info = file.query_info("*", FileQueryInfoFlags.NONE); + this.from_file_info(file_info); + } catch (Error e) { + warning("Failed reading file content type: %s", e.message); + } } public string? get_mime_type() { diff --git a/xmpp-vala/src/module/xep/0004_data_forms.vala b/xmpp-vala/src/module/xep/0004_data_forms.vala index f481e174..6c16a53d 100644 --- a/xmpp-vala/src/module/xep/0004_data_forms.vala +++ b/xmpp-vala/src/module/xep/0004_data_forms.vala @@ -83,11 +83,6 @@ public class DataForm { value_node.put_node(new StanzaNode.text(val)); } - internal void add_value_string(string val) { - StanzaNode node = new StanzaNode.build("value"); - node.put_node(new StanzaNode.text(val)); - } - internal Gee.List