@@ -18,10 +18,10 @@ use std::{mem, ptr, str, slice};
18
18
use std:: fmt;
19
19
20
20
/// The ZMQ container that manages all the sockets
21
- type Context_ = * c_void ;
21
+ type Context_ = * mut c_void ;
22
22
23
23
/// A ZMQ socket
24
- type Socket_ = * c_void ;
24
+ type Socket_ = * mut c_void ;
25
25
26
26
static MsgSize_ : uint = 48 ;
27
27
@@ -30,26 +30,26 @@ type Msg_ = [c_char, ..MsgSize_];
30
30
31
31
#[ link( name = "zmq" ) ]
32
32
extern {
33
- fn zmq_version ( major : * c_int , minor : * c_int , patch : * c_int ) ;
33
+ fn zmq_version ( major : * mut c_int , minor : * mut c_int , patch : * mut c_int ) ;
34
34
35
35
fn zmq_ctx_new ( ) -> Context_ ;
36
36
fn zmq_ctx_destroy ( ctx : Context_ ) -> c_int ;
37
37
38
38
fn zmq_errno ( ) -> c_int ;
39
- fn zmq_strerror ( errnum : c_int ) -> * c_char ;
39
+ fn zmq_strerror ( errnum : c_int ) -> * const c_char ;
40
40
41
41
fn zmq_socket ( ctx : Context_ , typ : c_int ) -> Socket_ ;
42
42
fn zmq_close ( socket : Socket_ ) -> c_int ;
43
43
44
44
fn zmq_getsockopt ( socket : Socket_ , opt : c_int , optval : * mut c_void , size : * mut size_t ) -> c_int ;
45
- fn zmq_setsockopt ( socket : Socket_ , opt : c_int , optval : * c_void , size : size_t ) -> c_int ;
45
+ fn zmq_setsockopt ( socket : Socket_ , opt : c_int , optval : * const c_void , size : size_t ) -> c_int ;
46
46
47
- fn zmq_bind ( socket : Socket_ , endpoint : * c_char ) -> c_int ;
48
- fn zmq_connect ( socket : Socket_ , endpoint : * c_char ) -> c_int ;
47
+ fn zmq_bind ( socket : Socket_ , endpoint : * const c_char ) -> c_int ;
48
+ fn zmq_connect ( socket : Socket_ , endpoint : * const c_char ) -> c_int ;
49
49
50
50
fn zmq_msg_init ( msg : & Msg_ ) -> c_int ;
51
51
fn zmq_msg_init_size ( msg : & Msg_ , size : size_t ) -> c_int ;
52
- fn zmq_msg_data ( msg : & Msg_ ) -> * u8 ;
52
+ fn zmq_msg_data ( msg : & Msg_ ) -> * const u8 ;
53
53
fn zmq_msg_size ( msg : & Msg_ ) -> size_t ;
54
54
fn zmq_msg_close ( msg : & Msg_ ) -> c_int ;
55
55
@@ -163,25 +163,25 @@ impl Constants {
163
163
164
164
#[ deriving( Clone , Eq , PartialEq ) ]
165
165
pub enum Error {
166
- EACCES = posix88:: EACCES ,
167
- EADDRINUSE = posix88:: EADDRINUSE ,
168
- EAGAIN = posix88:: EAGAIN ,
169
- EBUSY = posix88:: EBUSY ,
170
- ECONNREFUSED = posix88:: ECONNREFUSED ,
171
- EFAULT = posix88:: EFAULT ,
172
- EHOSTUNREACH = posix88:: EHOSTUNREACH ,
173
- EINPROGRESS = posix88:: EINPROGRESS ,
174
- EINVAL = posix88:: EINVAL ,
175
- EMFILE = posix88:: EMFILE ,
176
- EMSGSIZE = posix88:: EMSGSIZE ,
177
- ENAMETOOLONG = posix88:: ENAMETOOLONG ,
178
- ENODEV = posix88:: ENODEV ,
179
- ENOENT = posix88:: ENOENT ,
180
- ENOMEM = posix88:: ENOMEM ,
181
- ENOTCONN = posix88:: ENOTCONN ,
182
- ENOTSOCK = posix88:: ENOTSOCK ,
183
- EPROTO = posix88:: EPROTO ,
184
- EPROTONOSUPPORT = posix88:: EPROTONOSUPPORT ,
166
+ EACCES = posix88:: EACCES as int ,
167
+ EADDRINUSE = posix88:: EADDRINUSE as int ,
168
+ EAGAIN = posix88:: EAGAIN as int ,
169
+ EBUSY = posix88:: EBUSY as int ,
170
+ ECONNREFUSED = posix88:: ECONNREFUSED as int ,
171
+ EFAULT = posix88:: EFAULT as int ,
172
+ EHOSTUNREACH = posix88:: EHOSTUNREACH as int ,
173
+ EINPROGRESS = posix88:: EINPROGRESS as int ,
174
+ EINVAL = posix88:: EINVAL as int ,
175
+ EMFILE = posix88:: EMFILE as int ,
176
+ EMSGSIZE = posix88:: EMSGSIZE as int ,
177
+ ENAMETOOLONG = posix88:: ENAMETOOLONG as int ,
178
+ ENODEV = posix88:: ENODEV as int ,
179
+ ENOENT = posix88:: ENOENT as int ,
180
+ ENOMEM = posix88:: ENOMEM as int ,
181
+ ENOTCONN = posix88:: ENOTCONN as int ,
182
+ ENOTSOCK = posix88:: ENOTSOCK as int ,
183
+ EPROTO = posix88:: EPROTO as int ,
184
+ EPROTONOSUPPORT = posix88:: EPROTONOSUPPORT as int ,
185
185
// magic number is EHAUSNUMERO + num
186
186
ENOTSUP = 156384713 ,
187
187
ENOBUFS = 156384715 ,
@@ -249,12 +249,12 @@ impl Error {
249
249
250
250
// Return the current zeromq version.
251
251
pub fn version ( ) -> ( int , int , int ) {
252
- let major = 0 ;
253
- let minor = 0 ;
254
- let patch = 0 ;
252
+ let mut major = 0 ;
253
+ let mut minor = 0 ;
254
+ let mut patch = 0 ;
255
255
256
256
unsafe {
257
- zmq_version ( & major, & minor, & patch) ;
257
+ zmq_version ( & mut major, & mut minor, & mut patch) ;
258
258
}
259
259
260
260
( major as int , minor as int , patch as int )
@@ -727,7 +727,7 @@ macro_rules! setsockopt_num(
727
727
unsafe {
728
728
let size = mem:: size_of:: <$ty>( ) as size_t;
729
729
730
- if -1 == zmq_setsockopt( sock, opt, ( & value as * $ty) as * c_void, size) {
730
+ if -1 == zmq_setsockopt( sock, opt, ( & value as * const $ty) as * const c_void, size) {
731
731
Err ( errno_to_error( ) )
732
732
} else {
733
733
Ok ( ( ) )
@@ -746,7 +746,7 @@ fn setsockopt_bytes(sock: Socket_, opt: c_int, value: &[u8]) -> Result<(), Error
746
746
let r = zmq_setsockopt (
747
747
sock,
748
748
opt,
749
- value. as_ptr ( ) as * c_void ,
749
+ value. as_ptr ( ) as * const c_void ,
750
750
value. len ( ) as size_t
751
751
) ;
752
752
0 commit comments