MCPcopy Index your code
hub / github.com/RsyncProject/rsync / read_varint

Function read_varint

io.c:1816–1846  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1814}
1815
1816int32 read_varint(int f)
1817{
1818 union {
1819 char b[5];
1820 int32 x;
1821 } u;
1822 uchar ch;
1823 int extra;
1824
1825 u.x = 0;
1826 ch = read_byte(f);
1827 extra = int_byte_extra[ch / 4];
1828 if (extra) {
1829 uchar bit = ((uchar)1<<(8-extra));
1830 if (extra >= (int)sizeof u.b) {
1831 rprintf(FERROR, "Overflow in read_varint()\n");
1832 exit_cleanup(RERR_STREAMIO);
1833 }
1834 read_buf(f, u.b, extra);
1835 u.b[extra] = ch & (bit-1);
1836 } else
1837 u.b[0] = ch;
1838#if CAREFUL_ALIGNMENT
1839 u.x = IVAL(u.b,0);
1840#endif
1841#if SIZEOF_INT32 > 4
1842 if (u.x & (int32)0x80000000)
1843 u.x |= ~(int32)0xffffffff;
1844#endif
1845 return u.x;
1846}
1847
1848int64 read_varlong(int f, uchar min_bytes)
1849{

Callers 11

read_varint30Function · 0.85
recv_acl_accessFunction · 0.85
recv_ida_entriesFunction · 0.85
recv_rsync_aclFunction · 0.85
read_varint_boundedFunction · 0.85
read_varint_sizeFunction · 0.85
recv_file_entryFunction · 0.85
recv_file_listFunction · 0.85
setup_protocolFunction · 0.85
recv_xattr_requestFunction · 0.85
receive_xattrFunction · 0.85

Calls 4

read_byteFunction · 0.85
IVALFunction · 0.85
rprintfFunction · 0.70
read_bufFunction · 0.70

Tested by

no test coverage detected