2025-10-11 01:35:43 +01:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns = "http://www.w3.org/1999/xhtml" lang = "en-US" >
< head >
< meta http-equiv = "Content-Type" content = "text/xhtml;charset=UTF-8" / >
< meta http-equiv = "X-UA-Compatible" content = "IE=11" / >
< meta name = "generator" content = "Doxygen 1.14.0" / >
< meta name = "viewport" content = "width=device-width, initial-scale=1" / >
< title > libaaruformat: src/blocks/data.c File Reference< / title >
< link href = "tabs.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "jquery.js" > < / script >
< script type = "text/javascript" src = "dynsections.js" > < / script >
< script type = "text/javascript" src = "clipboard.js" > < / script >
< link href = "navtree.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "navtreedata.js" > < / script >
< script type = "text/javascript" src = "navtree.js" > < / script >
< script type = "text/javascript" src = "cookie.js" > < / script >
< link href = "search/search.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "search/searchdata.js" > < / script >
< script type = "text/javascript" src = "search/search.js" > < / script >
< link href = "doxygen.css" rel = "stylesheet" type = "text/css" / >
< / head >
< body >
< div id = "top" > <!-- do not remove this div, it is closed by doxygen! -->
< div id = "titlearea" >
< table cellspacing = "0" cellpadding = "0" >
< tbody >
< tr id = "projectrow" >
< td id = "projectalign" >
< div id = "projectname" > libaaruformat< span id = "projectnumber" >   1.0< / span >
< / div >
< div id = "projectbrief" > Aaru Data Preservation Suite - Format Library< / div >
< / td >
< / tr >
< / tbody >
< / table >
< / div >
<!-- end header part -->
<!-- Generated by Doxygen 1.14.0 -->
< script type = "text/javascript" >
var searchBox = new SearchBox("searchBox", "search/",'.html');
< / script >
< script type = "text/javascript" >
$(function() { codefold.init(); });
< / script >
< script type = "text/javascript" src = "menudata.js" > < / script >
< script type = "text/javascript" src = "menu.js" > < / script >
< script type = "text/javascript" >
$(function() {
initMenu('',true,false,'search.php','Search',true);
$(function() { init_search(); });
});
< / script >
< div id = "main-nav" > < / div >
< / div > <!-- top -->
< div id = "side-nav" class = "ui-resizable side-nav-resizable" >
< div id = "nav-tree" >
< div id = "nav-tree-contents" >
< div id = "nav-sync" class = "sync" > < / div >
< / div >
< / div >
< div id = "splitbar" style = "-moz-user-select:none;"
class="ui-resizable-handle">
< / div >
< / div >
< script type = "text/javascript" >
$(function(){initNavTree('data_8c.html','',''); });
< / script >
< div id = "container" >
< div id = "doc-content" >
<!-- window showing the filter options -->
< div id = "MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
< / div >
<!-- iframe showing the search results (closed by default) -->
< div id = "MSearchResultsWindow" >
< div id = "MSearchResults" >
< div class = "SRPage" >
< div id = "SRIndex" >
< div id = "SRResults" > < / div >
< div class = "SRStatus" id = "Loading" > Loading...< / div >
< div class = "SRStatus" id = "Searching" > Searching...< / div >
< div class = "SRStatus" id = "NoMatches" > No Matches< / div >
< / div >
< / div >
< / div >
< / div >
< div class = "header" >
< div class = "headertitle" > < div class = "title" > data.c File Reference< / div > < / div >
< / div > <!-- header -->
< div class = "contents" >
< div class = "textblock" > < code > #include < inttypes.h> < / code > < br / >
< code > #include < stdint.h> < / code > < br / >
< code > #include < stdio.h> < / code > < br / >
< code > #include < stdlib.h> < / code > < br / >
< code > #include " < a class = "el" href = "aaruformat_8h_source.html" > aaruformat.h< / a > " < / code > < br / >
< code > #include " < a class = "el" href = "log_8h_source.html" > log.h< / a > " < / code > < br / >
< code > #include " uthash.h" < / code > < br / >
< / div >
< p > < a href = "data_8c_source.html" > Go to the source code of this file.< / a > < / p >
< table class = "memberdecls" >
< tr class = "heading" > < td colspan = "2" > < h2 id = "header-func-members" class = "groupheader" > < a id = "func-members" name = "func-members" > < / a >
Functions< / h2 > < / td > < / tr >
< tr class = "memitem:a28d844a06cecbbf436d825a3c99ff0eb" id = "r_a28d844a06cecbbf436d825a3c99ff0eb" > < td class = "memItemLeft" align = "right" valign = "top" > int32_t  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "#a28d844a06cecbbf436d825a3c99ff0eb" > process_data_block< / a > (< a class = "el" href = "structaaruformat__context.html" > aaruformat_context< / a > *ctx, < a class = "el" href = "structIndexEntry.html" > IndexEntry< / a > *entry)< / td > < / tr >
< tr class = "memdesc:a28d844a06cecbbf436d825a3c99ff0eb" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > Processes a data block from the image stream. < br / > < / td > < / tr >
< / table >
< a name = "doc-func-members" id = "doc-func-members" > < / a > < h2 id = "header-doc-func-members" class = "groupheader" > Function Documentation< / h2 >
< a id = "a28d844a06cecbbf436d825a3c99ff0eb" name = "a28d844a06cecbbf436d825a3c99ff0eb" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#a28d844a06cecbbf436d825a3c99ff0eb" > ◆   < / a > < / span > process_data_block()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > int32_t process_data_block < / td >
< td > (< / td >
< td class = "paramtype" > < a class = "el" href = "structaaruformat__context.html" > aaruformat_context< / a > *< / td > < td class = "paramname" > < span class = "paramname" > < em > ctx< / em > < / span > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > < a class = "el" href = "structIndexEntry.html" > IndexEntry< / a > *< / td > < td class = "paramname" > < span class = "paramname" > < em > entry< / em > < / span >   )< / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Processes a data block from the image stream. < / p >
< p > Reads a data block from the image, decompresses if needed, and updates the context with its contents. This function handles various types of data blocks including compressed (LZMA) and uncompressed data, performs CRC validation, and stores the processed data in the appropriate context fields.< / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > ctx< / td > < td > Pointer to the aaruformat context. < / td > < / tr >
< tr > < td class = "paramname" > entry< / td > < td > Pointer to the index entry describing the data block.< / td > < / tr >
< / table >
< / dd >
< / dl >
< dl class = "section return" > < dt > Returns< / dt > < dd > Returns one of the following status codes: < / dd > < / dl >
< dl class = "retval" > < dt > Return values< / dt > < dd >
< table class = "retval" >
< tr > < td class = "paramname" > AARUF_STATUS_OK< / td > < td > (0) Successfully processed the data block. This is returned when:< ul >
< li > The block is processed successfully and all validations pass< / li >
< li > A NoData block type is encountered (these are skipped)< / li >
< li > A UserData block type is encountered (these update sector size but are otherwise skipped)< / li >
< li > Block validation fails but processing continues (non-fatal errors like CRC mismatches)< / li >
< li > Memory allocation failures occur (processing continues with other blocks)< / li >
< li > Block reading failures occur (processing continues with other blocks)< / li >
< li > Unknown compression types are encountered (block is skipped)< / li >
< / ul >
< / td > < / tr >
< tr > < td class = "paramname" > AARUF_ERROR_NOT_AARUFORMAT< / td > < td > (-1) The context or image stream is invalid (NULL pointers).< / td > < / tr >
< tr > < td class = "paramname" > AARUF_ERROR_CANNOT_READ_BLOCK< / td > < td > (-7) Failed to seek to the block position in the image stream. This occurs when fseek() fails or the file position doesn't match the expected offset.< / td > < / tr >
< tr > < td class = "paramname" > AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK< / td > < td > (-17) LZMA decompression failed. This can happen when:< ul >
< li > The LZMA decoder returns an error code< / li >
< li > The decompressed data size doesn't match the expected block length< / li >
< / ul >
< / td > < / tr >
< / table >
< / dd >
< / dl >
< dl class = "section note" > < dt > Note< / dt > < dd > Most validation and reading errors are treated as non-fatal and result in AARUF_STATUS_OK being returned while the problematic block is skipped. This allows processing to continue with other blocks in the image.< / dd >
< dd >
The function performs the following validations:< ul >
< li > Block identifier matches the expected block type< / li >
< li > Block data type matches the expected data type< / li >
< li > CRC64 checksum validation (with version-specific byte order handling)< / li >
< li > Proper decompression for LZMA-compressed blocks< / li >
< / ul >
< / dd > < / dl >
< dl class = "section warning" > < dt > Warning< / dt > < dd > Memory allocated for block data is stored in the context and should be freed when the context is destroyed. The function may replace existing data in the context. < / dd > < / dl >
< p class = "definition" > Definition at line < a class = "el" href = "data_8c_source.html#l00071" > 71< / a > of file < a class = "el" href = "data_8c_source.html" > data.c< / a > .< / p >
2025-10-13 14:26:33 +01:00
< p class = "reference" > References < a class = "el" href = "crc64_8c_source.html#l00160" > aaruf_crc64_data()< / a > , < a class = "el" href = "cst_8c_source.html#l00193" > aaruf_cst_untransform()< / a > , < a class = "el" href = "errors_8h_source.html#l00056" > AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK< / a > , < a class = "el" href = "errors_8h_source.html#l00046" > AARUF_ERROR_CANNOT_READ_BLOCK< / a > , < a class = "el" href = "errors_8h_source.html#l00040" > AARUF_ERROR_NOT_AARUFORMAT< / a > , < a class = "el" href = "helpers_8c_source.html#l00039" > aaruf_get_media_tag_type_for_datatype()< / a > , < a class = "el" href = "lzma_8c_source.html#l00039" > aaruf_lzma_decode_buffer()< / a > , < a class = "el" href = "errors_8h_source.html#l00075" > AARUF_STATUS_OK< / a > , < a class = "el" href = "consts_8h_source.html#l00071" > AARUF_VERSION_V1< / a > , < a class = "el" href = "enums_8h_source.html#l00117" > AppleProfileTag< / a > , < a class = "el" href = "aaru_8h_source.html#l00896" > AppleSectorTag< / a > , < a class = "el" href = "enums_8h_source.html#l00118" > AppleSonyTag< / a > , < a class = "el" href = "index_8h_source.html#l00110" > IndexEntry::blockType< / a > , < a class = "el" href = "endian_8h_source.html#l00081" > bswap_64< / a > , < a class = "el" href = "aaru_8h_source.html#l00903" > CdSectorEcc< / a > , < a class = "el" href = "aaru_8h_source.html#l00901" > CdSectorEccP< / a > , < a class = "el" href = "aaru_8h_source.html#l00902" > CdSectorEccQ< / a > , < a class = "el" href = "aaru_8h_source.html#l00900" > CdSectorEdc< / a > , < a class = "el" href = "aaru_8h_source.html#l00898" > CdSectorHeader< / a > , < a class = "el" href = "enums_8h_source.html#l00114" > CdSectorPrefix< / a > , < a class = "el" href = "enums_8h_source.html#l00121" > CdSectorPrefixCorrected< / a > , < a class = "el" href = "enums_8h_source.html#l00116" > CdSectorSubchannel< / a > , < a class = "el" href = "aaru_8h_source.html#l00899" > CdSectorSubHeader< / a > , < a class = "el" href = "enums_8h_source.html#l00115" > CdSectorSuffix< / a > , < a class = "el" href = "enums_8h_source.html#l00122" > CdSectorSuffixCorrected< / a > , < a class = "el" href = "aaru_8h_source.html#l00897" > CdSectorSync< / a > , < a class = "el" href = "data_8h_source.html#l00076" > BlockHeader::cmpLength< / a > , < a class = "el" href = "enums_8h_source.html#l00123" > CompactDiscMode2Subheader< / a > , < a class = "el" href = "data_8h_source.html#l00074" > BlockHeader::compression< / a > , < a class = "el" href = "data_8h_source.html#l00079" > BlockHeader::crc64< / a > , < a class = "el" href = "context_8h_source.html#l00120" > mediaTagEntry::data< / a > , < a class = "el" href = "index_8h_source.html#l00111" > IndexEntry::dataType< / a > , < a class = "el" href = "aaru_8h_source.html#l00908" > DvdCmi< / a > , < a class = "el" href = "enums_8h_source.html#l00126" > DvdSectorCprMai< / a > , < a class = "el" href = "enums_8h_source.html#l00130" > DvdSectorEdc< / a > , < a class = "el" href = "aaru_8h_source.html#l00915" > DvdSectorEdcAaru< / a > , < a class = "el" href = "enums_8h_source.html#l00128" > DvdSectorId< / a > , < a class = "el" href = "enums_8h_source.html#l00129" > DvdSectorIed< / a > , < a class = "el" href = "aaru_8h_source.html#l00914" > DvdSectorIedAaru< / a > , < a class = "el" href = "aaru_8h_source.html#l00912" > DvdSectorInformation< / a > , < a class = "el" href = "aaru_8h_source.html#l00913" > DvdSectorNumber< / a > , < a class = "el" href = "enums_8h_source.html#l00127" > DvdSectorTitleKeyDecrypted< / a > , < a class = "el" href = "aaru_8h_source.html#l00911" > DvdTitleKeyDecrypted< / a > , < a class = "el" href = "log_8h_source.html#l00040" > FATAL< / a > , < a class = "el" href = "context_8h_source.html#l00175" > aaruformat_context::header< / a > , < a class = "el" href = "data_8h_source.html#l00072" > BlockHeader::identifier< / a > , < a class = "el" href = "context_8h_source.html#l00260" > aaruformat_context::image_info< / a > , < a class = "el" href = "header_8h_source.html#l00110" > AaruHeaderV2::imageMajorVersion< / a > , < a class = "el" href = "aaru_8h_source.html#l00873" > ImageInfo::ImageSize< / a > , < a class = "el" href = "context_8h_source.html#l00176" > aaruformat_context::imageStream< / a > , < a class = "el" href = "data_8h_source.html#l00077" > BlockHeader::length< / a > , < a class = "el" href = "context_8h_source.html#l00122" > mediaTagEntry::length< / a > , < a class = "el" href = "enums_8h_source.html#l00034" > Lzma< / a > , < a class = "el" href = "consts_8h_source.html#l00082" > LZMA_PROPERTIES_LENGTH< / a > , < a class = "el" href = "enums_8h_source.html#l00036" > LzmaClauniaSubchannelTransform< / a > , < a cla
2025-10-11 01:35:43 +01:00
< p class = "reference" > Referenced by < a class = "el" href = "open_8c_source.html#l00125" > aaruf_open()< / a > .< / p >
< / div >
< / div >
< / div > <!-- contents -->
< / div > <!-- doc - content -->
< div id = "page-nav" class = "page-nav-panel" >
< div id = "page-nav-resize-handle" > < / div >
< div id = "page-nav-tree" >
< div id = "page-nav-contents" >
< / div > <!-- page - nav - contents -->
< / div > <!-- page - nav - tree -->
< / div > <!-- page - nav -->
< / div > <!-- container -->
<!-- start footer part -->
< div id = "nav-path" class = "navpath" > <!-- id is needed for treeview function! -->
< ul >
< li class = "navelem" > < a href = "dir_68267d1309a1af8e8297ef4c3efbcdba.html" > src< / a > < / li > < li class = "navelem" > < a href = "dir_b2e0cd1ddd0a904cb261e9b68779deb4.html" > blocks< / a > < / li > < li class = "navelem" > < a href = "data_8c.html" > data.c< / a > < / li >
< li class = "footer" > Generated by < a href = "https://www.doxygen.org/index.html" > < img class = "footer" src = "doxygen.svg" width = "104" height = "31" alt = "doxygen" / > < / a > 1.14.0 < / li >
< / ul >
< / div >
< / body >
< / html >