summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/starpbm.c2
-rw-r--r--src/escpos/parser.rl4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/bin/starpbm.c b/src/bin/starpbm.c
index ba4e46d..8abc036 100644
--- a/src/bin/starpbm.c
+++ b/src/bin/starpbm.c
@@ -92,7 +92,7 @@ pixels_from_pbm(FILE *f, size_t *out_w, size_t *out_h)
cfg[i] = strtol(buf, NULL, 10);
}
- if (!cfg[0] || !cfg[2])
+ if (!cfg[0] || !cfg[1])
errx(EXIT_FAILURE, "invalid width / height");
uint8_t *bw;
diff --git a/src/escpos/parser.rl b/src/escpos/parser.rl
index 7cf828f..34f4055 100644
--- a/src/escpos/parser.rl
+++ b/src/escpos/parser.rl
@@ -75,7 +75,7 @@ render_chr(struct escpos_canvas *canvas, struct cursor *cursor, const struct ras
}
}
}
- cursor->x += MIN(glyph->width + SPACING, canvas->w - cursor->x);
+ cursor->x += MIN((size_t)glyph->width + SPACING, canvas->w - cursor->x);
cursor->wy = MIN(cursor->y + MAX(raster->font.height, 1) - 1, canvas->h);
}
@@ -226,7 +226,7 @@ cut(const struct escpos_parser *parser, struct escpos_canvas *canvas, struct cur
action text {
putc(fc, stderr);
- uint32_t cp;
+ uint32_t cp = 0;
if (utf8_decode(&utf8.state, &cp, fc) == UTF8_ACCEPT)
render_chr(&parser->print_buffer, &print_buffer_cursor, &raster, cp);
}