Simplify various BIO_sock_* fuctions - less code, better variable names,
correct types and fewer casts.

ok deraadt@ miod@
More KNF.