Mercurial > hg
comparison mcabber/connwrap/connwrap.c @ 235:f7f07794d2df
[/trunk] Changeset 248 by mikael
* Try to kill some warnings
author | mikael |
---|---|
date | Fri, 10 Jun 2005 18:42:38 +0000 |
parents | e19ad58c3cad |
children | 8ca708a0d550 |
comparison
equal
deleted
inserted
replaced
234:16793da74564 | 235:f7f07794d2df |
---|---|
275 if(ssl) { | 275 if(ssl) { |
276 if ( !(*state & CW_CONNECT_WANT_SOMETHING)) | 276 if ( !(*state & CW_CONNECT_WANT_SOMETHING)) |
277 rc = cw_connect(sockfd, serv_addr, addrlen, 0); | 277 rc = cw_connect(sockfd, serv_addr, addrlen, 0); |
278 else{ /* check if the socket is connected correctly */ | 278 else{ /* check if the socket is connected correctly */ |
279 int optlen = sizeof(int), optval; | 279 int optlen = sizeof(int), optval; |
280 if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &optval, &optlen) || optval) | 280 if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &optval, (socklen_t*)&optlen) || optval) |
281 return -1; | 281 return -1; |
282 } | 282 } |
283 | 283 |
284 if(!rc) { | 284 if(!rc) { |
285 sslsock *p; | 285 sslsock *p; |
320 #endif | 320 #endif |
321 if ( !(*state & CW_CONNECT_WANT_SOMETHING)) | 321 if ( !(*state & CW_CONNECT_WANT_SOMETHING)) |
322 rc = connect(sockfd, serv_addr, addrlen); | 322 rc = connect(sockfd, serv_addr, addrlen); |
323 else{ /* check if the socket is connected correctly */ | 323 else{ /* check if the socket is connected correctly */ |
324 int optlen = sizeof(int), optval; | 324 int optlen = sizeof(int), optval; |
325 if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &optval, &optlen) || optval) | 325 if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &optval, (socklen_t*)&optlen) || optval) |
326 return -1; | 326 return -1; |
327 *state = 0; | 327 *state = 0; |
328 return 0; | 328 return 0; |
329 } | 329 } |
330 if (rc) | 330 if (rc) |
338 int cw_accept(int s, struct sockaddr *addr, int *addrlen, int ssl) { | 338 int cw_accept(int s, struct sockaddr *addr, int *addrlen, int ssl) { |
339 #ifdef HAVE_OPENSSL | 339 #ifdef HAVE_OPENSSL |
340 int rc; | 340 int rc; |
341 | 341 |
342 if(ssl) { | 342 if(ssl) { |
343 rc = accept(s, addr, addrlen); | 343 rc = accept(s, addr, (socklen_t*)addrlen); |
344 | 344 |
345 if(!rc) { | 345 if(!rc) { |
346 sslsock *p = addsock(s); | 346 sslsock *p = addsock(s); |
347 if(SSL_accept(p->ssl) != 1) | 347 if(SSL_accept(p->ssl) != 1) |
348 return -1; | 348 return -1; |
350 } | 350 } |
351 | 351 |
352 return rc; | 352 return rc; |
353 } | 353 } |
354 #endif | 354 #endif |
355 return accept(s, addr, addrlen); | 355 return accept(s, addr, (socklen_t*)addrlen); |
356 } | 356 } |
357 | 357 |
358 int cw_write(int fd, const void *buf, int count, int ssl) { | 358 int cw_write(int fd, const void *buf, int count, int ssl) { |
359 #ifdef HAVE_OPENSSL | 359 #ifdef HAVE_OPENSSL |
360 sslsock *p; | 360 sslsock *p; |
361 | 361 |
362 if(ssl) | 362 if(ssl) |
363 if(p = getsock(fd)) | 363 if((p = getsock(fd)) != NULL) |
364 return SSL_write(p->ssl, buf, count); | 364 return SSL_write(p->ssl, buf, count); |
365 #endif | 365 #endif |
366 return write(fd, buf, count); | 366 return write(fd, buf, count); |
367 } | 367 } |
368 | 368 |
369 int cw_read(int fd, void *buf, int count, int ssl) { | 369 int cw_read(int fd, void *buf, int count, int ssl) { |
370 #ifdef HAVE_OPENSSL | 370 #ifdef HAVE_OPENSSL |
371 sslsock *p; | 371 sslsock *p; |
372 | 372 |
373 if(ssl) | 373 if(ssl) |
374 if(p = getsock(fd)) | 374 if((p = getsock(fd)) != NULL) |
375 return SSL_read(p->ssl, buf, count); | 375 return SSL_read(p->ssl, buf, count); |
376 #endif | 376 #endif |
377 return read(fd, buf, count); | 377 return read(fd, buf, count); |
378 } | 378 } |
379 | 379 |
380 int cw_close(int fd) { | 380 void cw_close(int fd) { |
381 #ifdef HAVE_OPENSSL | 381 #ifdef HAVE_OPENSSL |
382 delsock(fd); | 382 delsock(fd); |
383 #endif | 383 #endif |
384 close(fd); | 384 close(fd); |
385 } | 385 } |