@@ -32,17 +32,6 @@ func init() {
32
32
os .Stdout .Write ([]byte (ESC_ERASE_DISPLAY ))
33
33
}
34
34
35
- func loadImage (path string ) (iImg image.Image , imgFmt string , E error ) {
36
-
37
- pF , E := os .Open (path )
38
- if E != nil {
39
- return
40
- }
41
- defer pF .Close ()
42
-
43
- return image .Decode (pF )
44
- }
45
-
46
35
func getFile (fpath string ) (* os.File , int64 , error ) {
47
36
48
37
pF , E := os .Open (fpath )
@@ -59,17 +48,6 @@ func getFile(fpath string) (*os.File, int64, error) {
59
48
return pF , fInf .Size (), nil
60
49
}
61
50
62
- func getImgInfo (pF * os.File ) (imgCfg image.Config , fmtName string , E error ) {
63
-
64
- if imgCfg , fmtName , E = image .DecodeConfig (pF ); E != nil {
65
- return
66
- }
67
-
68
- // REWIND FILE
69
- _ , E = pF .Seek (0 , 0 )
70
- return
71
- }
72
-
73
51
type TestLogger interface {
74
52
Log (... interface {})
75
53
Logf (string , ... interface {})
@@ -106,13 +84,25 @@ func testEx(iLog TestLogger, out io.Writer, mode string, testFiles []string) err
106
84
107
85
fmt .Println (fpath )
108
86
109
- imgCfg , fmtName , e2 := getImgInfo (fIn )
87
+ imgCfg , fmtName , e2 := image .DecodeConfig (fIn )
88
+ if e2 != nil {
89
+ iLog .Log (e2 )
90
+ continue
91
+ }
92
+
93
+ _ , e2 = fIn .Seek (0 , 0 )
94
+ if e2 != nil {
95
+ iLog .Log (e2 )
96
+ continue
97
+ }
98
+
99
+ iImg , _ , e2 := image .Decode (fIn )
110
100
if e2 != nil {
111
101
iLog .Log (e2 )
112
102
continue
113
103
}
114
104
115
- iImg , _ , e2 := loadImage ( fpath )
105
+ _ , e2 = fIn . Seek ( 0 , 0 )
116
106
if e2 != nil {
117
107
iLog .Log (e2 )
118
108
continue
0 commit comments