From 2514b693ad3b2102594f9661d3c647555758a034 Mon Sep 17 00:00:00 2001 From: Denis Pauk Date: Sat, 30 Jan 2021 20:54:42 +0200 Subject: [PATCH] Fix warning texthnd_t->buffer --- src/p_text.c | 16 ++++++++-------- src/p_text.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/p_text.c b/src/p_text.c index e32d05e..434bcca 100644 --- a/src/p_text.c +++ b/src/p_text.c @@ -217,7 +217,7 @@ void Do_Text_Display(edict_t *activator, int flags, char *message) char *p1, *p2, *p3; char sound[64]; texthnd_t *hnd; - byte *temp_buffer; + char *temp_buffer; int line_length; int new_line_length; qboolean alt, centered, right_justified; @@ -236,7 +236,7 @@ void Do_Text_Display(edict_t *activator, int flags, char *message) FILE *f; pak_header_t pakheader; pak_item_t pakitem; - + basedir = gi.cvar("basedir", "", 0); gamedir = gi.cvar("gamedir", "", 0); strcpy(filename,basedir->string); @@ -335,7 +335,7 @@ void Do_Text_Display(edict_t *activator, int flags, char *message) memset(hnd->buffer,0,hnd->allocated); memcpy(hnd->buffer,message,L); } - + hnd->size = strlen(hnd->buffer) + 1; // Eliminate all 's so lines are delineated with 's only p1 = hnd->buffer; @@ -402,7 +402,7 @@ void Do_Text_Display(edict_t *activator, int flags, char *message) { if(*p1 == 32) { - // We're at a space... good deal, just replace space with + // We're at a space... good deal, just replace space with // a line-break 0 and move on *p1 = 0; hnd->nlines++; @@ -553,7 +553,7 @@ void Do_Text_Display(edict_t *activator, int flags, char *message) } } // If we're at a 0, check to see if subsequent words will fit on this line - if((!linebreak) && (*p1 == 0) && (p1 < hnd->buffer+hnd->size-1) && + if((!linebreak) && (*p1 == 0) && (p1 < hnd->buffer+hnd->size-1) && (line_length < MAX_LINE_LENGTH) ) { // Don't do this if 2 consecutive 0's are found (end of paragraph) @@ -617,17 +617,17 @@ void Do_Text_Display(edict_t *activator, int flags, char *message) hnd->lines = text; activator->client->textdisplay = hnd; Text_Open(activator); - + } void Use_Target_Text(edict_t *self, edict_t *other, edict_t *activator) { - + if(!activator || !activator->client) return; activator->client->showinventory = false; activator->client->showscores = false; activator->client->showhelp = false; - + Text_Close(activator); Do_Text_Display(activator, self->spawnflags, self->message); diff --git a/src/p_text.h b/src/p_text.h index 091ed82..a9aea5e 100644 --- a/src/p_text.h +++ b/src/p_text.h @@ -13,7 +13,7 @@ typedef struct texthnd_s { int flags; int allocated; float last_update; - byte *buffer; + char *buffer; } texthnd_t; typedef struct text_s {