transformations = transformations;
if (&transformations == NULL)  return;
png_do_read_interlace(png_structp png_ptr){   png_row_infop row_info = &(png_ptr->row_info);   png_bytep row = png_ptr->row_buf + 1;   int pass = png_ptr->pass;   png_uint_32 transformations = png_ptr->transformations;#ifdef PNG_USE_LOCAL_ARRAYS   /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */   /* offset to next interlace block */   const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};#endif   png_debug(1,"in png_do_read_interlace (stock C version)\n");   if (row != NULL && row_info != NULL)   {      png_uint_32 final_width;      final_width = row_info->width * png_pass_inc[pass];      switch (row_info->pixel_depth)      {         case 1:         {            png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 3);            png_bytep dp = row + (png_size_t)((final_width - 1) >> 3);            int sshift, dshift;            int s_start, s_end, s_inc;            int jstop = png_pass_inc[pass];            png_byte v;            png_uint_32 i;            int j;#if defined(PNG_READ_PACKSWAP_SUPPORTED)            if (transformations & PNG_PACKSWAP)            {                sshift = (int)((row_info->width + 7) & 0x07);                dshift = (int)((final_width + 7) & 0x07);                s_start = 7;                s_end = 0;                s_inc = -1;            }            else#endif            {                sshift = 7 - (int)((row_info->width + 7) & 0x07);                dshift = 7 - (int)((final_width + 7) & 0x07);                s_start = 0;                s_end = 7;                s_inc = 1;            }            for (i = 0; i < row_info->width; i++)            {               v = (png_byte)((*sp >> sshift) & 0x01);               for (j = 0; j < jstop; j++)               {                  *dp &= (png_byte)((0x7f7f >> (7 - dshift)) & 0xff);                  *dp |= (png_byte)(v << dshift);                  if (dshift == s_end)                  {                     dshift = s_start;                     dp--;                  }                  else                     dshift += s_inc;               }               if (sshift == s_end)               {                  sshift = s_start;                  sp--;               }               else                  sshift += s_inc;            }            break;         }         case 2:         {            png_bytep sp = row + (png_uint_32)((row_info->width - 1) >> 2);            png_bytep dp = row + (png_uint_32)((final_width - 1) >> 2);            int sshift, dshift;            int s_start, s_end, s_inc;            int jstop = png_pass_inc[pass];            png_uint_32 i;#if defined(PNG_READ_PACKSWAP_SUPPORTED)            if (transformations & PNG_PACKSWAP)            {               sshift = (int)(((row_info->width + 3) & 0x03) << 1);               dshift = (int)(((final_width + 3) & 0x03) << 1);               s_start = 6;               s_end = 0;               s_inc = -2;            }            else#endif            {               sshift = (int)((3 - ((row_info->width + 3) & 0x03)) << 1);               dshift = (int)((3 - ((final_width + 3) & 0x03)) << 1);               s_start = 0;               s_end = 6;               s_inc = 2;            }            for (i = 0; i < row_info->width; i++)            {               png_byte v;               int j;               v = (png_byte)((*sp >> sshift) & 0x03);               for (j = 0; j < jstop; j++)               {                  *dp &= (png_byte)((0x3f3f >> (6 - dshift)) & 0xff);                  *dp |= (png_byte)(v << dshift);                  if (dshift == s_end)                  {                     dshift = s_start;                     dp--;                  }                  else                     dshift += s_inc;               }               if (sshift == s_end)               {                  sshift = s_start;                  sp--;               }               else                  sshift += s_inc;            }            break;         }         case 4:         {            png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 1);            png_bytep dp = row + (png_size_t)((final_width - 1) >> 1);            int sshift, dshift;            int s_start, s_end, s_inc;            png_uint_32 i;            int jstop = png_pass_inc[pass];#if defined(PNG_READ_PACKSWAP_SUPPORTED)            if (transformations & PNG_PACKSWAP)            {               sshift = (int)(((row_info->width + 1) & 0x01) << 2);               dshift = (int)(((final_width + 1) & 0x01) << 2);               s_start = 4;               s_end = 0;               s_inc = -4;            }            else#endif            {               sshift = (int)((1 - ((row_info->width + 1) & 0x01)) << 2);               dshift = (int)((1 - ((final_width + 1) & 0x01)) << 2);               s_start = 0;               s_end = 4;               s_inc = 4;            }            for (i = 0; i < row_info->width; i++)            {               png_byte v = (png_byte)((*sp >> sshift) & 0xf);               int j;               for (j = 0; j < jstop; j++)               {                  *dp &= (png_byte)((0xf0f >> (4 - dshift)) & 0xff);                  *dp |= (png_byte)(v << dshift);                  if (dshift == s_end)                  {                     dshift = s_start;                     dp--;                  }                  else                     dshift += s_inc;               }               if (sshift == s_end)               {                  sshift = s_start;                  sp--;               }               else                  sshift += s_inc;            }            break;         }         default:         {            png_size_t pixel_bytes = (row_info->pixel_depth >> 3);            png_bytep sp = row + (png_size_t)(row_info->width - 1) * pixel_bytes;            png_bytep dp = row + (png_size_t)(final_width - 1) * pixel_bytes;            int jstop = png_pass_inc[pass];            png_uint_32 i;            for (i = 0; i < row_info->width; i++)            {               png_byte v[8];               int j;               png_memcpy(v, sp, pixel_bytes);               for (j = 0; j < jstop; j++)               {                  png_memcpy(dp, v, pixel_bytes);                  dp -= pixel_bytes;               }               sp -= pixel_bytes;            }            break;         }      }      row_info->width = final_width;      row_info->rowbytes = ((final_width *         (png_uint_32)row_info->pixel_depth + 7) >> 3);   }#if !defined(PNG_READ_PACKSWAP_SUPPORTED)   transformations = transformations; /* silence compiler warning */#endif}