summaryrefslogtreecommitdiffstats
path: root/backend_mitsu9550.c
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2018-06-20 11:39:40 -0400
committerSolomon Peachy <pizza@shaftnet.org>2018-06-20 11:54:44 -0400
commit097d5793ef957aeb2de69f3745a22a7c31d512d3 (patch)
tree370e8e42ecc88cd99ea62d5b68995d6d42292e06 /backend_mitsu9550.c
parent29920b35ae86392f1f375e5279c3c1a12a5dcdb4 (diff)
downloadselphy_print-097d5793ef957aeb2de69f3745a22a7c31d512d3.tar.gz
selphy_print-097d5793ef957aeb2de69f3745a22a7c31d512d3.tar.bz2
selphy_print-097d5793ef957aeb2de69f3745a22a7c31d512d3.zip
mitsu98xx: bugfix.
Diffstat (limited to 'backend_mitsu9550.c')
-rw-r--r--backend_mitsu9550.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/backend_mitsu9550.c b/backend_mitsu9550.c
index 55673e5..60fbb02 100644
--- a/backend_mitsu9550.c
+++ b/backend_mitsu9550.c
@@ -1250,10 +1250,11 @@ static int mitsu9550_main_loop(void *vctx, const void *vjob) {
memcpy(newbuf + newlen, job->databuf + sizeof(struct mitsu9550_plane) + planelen * 3, sizeof(struct mitsu9550_cmd));
newlen += sizeof(struct mitsu9550_cmd);
- /* Clean up */
+ /* Clean up, and move pointer to new buffer; */
free(job->databuf);
job->databuf = newbuf;
job->datalen = newlen;
+ ptr = job->databuf;
/* Now handle the matte plane generation */
if (job->hdr1.matte) {
@@ -1352,13 +1353,15 @@ top:
}
/* Send over plane data */
- while(1) {
+ while(ptr < (job->databuf + job->datalen)) {
struct mitsu9550_plane *plane = (struct mitsu9550_plane *)ptr;
- uint32_t planelen = be16_to_cpu(plane->rows) * be16_to_cpu(plane->cols);
+ uint32_t planelen;
if (plane->cmd[0] != 0x1b ||
plane->cmd[1] != 0x5a ||
plane->cmd[2] != 0x54)
break;
+
+ planelen = be16_to_cpu(plane->rows) * be16_to_cpu(plane->cols);
if (plane->cmd[3] == 0x10)
planelen *= 2;