Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
dart_pdf
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
David PHAM-VAN
2022-04-13 08:53:51 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0cab08c9236e5bd1a72c76dcaf676597cc5b2606
0cab08c9
1 parent
d743026f
Improve hexDump function
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
pdf/test/utils.dart
pdf/test/utils.dart
View file @
0cab08c
...
...
@@ -81,18 +81,21 @@ Font loadFont(String filename) {
}
void
hexDump
(
ByteData
bytes
,
int
offset
,
int
length
,
[
ByteData
bytes
,
{
int
offset
=
0
,
int
?
length
,
int
?
highlight
,
int
?
highlightLength
,
])
{
int
columns
=
16
,
})
{
const
reset
=
'
\
x1B[0m'
;
const
red
=
'
\
x1B[1;31m'
;
var
s
=
''
;
var
t
=
''
;
var
n
=
0
;
var
hl
=
false
;
length
??=
bytes
.
lengthInBytes
;
for
(
var
i
=
0
;
i
<
length
;
i
++)
{
final
b
=
bytes
.
getUint8
(
offset
+
i
);
if
(
highlight
!=
null
&&
highlightLength
!=
null
)
{
...
...
@@ -118,7 +121,7 @@ void hexDump(
}
n
++;
if
(
n
%
16
==
0
)
{
if
(
n
%
columns
==
0
)
{
if
(
hl
)
{
s
+=
reset
;
t
+=
reset
;
...
...
@@ -129,5 +132,5 @@ void hexDump(
t
=
''
;
}
}
print
(
'
$s
$t
'
);
print
(
'
$s
${' ' * (columns * 3 - s.length + 3)}
$t
'
);
}
...
...
Please
register
or
login
to post a comment