diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2020-05-10 12:19:48 +0100 |
---|---|---|
committer | Robin Watts <Robin.Watts@artifex.com> | 2020-05-10 12:20:22 +0100 |
commit | 9b89ef860f52a6ca9696559c39104feba41e1de8 (patch) | |
tree | 53d5b6b9509cfa22fe63e103e54eef419ac1b341 /gpdl | |
parent | b778f827810b9f14c758334dd94f3f8df4d27bd4 (diff) | |
download | ghostpdl-9b89ef860f52a6ca9696559c39104feba41e1de8.tar.gz |
lgtm.com fixes: gpdl tweaks.
Diffstat (limited to 'gpdl')
-rw-r--r-- | gpdl/jpgtop.c | 1 | ||||
-rw-r--r-- | gpdl/pngtop.c | 9 | ||||
-rw-r--r-- | gpdl/psitop.c | 11 | ||||
-rw-r--r-- | gpdl/tifftop.c | 5 |
4 files changed, 10 insertions, 16 deletions
diff --git a/gpdl/jpgtop.c b/gpdl/jpgtop.c index 51009682b..ad5342737 100644 --- a/gpdl/jpgtop.c +++ b/gpdl/jpgtop.c @@ -104,7 +104,6 @@ jpg_detect_language(const char *s, int len) strncmp("JFIF", s+6, 5) == 0) return 100; } - /* FIXME: Other formats go here */ return 0; } diff --git a/gpdl/pngtop.c b/gpdl/pngtop.c index ebeea40a7..50aadc1e2 100644 --- a/gpdl/pngtop.c +++ b/gpdl/pngtop.c @@ -634,7 +634,9 @@ do_impl_process(png_interp_instance_t *png, stream_cursor_read * pr, bool eof) break; } - png->samples = gs_alloc_bytes(png->memory, png->byte_width * (png->interlaced ? png->height : 1), "png_impl_process(samples)"); + png->samples = gs_alloc_bytes(png->memory, + (size_t)png->byte_width * (png->interlaced ? png->height : 1), + "png_impl_process(samples)"); if (png->samples == NULL) { png->state = ii_state_flush; break; @@ -715,16 +717,11 @@ do_impl_process(png_interp_instance_t *png, stream_cursor_read * pr, bool eof) break; } - /* FIXME */ png->state = ii_state_flush; break; } default: case ii_state_flush: - //png_destroy_decompress(&png->cinfo); - - //gs_png_mem_term((j_common_ptr)&png->cinfo); - if (png->penum) { (void)gs_image_cleanup_and_free_enum(png->penum, png->pgs); png->penum = NULL; diff --git a/gpdl/psitop.c b/gpdl/psitop.c index 783f0d090..284b4b094 100644 --- a/gpdl/psitop.c +++ b/gpdl/psitop.c @@ -90,7 +90,7 @@ check_token(int token_type, const char *s, const char *e, int *score) #define TOKEN_CHECK(n) else if (e-s == strlen(n) && memcmp(s, n, e-s) == 0) { score[0] += e-s; score[1]++; } - if (0) {} + if (0) { /* Initial block of checking chain */ } TOKEN_CHECK("dup") TOKEN_CHECK("exch") TOKEN_CHECK("grestore") @@ -121,7 +121,7 @@ score_comment(const char *s, const char *e, int *score) { #define COMMENT_CHECK(n) else if (e-s >= strlen(n) && memcmp(s, n, strlen(n)) == 0) { score[0] += 100; score[1]++; } - if (0) {} + if (0) { /* Initial block of checking chain */ } COMMENT_CHECK("!PS") COMMENT_CHECK("%Title:") COMMENT_CHECK("%Version:") @@ -222,7 +222,7 @@ ps_detect_language(const char *s, int len) } else if (*t == 27) { /* Give up if we meet an ESC. It could be a UEL. */ break; - } else if (*t <= 32 || *t > 127) { + } else if (*t <= 32 || *(unsigned char *)t > 127) { if (check_token(token_type, token, t, score)) break; if (*t != 9 && *t != 10 && *t != 12 && *t != 13 && *t != 32) @@ -417,11 +417,10 @@ ps_impl_init_job(pl_interp_implementation_t *impl, { ps_interp_instance_t *psi = (ps_interp_instance_t *)impl->interp_client_data; int exit_code; - int code = 0; + int code; /* Any error after here *must* reset the device to null */ - if (code >= 0) - code = psapi_set_device(psi->psapi_instance, device); + code = psapi_set_device(psi->psapi_instance, device); if (code >= 0) code = psapi_run_string(psi->psapi_instance, "erasepage", 0, &exit_code); diff --git a/gpdl/tifftop.c b/gpdl/tifftop.c index 2c9769bcb..742a5f14a 100644 --- a/gpdl/tifftop.c +++ b/gpdl/tifftop.c @@ -688,7 +688,6 @@ do_impl_process(pl_interp_implementation_t * impl, stream_cursor_read * pr, int } tiff->proc_samples = tiff->samples; - /* FIXME: Need to allow for LAB, YUV etc too */ tiff->bpp = tiff->bpc * tiff->num_comps; switch(tiff->photometric) { case PHOTOMETRIC_MINISWHITE: @@ -751,9 +750,9 @@ do_impl_process(pl_interp_implementation_t * impl, stream_cursor_read * pr, int code = gs_error_unknownerror; goto fail_decode; } else if (tiff->tiled) { - tiff->proc_samples = gs_alloc_bytes(tiff->memory, tiff->tile_width * tiff->tile_height * 3, "tiff_tile"); + tiff->proc_samples = gs_alloc_bytes(tiff->memory, (size_t)tiff->tile_width * tiff->tile_height * 3, "tiff_tile"); } else { - tiff->proc_samples = gs_alloc_bytes(tiff->memory, tiff->width * 3, "tiff_scan"); + tiff->proc_samples = gs_alloc_bytes(tiff->memory, (size_t)tiff->width * 3, "tiff_scan"); } break; } |