diff --git a/caca/dirty.c b/caca/dirty.c index deec92b..9b12728 100644 --- a/caca/dirty.c +++ b/caca/dirty.c @@ -57,7 +57,7 @@ int caca_get_dirty_rectangle_count(caca_canvas_t *cv) * - \c EINVAL Specified rectangle index is out of bounds. * * \param cv A libcaca canvas. - * \param index The requested rectangle index. + * \param r The requested rectangle index. * \param xmin A pointer to an integer where the leftmost edge of the * dirty rectangle will be stored. * \param ymin A pointer to an integer where the topmost edge of the @@ -68,10 +68,10 @@ int caca_get_dirty_rectangle_count(caca_canvas_t *cv) * dirty rectangle will be stored. * \return 0 in case of success, -1 if an error occurred. */ -int caca_get_dirty_rectangle(caca_canvas_t *cv, int index, +int caca_get_dirty_rectangle(caca_canvas_t *cv, int r, int *xmin, int *ymin, int *xmax, int *ymax) { - if(index < 0 || index >= cv->ndirty) + if(r < 0 || r >= cv->ndirty) { seterrno(EINVAL); return -1; diff --git a/caca/figfont.c b/caca/figfont.c index 54eb35c..a2c1ada 100644 --- a/caca/figfont.c +++ b/caca/figfont.c @@ -390,6 +390,8 @@ static caca_figfont_t * open_figfont(char const *path) } else { + unsigned int tmp; + if(caca_file_gets(f, buf, 2048) == NULL) break; @@ -415,10 +417,8 @@ static caca_figfont_t * open_figfont(char const *path) return NULL; } - if(buf[1] == 'x') - sscanf(buf, "%x", &ff->lookup[ff->glyphs * 2]); - else - sscanf(buf, "%u", &ff->lookup[ff->glyphs * 2]); + sscanf(buf, buf[1] == 'x' ? "%x" : "%u", &tmp); + ff->lookup[ff->glyphs * 2] = tmp; } ff->lookup[ff->glyphs * 2 + 1] = 0;