@@ -18,10 +18,10 @@ use std::{mem, ptr, str, slice};
1818use std:: fmt;
1919
2020/// The ZMQ container that manages all the sockets
21- type Context_ = * c_void ;
21+ type Context_ = * mut c_void ;
2222
2323/// A ZMQ socket
24- type Socket_ = * c_void ;
24+ type Socket_ = * mut c_void ;
2525
2626static MsgSize_ : uint = 48 ;
2727
@@ -30,26 +30,26 @@ type Msg_ = [c_char, ..MsgSize_];
3030
3131#[ link( name = "zmq" ) ]
3232extern {
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 ) ;
3434
3535 fn zmq_ctx_new ( ) -> Context_ ;
3636 fn zmq_ctx_destroy ( ctx : Context_ ) -> c_int ;
3737
3838 fn zmq_errno ( ) -> c_int ;
39- fn zmq_strerror ( errnum : c_int ) -> * c_char ;
39+ fn zmq_strerror ( errnum : c_int ) -> * const c_char ;
4040
4141 fn zmq_socket ( ctx : Context_ , typ : c_int ) -> Socket_ ;
4242 fn zmq_close ( socket : Socket_ ) -> c_int ;
4343
4444 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 ;
4646
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 ;
4949
5050 fn zmq_msg_init ( msg : & Msg_ ) -> c_int ;
5151 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 ;
5353 fn zmq_msg_size ( msg : & Msg_ ) -> size_t ;
5454 fn zmq_msg_close ( msg : & Msg_ ) -> c_int ;
5555
@@ -163,25 +163,25 @@ impl Constants {
163163
164164#[ deriving( Clone , Eq , PartialEq ) ]
165165pub 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 ,
185185 // magic number is EHAUSNUMERO + num
186186 ENOTSUP = 156384713 ,
187187 ENOBUFS = 156384715 ,
@@ -249,12 +249,12 @@ impl Error {
249249
250250// Return the current zeromq version.
251251pub 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 ;
255255
256256 unsafe {
257- zmq_version ( & major, & minor, & patch) ;
257+ zmq_version ( & mut major, & mut minor, & mut patch) ;
258258 }
259259
260260 ( major as int , minor as int , patch as int )
@@ -727,7 +727,7 @@ macro_rules! setsockopt_num(
727727 unsafe {
728728 let size = mem:: size_of:: <$ty>( ) as size_t;
729729
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) {
731731 Err ( errno_to_error( ) )
732732 } else {
733733 Ok ( ( ) )
@@ -746,7 +746,7 @@ fn setsockopt_bytes(sock: Socket_, opt: c_int, value: &[u8]) -> Result<(), Error
746746 let r = zmq_setsockopt (
747747 sock,
748748 opt,
749- value. as_ptr ( ) as * c_void ,
749+ value. as_ptr ( ) as * const c_void ,
750750 value. len ( ) as size_t
751751 ) ;
752752
0 commit comments