Remove reflect and unsafe from header_compressed_nomemcopy

This commit is contained in:
ikawaha 2015-06-13 23:32:09 +09:00
parent eb723d5626
commit 49f71bc21c

View File

@ -103,9 +103,7 @@ func header_compressed_nomemcopy(w io.Writer) error {
"compress/gzip" "compress/gzip"
"fmt" "fmt"
"io" "io"
"reflect"
"strings" "strings"
"unsafe"
"os" "os"
"time" "time"
"io/ioutil" "io/ioutil"
@ -114,15 +112,7 @@ func header_compressed_nomemcopy(w io.Writer) error {
) )
func bindataRead(data, name string) ([]byte, error) { func bindataRead(data, name string) ([]byte, error) {
var empty [0]byte gz, err := gzip.NewReader(strings.NewReader(data))
sx := (*reflect.StringHeader)(unsafe.Pointer(&data))
b := empty[:]
bx := (*reflect.SliceHeader)(unsafe.Pointer(&b))
bx.Data = sx.Data
bx.Len = len(data)
bx.Cap = bx.Len
gz, err := gzip.NewReader(bytes.NewBuffer(b))
if err != nil { if err != nil {
return nil, fmt.Errorf("Read %%q: %%v", name, err) return nil, fmt.Errorf("Read %%q: %%v", name, err)
} }