@@ -140,7 +140,7 @@ impl<W: Writer> WriteMessage for W {
140140
141141 match * message {
142142 Bind { portal, statement, formats, values, result_formats } => {
143- ident = Some ( 'B' ) ;
143+ ident = Some ( b 'B') ;
144144 try!( buf. write_cstr ( portal) ) ;
145145 try!( buf. write_cstr ( statement) ) ;
146146
@@ -173,22 +173,22 @@ impl<W: Writer> WriteMessage for W {
173173 try!( buf. write_be_u32 ( secret_key) ) ;
174174 }
175175 Close { variant, name } => {
176- ident = Some ( 'C' ) ;
176+ ident = Some ( b 'C') ;
177177 try!( buf. write_u8 ( variant) ) ;
178178 try!( buf. write_cstr ( name) ) ;
179179 }
180180 Describe { variant, name } => {
181- ident = Some ( 'D' ) ;
181+ ident = Some ( b 'D') ;
182182 try!( buf. write_u8 ( variant) ) ;
183183 try!( buf. write_cstr ( name) ) ;
184184 }
185185 Execute { portal, max_rows } => {
186- ident = Some ( 'E' ) ;
186+ ident = Some ( b 'E') ;
187187 try!( buf. write_cstr ( portal) ) ;
188188 try!( buf. write_be_i32 ( max_rows) ) ;
189189 }
190190 Parse { name, query, param_types } => {
191- ident = Some ( 'P' ) ;
191+ ident = Some ( b 'P') ;
192192 try!( buf. write_cstr ( name) ) ;
193193 try!( buf. write_cstr ( query) ) ;
194194 try!( buf. write_be_i16 ( param_types. len ( ) as i16 ) ) ;
@@ -197,11 +197,11 @@ impl<W: Writer> WriteMessage for W {
197197 }
198198 }
199199 PasswordMessage { password } => {
200- ident = Some ( 'p' ) ;
200+ ident = Some ( b 'p') ;
201201 try!( buf. write_cstr ( password) ) ;
202202 }
203203 Query { query } => {
204- ident = Some ( 'Q' ) ;
204+ ident = Some ( b 'Q') ;
205205 try!( buf. write_cstr ( query) ) ;
206206 }
207207 StartupMessage { version, parameters } => {
@@ -214,15 +214,15 @@ impl<W: Writer> WriteMessage for W {
214214 }
215215 SslRequest { code } => try!( buf. write_be_u32 ( code) ) ,
216216 Sync => {
217- ident = Some ( 'S' ) ;
217+ ident = Some ( b 'S') ;
218218 }
219219 Terminate => {
220- ident = Some ( 'X' ) ;
220+ ident = Some ( b 'X') ;
221221 }
222222 }
223223
224224 match ident {
225- Some ( ident) => try!( self . write_u8 ( ident as u8 ) ) ,
225+ Some ( ident) => try!( self . write_u8 ( ident) ) ,
226226 None => ( )
227227 }
228228
@@ -264,34 +264,34 @@ impl<R: Reader> ReadMessage for R {
264264 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
267- let ret = match ident as char {
268- '1' => ParseComplete ,
269- '2' => BindComplete ,
270- '3' => CloseComplete ,
271- 'A' => NotificationResponse {
267+ let ret = match ident {
268+ b '1' => ParseComplete ,
269+ b '2' => BindComplete ,
270+ b '3' => CloseComplete ,
271+ b 'A' => NotificationResponse {
272272 pid : try!( buf. read_be_u32 ( ) ) ,
273273 channel : try!( buf. read_cstr ( ) ) ,
274274 payload : try!( buf. read_cstr ( ) )
275275 } ,
276- 'C' => CommandComplete { tag : try!( buf. read_cstr ( ) ) } ,
277- 'D' => try!( read_data_row ( & mut buf) ) ,
278- 'E' => ErrorResponse { fields : try!( read_fields ( & mut buf) ) } ,
279- 'I' => EmptyQueryResponse ,
280- 'K' => BackendKeyData {
276+ b 'C' => CommandComplete { tag : try!( buf. read_cstr ( ) ) } ,
277+ b 'D' => try!( read_data_row ( & mut buf) ) ,
278+ b 'E' => ErrorResponse { fields : try!( read_fields ( & mut buf) ) } ,
279+ b 'I' => EmptyQueryResponse ,
280+ b 'K' => BackendKeyData {
281281 process_id : try!( buf. read_be_u32 ( ) ) ,
282282 secret_key : try!( buf. read_be_u32 ( ) )
283283 } ,
284- 'n' => NoData ,
285- 'N' => NoticeResponse { fields : try!( read_fields ( & mut buf) ) } ,
286- 'R' => try!( read_auth_message ( & mut buf) ) ,
287- 's' => PortalSuspended ,
288- 'S' => ParameterStatus {
284+ b 'n' => NoData ,
285+ b 'N' => NoticeResponse { fields : try!( read_fields ( & mut buf) ) } ,
286+ b 'R' => try!( read_auth_message ( & mut buf) ) ,
287+ b 's' => PortalSuspended ,
288+ b 'S' => ParameterStatus {
289289 parameter : try!( buf. read_cstr ( ) ) ,
290290 value : try!( buf. read_cstr ( ) )
291291 } ,
292- 't' => try!( read_parameter_description ( & mut buf) ) ,
293- 'T' => try!( read_row_description ( & mut buf) ) ,
294- 'Z' => ReadyForQuery { _state : try!( buf. read_u8 ( ) ) } ,
292+ b 't' => try!( read_parameter_description ( & mut buf) ) ,
293+ b 'T' => try!( read_row_description ( & mut buf) ) ,
294+ b 'Z' => ReadyForQuery { _state : try!( buf. read_u8 ( ) ) } ,
295295 ident => return Err ( IoError {
296296 kind : OtherIoError ,
297297 desc : "Unexpected message tag" ,
@@ -337,7 +337,7 @@ fn read_auth_message(buf: &mut MemReader) -> IoResult<BackendMessage> {
337337 2 => AuthenticationKerberosV5 ,
338338 3 => AuthenticationCleartextPassword ,
339339 5 => {
340- let mut salt = [ 0 , 0 , 0 , 0 ] ;
340+ let mut salt = [ 0 , .. 4 ] ;
341341 try!( buf. read_at_least ( salt. len ( ) , salt) ) ;
342342 AuthenticationMD5Password { salt : salt }
343343 } ,
0 commit comments