Skip to content

Commit

Permalink
More const in console code.
Browse files Browse the repository at this point in the history
  • Loading branch information
skullernet committed Jun 28, 2024
1 parent a14c527 commit befe9f8
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/client/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ static void Con_Dump_f(void)
// write the remaining lines
for (; l <= con.current; l++) {
char buffer[CON_LINEWIDTH + 1];
char *p = con.text[l & CON_TOTALLINES_MASK].text;
const char *p = con.text[l & CON_TOTALLINES_MASK].text;
int i;

for (i = 0; i < CON_LINEWIDTH && p[i]; i++)
Expand Down Expand Up @@ -686,8 +686,8 @@ DRAWING

static int Con_DrawLine(int v, int row, float alpha, bool notify)
{
consoleLine_t *line = &con.text[row & CON_TOTALLINES_MASK];
char *s = line->text;
const consoleLine_t *line = &con.text[row & CON_TOTALLINES_MASK];
const char *s = line->text;
int flags = 0;
int x = CHAR_WIDTH;
int w = con.linewidth;
Expand Down Expand Up @@ -1057,7 +1057,7 @@ void Con_DrawConsole(void)
==============================================================================
*/

static void Con_Say(char *msg)
static void Con_Say(const char *msg)
{
CL_ClientCommand(va("say%s \"%s\"", con.chat == CHAT_TEAM ? "_team" : "", msg));
}
Expand All @@ -1072,7 +1072,7 @@ static void Con_InteractiveMode(void)

static void Con_Action(void)
{
char *cmd = Prompt_Action(&con.prompt);
const char *cmd = Prompt_Action(&con.prompt);

Con_InteractiveMode();

Expand Down Expand Up @@ -1147,8 +1147,8 @@ static void Con_Paste(char *(*func)(void))
// console lines are not necessarily NUL-terminated
static void Con_ClearLine(char *buf, int row)
{
consoleLine_t *line = &con.text[row & CON_TOTALLINES_MASK];
char *s = line->text + line->ts_len;
const consoleLine_t *line = &con.text[row & CON_TOTALLINES_MASK];
const char *s = line->text + line->ts_len;
int w = con.linewidth - line->ts_len;

while (w-- > 0 && *s)
Expand All @@ -1159,7 +1159,7 @@ static void Con_ClearLine(char *buf, int row)
static void Con_SearchUp(void)
{
char buf[CON_LINEWIDTH + 1];
char *s = con.prompt.inputLine.text;
const char *s = con.prompt.inputLine.text;
int top = con.current - CON_TOTALLINES + 1;

if (top < 0)
Expand All @@ -1180,7 +1180,7 @@ static void Con_SearchUp(void)
static void Con_SearchDown(void)
{
char buf[CON_LINEWIDTH + 1];
char *s = con.prompt.inputLine.text;
const char *s = con.prompt.inputLine.text;

if (!*s)
return;
Expand Down Expand Up @@ -1329,7 +1329,7 @@ void Key_Message(int key)
}

if (key == K_ENTER || key == K_KP_ENTER) {
char *cmd = Prompt_Action(&con.chatPrompt);
const char *cmd = Prompt_Action(&con.chatPrompt);

if (cmd) {
Con_Say(cmd);
Expand Down

0 comments on commit befe9f8

Please sign in to comment.