mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
Step 1 of the Big Error Shift: make os.Error an interface and replace *os.Errors with os.Errors.
lib/template updated to use new setup; its clients also updated. Step 2 will make os's error support internally much cleaner. R=rsc OCL=27586 CL=27586
This commit is contained in:
parent
3ea8d854a3
commit
aaf63f8d06
57 changed files with 341 additions and 339 deletions
|
|
@ -30,7 +30,7 @@ func newByteReader(p []byte) io.Read {
|
|||
return b
|
||||
}
|
||||
|
||||
func (b *byteReader) Read(p []byte) (int, *os.Error) {
|
||||
func (b *byteReader) Read(p []byte) (int, os.Error) {
|
||||
n := len(p);
|
||||
if n > len(b.p) {
|
||||
n = len(b.p)
|
||||
|
|
@ -52,7 +52,7 @@ func newHalfByteReader(p []byte) io.Read {
|
|||
return b
|
||||
}
|
||||
|
||||
func (b *halfByteReader) Read(p []byte) (int, *os.Error) {
|
||||
func (b *halfByteReader) Read(p []byte) (int, os.Error) {
|
||||
n := len(p)/2;
|
||||
if n == 0 && len(p) > 0 {
|
||||
n = 1
|
||||
|
|
@ -76,7 +76,7 @@ func newRot13Reader(r io.Read) *rot13Reader {
|
|||
return r13
|
||||
}
|
||||
|
||||
func (r13 *rot13Reader) Read(p []byte) (int, *os.Error) {
|
||||
func (r13 *rot13Reader) Read(p []byte) (int, os.Error) {
|
||||
n, e := r13.r.Read(p);
|
||||
if e != nil {
|
||||
return n, e
|
||||
|
|
@ -218,7 +218,7 @@ func TestBufRead(t *testing.T) {
|
|||
}
|
||||
|
||||
type writeBuffer interface {
|
||||
Write(p []byte) (int, *os.Error);
|
||||
Write(p []byte) (int, os.Error);
|
||||
GetBytes() []byte
|
||||
}
|
||||
|
||||
|
|
@ -232,7 +232,7 @@ func newByteWriter() writeBuffer {
|
|||
return new(byteWriter)
|
||||
}
|
||||
|
||||
func (w *byteWriter) Write(p []byte) (int, *os.Error) {
|
||||
func (w *byteWriter) Write(p []byte) (int, os.Error) {
|
||||
if w.p == nil {
|
||||
w.p = make([]byte, len(p)+100)
|
||||
} else if w.n + len(p) >= len(w.p) {
|
||||
|
|
@ -262,7 +262,7 @@ func newHalfByteWriter() writeBuffer {
|
|||
return w
|
||||
}
|
||||
|
||||
func (w *halfByteWriter) Write(p []byte) (int, *os.Error) {
|
||||
func (w *halfByteWriter) Write(p []byte) (int, os.Error) {
|
||||
n := (len(p)+1) / 2;
|
||||
// BUG return w.bw.Write(p[0:n])
|
||||
r, e := w.bw.Write(p[0:n]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue