@@ -3,9 +3,9 @@ use std::mem;
33
44use types:: Oid ;
55
6- pub static PROTOCOL_VERSION : i32 = 0x0003_0000 ;
7- pub static CANCEL_CODE : i32 = 80877102 ;
8- pub static SSL_CODE : i32 = 80877103 ;
6+ pub static PROTOCOL_VERSION : u32 = 0x0003_0000 ;
7+ pub static CANCEL_CODE : u32 = 80877102 ;
8+ pub static SSL_CODE : u32 = 80877103 ;
99
1010pub enum BackendMessage {
1111 AuthenticationCleartextPassword ,
@@ -18,8 +18,8 @@ pub enum BackendMessage {
1818 AuthenticationSCMCredential ,
1919 AuthenticationSSPI ,
2020 BackendKeyData {
21- pub process_id : i32 ,
22- pub secret_key : i32
21+ pub process_id : u32 ,
22+ pub secret_key : u32
2323 } ,
2424 BindComplete ,
2525 CloseComplete ,
@@ -38,7 +38,7 @@ pub enum BackendMessage {
3838 pub fields : Vec < ( u8 , String ) >
3939 } ,
4040 NotificationResponse {
41- pub pid : i32 ,
41+ pub pid : u32 ,
4242 pub channel : String ,
4343 pub payload : String ,
4444 } ,
@@ -78,9 +78,9 @@ pub enum FrontendMessage<'a> {
7878 pub result_formats : & ' a [ i16 ]
7979 } ,
8080 CancelRequest {
81- pub code : i32 ,
82- pub process_id : i32 ,
83- pub secret_key : i32 ,
81+ pub code : u32 ,
82+ pub process_id : u32 ,
83+ pub secret_key : u32 ,
8484 } ,
8585 Close {
8686 pub variant : u8 ,
@@ -106,10 +106,10 @@ pub enum FrontendMessage<'a> {
106106 pub query : & ' a str
107107 } ,
108108 SslRequest {
109- pub code : i32
109+ pub code : u32
110110 } ,
111111 StartupMessage {
112- pub version : i32 ,
112+ pub version : u32 ,
113113 pub parameters : & ' a [ ( String , String ) ]
114114 } ,
115115 Sync ,
@@ -168,9 +168,9 @@ impl<W: Writer> WriteMessage for W {
168168 }
169169 }
170170 CancelRequest { code, process_id, secret_key } => {
171- try!( buf. write_be_i32 ( code) ) ;
172- try!( buf. write_be_i32 ( process_id) ) ;
173- try!( buf. write_be_i32 ( secret_key) ) ;
171+ try!( buf. write_be_u32 ( code) ) ;
172+ try!( buf. write_be_u32 ( process_id) ) ;
173+ try!( buf. write_be_u32 ( secret_key) ) ;
174174 }
175175 Close { variant, name } => {
176176 ident = Some ( 'C' ) ;
@@ -205,14 +205,14 @@ impl<W: Writer> WriteMessage for W {
205205 try!( buf. write_cstr ( query) ) ;
206206 }
207207 StartupMessage { version, parameters } => {
208- try!( buf. write_be_i32 ( version) ) ;
208+ try!( buf. write_be_u32 ( version) ) ;
209209 for & ( ref k, ref v) in parameters. iter ( ) {
210210 try!( buf. write_cstr ( k. as_slice ( ) ) ) ;
211211 try!( buf. write_cstr ( v. as_slice ( ) ) ) ;
212212 }
213213 try!( buf. write_u8 ( 0 ) ) ;
214214 }
215- SslRequest { code } => try!( buf. write_be_i32 ( code) ) ,
215+ SslRequest { code } => try!( buf. write_be_u32 ( code) ) ,
216216 Sync => {
217217 ident = Some ( 'S' ) ;
218218 }
@@ -261,15 +261,15 @@ impl<R: Reader> ReadMessage for R {
261261 fn read_message ( & mut self ) -> IoResult < BackendMessage > {
262262 let ident = try!( self . read_u8 ( ) ) ;
263263 // subtract size of length value
264- let len = try!( self . read_be_i32 ( ) ) as uint - mem:: size_of :: < i32 > ( ) ;
264+ let len = try!( self . read_be_u32 ( ) ) as uint - mem:: size_of :: < i32 > ( ) ;
265265 let mut buf = MemReader :: new ( try!( self . read_exact ( len) ) ) ;
266266
267267 let ret = match ident as char {
268268 '1' => ParseComplete ,
269269 '2' => BindComplete ,
270270 '3' => CloseComplete ,
271271 'A' => NotificationResponse {
272- pid : try!( buf. read_be_i32 ( ) ) ,
272+ pid : try!( buf. read_be_u32 ( ) ) ,
273273 channel : try!( buf. read_cstr ( ) ) ,
274274 payload : try!( buf. read_cstr ( ) )
275275 } ,
@@ -278,8 +278,8 @@ impl<R: Reader> ReadMessage for R {
278278 'E' => ErrorResponse { fields : try!( read_fields ( & mut buf) ) } ,
279279 'I' => EmptyQueryResponse ,
280280 'K' => BackendKeyData {
281- process_id : try!( buf. read_be_i32 ( ) ) ,
282- secret_key : try!( buf. read_be_i32 ( ) )
281+ process_id : try!( buf. read_be_u32 ( ) ) ,
282+ secret_key : try!( buf. read_be_u32 ( ) )
283283 } ,
284284 'n' => NoData ,
285285 'N' => NoticeResponse { fields : try!( read_fields ( & mut buf) ) } ,
0 commit comments