这将创建一个尝试除以零的错误,如果该错误未被语言的错误处理功能捕获,则可能会出现意外结果:
static void aspect_adjust_packed4444_scanline_c( uint8_t *output,
uint8_t *input,
int width,
double pixel_aspect )
{
double i;
int prev_i = 0;
int w = 0;
pixel_aspect = 1.0 / pixel_aspect;
for( i = 0.0; i < width; i += pixel_aspect )
{
uint8_t *curin = input + ((int) i)*4;
if( !prev_i )
{
output[ 0 ] = curin[ 0 ];
output[ 1 ] = curin[ 1 ];
output[ 2 ] = curin[ 2 ];
output[ 3 ] = curin[ 3 ];
}
else
{
int avg_a = 0;
int avg_y = 0;
int avg_cb = 0;
int avg_cr = 0;
int pos = prev_i * 4;
int c = 0; /* assignment: Assigning: "c" = "0" */
int j;
for( j = prev_i; j <= (int) i; j++ )
{
avg_a += input[ pos++ ];
avg_y += input[ pos++ ];
avg_cb += input[ pos++ ];
avg_cr += input[ pos++ ];
c++;
}
output[ 0 ] = avg_a / c; /* Division or modulo by zero */
output[ 1 ] = avg_y / c; /* Division or modulo by zero */
output[ 2 ] = avg_cb / c; /* Division or modulo by zero */
output[ 3 ] = avg_cr / c; /* Division or modulo by zero */
}
output += 4;
prev_i = (int) i;
w++;
}
}