Fix warning - regarding missing prototypes and sign conversions

This commit is contained in:
2026-09-01 19:20:50 +02:00
parent cca190e2f4
commit 3d6b08d9d5
9 changed files with 27 additions and 8 deletions
+1
View File
@@ -4,6 +4,7 @@
#include <string.h>
#include <hammy/command.h>
#include <hammy/commands.h>
#include <hammy/job.h>
#include <hammy/refdb.h>
#include <hammy/utils.h>
+1
View File
@@ -7,6 +7,7 @@
#include <stdarg.h>
#include <hammy/command.h>
#include <hammy/commands.h>
#include <hammy/job.h>
#include <hammy/refdb.h>
+2 -1
View File
@@ -4,6 +4,7 @@
#include <string.h>
#include <hammy/command.h>
#include <hammy/commands.h>
#include <hammy/job.h>
#include <hammy/refdb.h>
@@ -28,7 +29,7 @@
// invalid JSON.
static bool morse_append(char* buf, size_t cap, size_t* len, bool gap, const char* token) {
size_t n = strlen(token);
size_t need = (*len > 0 ? 1 : 0) + (gap ? 2 : 0) + n;
size_t need = (*len > 0 ? 1u : 0u) + (gap ? 2u : 0u) + n;
if (*len + need + 1 > cap) { return false; }
+2 -1
View File
@@ -4,6 +4,7 @@
#include <string.h>
#include <hammy/command.h>
#include <hammy/commands.h>
#include <hammy/job.h>
#include <hammy/refdb.h>
#include <hammy/utils.h>
@@ -29,7 +30,7 @@
// invalid JSON.
static bool phonetic_append(char* buf, size_t cap, size_t* len, bool gap, const char* token) {
size_t n = strlen(token);
size_t need = (*len > 0 ? 1 : 0) + (gap ? 2 : 0) + n;
size_t need = (*len > 0 ? 1u : 0u) + (gap ? 2u : 0u) + n;
if (*len + need + 1 > cap) { return false; }
+1
View File
@@ -3,6 +3,7 @@
#include <stdio.h>
#include <hammy/command.h>
#include <hammy/commands.h>
#include <hammy/job.h>
// Discord epoch, for turning a snowflake back into a wall-clock time.
+1
View File
@@ -4,6 +4,7 @@
#include <string.h>
#include <hammy/command.h>
#include <hammy/commands.h>
#include <hammy/job.h>
#include <hammy/refdb.h>
#include <hammy/utils.h>
+1 -6
View File
@@ -2,16 +2,11 @@
#include <string.h>
#include <hammy/command.h>
#include <hammy/commands.h> // Table
// Handlers live in src/hammy/commands/. Declared here rather than in a header
// so adding a command touches exactly two places: its own .c file and this
// table.
void hammy_cmd_ping(const hammy_job_t* job, struct discord* client, hammy_refdb_t* refdb); // Ping
void hammy_cmd_morse(const hammy_job_t* job, struct discord* client, hammy_refdb_t* refdb); // Text -> Morse
void hammy_cmd_freq(const hammy_job_t* job, struct discord* client, hammy_refdb_t* refdb); // Frequency lookup
void hammy_cmd_q(const hammy_job_t* job, struct discord* client, hammy_refdb_t* refdb); // Q-Code lookup
void hammy_cmd_abbr(const hammy_job_t* job, struct discord* client, hammy_refdb_t* refdb); // Abbreviation lookup
void hammy_cmd_phonetic(const hammy_job_t* job, struct discord* client, hammy_refdb_t* refdb); // Callsign -> Phonetics
// TODO: Temporary - move to a proper options system; e.g. a vector of heap-allocated options or something. For now, just point at static storage.
static struct discord_application_command_option morse_opts[] = {
+3
View File
@@ -196,6 +196,8 @@ static bool prepare(sqlite3* h, const char* sql, sqlite3_stmt** out) {
return true;
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wjump-misses-init" // suppresses the "jumped initialization of varaible" warning, has no effect here
hammy_refdb_t* hammy_refdb_open(const char* path) {
if (!path) { return NULL; }
@@ -272,6 +274,7 @@ fail:
hammy_refdb_close(&db);
return NULL;
}
#pragma GCC diagnostic pop
bool hammy_refdb_close(hammy_refdb_t** db) {
if (!db || !(*db)) { return false; }