Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Sunxi Tools
Commits
151f7afe
Commit
151f7afe
authored
May 03, 2012
by
Alejandro Mery
Browse files
bin2fex: improved error handling
parent
3abad84f
Changes
1
Show whitespace changes
Inline
Side-by-side
bin2fex.c
View file @
151f7afe
...
@@ -34,7 +34,10 @@
...
@@ -34,7 +34,10 @@
/**
/**
*/
*/
static
int
decompile_gpio
(
struct
script_section
*
section
,
struct
script_section_entry
*
entry
,
struct
script_gpio_value
*
gpio
,
int
length
,
FILE
*
out
)
static
inline
int
decompile_gpio
(
struct
script_section
*
section
,
struct
script_section_entry
*
entry
,
struct
script_gpio_value
*
gpio
,
int
length
,
FILE
*
out
)
{
{
int
ok
=
1
;
int
ok
=
1
;
char
port
=
'?'
;
char
port
=
'?'
;
...
@@ -85,9 +88,11 @@ static int decompile_section(void *bin, size_t bin_size,
...
@@ -85,9 +88,11 @@ static int decompile_section(void *bin, size_t bin_size,
switch
(
type
)
{
switch
(
type
)
{
case
SCRIPT_VALUE_TYPE_SINGLE_WORD
:
{
case
SCRIPT_VALUE_TYPE_SINGLE_WORD
:
{
int32_t
*
d
=
data
;
int32_t
*
d
=
data
;
if
(
length
!=
1
)
if
(
length
!=
1
)
{
pr_err
(
"%s.%s: invalid length %d (assuming %d)
\n
"
,
pr_err
(
"%s.%s: invalid length %d (assuming %d)
\n
"
,
section
->
name
,
entry
->
name
,
length
,
1
);
section
->
name
,
entry
->
name
,
length
,
1
);
ok
=
0
;
}
/* TODO: some are preferred in hexa */
/* TODO: some are preferred in hexa */
fprintf
(
out
,
"%s
\t
= %d
\n
"
,
entry
->
name
,
*
d
);
fprintf
(
out
,
"%s
\t
= %d
\n
"
,
entry
->
name
,
*
d
);
...
@@ -113,6 +118,7 @@ static int decompile_section(void *bin, size_t bin_size,
...
@@ -113,6 +118,7 @@ static int decompile_section(void *bin, size_t bin_size,
pr_err
(
"%s.%s: unknown type %d
\n
"
,
pr_err
(
"%s.%s: unknown type %d
\n
"
,
section
->
name
,
entry
->
name
,
type
);
section
->
name
,
entry
->
name
,
type
);
fprintf
(
out
,
"%s
\t
=
\n
"
,
entry
->
name
);
fprintf
(
out
,
"%s
\t
=
\n
"
,
entry
->
name
);
ok
=
0
;
break
;
break
;
}
}
}
}
...
...
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