fixed initialization issues in nwad-skad conversion functions

This commit is contained in:
hyung-hwan 2021-08-19 18:28:05 +00:00
parent dfd51e44f3
commit b1586e903f
2 changed files with 11 additions and 1 deletions

View File

@ -525,7 +525,7 @@ qse_mchar_t* SocketAddress::toStrBuf (qse_mchar_t* buf, qse_size_t len) const QS
{ {
qse_nwad_t nwad; qse_nwad_t nwad;
qse_skadtonwad (&this->skad, &nwad); qse_skadtonwad (&this->skad, &nwad);
qse_nwadtombs (&nwad, buf, len, QSE_NWADTOWCS_ALL); qse_nwadtombs (&nwad, buf, len, QSE_NWADTOMBS_ALL);
return buf; return buf;
} }

View File

@ -164,6 +164,8 @@ static QSE_INLINE int skad_to_nwad (const sockaddr_t* skad, qse_nwad_t* nwad)
} }
#endif #endif
default: default:
QSE_MEMSET (nwad, 0, QSE_SIZEOF(*nwad));
nwad->type = QSE_NWAD_NX;
break; break;
} }
@ -237,6 +239,14 @@ static QSE_INLINE int nwad_to_skad (const qse_nwad_t* nwad, sockaddr_t* skad)
break; break;
} }
default:
{
struct sockaddr* sa;
sa = (struct sockaddr*)skad;
QSE_MEMSET (sa, 0, QSE_SIZEOF(*sa));
sa->sa_family = AF_UNSPEC;
break;
}
} }
return addrsize; return addrsize;