mirror of
https://github.com/fltk/fltk.git
synced 2026-05-22 07:01:34 +08:00
Fix "fl_add_symbol() *always* increments symbnumb" (#1410).
This commit is contained in:
+3
-2
@@ -68,10 +68,11 @@ static void fl_init_symbols(void);
|
||||
|
||||
/**
|
||||
Adds a symbol to the system.
|
||||
If a symbol with that name is already defined, its draw function is replaced by \p drawit.
|
||||
\param[in] name name of symbol (without the "@")
|
||||
\param[in] drawit function to draw symbol
|
||||
\param[in] scalable set to 1 if \p drawit uses scalable vector drawing
|
||||
\returns 1 on success, 0 on failure
|
||||
\returns 1 on success, 0 if the maximum number of symbols has been reached.
|
||||
*/
|
||||
int fl_add_symbol(const char *name, void (*drawit)(Fl_Color), int scalable)
|
||||
{
|
||||
@@ -79,11 +80,11 @@ int fl_add_symbol(const char *name, void (*drawit)(Fl_Color), int scalable)
|
||||
int pos;
|
||||
if (symbnumb > MAXSYMBOL / 2) return 0; // table is full
|
||||
pos = find(name);
|
||||
if (!symbols[pos].notempty) symbnumb++;
|
||||
symbols[pos].name = name;
|
||||
symbols[pos].drawit = drawit;
|
||||
symbols[pos].notempty = 1;
|
||||
symbols[pos].scalable = scalable;
|
||||
symbnumb++;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user