diff options
author | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2014-02-06 18:33:34 +0000 |
---|---|---|
committer | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2014-02-06 18:33:34 +0000 |
commit | 7e86f2f686334cb3db458b4585dfce9c1b712bc4 (patch) | |
tree | 88b4a0536faefcada96437e7cddd3a36cfdee0a4 /filter/rastertopwg.c | |
parent | b1564baed9db112cb1334027f1d141877d88fcf4 (diff) | |
download | cups-7e86f2f686334cb3db458b4585dfce9c1b712bc4.tar.gz |
Full sweep of all Clang warnings, plus some bug fixes for incorrect memcpy usage.
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@11558 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'filter/rastertopwg.c')
-rw-r--r-- | filter/rastertopwg.c | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/filter/rastertopwg.c b/filter/rastertopwg.c index 622aa605a..0116fb173 100644 --- a/filter/rastertopwg.c +++ b/filter/rastertopwg.c @@ -1,21 +1,17 @@ /* * "$Id$" * - * CUPS raster to PWG raster format filter for CUPS. + * CUPS raster to PWG raster format filter for CUPS. * - * Copyright 2011 Apple Inc. + * Copyright 2011, 2014 Apple Inc. * - * These coded instructions, statements, and computer programs are the - * property of Apple Inc. and are protected by Federal copyright law. - * Distribution and use rights are outlined in the file "LICENSE.txt" - * which should have been included with this file. If this file is - * file is missing or damaged, see the license at "http://www.cups.org/". + * These coded instructions, statements, and computer programs are the + * property of Apple Inc. and are protected by Federal copyright law. + * Distribution and use rights are outlined in the file "LICENSE.txt" + * which should have been included with this file. If this file is + * file is missing or damaged, see the license at "http://www.cups.org/". * - * This file is subject to the Apple OS-Developed Software exception. - * - * Contents: - * - * main() - Main entry for filter. + * This file is subject to the Apple OS-Developed Software exception. */ /* @@ -41,9 +37,9 @@ main(int argc, /* I - Number of command-line args */ *outras; /* Output raster stream */ cups_page_header2_t inheader, /* Input raster page header */ outheader; /* Output raster page header */ - int y; /* Current line */ + unsigned y; /* Current line */ unsigned char *line; /* Line buffer */ - int page = 0, /* Current page */ + unsigned page = 0, /* Current page */ page_width, /* Actual page width */ page_height, /* Actual page height */ page_top, /* Top margin */ @@ -101,14 +97,10 @@ main(int argc, /* I - Number of command-line args */ fprintf(stderr, "PAGE: %d %d\n", page, inheader.NumCopies); - page_width = (int)(inheader.cupsPageSize[0] * inheader.HWResolution[0] / - 72.0); - page_height = (int)(inheader.cupsPageSize[1] * inheader.HWResolution[1] / - 72.0); - page_left = (int)(inheader.cupsImagingBBox[0] * - inheader.HWResolution[0] / 72.0); - page_bottom = (int)(inheader.cupsImagingBBox[1] * - inheader.HWResolution[1] / 72.0); + page_width = (unsigned)(inheader.cupsPageSize[0] * inheader.HWResolution[0] / 72.0); + page_height = (unsigned)(inheader.cupsPageSize[1] * inheader.HWResolution[1] / 72.0); + page_left = (unsigned)(inheader.cupsImagingBBox[0] * inheader.HWResolution[0] / 72.0); + page_bottom = (unsigned)(inheader.cupsImagingBBox[1] * inheader.HWResolution[1] / 72.0); page_top = page_height - page_bottom - inheader.cupsHeight; linesize = (page_width * inheader.cupsBitsPerPixel + 7) / 8; lineoffset = page_left * inheader.cupsBitsPerPixel / 8; /* Round down */ @@ -199,7 +191,7 @@ main(int argc, /* I - Number of command-line args */ if ((val = cupsGetOption("print-quality", num_options, options)) != NULL) { - int quality = atoi(val); /* print-quality value */ + unsigned quality = (unsigned)atoi(val); /* print-quality value */ if (quality >= IPP_QUALITY_DRAFT && quality <= IPP_QUALITY_HIGH) outheader.cupsInteger[8] = quality; @@ -270,7 +262,7 @@ main(int argc, /* I - Number of command-line args */ { if (inheader.Tumble) { - outheader.cupsInteger[1] = -1;/* CrossFeedTransform */ + outheader.cupsInteger[1] = ~0U;/* CrossFeedTransform */ outheader.cupsInteger[2] = 1; /* FeedTransform */ outheader.cupsInteger[3] = page_width - page_left - @@ -286,7 +278,7 @@ main(int argc, /* I - Number of command-line args */ else { outheader.cupsInteger[1] = 1; /* CrossFeedTransform */ - outheader.cupsInteger[2] = -1;/* FeedTransform */ + outheader.cupsInteger[2] = ~0U;/* FeedTransform */ outheader.cupsInteger[3] = page_left; /* ImageBoxLeft */ @@ -302,8 +294,8 @@ main(int argc, /* I - Number of command-line args */ { if (inheader.Tumble) { - outheader.cupsInteger[1] = -1;/* CrossFeedTransform */ - outheader.cupsInteger[2] = -1;/* FeedTransform */ + outheader.cupsInteger[1] = ~0U;/* CrossFeedTransform */ + outheader.cupsInteger[2] = ~0U;/* FeedTransform */ outheader.cupsInteger[3] = page_width - page_left - inheader.cupsWidth; @@ -334,8 +326,8 @@ main(int argc, /* I - Number of command-line args */ { if (inheader.Tumble) { - outheader.cupsInteger[1] = -1;/* CrossFeedTransform */ - outheader.cupsInteger[2] = -1;/* FeedTransform */ + outheader.cupsInteger[1] = ~0U;/* CrossFeedTransform */ + outheader.cupsInteger[2] = ~0U;/* FeedTransform */ outheader.cupsInteger[3] = page_width - page_left - inheader.cupsWidth; |