Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libdvbpsi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
libdvbpsi
Commits
f321f9d2
Commit
f321f9d2
authored
Jul 15, 2015
by
Daniel Kamil Kozar
Committed by
Jean-Paul Saman
Jan 12, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a macro for checking arrays of structs
Signed-off-by:
Jean-Paul Saman
<
jpsaman@videolan.org
>
parent
ef99ff06
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
17 deletions
+39
-17
misc/dr.xsl
misc/dr.xsl
+2
-1
misc/test_dr.c
misc/test_dr.c
+20
-10
misc/test_dr.h
misc/test_dr.h
+17
-6
No files found.
misc/dr.xsl
View file @
f321f9d2
...
...
@@ -130,7 +130,8 @@ static int main_<xsl:value-of select="@sname" />_<xsl:value-of select="@msuffix"
/* check
<xsl:value-of
select=
"@name"
/>
*/
<xsl:apply-templates
select=
".."
mode=
"init"
/>
BOZO_begin_array(
<xsl:value-of
select=
"@name"
/>
,
<xsl:value-of
select=
"@len_name"
/>
,
<xsl:value-of
select=
"@min_size"
/>
)
BOZO_DOJOB(
<xsl:value-of
select=
"../@fname"
/>
);
BOZO_check_array(
<xsl:value-of
select=
"@name"
/>
,
<xsl:value-of
select=
"@len_name"
/>
)
BOZO_check_array_begin(
<xsl:value-of
select=
"@name"
/>
,
<xsl:value-of
select=
"@len_name"
/>
)
BOZO_check_array_gen(
<xsl:value-of
select=
"@name"
/>
,
<xsl:value-of
select=
"@len_name"
/>
)
BOZO_CLEAN();
<xsl:choose>
<xsl:when
test=
"@max_size"
>
...
...
misc/test_dr.c
View file @
f321f9d2
...
...
@@ -471,7 +471,8 @@ static int main_ca_(void)
BOZO_init_integer
(
i_ca_pid
,
0
);
BOZO_begin_array
(
i_private_data
,
i_private_length
,
0
)
BOZO_DOJOB
(
CA
);
BOZO_check_array
(
i_private_data
,
i_private_length
)
BOZO_check_array_begin
(
i_private_data
,
i_private_length
)
BOZO_check_array_gen
(
i_private_data
,
i_private_length
)
BOZO_CLEAN
();
BOZO_end_array
(
i_private_data
,
ARRAY_SIZE
(
s_decoded
.
i_private_data
))
...
...
@@ -492,7 +493,8 @@ static int main_iso639_(void)
/* check code */
BOZO_begin_array
(
code
,
i_code_count
,
1
)
BOZO_DOJOB
(
ISO639
);
BOZO_check_array
(
code
,
i_code_count
)
BOZO_check_array_begin
(
code
,
i_code_count
)
BOZO_check_array_gen
(
code
,
i_code_count
)
BOZO_CLEAN
();
BOZO_end_array
(
code
,
ARRAY_SIZE
(
s_decoded
.
code
))
...
...
@@ -610,7 +612,8 @@ static int main_copyright_(void)
BOZO_init_integer
(
i_copyright_identifier
,
0
);
BOZO_begin_array
(
i_additional_info
,
i_additional_length
,
0
)
BOZO_DOJOB
(
Copyright
);
BOZO_check_array
(
i_additional_info
,
i_additional_length
)
BOZO_check_array_begin
(
i_additional_info
,
i_additional_length
)
BOZO_check_array_gen
(
i_additional_info
,
i_additional_length
)
BOZO_CLEAN
();
BOZO_end_array
(
i_additional_info
,
ARRAY_SIZE
(
s_decoded
.
i_additional_info
))
...
...
@@ -825,7 +828,8 @@ static int main_network_name_(void)
/* check i_name_byte */
BOZO_begin_array
(
i_name_byte
,
i_name_length
,
0
)
BOZO_DOJOB
(
NetworkName
);
BOZO_check_array
(
i_name_byte
,
i_name_length
)
BOZO_check_array_begin
(
i_name_byte
,
i_name_length
)
BOZO_check_array_gen
(
i_name_byte
,
i_name_length
)
BOZO_CLEAN
();
BOZO_end_array
(
i_name_byte
,
ARRAY_SIZE
(
s_decoded
.
i_name_byte
))
...
...
@@ -846,7 +850,8 @@ static int main_stuffing_(void)
/* check i_stuffing_byte */
BOZO_begin_array
(
i_stuffing_byte
,
i_stuffing_length
,
0
)
BOZO_DOJOB
(
Stuffing
);
BOZO_check_array
(
i_stuffing_byte
,
i_stuffing_length
)
BOZO_check_array_begin
(
i_stuffing_byte
,
i_stuffing_length
)
BOZO_check_array_gen
(
i_stuffing_byte
,
i_stuffing_length
)
BOZO_CLEAN
();
BOZO_end_array
(
i_stuffing_byte
,
ARRAY_SIZE
(
s_decoded
.
i_stuffing_byte
))
...
...
@@ -867,7 +872,8 @@ static int main_bouquet_name_(void)
/* check i_char */
BOZO_begin_array
(
i_char
,
i_name_length
,
0
)
BOZO_DOJOB
(
BouquetName
);
BOZO_check_array
(
i_char
,
i_name_length
)
BOZO_check_array_begin
(
i_char
,
i_name_length
)
BOZO_check_array_gen
(
i_char
,
i_name_length
)
BOZO_CLEAN
();
BOZO_end_array
(
i_char
,
ARRAY_SIZE
(
s_decoded
.
i_char
))
...
...
@@ -899,7 +905,8 @@ static int main_service_1(void)
BOZO_init_integer
(
i_service_type
,
0
);
BOZO_begin_array
(
i_service_provider_name
,
i_service_provider_name_length
,
0
)
BOZO_DOJOB
(
Service
);
BOZO_check_array
(
i_service_provider_name
,
i_service_provider_name_length
)
BOZO_check_array_begin
(
i_service_provider_name
,
i_service_provider_name_length
)
BOZO_check_array_gen
(
i_service_provider_name
,
i_service_provider_name_length
)
BOZO_CLEAN
();
BOZO_end_array
(
i_service_provider_name
,
ARRAY_SIZE
(
s_decoded
.
i_service_provider_name
))
...
...
@@ -931,7 +938,8 @@ static int main_service_2(void)
BOZO_init_integer
(
i_service_type
,
0
);
BOZO_begin_array
(
i_service_name
,
i_service_name_length
,
0
)
BOZO_DOJOB
(
Service
);
BOZO_check_array
(
i_service_name
,
i_service_name_length
)
BOZO_check_array_begin
(
i_service_name
,
i_service_name_length
)
BOZO_check_array_gen
(
i_service_name
,
i_service_name_length
)
BOZO_CLEAN
();
BOZO_end_array
(
i_service_name
,
ARRAY_SIZE
(
s_decoded
.
i_service_name
))
...
...
@@ -963,7 +971,8 @@ static int main_service_3(void)
BOZO_init_integer
(
i_service_type
,
0
);
BOZO_begin_array
(
i_service_name
,
i_service_name_length
,
0
)
BOZO_DOJOB
(
Service
);
BOZO_check_array
(
i_service_name
,
i_service_name_length
)
BOZO_check_array_begin
(
i_service_name
,
i_service_name_length
)
BOZO_check_array_gen
(
i_service_name
,
i_service_name_length
)
BOZO_CLEAN
();
BOZO_end_array
(
i_service_name
,
126
)
...
...
@@ -973,7 +982,8 @@ static int main_service_3(void)
BOZO_init_integer
(
i_service_type
,
0
);
BOZO_begin_array
(
i_service_provider_name
,
i_service_provider_name_length
,
0
)
BOZO_DOJOB
(
Service
);
BOZO_check_array
(
i_service_provider_name
,
i_service_provider_name_length
)
BOZO_check_array_begin
(
i_service_provider_name
,
i_service_provider_name_length
)
BOZO_check_array_gen
(
i_service_provider_name
,
i_service_provider_name_length
)
BOZO_CLEAN
();
BOZO_end_array
(
i_service_provider_name
,
126
)
...
...
misc/test_dr.h
View file @
f321f9d2
...
...
@@ -144,17 +144,28 @@
fprintf(stdout, " Ok.\n"); \
}
#define BOZO_check_array(name, len_name) \
if( !i_err \
#define BOZO_check_array_begin(name, len_name) \
if(!i_err && s_decoded.len_name != p_new_decoded->len_name) \
{ \
fprintf(stderr, "\nError : array %s sizes not equal : %d -> %d\n", \
#name, s_decoded.len_name, p_new_decoded->len_name); \
i_err = 1; \
}
#define BOZO_check_array_gen(name, len_name) \
else if( !i_err \
&& (memcmp(s_decoded.name, p_new_decoded->name, \
s_decoded.len_name * sizeof(s_decoded.name[0])) != 0)) \
{ \
fprintf(stderr, "\nError: array %s not equal\n", #name); \
i_err = 1; \
} \
else if(!i_err && s_decoded.len_name != p_new_decoded->len_name) \
}
#define BOZO_check_array_cmp(name, len_name, type) \
else if( !i_err \
&& (compare_##type##(s_decoded.name, p_new_decoded->name, \
s_decoded.len_name) != 0)) \
{ \
fprintf(stderr, "\nError : array %s sizes not equal : %d -> %d\n", \
#name, s_decoded.len_name, p_new_decoded->len_name); \
fprintf(stderr, "\nError: array %s not equal\n", #name); \
i_err = 1; \
}
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