net/os: deprecate write_str() in favor of write_string()
							parent
							
								
									8fa7e67000
								
							
						
					
					
						commit
						bb79df932b
					
				| 
						 | 
					@ -67,10 +67,16 @@ pub fn (mut c TcpConn) write(bytes []byte) ?int {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// write_str blocks and attempts to write all data
 | 
					// write_str blocks and attempts to write all data
 | 
				
			||||||
 | 
					[deprecated: 'use TcpConn.write_string() instead']
 | 
				
			||||||
pub fn (mut c TcpConn) write_str(s string) ?int {
 | 
					pub fn (mut c TcpConn) write_str(s string) ?int {
 | 
				
			||||||
	return c.write_ptr(s.str, s.len)
 | 
						return c.write_ptr(s.str, s.len)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// write_string blocks and attempts to write all data
 | 
				
			||||||
 | 
					pub fn (mut c TcpConn) write_string(s string) ?int {
 | 
				
			||||||
 | 
						return c.write_ptr(s.str, s.len)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub fn (mut c TcpConn) read_ptr(buf_ptr byteptr, len int) ?int {
 | 
					pub fn (mut c TcpConn) read_ptr(buf_ptr byteptr, len int) ?int {
 | 
				
			||||||
	mut res := wrap_read_result(C.recv(c.sock.handle, buf_ptr, len, 0)) ?
 | 
						mut res := wrap_read_result(C.recv(c.sock.handle, buf_ptr, len, 0)) ?
 | 
				
			||||||
	$if trace_tcp ? {
 | 
						$if trace_tcp ? {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -311,14 +311,9 @@ pub fn (mut f File) flush() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// write_str writes the bytes of a string into a file,
 | 
					// write_str writes the bytes of a string into a file,
 | 
				
			||||||
// *including* the terminating 0 byte.
 | 
					// *including* the terminating 0 byte.
 | 
				
			||||||
 | 
					[deprecated: 'use File.write_string() instead']
 | 
				
			||||||
pub fn (mut f File) write_str(s string) ? {
 | 
					pub fn (mut f File) write_str(s string) ? {
 | 
				
			||||||
	if !f.is_opened {
 | 
						f.write_string(s) or { return err }
 | 
				
			||||||
		return error('file is closed')
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	written := int(C.fwrite(voidptr(s.str), s.len, 1, f.cfile))
 | 
					 | 
				
			||||||
	if written == 0 && s.len != 0 {
 | 
					 | 
				
			||||||
		return error('0 bytes written')
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// read_struct reads a single struct of type `T`
 | 
					// read_struct reads a single struct of type `T`
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue