Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cmp_tool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dominik Loidolt
cmp_tool
Commits
26613dd5
Commit
26613dd5
authored
Nov 21, 2022
by
Dominik Loidolt
Browse files
Options
Downloads
Patches
Plain Diff
Remove compiler warnings
parent
eb5acd39
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!12
increase code coverage, general code refactoring
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
cmp_tool.c
+1
-1
1 addition, 1 deletion
cmp_tool.c
lib/rmap.c
+6
-4
6 additions, 4 deletions
lib/rmap.c
test/cmp_entity/test_cmp_entity.c
+1
-1
1 addition, 1 deletion
test/cmp_entity/test_cmp_entity.c
test/cmp_icu/test_decmp.c
+16
-3
16 additions, 3 deletions
test/cmp_icu/test_decmp.c
with
24 additions
and
9 deletions
cmp_tool.c
+
1
−
1
View file @
26613dd5
...
...
@@ -55,7 +55,7 @@ static int compression(struct cmp_cfg *cfg, struct cmp_info *info);
static
int
decompression
(
struct
cmp_entity
*
ent
,
uint16_t
*
input_model_buf
);
/* create a default configuration for a compression data type */
static
enum
cfg_default_opt
{
DIFF_CFG
,
MODEL_CFG
};
enum
cfg_default_opt
{
DIFF_CFG
,
MODEL_CFG
};
static
int
cmp_cfg_create_default
(
struct
cmp_cfg
*
cfg
,
enum
cmp_data_type
data_type
,
enum
cfg_default_opt
mode
);
...
...
This diff is collapsed.
Click to expand it.
lib/rmap.c
+
6
−
4
View file @
26613dd5
...
...
@@ -582,12 +582,14 @@ struct rmap_pkt *rmap_pkt_from_buffer(uint8_t *buf, uint32_t len)
pkt
->
hdr_crc
=
buf
[
RMAP_HEADER_CRC
];
if
(
pkt
->
data_len
)
{
if
(
len
<
RMAP_DATA_START
+
n
+
pkt
->
data_len
+
1
)
{
/* +1 for data CRC */
printf
(
"buffer len is smaller than the contained RMAP packet; buf len: %"
PRIu32
" bytes vs RMAP: %lu bytes needed
\n
"
,
len
,
RMAP_DATA_START
+
n
+
pkt
->
data_len
);
size_t
pkt_size
=
RMAP_DATA_START
+
n
+
pkt
->
data_len
+
1
;
/* +1 for data CRC */
if
(
len
<
pkt_size
)
{
printf
(
"buffer len is smaller than the contained RMAP packet; buf len: %"
PRIu32
" bytes vs RMAP: %zu bytes needed
\n
"
,
len
,
pkt_size
);
goto
error
;
}
if
(
len
>
RMAP_DATA_START
+
n
+
pkt
->
data_len
+
1
)
/* +1 for data CRC */
if
(
len
>
pkt_size
)
printf
(
"warning: the buffer is larger than the included RMAP packet
\n
"
);
pkt
->
data
=
(
uint8_t
*
)
malloc
(
pkt
->
data_len
);
...
...
This diff is collapsed.
Click to expand it.
test/cmp_entity/test_cmp_entity.c
+
1
−
1
View file @
26613dd5
...
...
@@ -17,11 +17,11 @@
*/
#include
<stdlib.h>
#include
<string.h>
#if defined __has_include
# if __has_include(<time.h>)
# include <time.h>
# include <stdlib.h>
# define HAS_TIME_H 1
# endif
#endif
...
...
This diff is collapsed.
Click to expand it.
test/cmp_icu/test_decmp.c
+
16
−
3
View file @
26613dd5
...
...
@@ -20,6 +20,14 @@
#include
<string.h>
#include
<stdlib.h>
#if defined __has_include
# if __has_include(<time.h>)
# include <time.h>
# include <unistd.h>
# define HAS_TIME_H 1
# endif
#endif
#include
"unity.h"
#include
"compiler.h"
...
...
@@ -202,7 +210,7 @@ void test_rice_decoder(void)
uint32_t
code_word
;
unsigned
int
m
=
~
0
;
/* we don't need this value */
unsigned
int
log2_m
;
u
nsigned
in
t
decoded_cw
;
u
int32_
t
decoded_cw
;
/* test log_2 to big */
code_word
=
0xE0000000
;
...
...
@@ -271,7 +279,7 @@ void test_decode_normal(void)
uint32_t
decoded_value
=
~
0
;
int
stream_pos
,
sample
;
/* compressed data from 0 to 6; */
uint32_t
cmp_data
[]
=
{
0x5BBDF7E0
};
uint32_t
cmp_data
[
1
]
=
{
0x5BBDF7E0
};
struct
decoder_setup
setup
=
{
0
};
cpu_to_be32s
(
cmp_data
);
...
...
@@ -535,7 +543,7 @@ int my_random(unsigned int min, unsigned int max)
void
test_imagette_random
(
void
)
{
unsigned
int
seed
=
time
(
NULL
)
*
getpid
()
;
unsigned
int
seed
;
size_t
i
,
s
,
cmp_data_size
;
int
error
;
struct
cmp_cfg
cfg
;
...
...
@@ -549,6 +557,11 @@ void test_imagette_random(void)
uint16_t
*
data
,
*
model
=
NULL
,
*
up_model
=
NULL
,
*
de_up_model
=
NULL
;
/* Seeds the pseudo-random number generator used by rand() */
#if HAS_TIME_H
seed
=
time
(
NULL
)
*
getpid
();
#else
seed
=
1
;
#endif
srand
(
seed
);
printf
(
"seed: %u
\n
"
,
seed
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment