]> mj.ucw.cz Git - libucw.git/commitdiff
and now a correct solution... skip_input_data should be able to jump
authorPavel Charvat <pavel.charvat@netcentrum.cz>
Wed, 27 Sep 2006 11:24:47 +0000 (13:24 +0200)
committerPavel Charvat <pavel.charvat@netcentrum.cz>
Wed, 27 Sep 2006 11:24:47 +0000 (13:24 +0200)
exactly at EOF (according to libjpeg documentation)

images/io-libjpeg.c

index ccc20f36f9fd10316bc17ed0aebedef9b0dfaa52..00d1419d33220c2ce838dd3fea1704da0723f530 100644 (file)
@@ -135,12 +135,12 @@ libjpeg_skip_input_data(j_decompress_ptr cinfo, long num_bytes)
         {
          num_bytes -= i->src.bytes_in_buffer;
          libjpeg_fastbuf_read_commit(i);
-         bskip(i->fastbuf, num_bytes);
-         if (!libjpeg_fastbuf_read_prepare(i))
+         if (bskip(i->fastbuf, num_bytes) < num_bytes)
            {
              IMAGE_ERROR(i->err.io->context, IMAGE_ERROR_READ_FAILED, "Incomplete JPEG file");
              longjmp(i->err.setjmp_buf, 1);
            }
+         libjpeg_fastbuf_read_prepare(i);
        }
     }
 }