~adedov/libiqxmlrpc/old

« back to all changes in this revision

Viewing changes to libiqxmlrpc/ssl_connection.cc

  • Committer: Anton Dedov
  • Date: 2013-04-12 11:59:12 UTC
  • Revision ID: adedov@gmail.com-20130412115912-706hkgpi5ydd1btq
Windows 2012 compilationi fixes (by Sergey Rylkov):
* Better support for 64bit: s/unsigned/size_t/
* Fix compilation issues
* Replace _WINDOWS with WIN32

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
  if( !ssl )
20
20
    throw ssl::exception();
21
21
 
22
 
  if( !SSL_set_fd( ssl, sock.get_handler() ) )
 
22
  if( !SSL_set_fd( ssl, static_cast<int>(sock.get_handler()) ) )
23
23
    throw ssl::exception();
24
24
}
25
25
 
82
82
}
83
83
 
84
84
 
85
 
int ssl::Connection::send( const char* data, int len )
 
85
size_t ssl::Connection::send( const char* data, size_t len )
86
86
{
87
 
  int ret = SSL_write( ssl, data, len );
 
87
  int ret = SSL_write( ssl, data, static_cast<int>(len) );
88
88
 
89
 
  if( ret != len )
 
89
  if( static_cast<size_t>(ret) != len )
90
90
    throw_io_exception( ssl, ret );
91
91
 
92
 
  return ret;
 
92
  return static_cast<size_t>(ret);
93
93
}
94
94
 
95
95
 
96
 
int ssl::Connection::recv( char* buf, int len )
 
96
size_t ssl::Connection::recv( char* buf, size_t len )
97
97
{
98
 
  int ret = SSL_read( ssl, buf, len );
 
98
  int ret = SSL_read( ssl, buf, static_cast<int>(len) );
99
99
 
100
100
  if( ret <= 0 )
101
101
    throw_io_exception( ssl, ret );
102
102
 
103
 
  return ret;
 
103
  return static_cast<size_t>(ret);
104
104
}
105
105
 
106
106
 
107
107
inline bool ssl::Connection::shutdown_recved()
108
108
{
109
 
  return SSL_get_shutdown(ssl) & SSL_RECEIVED_SHUTDOWN;
 
109
  return (SSL_get_shutdown(ssl) & SSL_RECEIVED_SHUTDOWN) != 0;
110
110
}
111
111
 
112
112
 
225
225
}
226
226
 
227
227
 
228
 
int ssl::Reaction_connection::try_recv()
 
228
size_t ssl::Reaction_connection::try_recv()
229
229
{
230
 
  int ln = recv( recv_buf, buf_len );
 
230
  size_t ln = recv( recv_buf, buf_len );
231
231
  state = EMPTY;
232
232
 
233
233
  return ln;
270
270
}
271
271
 
272
272
 
273
 
void ssl::Reaction_connection::reg_send( const char* buf, int len )
 
273
void ssl::Reaction_connection::reg_send( const char* buf, size_t len )
274
274
{
275
275
  state = WRITING;
276
276
  send_buf = buf;
279
279
}
280
280
 
281
281
 
282
 
void ssl::Reaction_connection::reg_recv( char* buf, int len )
 
282
void ssl::Reaction_connection::reg_recv( char* buf, size_t len )
283
283
{
284
284
  state = READING;
285
285
  recv_buf = buf;