Fix some `cppcheck` warnings.

* src/bzip2/ftbzip2.c (ft_bzip2_file_skip_output), src/gzip/ftgzip.c
(ft_gzip_file_skip_output): Reduce scope of `delta`.

* src/psaux/psintrp.c, src/psaux/psintrp.h (cf2_interpT2CharString): Add
`const` to `buf` parameter.

* src/raster/ftraster.c (DelOld): Add `const` to `profile` parameter.
(Vertical_Sweep_Span): Reduce scope of `target`.
(FT_Outline_Get_CBox): Reduce scope of `xMin`, `xMax`, `yMin`, `yMax`.

* src/smooth/ftgrays.c (gray_render_conic): Reduce scope of `split`.
(gray_sweep, gray_sweep_direct): Reduce scope of `area`.

* src/tools/apinames.c (names_dump) <OUTPUT_WATCOM_LBC>: Reduce scope of
`temp`.
This commit is contained in:
Werner Lemberg 2021-07-24 20:32:16 +02:00
parent 28c2d7f31c
commit c2fa51d9bd
7 changed files with 34 additions and 23 deletions

View File

@ -327,12 +327,13 @@
FT_ULong count )
{
FT_Error error = FT_Err_Ok;
FT_ULong delta;
for (;;)
{
delta = (FT_ULong)( zip->limit - zip->cursor );
FT_ULong delta = (FT_ULong)( zip->limit - zip->cursor );
if ( delta >= count )
delta = count;

View File

@ -467,12 +467,13 @@
FT_ULong count )
{
FT_Error error = FT_Err_Ok;
FT_ULong delta;
for (;;)
{
delta = (FT_ULong)( zip->limit - zip->cursor );
FT_ULong delta = (FT_ULong)( zip->limit - zip->cursor );
if ( delta >= count )
delta = count;

View File

@ -469,7 +469,7 @@
*/
FT_LOCAL_DEF( void )
cf2_interpT2CharString( CF2_Font font,
CF2_Buffer buf,
const CF2_Buffer buf,
CF2_OutlineCallbacks callbacks,
const FT_Vector* translation,
FT_Bool doingSeac,

View File

@ -65,7 +65,7 @@ FT_BEGIN_HEADER
FT_LOCAL( void )
cf2_interpT2CharString( CF2_Font font,
CF2_Buffer charstring,
const CF2_Buffer buf,
CF2_OutlineCallbacks callbacks,
const FT_Vector* translation,
FT_Bool doingSeac,

View File

@ -2095,8 +2095,8 @@
* Removes an old profile from a linked list.
*/
static void
DelOld( PProfileList list,
PProfile profile )
DelOld( PProfileList list,
const PProfile profile )
{
PProfile *old, current;
@ -2206,8 +2206,7 @@
PProfile left,
PProfile right )
{
Long e1, e2;
Byte* target;
Long e1, e2;
Int dropOutControl = left->flags & 7;
@ -2240,6 +2239,8 @@
if ( e2 >= 0 && e1 < ras.bWidth )
{
Byte* target;
Int c1, c2;
Byte f1, f2;
@ -2949,11 +2950,11 @@
FT_Outline_Get_CBox( const FT_Outline* outline,
FT_BBox *acbox )
{
Long xMin, yMin, xMax, yMax;
if ( outline && acbox )
{
Long xMin, yMin, xMax, yMax;
if ( outline->n_points == 0 )
{
xMin = 0;

View File

@ -658,8 +658,8 @@ typedef ptrdiff_t FT_PtrDist;
return;
}
fx1 = FRACT( x1 );
fx2 = FRACT( x2 );
fx1 = FRACT( x1 );
fx2 = FRACT( x2 );
/* everything is located in a single cell. That is easy! */
/* */
@ -1256,7 +1256,7 @@ typedef ptrdiff_t FT_PtrDist;
FT_Vector bez_stack[16 * 2 + 1]; /* enough to accommodate bisections */
FT_Vector* arc = bez_stack;
TPos dx, dy;
int draw, split;
int draw;
arc[0].x = UPSCALE( to->x );
@ -1299,7 +1299,9 @@ typedef ptrdiff_t FT_PtrDist;
/* many times as there are trailing zeros in the counter. */
do
{
split = draw & ( -draw ); /* isolate the rightmost 1-bit */
int split = draw & ( -draw ); /* isolate the rightmost 1-bit */
while ( ( split >>= 1 ) )
{
gray_split_conic( arc );
@ -1466,7 +1468,8 @@ typedef ptrdiff_t FT_PtrDist;
static void
gray_sweep( RAS_ARG )
{
int fill = ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL ? 0x100 : INT_MIN;
int fill = ( ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL ) ? 0x100
: INT_MIN;
int coverage;
int y;
@ -1476,13 +1479,15 @@ typedef ptrdiff_t FT_PtrDist;
PCell cell = ras.ycells[y - ras.min_ey];
TCoord x = ras.min_ex;
TArea cover = 0;
TArea area;
unsigned char* line = ras.target.origin - ras.target.pitch * y;
for ( ; !CELL_IS_NULL( cell ); cell = cell->next )
{
TArea area;
if ( cover != 0 && cell->x > x )
{
FT_FILL_RULE( coverage, cover, fill );
@ -1513,7 +1518,8 @@ typedef ptrdiff_t FT_PtrDist;
static void
gray_sweep_direct( RAS_ARG )
{
int fill = ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL ? 0x100 : INT_MIN;
int fill = ( ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL ) ? 0x100
: INT_MIN;
int coverage;
int y;
@ -1526,11 +1532,13 @@ typedef ptrdiff_t FT_PtrDist;
PCell cell = ras.ycells[y - ras.min_ey];
TCoord x = ras.min_ex;
TArea cover = 0;
TArea area;
for ( ; !CELL_IS_NULL( cell ); cell = cell->next )
{
TArea area;
if ( cover != 0 && cell->x > x )
{
FT_FILL_RULE( coverage, cover, fill );

View File

@ -167,7 +167,6 @@ names_dump( FILE* out,
case OUTPUT_WATCOM_LBC:
{
const char* dot;
char temp[512];
if ( !dll_name )
@ -181,7 +180,8 @@ names_dump( FILE* out,
dot = strchr( dll_name, '.' );
if ( dot )
{
int len = dot - dll_name;
char temp[512];
int len = dot - dll_name;
if ( len > (int)( sizeof ( temp ) - 1 ) )