mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
spa: small cleanups
Initialize result variable. Use strncpy to avoid warnings about using non-NULL terminaded strings.
This commit is contained in:
parent
01cb3fa862
commit
469b7b0148
7 changed files with 9 additions and 9 deletions
|
|
@ -557,7 +557,7 @@ impl_node_port_set_param(void *object,
|
||||||
{
|
{
|
||||||
struct state *this = object;
|
struct state *this = object;
|
||||||
struct port *port;
|
struct port *port;
|
||||||
int res;
|
int res = 0;
|
||||||
|
|
||||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -557,7 +557,7 @@ impl_node_port_set_param(void *object,
|
||||||
{
|
{
|
||||||
struct state *this = object;
|
struct state *this = object;
|
||||||
struct port *port;
|
struct port *port;
|
||||||
int res;
|
int res = 0;
|
||||||
|
|
||||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -715,7 +715,7 @@ static int impl_node_port_set_param(void *object,
|
||||||
uint32_t id, uint32_t flags,
|
uint32_t id, uint32_t flags,
|
||||||
const struct spa_pod *param)
|
const struct spa_pod *param)
|
||||||
{
|
{
|
||||||
int res;
|
int res = 0;
|
||||||
struct impl *this = object;
|
struct impl *this = object;
|
||||||
struct port *port;
|
struct port *port;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -920,7 +920,7 @@ on_socket_io(void *data, int fd, uint32_t mask)
|
||||||
if (len < (int)sizeof(struct nj2_session_params))
|
if (len < (int)sizeof(struct nj2_session_params))
|
||||||
goto short_packet;
|
goto short_packet;
|
||||||
|
|
||||||
if (strcmp(params.type, "params") != 0)
|
if (strncmp(params.type, "params", sizeof(params.type)) != 0)
|
||||||
goto wrong_type;
|
goto wrong_type;
|
||||||
|
|
||||||
switch(ntohl(params.packet_id)) {
|
switch(ntohl(params.packet_id)) {
|
||||||
|
|
|
||||||
|
|
@ -434,7 +434,7 @@ on_setup_io(void *data, int fd, uint32_t mask)
|
||||||
if (len < (int)sizeof(params))
|
if (len < (int)sizeof(params))
|
||||||
goto short_packet;
|
goto short_packet;
|
||||||
|
|
||||||
if (strcmp(params.type, "params") != 0)
|
if (strncmp(params.type, "params", sizeof(params.type)) != 0)
|
||||||
goto wrong_type;
|
goto wrong_type;
|
||||||
|
|
||||||
switch(ntohl(params.packet_id)) {
|
switch(ntohl(params.packet_id)) {
|
||||||
|
|
@ -1072,7 +1072,7 @@ on_socket_io(void *data, int fd, uint32_t mask)
|
||||||
if (len < (int)sizeof(params))
|
if (len < (int)sizeof(params))
|
||||||
goto short_packet;
|
goto short_packet;
|
||||||
|
|
||||||
if (strcmp(params.type, "params") != 0)
|
if (strncmp(params.type, "params", sizeof(params.type)) != 0)
|
||||||
goto wrong_type;
|
goto wrong_type;
|
||||||
|
|
||||||
switch(ntohl(params.packet_id)) {
|
switch(ntohl(params.packet_id)) {
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ static inline void nj2_session_params_hton(struct nj2_session_params *net,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct nj2_packet_header {
|
struct nj2_packet_header {
|
||||||
char type[8]; /* packet type ('headr') */
|
char type[8]; /* packet type ('header') */
|
||||||
uint32_t data_type; /* 'a' for audio, 'm' for midi and 's' for sync */
|
uint32_t data_type; /* 'a' for audio, 'm' for midi and 's' for sync */
|
||||||
uint32_t data_stream; /* 's' for send, 'r' for return */
|
uint32_t data_stream; /* 's' for send, 'r' for return */
|
||||||
uint32_t id; /* unique ID of the follower */
|
uint32_t id; /* unique ID of the follower */
|
||||||
|
|
|
||||||
|
|
@ -663,7 +663,7 @@ static inline int32_t netjack2_driver_sync_wait(struct netjack2_peer *peer)
|
||||||
if (len >= (ssize_t)sizeof(sync)) {
|
if (len >= (ssize_t)sizeof(sync)) {
|
||||||
//nj2_dump_packet_header(&sync);
|
//nj2_dump_packet_header(&sync);
|
||||||
|
|
||||||
if (strcmp(sync.type, "header") == 0 &&
|
if (strncmp(sync.type, "header", sizeof(sync.type)) == 0 &&
|
||||||
ntohl(sync.data_type) == 's' &&
|
ntohl(sync.data_type) == 's' &&
|
||||||
ntohl(sync.data_stream) == peer->other_stream &&
|
ntohl(sync.data_stream) == peer->other_stream &&
|
||||||
ntohl(sync.id) == peer->params.id)
|
ntohl(sync.id) == peer->params.id)
|
||||||
|
|
@ -695,7 +695,7 @@ static inline int32_t netjack2_manager_sync_wait(struct netjack2_peer *peer)
|
||||||
if (len >= (ssize_t)sizeof(sync)) {
|
if (len >= (ssize_t)sizeof(sync)) {
|
||||||
//nj2_dump_packet_header(sync);
|
//nj2_dump_packet_header(sync);
|
||||||
|
|
||||||
if (strcmp(sync.type, "header") == 0 &&
|
if (strncmp(sync.type, "header", sizeof(sync.type)) == 0 &&
|
||||||
ntohl(sync.data_type) == 's' &&
|
ntohl(sync.data_type) == 's' &&
|
||||||
ntohl(sync.data_stream) == peer->other_stream &&
|
ntohl(sync.data_stream) == peer->other_stream &&
|
||||||
ntohl(sync.id) == peer->params.id)
|
ntohl(sync.id) == peer->params.id)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue