Skip to content

Commit

Permalink
Support .mcm files with a somewhat invalid header
Browse files Browse the repository at this point in the history
Some tools generate .mcm files starting with "MAX7456\n" rather
than "MAX7456\r\n".
  • Loading branch information
fiam committed Jun 26, 2018
1 parent f2052ff commit ffd789a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import (
)

const (
max7456Hdr = "MAX7456\r\n"
max7456Hdr = "MAX7456\r\n"
max7456AltHdr = "MAX7456\n"
)

// MCMDecoder decodes a .mcm file into its characters.
Expand Down Expand Up @@ -40,7 +41,7 @@ func NewDecoder(r io.Reader) (*MCMDecoder, error) {
if err != nil {
return nil, err
}
if hdr != max7456Hdr {
if hdr != max7456Hdr && hdr != max7456AltHdr {
return nil, fmt.Errorf("unknown character map header %q", hdr)
}
var builder charBuilder
Expand Down

0 comments on commit ffd789a

Please sign in to comment.