misc: Fix a small pile of static analysis problems

This commit is contained in:
Solomon Peachy 2020-03-03 00:16:05 -05:00
parent 47050d301d
commit 4c5e93811e
5 changed files with 12 additions and 19 deletions

View File

@ -1244,7 +1244,7 @@ int main (int argc, char **argv)
{
struct libusb_context *ctx = NULL;
struct libusb_device **list = NULL;
struct libusb_device_handle *dev;
struct libusb_device_handle *dev = NULL;
struct dyesub_backend *backend = NULL;
void * backend_ctx = NULL;
@ -1359,8 +1359,6 @@ int main (int argc, char **argv)
}
*use_serno = 0;
use_serno++;
backend = find_backend(backend_str);
}
if (use_serno) {

View File

@ -182,7 +182,6 @@ int mitsu_readlamdata(const char *fname, uint16_t lamstride,
uint16_t rows, uint16_t cols, uint8_t bpp)
{
int i, j, fd;
int remain = cols * rows * bpp;
char full[2048];
snprintf(full, sizeof(full), "%s/%s", corrtable_path, fname);
@ -196,7 +195,7 @@ int mitsu_readlamdata(const char *fname, uint16_t lamstride,
/* Read in the matte data plane */
for (j = 0 ; j < rows ; j++) {
remain = lamstride * bpp;
int remain = lamstride * bpp;
/* Read one row of lamination data at a time */
while (remain) {

View File

@ -1602,8 +1602,6 @@ static int mitsu70x_main_loop(void *vctx, const void *vjob)
/* Now that we've filled everything in, read matte from file */
if (job->matte) {
int ret;
ret = mitsu_readlamdata(job->laminatefname, LAMINATE_STRIDE,
job->databuf, &job->datalen,
be16_to_cpu(hdr->lamrows), be16_to_cpu(hdr->lamcols), 2);

View File

@ -123,10 +123,10 @@ int sinfonia_read_parse(int data_fd, uint32_t model,
job->jp.oc_mode = hdr[9];
else
job->jp.oc_mode = hdr[10];
if (hdr[1] == 1245)
if (hdr[1] == 1245) {
job->jp.mattedepth = hdr[11];
if (hdr[1] == 1245)
job->jp.dust = hdr[12];
}
job->jp.columns = hdr[13];
job->jp.rows = hdr[14];
job->jp.copies = hdr[15];

View File

@ -964,8 +964,6 @@ static void CImageEffect70_CalcSA(struct BandImage *img,
out[1] = 0;
out[0] = 0;
row = start_row;
ptr = buf - start_row * stride;
for ( row = start_row ; row < rows ; row++ ) {
int16_t *v18 = ptr + 3 * start_col;
@ -1329,7 +1327,7 @@ int send_image_data(struct BandImage *out, void *context,
goto done;
if (out->bytes_per_row > 0) {
v15 = out->imgbuf + ((rows - 1) * out->bytes_per_row);
v15 = (uint16_t*)((uint8_t*)out->imgbuf + ((rows - 1) * out->bytes_per_row));
} else {
v15 = out->imgbuf;
}
@ -1613,7 +1611,7 @@ static int CP98xx_DoCorrectGammaTbl(struct CP98xx_GammaParams *Gamma,
if (bytesPerRow < 0) {
rowPtr = img->imgbuf;
} else {
rowPtr = img->imgbuf + (bytesPerRow * (rows - 1));
rowPtr = (uint8_t*)img->imgbuf + (bytesPerRow * (rows - 1));
}
step = KH->Step;
@ -1712,8 +1710,8 @@ static int CP98xx_DoGammaConv(struct CP98xx_GammaParams *Gamma,
inRowPtr = inImage->imgbuf;
outRowPtr = outImage->imgbuf;
} else {
outRowPtr = outImage->imgbuf + (pixelsPerRow * (rows-1) * sizeof(uint16_t));
inRowPtr = inImage->imgbuf + (inBytesPerRow * (rows-1));
outRowPtr = (uint16_t*)((uint8_t*)outImage->imgbuf + (pixelsPerRow * (rows-1) * sizeof(uint16_t)));
inRowPtr = (uint8_t*)inImage->imgbuf + (inBytesPerRow * (rows-1));
}
maxTank = cols * 255;
@ -1937,16 +1935,16 @@ static int CP98xx_DoWMAM(struct CP98xx_WMAM *wmam, struct BandImage *img, int al
memset(rowCalcBuf1, 0, cols * 3 * sizeof(double));
memset(rowCalcBuf2, 0, cols * 3 * sizeof(double));
row = 0;
pdVar5 = pdVar7 + (cols -1) * 3;
pdVar3 = pdVar8 + (cols -1) * 3;
for (row = 0 ; row < rows ; row++) {
col = pixelCnt;
doubleBufOffset = 0;
imgBufOffset = 0;
if (pixelCnt < 0) {
col = 0;
} else {
col = pixelCnt;
}
for ( ; col > 0 ; col --) {
@ -2032,7 +2030,7 @@ static int CP98xx_DoWMAM(struct CP98xx_WMAM *wmam, struct BandImage *img, int al
}
} else {
pixelVal = dVar16;
iVar1 = 0x80;
iVar1 = 0x80; // XXX seems redundant, double-check iVar1 here.
if ((-0xff0 < pixelVal) && (iVar1 = 0xff, pixelVal < 1)) {
iVar1 = 0xff - ((0x10 - pixelVal) >> 5);
}
@ -2552,7 +2550,7 @@ int M1_CLocalEnhancer(const struct M1CPCData *cpc,
if (img->bytes_per_row < 0)
inBasePtr = img->imgbuf;
else
inBasePtr = img->imgbuf + (size.cy - 1) * img->bytes_per_row;
inBasePtr = (uint16_t*)((uint8_t*)img->imgbuf + (size.cy - 1) * img->bytes_per_row);
inRowPtr = inBasePtr;
rowPtr = rowBuffer;