Skip to content

Commit

Permalink
Fix #795, WIP applied style
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Feb 19, 2021
1 parent 5c78d08 commit 9e4a8e5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/os/portable/os-impl-bsd-sockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,8 +565,8 @@ int32 OS_SocketAddrInit_Impl(OS_SockAddr_t *Addr, OS_SocketDomain_t Domain)
return OS_ERR_NOT_IMPLEMENTED;
}

Addr->ActualLength = OSAL_SIZE_C(addrlen);
Accessor->sa.sa_family = sa_family;
Addr->ActualLength = OSAL_SIZE_C(addrlen);
Accessor->sa.sa_family = sa_family;

return OS_SUCCESS;
} /* end OS_SocketAddrInit_Impl */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ void Test_OS_SocketOpen_Impl(void)
OS_object_token_t token = {0};

/* Set up token for index 0 */
token.obj_idx = UT_INDEX_0;
token.obj_idx = UT_INDEX_0;

/* Invalid socket type */
OS_stream_table[0].socket_type = -1;
OSAPI_TEST_FUNCTION_RC(OS_SocketOpen_Impl, (&token), OS_ERR_NOT_IMPLEMENTED);

/* Invalid domain type */
OS_stream_table[0].socket_type = OS_SocketType_DATAGRAM;
OS_stream_table[0].socket_type = OS_SocketType_DATAGRAM;
OS_stream_table[0].socket_domain = -1;
OSAPI_TEST_FUNCTION_RC(OS_SocketOpen_Impl, (&token), OS_ERR_NOT_IMPLEMENTED);

Expand All @@ -52,10 +52,9 @@ void Test_OS_SocketOpen_Impl(void)
OSAPI_TEST_FUNCTION_RC(OS_SocketOpen_Impl, (&token), OS_ERROR);

/* Success case */
OS_stream_table[0].socket_type = OS_SocketType_STREAM;
OS_stream_table[0].socket_type = OS_SocketType_STREAM;
OS_stream_table[0].socket_domain = OS_SocketDomain_INET6;
OSAPI_TEST_FUNCTION_RC(OS_SocketOpen_Impl, (&token), OS_SUCCESS);

}

/* ------------------- End of test cases --------------------------------------*/
Expand Down
2 changes: 1 addition & 1 deletion src/unit-test-coverage/ut-stubs/inc/OCS_sys_socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
/* ----------------------------------------- */
/* types normally defined in sys/socket.h */
/* ----------------------------------------- */
typedef size_t OCS_socklen_t;
typedef size_t OCS_socklen_t;
typedef unsigned short int OCS_sa_family_t;

struct OCS_sockaddr
Expand Down
5 changes: 2 additions & 3 deletions src/unit-test-coverage/ut-stubs/src/sys-socket-stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,13 @@ int OCS_listen(int fd, int n)
return UT_DEFAULT_IMPL(OCS_listen);
}

OCS_ssize_t OCS_recvfrom(int fd, void *buf, size_t n, int flags, struct OCS_sockaddr *addr,
OCS_socklen_t *addr_len)
OCS_ssize_t OCS_recvfrom(int fd, void *buf, size_t n, int flags, struct OCS_sockaddr *addr, OCS_socklen_t *addr_len)
{
return UT_DEFAULT_IMPL(OCS_recvfrom);
}

OCS_ssize_t OCS_sendto(int fd, const void *buf, size_t n, int flags, const struct OCS_sockaddr *addr,
OCS_socklen_t addr_len)
OCS_socklen_t addr_len)
{
return UT_DEFAULT_IMPL(OCS_sendto);
}
Expand Down

0 comments on commit 9e4a8e5

Please sign in to comment.