FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
unrar/getbits.cpp at main · aawc/unrar · GitHub
This repository was archived by the owner on Feb 12, 2026. It is now read-only.
aawc
/
unrar
Public archive
Notifications
You must be signed in to change notification settings
Fork
35
Star
56
Code
Issues
0
Pull requests
2
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
unrar
/
getbits.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
52 lines (41 loc) · 1.08 KB
Breadcrumbs
unrar
/
getbits.cpp
Copy path
File metadata and controls
52 lines (41 loc) · 1.08 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#
include
"
rar.hpp
"
BitInput::BitInput
(
bool
AllocBuffer)
{
ExternalBuffer=
false
;
if
(AllocBuffer)
{
//
getbits*() attempt to read data from InAddr, ... InAddr+8 positions.
//
So let's allocate 8 additional bytes for situation, when we need to
//
read only 1 byte from the last position of buffer and avoid a crash
//
from access to next 8 bytes, which contents we do not need.
size_t
BufSize=
MAX_SIZE
+
8
;
InBuf=
new
byte[BufSize];
//
Ensure that we get predictable results when accessing bytes in area
//
not filled with read data.
memset
(InBuf,
0
,BufSize);
}
else
InBuf=
nullptr
;
}
BitInput::~BitInput
()
{
if
(!ExternalBuffer)
delete[]
InBuf;
}
void
BitInput::faddbits
(uint Bits)
{
//
Function wrapped version of inline addbits to reduce the code size.
addbits
(Bits);
}
uint
BitInput::fgetbits
()
{
//
Function wrapped version of inline getbits to reduce the code size.
return
getbits
();
}
void
BitInput::SetExternalBuffer
(byte *Buf)
{
if
(InBuf!=
nullptr
&& !ExternalBuffer)
delete[]
InBuf;
InBuf=Buf;
ExternalBuffer=
true
;
}
Back
|
FazBrowse Home
|
New Git URL