X-Git-Url: http://deadsoftware.ru/gitweb?p=d2df-sdl.git;a=blobdiff_plain;f=src%2Flib%2Fvampimg%2FJpegLib%2Fimjdmarker.pas;h=b87a3dd8d4d1a85819e8c7e91ca1b3324044afd7;hp=c2202c2e0a44009a5bddea3e2d5d901cb38cac81;hb=48fffe15692e9dcd2bdc2ed64f6e998af13211cf;hpb=ecfa6c6b626717711a8ae93cc455f69f0048498a diff --git a/src/lib/vampimg/JpegLib/imjdmarker.pas b/src/lib/vampimg/JpegLib/imjdmarker.pas index c2202c2..b87a3dd 100644 --- a/src/lib/vampimg/JpegLib/imjdmarker.pas +++ b/src/lib/vampimg/JpegLib/imjdmarker.pas @@ -1631,7 +1631,7 @@ function get_interesting_appn (cinfo : j_decompress_ptr) : boolean; var length : INT32; b : array[0..APPN_DATA_LEN-1] of JOCTET; - i, numtoread : uint; + i, numtoread: uint; var datasrc : jpeg_source_mgr_ptr; next_input_byte : JOCTETptr; @@ -1692,27 +1692,31 @@ begin numtoread := uint(length) else numtoread := 0; - for i := 0 to numtoread-1 do + + if numtoread > 0 then begin - { Read a byte into b[i]. If must suspend, return FALSE. } - { make a byte available. - Note we do *not* do INPUT_SYNC before calling fill_input_buffer, - but we must reload the local copies after a successful fill. } - if (bytes_in_buffer = 0) then + for i := 0 to numtoread-1 do begin - if (not datasrc^.fill_input_buffer(cinfo)) then + { Read a byte into b[i]. If must suspend, return FALSE. } + { make a byte available. + Note we do *not* do INPUT_SYNC before calling fill_input_buffer, + but we must reload the local copies after a successful fill. } + if (bytes_in_buffer = 0) then begin - get_interesting_appn := FALSE; - exit; + if (not datasrc^.fill_input_buffer(cinfo)) then + begin + get_interesting_appn := FALSE; + exit; + end; + { Reload the local copies } + next_input_byte := datasrc^.next_input_byte; + bytes_in_buffer := datasrc^.bytes_in_buffer; end; - { Reload the local copies } - next_input_byte := datasrc^.next_input_byte; - bytes_in_buffer := datasrc^.bytes_in_buffer; - end; - Dec( bytes_in_buffer ); + Dec( bytes_in_buffer ); - b[i] := GETJOCTET(next_input_byte^); - Inc(next_input_byte); + b[i] := GETJOCTET(next_input_byte^); + Inc(next_input_byte); + end; end; Dec(length, numtoread);