diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2019-05-06 21:10:43 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2019-05-07 11:02:30 -0400 |
commit | b74809107973ae2e6cc027842a004c40cd411a65 (patch) | |
tree | 4f7707b9f3ac7720fc696b98dddcd8aa08b352c9 /backend_mitsu9550.c | |
parent | 34896a0e293b087a46060360cc2c5ca31be043ea (diff) | |
download | selphy_print-b74809107973ae2e6cc027842a004c40cd411a65.tar.gz selphy_print-b74809107973ae2e6cc027842a004c40cd411a65.tar.bz2 selphy_print-b74809107973ae2e6cc027842a004c40cd411a65.zip |
misc: Fix up a small pile of bugs found via static analysis.
Diffstat (limited to 'backend_mitsu9550.c')
-rw-r--r-- | backend_mitsu9550.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/backend_mitsu9550.c b/backend_mitsu9550.c index 4bea415..e75f641 100644 --- a/backend_mitsu9550.c +++ b/backend_mitsu9550.c @@ -656,7 +656,7 @@ hdr_done: /* Byteswap data table to native endianness, if necessary */ #if (__BYTE_ORDER == __LITTLE_ENDIAN) - int i, j; + int j; struct mitsu98xx_data *ptr = &ctx->m98xxdata->superfine; for (j = 0 ; j < 3 ; j++) { for (i = 3 ; i < 3 ; i++) { @@ -833,19 +833,19 @@ hdr_done: } if (!ctx->lut) { - uint8_t *buf = malloc(LUT_LEN); - if (!buf) { + uint8_t *lbuf = malloc(LUT_LEN); + if (!lbuf) { ERROR("Memory allocation failure!\n"); mitsu9550_cleanup_job(job); return CUPS_BACKEND_RETRY_CURRENT; } - if (ctx->Get3DColorTable(buf, MITSU_M98xx_LUT_FILE)) { + if (ctx->Get3DColorTable(lbuf, MITSU_M98xx_LUT_FILE)) { ERROR("Unable to open LUT file '%s'\n", MITSU_M98xx_LUT_FILE); mitsu9550_cleanup_job(job); return CUPS_BACKEND_CANCEL; } - ctx->lut = ctx->Load3DColorTable(buf); - free(buf); + ctx->lut = ctx->Load3DColorTable(lbuf); + free(lbuf); if (!ctx->lut) { ERROR("Unable to parse LUT\n"); mitsu9550_cleanup_job(job); @@ -1337,7 +1337,6 @@ top: /* Send over plane data */ while(ptr < (job->databuf + job->datalen)) { struct mitsu9550_plane *plane = (struct mitsu9550_plane *)ptr; - uint32_t planelen; if (plane->cmd[0] != 0x1b || plane->cmd[1] != 0x5a || plane->cmd[2] != 0x54) @@ -1432,7 +1431,7 @@ top: /* Don't forget the 9810's matte plane */ if (job->hdr1.matte) { struct mitsu9550_plane *plane = (struct mitsu9550_plane *)ptr; - uint32_t planelen = be16_to_cpu(plane->rows) * be16_to_cpu(plane->cols); + planelen = be16_to_cpu(plane->rows) * be16_to_cpu(plane->cols); if (plane->cmd[3] == 0x10) planelen *= 2; |