From 5b94194b2975cafdeb53b6c05857789f854e5558 Mon Sep 17 00:00:00 2001 From: David Howden Date: Sun, 3 Jan 2016 23:04:12 +1100 Subject: [PATCH] Remove unused error parameter, and tidy up implementation. --- id3v2frames.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/id3v2frames.go b/id3v2frames.go index c5fda33..8e66457 100644 --- a/id3v2frames.go +++ b/id3v2frames.go @@ -326,7 +326,7 @@ func decodeText(enc byte, b []byte) (string, error) { if len(b) == 1 { return "", nil } - return decodeUTF16WithBOM(b) + return decodeUTF16WithBOM(b), nil case 2: // UTF-16 without byte order (assuming BigEndian) if len(b) == 1 { @@ -383,19 +383,21 @@ func decodeISO8859(b []byte) string { return string(r) } -func decodeUTF16WithBOM(b []byte) (string, error) { +func decodeUTF16WithBOM(b []byte) string { var bo binary.ByteOrder switch { case b[0] == 0xFE && b[1] == 0xFF: bo = binary.BigEndian + b = b[2:] case b[0] == 0xFF && b[1] == 0xFE: bo = binary.LittleEndian + b = b[2:] default: - return decodeUTF16(b, DefaultUTF16WithBOMByteOrder), nil + bo = DefaultUTF16WithBOMByteOrder } - return decodeUTF16(b[2:], bo), nil + return decodeUTF16(b, bo) } func decodeUTF16(b []byte, bo binary.ByteOrder) string {