MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / read_header

Function read_header

src/burp/mvol.cpp:1753–1992  ·  view source on GitHub ↗

____________________________________________________________ Functional description

Source from the content-addressed store, hash-verified

1751// Functional description
1752//
1753static bool read_header(DESC handle, ULONG* buffer_size, USHORT* format, bool init_flag)
1754{
1755 TEXT buffer[MAX_FILE_NAME_SIZE], msg[BURP_MSG_GET_SIZE];
1756
1757 BurpGlobals* tdgbl = BurpGlobals::getSpecific();
1758
1759 // Headers are a version number, and a volume number
1760
1761 if (tdgbl->stdIoMode && tdgbl->uSvc->isService())
1762 {
1763 tdgbl->uSvc->started();
1764 tdgbl->mvol_io_cnt = tdgbl->uSvc->getBytes(tdgbl->mvol_io_buffer, tdgbl->mvol_io_buffer_size);
1765 }
1766 else
1767 {
1768#ifndef WIN_NT
1769 tdgbl->mvol_io_cnt = read(handle, tdgbl->mvol_io_buffer, tdgbl->mvol_actual_buffer_size);
1770#else
1771 DWORD bytesRead = 0;
1772 ReadFile(handle, tdgbl->mvol_io_buffer, tdgbl->mvol_actual_buffer_size, &bytesRead, NULL);
1773 tdgbl->mvol_io_cnt = bytesRead;
1774#endif
1775 }
1776 if (!tdgbl->mvol_io_cnt)
1777 BURP_error_redirect(0, 45); // maybe there's a better message
1778
1779 tdgbl->mvol_io_ptr = tdgbl->mvol_io_buffer;
1780
1781 int attribute = get(tdgbl);
1782 if (attribute != rec_burp)
1783 BURP_error_redirect(0, 45);
1784 // msg 45 expected backup description record
1785
1786 int l, maxlen;
1787 int temp;
1788 TEXT* p;
1789 for (attribute = get(tdgbl); attribute != att_end; attribute = get(tdgbl))
1790 {
1791 switch (attribute)
1792 {
1793 case att_backup_blksize:
1794 {
1795 const ULONG temp_buffer_size = get_numeric();
1796 if (init_flag)
1797 *buffer_size = temp_buffer_size;
1798 }
1799 break;
1800
1801 case att_backup_compress:
1802 temp = get_numeric();
1803 if (init_flag)
1804 tdgbl->gbl_sw_compress = temp != 0;
1805 break;
1806
1807 case att_backup_date:
1808 l = get(tdgbl);
1809 if (init_flag)
1810 {

Callers 2

mvol_init_readFunction · 0.85
mvol.cppFile · 0.85

Calls 10

BURP_error_redirectFunction · 0.85
get_numericFunction · 0.85
BURP_msg_getFunction · 0.85
BURP_errorFunction · 0.85
bad_attributeFunction · 0.85
getFunction · 0.70
SafeArgClass · 0.50
isServiceMethod · 0.45
startedMethod · 0.45
getBytesMethod · 0.45

Tested by

no test coverage detected