File tree Expand file tree Collapse file tree 6 files changed +13
-13
lines changed Expand file tree Collapse file tree 6 files changed +13
-13
lines changed Original file line number Diff line number Diff line change 4
4
5
5
require (
6
6
github.com/alecthomas/assert/v2 v2.0.2
7
- github.com/tetratelabs/wazero v1.0.0-pre.4
7
+ github.com/tetratelabs/wazero v1.0.1
8
8
github.com/yeqown/go-qrcode/v2 v2.2.1
9
9
github.com/yeqown/go-qrcode/writer/standard v1.2.1
10
10
golang.org/x/exp v0.0.0-20220827204233-334a2380cb91
Original file line number Diff line number Diff line change @@ -14,8 +14,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
14
14
github.com/pkg/errors v0.9.1 /go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0 =
15
15
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM =
16
16
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY =
17
- github.com/tetratelabs/wazero v1.0.0-pre.4 h1:RBJQT5OzmORkSp6MmZDWoFEr0zXjk4pmvMKAdeUnsaI =
18
- github.com/tetratelabs/wazero v1.0.0-pre.4 /go.mod h1:u8wrFmpdrykiFK0DFPiFm5a4+0RzsdmXYVtijBKqUVo =
17
+ github.com/tetratelabs/wazero v1.0.1 h1:xyWBoGyMjYekG3mEQ/W7xm9E05S89kJ/at696d/9yuc =
18
+ github.com/tetratelabs/wazero v1.0.1 /go.mod h1:wYx2gNRg8/WihJfSDxA1TIL8H+GkfLYm+bIfbblu9VQ =
19
19
github.com/yeqown/go-qrcode/v2 v2.2.1 h1:Jc1Q916fwC05R8C7mpWDbrT9tyLPaLLKDABoC5XBCe8 =
20
20
github.com/yeqown/go-qrcode/v2 v2.2.1 /go.mod h1:2Qsk2APUCPne0TsRo40DIkI5MYnbzYKCnKGEFWrxd24 =
21
21
github.com/yeqown/go-qrcode/writer/standard v1.2.1 h1:FMRZiur5yApUIe4fqtqmcdl/XQTZAZWt2DhkPx4VIW0 =
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ func (s *Scanner) ReadAll(img image.Image) ([][]byte, error) {
90
90
return nil , err
91
91
}
92
92
93
- data := [][]byte {}
93
+ var data [][]byte
94
94
symbol , next := s .getSymbols (zbarImg )
95
95
96
96
for next {
@@ -149,9 +149,9 @@ func (s *Scanner) createImage(i image.Image) img {
149
149
150
150
switch i := i .(type ) {
151
151
case * image.Gray :
152
- s .mod .Memory ().Write (ctx , buf , i .Pix )
152
+ s .mod .Memory ().Write (buf , i .Pix )
153
153
default :
154
- s .mod .Memory ().Write (ctx , buf , toGray (i ).Pix )
154
+ s .mod .Memory ().Write (buf , toGray (i ).Pix )
155
155
}
156
156
157
157
var zbarImg img
@@ -224,7 +224,7 @@ type Reader struct {
224
224
// Read reads a symbol into b
225
225
//
226
226
// Make sure not to Call (*Reader).Next() before
227
- // receiving io.EOF. Otherwise, the remaning data
227
+ // receiving io.EOF. Otherwise, the remaining data
228
228
// will be skipped.
229
229
// The reader may return
230
230
//
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ func newZbarInstance() (wazero.Runtime, api.Module) {
25
25
wasi_snapshot_preview1 .MustInstantiate (ctx , r )
26
26
emscripten .MustInstantiate (ctx , r )
27
27
28
- zbar := must (r .InstantiateModuleFromBinary (ctx , zbarWasm ))
28
+ zbar := must (r .Instantiate (ctx , zbarWasm ))
29
29
return r , zbar
30
30
}
31
31
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ func Test_E2E(t *testing.T) {
51
51
52
52
res , err := zbar .ReadAll (img )
53
53
assert .NoError (t , err )
54
- assert .Equal (t , [] byte ( random ) , res [0 ])
54
+ assert .Equal (t , random , res [0 ])
55
55
56
56
res = [][]byte {{}}
57
57
r , err := zbar .Read (img )
@@ -63,6 +63,6 @@ func Test_E2E(t *testing.T) {
63
63
}
64
64
65
65
assert .NoError (t , err )
66
- assert .Equal (t , [][]byte {[] byte ( random ) }, res )
66
+ assert .Equal (t , [][]byte {random }, res )
67
67
68
68
}
Original file line number Diff line number Diff line change @@ -28,18 +28,18 @@ func newSymbol(ptr uint32, zbar api.Module) symbol {
28
28
29
29
func (s * symbol ) read (b []byte , offset uint32 ) (uint32 , bool ) {
30
30
if offset + uint32 (len (b )) < s .len {
31
- b2 , _ := s .mod .Memory ().Read (ctx , s .data + offset , uint32 (len (b )))
31
+ b2 , _ := s .mod .Memory ().Read (s .data + offset , uint32 (len (b )))
32
32
copy (b , b2 )
33
33
return uint32 (len (b )), true
34
34
}
35
35
36
- b2 , _ := s .mod .Memory ().Read (ctx , s .data + offset , s .len - offset )
36
+ b2 , _ := s .mod .Memory ().Read (s .data + offset , s .len - offset )
37
37
copy (b , b2 )
38
38
return s .len - offset , false
39
39
}
40
40
41
41
func (s * symbol ) readAll () []byte {
42
- b , ok := s .mod .Memory ().Read (ctx , s .data , s .len )
42
+ b , ok := s .mod .Memory ().Read (s .data , s .len )
43
43
if ! ok {
44
44
return nil
45
45
}
You can’t perform that action at this time.
0 commit comments