aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/image/jpeg/reader.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/image/jpeg/reader.go')
-rw-r--r--src/pkg/image/jpeg/reader.go23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/pkg/image/jpeg/reader.go b/src/pkg/image/jpeg/reader.go
index 450355efae..c1fc2d590f 100644
--- a/src/pkg/image/jpeg/reader.go
+++ b/src/pkg/image/jpeg/reader.go
@@ -13,7 +13,6 @@ import (
"image/color"
"image/ycbcr"
"io"
- "os"
)
// TODO(nigeltao): fix up the doc comment style so that sentences start with
@@ -22,12 +21,12 @@ import (
// A FormatError reports that the input is not a valid JPEG.
type FormatError string
-func (e FormatError) String() string { return "invalid JPEG format: " + string(e) }
+func (e FormatError) Error() string { return "invalid JPEG format: " + string(e) }
// An UnsupportedError reports that the input uses a valid but unimplemented JPEG feature.
type UnsupportedError string
-func (e UnsupportedError) String() string { return "unsupported JPEG feature: " + string(e) }
+func (e UnsupportedError) Error() string { return "unsupported JPEG feature: " + string(e) }
// Component specification, specified in section B.2.2.
type component struct {
@@ -91,7 +90,7 @@ var unzig = [blockSize]int{
// If the passed in io.Reader does not also have ReadByte, then Decode will introduce its own buffering.
type Reader interface {
io.Reader
- ReadByte() (c byte, err os.Error)
+ ReadByte() (c byte, err error)
}
type decoder struct {
@@ -109,7 +108,7 @@ type decoder struct {
}
// Reads and ignores the next n bytes.
-func (d *decoder) ignore(n int) os.Error {
+func (d *decoder) ignore(n int) error {
for n > 0 {
m := len(d.tmp)
if m > n {
@@ -125,7 +124,7 @@ func (d *decoder) ignore(n int) os.Error {
}
// Specified in section B.2.2.
-func (d *decoder) processSOF(n int) os.Error {
+func (d *decoder) processSOF(n int) error {
switch n {
case 6 + 3*nGrayComponent:
d.nComp = nGrayComponent
@@ -172,7 +171,7 @@ func (d *decoder) processSOF(n int) os.Error {
}
// Specified in section B.2.4.1.
-func (d *decoder) processDQT(n int) os.Error {
+func (d *decoder) processDQT(n int) error {
const qtLength = 1 + blockSize
for ; n >= qtLength; n -= qtLength {
_, err := io.ReadFull(d.r, d.tmp[0:qtLength])
@@ -229,7 +228,7 @@ func (d *decoder) makeImg(h0, v0, mxx, myy int) {
}
// Specified in section B.2.3.
-func (d *decoder) processSOS(n int) os.Error {
+func (d *decoder) processSOS(n int) error {
if d.nComp == 0 {
return FormatError("missing SOF marker")
}
@@ -362,7 +361,7 @@ func (d *decoder) processSOS(n int) os.Error {
}
// Specified in section B.2.4.4.
-func (d *decoder) processDRI(n int) os.Error {
+func (d *decoder) processDRI(n int) error {
if n != 2 {
return FormatError("DRI has wrong length")
}
@@ -375,7 +374,7 @@ func (d *decoder) processDRI(n int) os.Error {
}
// decode reads a JPEG image from r and returns it as an image.Image.
-func (d *decoder) decode(r io.Reader, configOnly bool) (image.Image, os.Error) {
+func (d *decoder) decode(r io.Reader, configOnly bool) (image.Image, error) {
if rr, ok := r.(Reader); ok {
d.r = rr
} else {
@@ -451,14 +450,14 @@ func (d *decoder) decode(r io.Reader, configOnly bool) (image.Image, os.Error) {
}
// Decode reads a JPEG image from r and returns it as an image.Image.
-func Decode(r io.Reader) (image.Image, os.Error) {
+func Decode(r io.Reader) (image.Image, error) {
var d decoder
return d.decode(r, false)
}
// DecodeConfig returns the color model and dimensions of a JPEG image without
// decoding the entire image.
-func DecodeConfig(r io.Reader) (image.Config, os.Error) {
+func DecodeConfig(r io.Reader) (image.Config, error) {
var d decoder
if _, err := d.decode(r, true); err != nil {
return image.Config{}, err