Skip to content

Commit 10b76a9

Browse files
committed
extmod/modussl_mbedtls: Allow to compile with unix coverage build.
Fixes a few C warnings. No functional changes.
1 parent 74ec52d commit 10b76a9

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

extmod/modussl_mbedtls.c

+13-6
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,30 @@ struct ssl_args {
6565

6666
STATIC const mp_obj_type_t ussl_socket_type;
6767

68-
void mbedtls_debug(void *ctx, int level, const char *file, int line, const char *str) {
68+
#ifdef MBEDTLS_DEBUG_C
69+
STATIC void mbedtls_debug(void *ctx, int level, const char *file, int line, const char *str) {
70+
(void)ctx;
71+
(void)level;
6972
printf("DBG:%s:%04d: %s\n", file, line, str);
7073
}
74+
#endif
7175

7276
// TODO: FIXME!
73-
int null_entropy_func(void *data, unsigned char *output, size_t len) {
77+
STATIC int null_entropy_func(void *data, unsigned char *output, size_t len) {
78+
(void)data;
79+
(void)output;
80+
(void)len;
7481
// enjoy random bytes
7582
return 0;
7683
}
7784

78-
int _mbedtls_ssl_send(void *ctx, const byte *buf, size_t len) {
85+
STATIC int _mbedtls_ssl_send(void *ctx, const byte *buf, size_t len) {
7986
mp_obj_t sock = *(mp_obj_t*)ctx;
8087

8188
const mp_stream_p_t *sock_stream = mp_get_stream_raise(sock, MP_STREAM_OP_WRITE);
8289
int err;
8390

84-
int out_sz = sock_stream->write(sock, buf, len, &err);
91+
mp_uint_t out_sz = sock_stream->write(sock, buf, len, &err);
8592
if (out_sz == MP_STREAM_ERROR) {
8693
if (mp_is_nonblocking_error(err)) {
8794
return MBEDTLS_ERR_SSL_WANT_WRITE;
@@ -92,13 +99,13 @@ int _mbedtls_ssl_send(void *ctx, const byte *buf, size_t len) {
9299
}
93100
}
94101

95-
int _mbedtls_ssl_recv(void *ctx, byte *buf, size_t len) {
102+
STATIC int _mbedtls_ssl_recv(void *ctx, byte *buf, size_t len) {
96103
mp_obj_t sock = *(mp_obj_t*)ctx;
97104

98105
const mp_stream_p_t *sock_stream = mp_get_stream_raise(sock, MP_STREAM_OP_READ);
99106
int err;
100107

101-
int out_sz = sock_stream->read(sock, buf, len, &err);
108+
mp_uint_t out_sz = sock_stream->read(sock, buf, len, &err);
102109
if (out_sz == MP_STREAM_ERROR) {
103110
if (mp_is_nonblocking_error(err)) {
104111
return MBEDTLS_ERR_SSL_WANT_READ;

0 commit comments

Comments
 (0)