Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
binwalk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-gitdep
binwalk
Commits
6988048f
Commit
6988048f
authored
Nov 16, 2013
by
heffnercj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed BlockFile to extend io.FileIO instead of the file object
parent
36774f18
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
common.py
src/binwalk/common.py
+4
-3
No files found.
src/binwalk/common.py
View file @
6988048f
...
...
@@ -91,7 +91,7 @@ def unique_file_name(base_name, extension=''):
return
fname
class
BlockFile
(
io
.
BufferedReader
):
class
BlockFile
(
io
.
FileIO
):
'''
Abstraction class to handle reading data from files in blocks.
Necessary for large files.
...
...
@@ -109,11 +109,12 @@ class BlockFile(io.BufferedReader):
# limit disk I/O, but small enough to limit the size of processed data blocks.
READ_BLOCK_SIZE
=
1
*
1024
*
1024
def
__init__
(
self
,
fname
,
length
=
0
,
offset
=
0
):
def
__init__
(
self
,
fname
,
mode
=
'r'
,
length
=
0
,
offset
=
0
):
'''
Class constructor.
@fname - Path to the file to be opened.
@mode - Mode to open the file in (default: 'r').
@length - Maximum number of bytes to read from the file via self.block_read().
@offset - Offset at which to start reading from the file.
...
...
@@ -136,7 +137,7 @@ class BlockFile(io.BufferedReader):
else
:
self
.
length
=
self
.
size
io
.
BufferedReader
.
__init__
(
self
,
fname
,
"rb"
)
io
.
FileIO
.
__init__
(
self
,
fname
,
mode
)
self
.
seek
(
self
.
offset
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment