MIN/MAX multi-evaluate their arguments.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Pierre Habouzit 2008-06-28 23:50:43 +02:00 committed by Julien Danjou
parent 912b9cd28a
commit b63f768f00
2 changed files with 6 additions and 5 deletions

View File

@ -541,7 +541,8 @@ luaA_progressbar_bar_data_add(lua_State *L)
if(!bar)
bar = progressbar_bar_add(d, title);
bar->value = MAX(bar->min_value, MIN(bar->max_value, luaL_checknumber(L, 3)));
bar->value = luaL_checknumber(L, 3);
bar->value = MAX(bar->min_value, MIN(bar->max_value, bar->value));
widget_invalidate_bywidget(*widget);

View File

@ -58,10 +58,10 @@ textbox_draw(draw_context_t *ctx, int screen __attribute__ ((unused)),
else
{
draw_parser_data_init(&pdata);
w->area.width = MIN(draw_text_extents(ctx->connection,
ctx->phys_screen,
globalconf.font, d->text, &pdata).width,
ctx->width - used);
w->area.width = draw_text_extents(ctx->connection, ctx->phys_screen,
globalconf.font, d->text, &pdata).width;
if(w->area.width > ctx->width - used)
w->area.width = ctx->width - used;
if(pdata.bg_image)
w->area.width = MAX(w->area.width, pdata.bg_resize ? w->area.height : pdata.bg_image->width);