Skip to content

Commit

Permalink
Make all comments sentences
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-vasile committed Oct 6, 2019
1 parent d39c541 commit 3b3d620
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
6 changes: 3 additions & 3 deletions internal/matchers/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,21 @@ func Ar(in []byte) bool {
return bytes.HasPrefix(in, []byte{0x21, 0x3C, 0x61, 0x72, 0x63, 0x68, 0x3E})
}

// Deb matches a Debian package file
// Deb matches a Debian package file.
func Deb(in []byte) bool {
return len(in) > 8 && bytes.HasPrefix(in[8:], []byte{0x64, 0x65, 0x62, 0x69,
0x61, 0x6E, 0x2D, 0x62, 0x69, 0x6E, 0x61, 0x72, 0x79})
}

// Rar matches a RAR archive file
// Rar matches a RAR archive file.
func Rar(in []byte) bool {
if !bytes.HasPrefix(in, []byte{0x52, 0x61, 0x72, 0x21, 0x1A, 0x07}) {
return false
}
return len(in) > 8 && (bytes.Equal(in[6:8], []byte{0x01, 0x00}) || in[6] == 0x00)
}

// Warc matches a Web ARChive file
// Warc matches a Web ARChive file.
func Warc(in []byte) bool {
return bytes.HasPrefix(in, []byte("WARC/"))
}
6 changes: 3 additions & 3 deletions internal/matchers/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ func Pdf(in []byte) bool {
return bytes.HasPrefix(in, []byte{0x25, 0x50, 0x44, 0x46})
}

// DjVu matches a DjVu file
// DjVu matches a DjVu file.
func DjVu(in []byte) bool {
if !bytes.HasPrefix(in, []byte{0x41, 0x54, 0x26, 0x54, 0x46, 0x4F, 0x52, 0x4D}) {
return false
Expand All @@ -21,15 +21,15 @@ func DjVu(in []byte) bool {
bytes.HasPrefix(in[12:], []byte("THUM"))
}

// Mobi matches a Mobi file
// Mobi matches a Mobi file.
func Mobi(in []byte) bool {
if len(in) < 68 {
return false
}
return bytes.Equal(in[60:68], []byte("BOOKMOBI"))
}

// Lit matches a Microsoft Lit file
// Lit matches a Microsoft Lit file.
func Lit(in []byte) bool {
return bytes.HasPrefix(in, []byte("ITOLITLS"))
}
6 changes: 3 additions & 3 deletions internal/matchers/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ func isJpeg2k(in []byte) bool {
bytes.Equal(signature, []byte{0x6A, 0x50, 0x32, 0x20})
}

// Jp2 matches a JPEG 2000 Image file (ISO 15444-1)
// Jp2 matches a JPEG 2000 Image file (ISO 15444-1).
func Jp2(in []byte) bool {
return isJpeg2k(in) && bytes.Equal(in[20:24], []byte{0x6a, 0x70, 0x32, 0x20})
}

// Jpx matches a JPEG 2000 Image file (ISO 15444-2)
// Jpx matches a JPEG 2000 Image file (ISO 15444-2).
func Jpx(in []byte) bool {
return isJpeg2k(in) && bytes.Equal(in[20:24], []byte{0x6a, 0x70, 0x78, 0x20})
}

// Jpm matches a JPEG 2000 Image file (ISO 15444-6)
// Jpm matches a JPEG 2000 Image file (ISO 15444-6).
func Jpm(in []byte) bool {
return isJpeg2k(in) && bytes.Equal(in[20:24], []byte{0x6a, 0x70, 0x6D, 0x20})
}
Expand Down
2 changes: 2 additions & 0 deletions internal/matchers/signature.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func (fSig ftypSig) detect(in []byte) bool {
bytes.Equal(in[8:12], fSig)
}

// Implement sig interface.
func (xSig xmlSig) detect(in []byte) bool {
l := 512
if len(in) < l {
Expand All @@ -117,6 +118,7 @@ func (xSig xmlSig) detect(in []byte) bool {
return localNameIndex != -1 && localNameIndex < bytes.Index(in, xSig.xmlns)
}

// detect returns true if any of the provided singatures pass for in input.
func detect(in []byte, sigs []sig) bool {
for _, sig := range sigs {
if sig.detect(in) {
Expand Down
2 changes: 1 addition & 1 deletion internal/matchers/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func GeoJson(in []byte) bool {
return false
}

// NdJson matches a Newline delimited JSON file
// NdJson matches a Newline delimited JSON file.
func NdJson(in []byte) bool {
// Separator with carriage return and new line `\r\n`
srn := []byte{0x0D, 0x0A}
Expand Down

0 comments on commit 3b3d620

Please sign in to comment.