From 4c92723df0a232168caa4b1ef1341daaa81e2a3c Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Wed, 31 Jul 2024 13:07:09 +0200 Subject: [PATCH] Implement blank ucs2 coder --- encoding/ucs2.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/encoding/ucs2.go b/encoding/ucs2.go index 9ec252f..34883fb 100644 --- a/encoding/ucs2.go +++ b/encoding/ucs2.go @@ -4,10 +4,16 @@ import "bytes" type UCS2Coder struct{} -func (c *UCS2Coder) Encode(s string, buf *bytes.Buffer) { +func (c *UCS2Coder) Encode(s *string, buf *bytes.Buffer) error { + panic("UCS2 not implemented yet") +} +func (c *UCS2Coder) Decode(buf *bytes.Buffer) (string, error) { panic("UCS2 not implemented yet") } -func (c *UCS2Coder) Decode(buf *bytes.Buffer) string { - panic("UCS2 not implemented yet") +func (c UCS2Coder) EncodesInto(s *string) int { + return len(*s) * 2 +} +func (c UCS2Coder) DecodesInto(buf *bytes.Buffer) int { + return buf.Len() / 2 }