Fix compiler warnings

fluid/code.cxx: unused variable

src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx:
  function may return address of local variable [-Wreturn-local-addr]
This commit is contained in:
Albrecht Schlosser 2023-12-04 16:50:23 +01:00
parent 75c97edb1e
commit a73a14347d
2 changed files with 5 additions and 6 deletions

View File

@ -131,8 +131,6 @@ int write_strings(const Fl_String &filename) {
}
if (w->tooltip()) {
const char *s;
fputs("msgid \"", fp);
write_escaped_strings(fp, w->tooltip());
fputs("\"\n", fp);

View File

@ -452,21 +452,22 @@ int fl_correct_encoding(const char* name) {
static const char *find_best_font(const char *fname, int size) {
int cnt;
static char **list = NULL;
// locate or create an Fl_Font_Descriptor for a given Fl_Fontdesc and size:
// note: namebuffer must be static: its address may be returned to caller
static char namebuffer[1024]; // holds scalable font name
// locate or create an Fl_Font_Descriptor for a given Fl_Fontdesc and size:
if (list) XFreeFontNames(list);
list = XListFonts(fl_display, fname, 100, &cnt);
if (!list) return "fixed";
// search for largest <= font size:
char* name = list[0]; int ptsize = 0; // best one found so far
char* name = list[0]; int ptsize = 0; // best one found so far
int matchedlength = 32767;
char namebuffer[1024]; // holds scalable font name
int found_encoding = 0;
int m = cnt; if (m<0) m = -m;
for (int n=0; n < m; n++) {
char* thisname = list[n];
if (fl_correct_encoding(thisname)) {
if (!found_encoding) ptsize = 0; // force it to choose this
if (!found_encoding) ptsize = 0; // force it to choose this
found_encoding = 1;
} else {
if (found_encoding) continue;