fvwm2/fvwm-2.5.21-string_compar.patch

172 lines
4.0 KiB
Diff

--- fvwm/builtins.c
+++ fvwm/builtins.c
@@ -2884,7 +2884,7 @@
int ret;
unsigned long argument, data1 = 0, data2 = 0;
- if (action == NULL || action == "\0")
+ if (action == NULL || action[0] == '\0')
{
return;
}
--- libs/Flocale.c
+++ libs/Flocale.c
@@ -1066,21 +1066,22 @@
FftFontType *fftf = NULL;
FlocaleFont *flf = NULL;
char *fn, *hints = NULL;
+ char *fallback_font = FLOCALE_FFT_FALLBACK_FONT;
hints = GetQuotedString(fontname, &fn, "/", NULL, NULL, NULL);
if (fn == NULL)
{
- fn = FLOCALE_FFT_FALLBACK_FONT;
+ fn = fallback_font;
}
else if (*fn == '\0')
{
free(fn);
- fn = FLOCALE_FFT_FALLBACK_FONT;
+ fn = fallback_font;
}
fftf = FftGetFont(dpy, fn, module);
if (fftf == NULL)
{
- if (fn != NULL && fn != FLOCALE_FFT_FALLBACK_FONT)
+ if (fn != NULL && fn != fallback_font)
{
free(fn);
}
@@ -1095,7 +1096,7 @@
&flf->fftf, &flf->height, &flf->ascent, &flf->descent);
FftGetFontWidths(flf, &flf->max_char_width);
free(fftf);
- if (fn != NULL && fn != FLOCALE_FFT_FALLBACK_FONT)
+ if (fn != NULL && fn != fallback_font)
{
free(fn);
}
@@ -1115,16 +1116,17 @@
char *ds;
XFontSetExtents *fset_extents;
char *fn, *hints = NULL, *fn_fixed = NULL;
+ char *fallback_font = FLOCALE_MB_FALLBACK_FONT;
hints = GetQuotedString(fontname, &fn, "/", NULL, NULL, NULL);
if (*fn == '\0')
{
free(fn);
- fn = fn_fixed = FLOCALE_MB_FALLBACK_FONT;
+ fn = fn_fixed = fallback_font;
}
else if (!(fn_fixed = FlocaleFixNameForFontSet(dpy, fn, module)))
{
- if (fn != NULL && fn != FLOCALE_MB_FALLBACK_FONT)
+ if (fn != NULL && fn != fallback_font)
{
free(fn);
}
@@ -1136,7 +1138,7 @@
{
free(fn_fixed);
}
- if (fn != NULL && fn != FLOCALE_MB_FALLBACK_FONT)
+ if (fn != NULL && fn != fallback_font)
{
free(fn);
}
@@ -1185,7 +1187,7 @@
{
free(fn_fixed);
}
- if (fn != NULL && fn != FLOCALE_MB_FALLBACK_FONT)
+ if (fn != NULL && fn != fallback_font)
{
free(fn);
}
@@ -1201,6 +1203,7 @@
FlocaleFont *flf;
char *str,*fn,*tmp;
char *hints = NULL;
+ char *fallback_font = FLOCALE_FALLBACK_FONT;
hints = GetQuotedString(fontname, &tmp, "/", NULL, NULL, NULL);
str = GetQuotedString(tmp, &fn, ",", NULL, NULL, NULL);
@@ -1209,10 +1212,10 @@
if (*fn == '\0')
{
free(fn);
- fn = FLOCALE_FALLBACK_FONT;
+ fn = fallback_font;
}
font = XLoadQueryFont(dpy, fn);
- if (fn != NULL && fn != FLOCALE_FALLBACK_FONT)
+ if (fn != NULL && fn != fallback_font)
{
free(fn);
fn = NULL;
@@ -1224,7 +1227,7 @@
}
if (font == NULL)
{
- if (fn != NULL && fn != FLOCALE_FALLBACK_FONT)
+ if (fn != NULL && fn != fallback_font)
{
free(fn);
}
@@ -1248,7 +1251,7 @@
flf->max_char_width = font->max_bounds.width;
if (flf->font->max_byte1 > 0)
flf->flags.is_mb = True;
- if (fn != NULL && fn != FLOCALE_FALLBACK_FONT)
+ if (fn != NULL && fn != fallback_font)
{
free(fn);
}
@@ -1382,6 +1385,8 @@
int shadow_offset = 0;
int shadow_dir = MULTI_DIR_SE;
int i;
+ char *mb_fallback_font = FLOCALE_MB_FALLBACK_FONT;
+ char *fallback_font = FLOCALE_FALLBACK_FONT;
/* removing quoting for modules */
if (fontname && (t = strchr("\"'`", *fontname)))
@@ -1395,7 +1400,7 @@
if (fontname == NULL || *fontname == 0)
{
ask_default = True;
- fontname = FLOCALE_MB_FALLBACK_FONT;
+ fontname = mb_fallback_font;
}
while (flf)
@@ -1454,14 +1459,14 @@
}
else
{
- fn = FLOCALE_MB_FALLBACK_FONT;
+ fn = mb_fallback_font;
}
while (!flf && (fn && *fn))
{
flf = FlocaleGetFontOrFontSet(
dpy, fn, encoding, fontname, module);
- if (fn != NULL && fn != FLOCALE_MB_FALLBACK_FONT &&
- fn != FLOCALE_FALLBACK_FONT)
+ if (fn != NULL && fn != mb_fallback_font &&
+ fn != fallback_font)
{
free(fn);
fn = NULL;
@@ -1471,8 +1476,7 @@
str = GetQuotedString(str, &fn, ";", NULL, NULL, NULL);
}
}
- if (fn != NULL && fn != FLOCALE_MB_FALLBACK_FONT &&
- fn != FLOCALE_FALLBACK_FONT)
+ if (fn != NULL && fn != mb_fallback_font && fn != fallback_font)
{
free(fn);
}