aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George2017-02-22 14:58:37 +1100
committerDamien George2017-02-22 14:58:37 +1100
commitd03f089baa674e046da10891be338d14346f8a3a (patch)
tree48b5909e22b24429d8cde92744128a766f40e8f4
parente859ddf3e131cc04275779667e125092a5f3be99 (diff)
cc3200/mods/modusocket: Init vars to 0 to silence compiler warnings.
Some compilers can't analyse the code to determine that these variables are always set before being used.
-rw-r--r--cc3200/mods/modusocket.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/cc3200/mods/modusocket.c b/cc3200/mods/modusocket.c
index 56e0946a7..82a85e8a2 100644
--- a/cc3200/mods/modusocket.c
+++ b/cc3200/mods/modusocket.c
@@ -422,7 +422,7 @@ STATIC mp_obj_t socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
mp_uint_t port = netutils_parse_inet_addr(addr_in, ip, NETUTILS_LITTLE);
// call the NIC to bind the socket
- int _errno;
+ int _errno = 0;
if (wlan_socket_bind(self, ip, port, &_errno) != 0) {
mp_raise_OSError(-_errno);
}
@@ -459,8 +459,8 @@ STATIC mp_obj_t socket_accept(mp_obj_t self_in) {
// accept the incoming connection
uint8_t ip[MOD_NETWORK_IPV4ADDR_BUF_SIZE];
- mp_uint_t port;
- int _errno;
+ mp_uint_t port = 0;
+ int _errno = 0;
if (wlan_socket_accept(self, socket2, ip, &port, &_errno) != 0) {
mp_raise_OSError(-_errno);
}
@@ -546,7 +546,7 @@ STATIC mp_obj_t socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_
mp_uint_t port = netutils_parse_inet_addr(addr_in, ip, NETUTILS_LITTLE);
// call the nic to sendto
- int _errno;
+ int _errno = 0;
mp_int_t ret = wlan_socket_sendto(self, bufinfo.buf, bufinfo.len, ip, port, &_errno);
if (ret < 0) {
mp_raise_OSError(-_errno);
@@ -561,8 +561,8 @@ STATIC mp_obj_t socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
vstr_t vstr;
vstr_init_len(&vstr, mp_obj_get_int(len_in));
byte ip[4];
- mp_uint_t port;
- int _errno;
+ mp_uint_t port = 0;
+ int _errno = 0;
mp_int_t ret = wlan_socket_recvfrom(self, (byte*)vstr.buf, vstr.len, ip, &port, &_errno);
if (ret < 0) {
if (_errno == MP_EAGAIN && self->sock_base.has_timeout) {