From kde-commits Mon Aug 01 19:18:04 2005 From: Albert Astals Cid Date: Mon, 01 Aug 2005 19:18:04 +0000 To: kde-commits Subject: branches/KDE/3.4/kdegraphics/kpdf/xpdf/xpdf Message-Id: <1122923884.543993.25003.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=112292389513215 SVN commit 442150 by aacid: Even more backports of the fix to the 3299 patch M +10 -5 DCTStream.cc M +1 -0 DCTStream.h --- branches/KDE/3.4/kdegraphics/kpdf/xpdf/xpdf/DCTStream.cc #442149:442150 @@ -15,7 +15,15 @@ static boolean str_fill_input_buffer(j_decompress_ptr cinfo) { struct str_src_mgr * src = (struct str_src_mgr *)cinfo->src; - src->buffer = src->str->getChar(); + if (src->index == 0) { + src->buffer = 0xFF; + src->index++; + } + else if (src->index == 1) { + src->buffer = 0xD8; + src->index++; + } + else src->buffer = src->str->getChar(); src->pub.next_input_byte = &src->buffer; src->pub.bytes_in_buffer = 1; return TRUE; @@ -50,6 +58,7 @@ src.pub.bytes_in_buffer = 0; src.pub.next_input_byte = NULL; src.str = str; + src.index = 0; cinfo.src = (jpeg_source_mgr *)&src; cinfo.err = jpeg_std_error(&jerr); x = 0; @@ -98,10 +107,6 @@ n++; } - // ...and this skips the garbage - str->reset(); - for (n = n - 2; n > 0; n--) str->getChar(); - jpeg_read_header(&cinfo, TRUE); jpeg_start_decompress(&cinfo); --- branches/KDE/3.4/kdegraphics/kpdf/xpdf/xpdf/DCTStream.h #442149:442150 @@ -44,6 +44,7 @@ struct jpeg_source_mgr pub; JOCTET buffer; Stream *str; + int index; };