Browse Source

vgui2/vgui_surfacelib/linuxfont: fix incorrect variadic casts

backport from MainUI C++
Ref: fad4805fab
pull/38/head
r-a-sattarov 2 years ago
parent
commit
2ad3bc4a66
  1. 28
      vgui2/vgui_surfacelib/linuxfont.cpp

28
vgui2/vgui_surfacelib/linuxfont.cpp

@ -166,44 +166,40 @@ void CLinuxFont::CreateFontList() @@ -166,44 +166,40 @@ void CLinuxFont::CreateFontList()
}
#ifndef ANDROID
static FcPattern* FontMatch(const char* type, FcType vtype, const void* value,
...)
static FcPattern* FontMatch(const char* type, ...)
{
FcValue fcvalue;
va_list ap;
va_start(ap, value);
va_start(ap, type);
FcPattern* pattern = FcPatternCreate();
for (;;)
{
FcValue fcvalue;
fcvalue.type = vtype;
switch (vtype) {
for (;;) {
// FcType is promoted to int when passed through ...
fcvalue.type = static_cast<FcType>(va_arg(ap, int));
switch (fcvalue.type) {
case FcTypeString:
fcvalue.u.s = (FcChar8*) value;
fcvalue.u.s = va_arg(ap, const FcChar8 *);
break;
case FcTypeInteger:
fcvalue.u.i = (int) value;
fcvalue.u.i = va_arg(ap, int);
break;
default:
Assert(!"FontMatch unhandled type");
}
FcPatternAdd(pattern, type, fcvalue, 0);
FcPatternAdd(pattern, type, fcvalue, FcFalse);
type = va_arg(ap, const char *);
if (!type)
break;
// FcType is promoted to int when passed through ...
vtype = static_cast<FcType>(va_arg(ap, int));
value = va_arg(ap, const void *);
};
va_end(ap);
FcConfigSubstitute(0, pattern, FcMatchPattern);
FcConfigSubstitute(NULL, pattern, FcMatchPattern);
FcDefaultSubstitute(pattern);
FcResult result;
FcPattern* match = FcFontMatch(0, pattern, &result);
FcPattern* match = FcFontMatch(NULL, pattern, &result);
FcPatternDestroy(pattern);
return match;

Loading…
Cancel
Save