}
func isWS(b byte) bool {
- return bytes.IndexByte([]byte("\t\n\x0C\r "), b) != -1
+ switch b {
+ case '\t', '\n', '\x0c', '\r', ' ':
+ return true
+ }
+ return false
}
type sniffSig interface {
return "text/html; charset=utf-8"
}
+var mp4ftype = []byte("ftyp")
+
type mp4Sig int
func (mp4Sig) match(data []byte, firstNonWS int) string {
if boxSize%4 != 0 || len(data) < boxSize {
return ""
}
- if !bytes.Equal(data[4:8], []byte("ftyp")) {
+ if !bytes.Equal(data[4:8], mp4ftype) {
return ""
}
for st := 8; st < boxSize; st += 4 {