BIO ctrl cleanups
@@ -186,29 +186,25 @@ static long transport_bio_simple_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
int status = -1;
WINPR_BIO_SIMPLE_SOCKET* ptr = (WINPR_BIO_SIMPLE_SOCKET*)BIO_get_data(bio);
- if (cmd == BIO_C_SET_SOCKET)
+ switch (cmd)
{
+ case BIO_C_SET_SOCKET:
transport_bio_simple_uninit(bio);
transport_bio_simple_init(bio, (SOCKET)arg2, (int)arg1);
return 1;
- }
- else if (cmd == BIO_C_GET_SOCKET)
- {
+ case BIO_C_GET_SOCKET:
if (!BIO_get_init(bio) || !arg2)
return 0;
*((SOCKET*)arg2) = ptr->socket;
return 1;
- }
- else if (cmd == BIO_C_GET_EVENT)
- {
+ case BIO_C_GET_EVENT:
if (!BIO_get_init(bio) || !arg2)
return 0;
*((HANDLE*)arg2) = ptr->hEvent;
return 1;
- }
- else if (cmd == BIO_C_SET_NONBLOCK)
+ case BIO_C_SET_NONBLOCK:
{
#ifndef _WIN32
int flags;
@@ -227,7 +223,7 @@ static long transport_bio_simple_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
#endif
return 1;
}
- else if (cmd == BIO_C_WAIT_READ)
+ case BIO_C_WAIT_READ:
{
int timeout = (int)arg1;
int sockfd = (int)ptr->socket;
@@ -261,7 +257,8 @@ static long transport_bio_simple_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
#endif
}
- else if (cmd == BIO_C_WAIT_WRITE)
+ break;
+ case BIO_C_WAIT_WRITE:
{
int timeout = (int)arg1;
int sockfd = (int)ptr->socket;
@@ -295,6 +292,10 @@ static long transport_bio_simple_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
#endif
}
+ break;
+ default:
+ break;
+ }
switch (cmd)
{
@@ -563,7 +564,7 @@ static int transport_bio_buffered_gets(BIO* bio, char* str, int size)
static long transport_bio_buffered_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
{
- int status = -1;
+ long status = -1;
WINPR_BIO_BUFFERED_SOCKET* ptr = (WINPR_BIO_BUFFERED_SOCKET*)BIO_get_data(bio);
switch (cmd)
