Changed TAG_MORE parameter to a struct containing a va_list to ensure that no matter how va_list is defined the address can be taken.

SVN r119 (trunk)
This commit is contained in:
Christoph Oelckers 2006-05-16 10:06:23 +00:00
parent bb25008804
commit 4a8ca6d134
3 changed files with 17 additions and 12 deletions

View file

@ -103,7 +103,7 @@ void STACK_ARGS DCanvas::DrawTexture (FTexture *img, int x0, int y0, DWORD tags_
while (tag != TAG_DONE) while (tag != TAG_DONE)
{ {
va_list *more_p; TagMoreData *more_p;
DWORD data; DWORD data;
switch (tag) switch (tag)
@ -114,9 +114,9 @@ void STACK_ARGS DCanvas::DrawTexture (FTexture *img, int x0, int y0, DWORD tags_
break; break;
case TAG_MORE: case TAG_MORE:
more_p = va_arg (tags, va_list*); more_p = va_arg (tags, TagMoreData*);
va_end (tags); va_end (tags);
tags = *more_p; tags = more_p->tagdata;
break; break;
case DTA_DestWidth: case DTA_DestWidth:

View file

@ -71,10 +71,10 @@ void STACK_ARGS DCanvas::DrawChar (int normalcolor, int x, int y, byte character
if (NULL != (pic = Font->GetChar (character, &dummy))) if (NULL != (pic = Font->GetChar (character, &dummy)))
{ {
const BYTE *range = Font->GetColorTranslation ((EColorRange)normalcolor); const BYTE *range = Font->GetColorTranslation ((EColorRange)normalcolor);
va_list taglist; TagMoreData taglist;
va_start (taglist, character); va_start (taglist.tagdata, character);
DrawTexture (pic, x, y, DTA_Translation, range, TAG_MORE, &taglist); DrawTexture (pic, x, y, DTA_Translation, range, TAG_MORE, &taglist);
va_end (taglist); va_end (taglist.tagdata);
} }
} }
@ -125,7 +125,7 @@ void STACK_ARGS DCanvas::DrawText (int normalcolor, int x, int y, const char *st
while (tag != TAG_DONE) while (tag != TAG_DONE)
{ {
va_list *more_p; TagMoreData * more_p;
DWORD data; DWORD data;
void *ptrval; void *ptrval;
@ -137,9 +137,9 @@ void STACK_ARGS DCanvas::DrawText (int normalcolor, int x, int y, const char *st
break; break;
case TAG_MORE: case TAG_MORE:
more_p = va_arg (tags, va_list*); more_p = va_arg (tags, TagMoreData*);
va_end (tags); va_end (tags);
tags = *more_p; tags = more_p->tagdata;
break; break;
case DTA_DestWidth: case DTA_DestWidth:
@ -226,10 +226,10 @@ void STACK_ARGS DCanvas::DrawText (int normalcolor, int x, int y, const char *st
if (NULL != (pic = Font->GetChar (c, &w))) if (NULL != (pic = Font->GetChar (c, &w)))
{ {
va_list taglist; TagMoreData taglist;
va_start (taglist, string); va_start (taglist.tagdata, string);
DrawTexture (pic, cx, cy, DTA_Translation, range, TAG_MORE, &taglist); DrawTexture (pic, cx, cy, DTA_Translation, range, TAG_MORE, &taglist);
va_end (taglist); va_end (taglist.tagdata);
} }
cx += (w + kerning) * scalex; cx += (w + kerning) * scalex;
} }

View file

@ -66,6 +66,11 @@ class FTexture;
#define TAG_IGNORE (1L) /* Ignore this Tag */ #define TAG_IGNORE (1L) /* Ignore this Tag */
#define TAG_MORE (2L) /* Ends this list and continues with the */ #define TAG_MORE (2L) /* Ends this list and continues with the */
/* list pointed to in ti_Data */ /* list pointed to in ti_Data */
struct TagMoreData
{
va_list tagdata;
};
//#define TAG_SKIP (3L) /* Skip this and the next ti_Data Tags */ //#define TAG_SKIP (3L) /* Skip this and the next ti_Data Tags */
#define TAG_USER ((DWORD)(1L<<31)) #define TAG_USER ((DWORD)(1L<<31))