summaryrefslogtreecommitdiff
path: root/sent.c
diff options
context:
space:
mode:
authorMarkus Teich <markus.teich@stusta.mhn.de>2015-11-17 00:19:39 +0100
committerMarkus Teich <markus.teich@stusta.mhn.de>2015-11-17 00:19:39 +0100
commit84734c73e82b8b30e2eef82c192a53010fb2d35f (patch)
tree6abc57b48ea59c1bb9d1372e3cf601d235cdbaf7 /sent.c
parenteb07f3dc10c9efa6272ae5177de74a7fc093cf51 (diff)
downloadsent-84734c73e82b8b30e2eef82c192a53010fb2d35f.tar.gz
sent-84734c73e82b8b30e2eef82c192a53010fb2d35f.tar.bz2
sent-84734c73e82b8b30e2eef82c192a53010fb2d35f.zip
fix several number overflow issues
Diffstat (limited to 'sent.c')
-rw-r--r--sent.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sent.c b/sent.c
index c4696be..6fd288b 100644
--- a/sent.c
+++ b/sent.c
@@ -318,7 +318,7 @@ void pngdraw(Image *img)
void getfontsize(Slide *s, unsigned int *width, unsigned int *height)
{
- size_t i, j;
+ int i, j;
unsigned int curw, imax;
float lfac = linespacing * (s->linecount - 1) + 1;
@@ -326,7 +326,7 @@ void getfontsize(Slide *s, unsigned int *width, unsigned int *height)
for (j = NUMFONTSCALES - 1; j >= 0; j--)
if (fonts[j]->h * lfac <= xw.uh)
break;
- drw_setfontset(d, fonts[j]);
+ drw_setfontset(d, fonts[++j]);
/* fit width */
*width = 0;
@@ -334,7 +334,7 @@ void getfontsize(Slide *s, unsigned int *width, unsigned int *height)
curw = drw_fontset_getwidth(d, s->lines[i]);
if (curw >= *width)
imax = i;
- while (j >= 0 && curw > xw.uw) {
+ while (j > 0 && curw > xw.uw) {
drw_setfontset(d, fonts[--j]);
curw = drw_fontset_getwidth(d, s->lines[i]);
}
Software created with 💖