pub(super) fn read_chunk_ztxt(
    info: &mut Info,
    zlibsettings: &DecompressSettings,
    data: &[u8],
) -> Result<(), Error> {
    let mut length = 0;
    while length < data.len() && data[length] != 0 {
        length += 1
    }
    if length + 2 >= data.len() {
        return Err(Error(75));
    }
    if length < 1 || length > 79 {
        return Err(Error(89));
    }
    let key = &data[0..length];
    if data[length + 1] != 0 {
        return Err(Error(72));
    }
    /*the 0 byte indicating compression must be 0*/
    let string2_begin = length + 2; /*no null termination, corrupt?*/
    if string2_begin > data.len() {
        return Err(Error(75)); /*will fail if zlib error, e.g. if length is too small*/
    }
    let inl = &data[string2_begin..];
    let decoded = zlib_decompress(inl, zlibsettings)?;
    info.push_text(key, &decoded);
    Ok(())
}
/*compressed text chunk (zTXt)*/
compressed text chunk (zTXt)
compressed text chunk ( zTXt )
pub(super) fn read_chunk_ztxt(
    info: &mut Info,
    zlibsettings: &DecompressSettings,
    data: &[u8],
) -> Result<(), Error> {
    let mut length = 0;
    while length < data.len() && data[length] != 0 {
        length += 1
    }
    if length + 2 >= data.len() {
        return Err(Error(75));
    }
    if length < 1 || length > 79 {
        return Err(Error(89));
    }
    let key = &data[0..length];
    if data[length + 1] != 0 {
        return Err(Error(72));
    }
    /*the 0 byte indicating compression must be 0*/
    let string2_begin = length + 2; /*no null termination, corrupt?*/
    if string2_begin > data.len() {
        return Err(Error(75)); /*will fail if zlib error, e.g. if length is too small*/
    }
    let inl = &data[string2_begin..];
    let decoded = zlib_decompress(inl, zlibsettings)?;
    info.push_text(key, &decoded);
    Ok(())
}
pub ( super ) fn read_chunk_ztxt ( info : & mut Info , zlibsettings : & DecompressSettings , data : & [ u8 ] , ) -> Result < ( ) , Error > { let mut length = 0 ; while length < data . len ( ) && data [ length ] != 0 { length += 1 } if length + 2 >= data . len ( ) { return Err ( Error ( 75 ) ) ; } if length < 1 || length > 79 { return Err ( Error ( 89 ) ) ; } let key = & data [ 0 .. length ] ; if data [ length + 1 ] != 0 { return Err ( Error ( 72 ) ) ; } /*the 0 byte indicating compression must be 0*/ let string2_begin = length + 2 ; /*no null termination, corrupt?*/ if string2_begin > data . len ( ) { return Err ( Error ( 75 ) ) ; /*will fail if zlib error, e.g. if length is too small*/ } let inl = & data [ string2_begin .. ] ; let decoded = zlib_decompress ( inl , zlibsettings ) ? ; info . push_text ( key , & decoded ) ; Ok ( ( ) ) }
compressed text chunk (zTXt)
compressed text chunk ( zTXt )
info
&mut Info
zlibsettings
&DecompressSettings
data
&[u8]