Fix warnings on clang (literally 95% implicit conversion to char* from const char*)#
This commit is contained in:
+1
-1
@@ -32,7 +32,7 @@ void hammy_cmd_abbr(const hammy_job_t* job, struct discord* client, hammy_refdb_
|
||||
return;
|
||||
}
|
||||
|
||||
hammy_to_uppercase(abbr);
|
||||
hammy_to_uppercase((char*)abbr);
|
||||
|
||||
snprintf(body, sizeof(body), "Abbreviation: `%s`\nMeaning: `%s`\nUsage Context: `%s`", abbr, (str ? str : "Not Specified"), (context ? context : "Not Specified"));
|
||||
|
||||
|
||||
@@ -30,7 +30,10 @@ static void sb_addf(hammy_sb_t* sb, const char* fmt, ...) {
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wformat-nonliteral"
|
||||
int n = vsnprintf(sb->buf + sb->len, sb->cap - sb->len, fmt, ap);
|
||||
#pragma clang diagnostic pop
|
||||
va_end(ap);
|
||||
|
||||
if (n < 0) {
|
||||
|
||||
@@ -130,7 +130,7 @@ void hammy_cmd_phonetic(const hammy_job_t* job, struct discord* client, hammy_re
|
||||
memcpy(pronunciation + pronunciationLen, HAMMY_PHONETIC_TRUNCATED, sizeof(HAMMY_PHONETIC_TRUNCATED));
|
||||
}
|
||||
|
||||
hammy_to_uppercase(text);
|
||||
hammy_to_uppercase((char*)text);
|
||||
|
||||
// Reply with the phonetic words and how each of them is spoken.
|
||||
char body[sizeof(phonetic) + sizeof(pronunciation) + 48];
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ void hammy_cmd_q(const hammy_job_t* job, struct discord* client, hammy_refdb_t*
|
||||
return;
|
||||
}
|
||||
|
||||
hammy_to_uppercase(qcode);
|
||||
hammy_to_uppercase((char*)qcode);
|
||||
|
||||
snprintf(body, sizeof(body), "Q-Code: `%s`\nQuestion: `%s`\nAnswer: `%s`", qcode, (questionStr ? questionStr : "Not Specified"), (answerStr ? answerStr : "Not Specified"));
|
||||
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ static void hammy_bot_on_interaction(struct discord* client, const struct discor
|
||||
code = discord_create_interaction_response(client, event->id, event->token, ¶ms, NULL);
|
||||
} else {
|
||||
params.data = &(struct discord_interaction_callback_data){
|
||||
.content = "I don't know that command!"
|
||||
.content = (char*)"I don't know that command!"
|
||||
};
|
||||
|
||||
code = discord_create_interaction_response(client, event->id, event->token, ¶ms, NULL);
|
||||
|
||||
+12
-12
@@ -10,8 +10,8 @@
|
||||
|
||||
// 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[] = {
|
||||
{ .type = DISCORD_APPLICATION_OPTION_STRING, .name = "text",
|
||||
.description = "Text to convert to Morse code", .required = true },
|
||||
{ .type = DISCORD_APPLICATION_OPTION_STRING, .name = (char*)"text",
|
||||
.description = (char*)"Text to convert to Morse code", .required = true },
|
||||
};
|
||||
|
||||
static struct discord_application_command_options morse_opts_struct = {
|
||||
@@ -20,10 +20,10 @@ static struct discord_application_command_options morse_opts_struct = {
|
||||
};
|
||||
|
||||
static struct discord_application_command_option freq_opts[] = {
|
||||
{ .type = DISCORD_APPLICATION_OPTION_STRING, .name = "frequency",
|
||||
.description = "Frequency in MHz", .required = true },
|
||||
{ .type = DISCORD_APPLICATION_OPTION_STRING, .name = "country",
|
||||
.description = "Country code to look up (e.g. US) - Defaults to US if none specified.", .required = false },
|
||||
{ .type = DISCORD_APPLICATION_OPTION_STRING, .name = (char*)"frequency",
|
||||
.description = (char*)"Frequency in MHz", .required = true },
|
||||
{ .type = DISCORD_APPLICATION_OPTION_STRING, .name = (char*)"country",
|
||||
.description = (char*)"Country code to look up (e.g. US) - Defaults to US if none specified.", .required = false },
|
||||
};
|
||||
|
||||
static struct discord_application_command_options freq_opts_struct = {
|
||||
@@ -32,8 +32,8 @@ static struct discord_application_command_options freq_opts_struct = {
|
||||
};
|
||||
|
||||
static struct discord_application_command_option q_opts[] = {
|
||||
{ .type = DISCORD_APPLICATION_OPTION_STRING, .name = "q-code",
|
||||
.description = "Q-Code to convert to Question/Answer", .required = true },
|
||||
{ .type = DISCORD_APPLICATION_OPTION_STRING, .name = (char*)"q-code",
|
||||
.description = (char*)"Q-Code to convert to Question/Answer", .required = true },
|
||||
};
|
||||
|
||||
static struct discord_application_command_options q_opts_struct = {
|
||||
@@ -42,8 +42,8 @@ static struct discord_application_command_options q_opts_struct = {
|
||||
};
|
||||
|
||||
static struct discord_application_command_option abbr_opts[] = {
|
||||
{ .type = DISCORD_APPLICATION_OPTION_STRING, .name = "abbreviation",
|
||||
.description = "Abbreviation to convert to Meaning", .required = true },
|
||||
{ .type = DISCORD_APPLICATION_OPTION_STRING, .name = (char*)"abbreviation",
|
||||
.description = (char*)"Abbreviation to convert to Meaning", .required = true },
|
||||
};
|
||||
|
||||
static struct discord_application_command_options abbr_opts_struct = {
|
||||
@@ -52,8 +52,8 @@ static struct discord_application_command_options abbr_opts_struct = {
|
||||
};
|
||||
|
||||
static struct discord_application_command_option phonetic_opts[] = {
|
||||
{ .type = DISCORD_APPLICATION_OPTION_STRING, .name = "text",
|
||||
.description = "Text to convert to Phonetics", .required = true },
|
||||
{ .type = DISCORD_APPLICATION_OPTION_STRING, .name = (char*)"text",
|
||||
.description = (char*)"Text to convert to Phonetics", .required = true },
|
||||
};
|
||||
|
||||
static struct discord_application_command_options phonetic_opts_struct = {
|
||||
|
||||
+1
-1
@@ -192,4 +192,4 @@ void hammy_pool_stats(hammy_pool_t* pool, size_t* outQueued, size_t* outBusy) {
|
||||
if (outBusy) { *outBusy = pool->busy; }
|
||||
if (outQueued) { *outQueued = pool->count; }
|
||||
pthread_mutex_unlock(&pool->lock);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user