Skip to content

Commit

Permalink
Unexpose types(Decoder/Encoder) that should not be.
Browse files Browse the repository at this point in the history
Some packages using them could not be built on Linux even if it could be built on Windows. Use the functions NewDecoder or NewEncder instead.
  • Loading branch information
hymkor committed Apr 24, 2023
1 parent 133c580 commit 4a80ad6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions decoder_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ import (
)

func newDecoder(cp uintptr) transform.Transformer {
return Decoder{CP: cp}
return _Decoder{CP: cp}
}

// Decoder is a transform.Transformer implementation that converts ANSI strings to UTF8 strings.
type Decoder struct {
// _Decoder is a transform.Transformer implementation that converts ANSI strings to UTF8 strings.
type _Decoder struct {
CP uintptr
}

// Reset does nothing in Decoder
func (f Decoder) Reset() {}
// Reset does nothing in _Decoder
func (f _Decoder) Reset() {}

// Transform converts the ANSI string in src to a UTF8 string and stores it in dst.
func (f Decoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
func (f _Decoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
for len(src) > 0 {
// println("called Transform")
n := bytes.IndexByte(src, '\n')
Expand Down
12 changes: 6 additions & 6 deletions encoder_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ import (
)

func newEncoder(cp uintptr) transform.Transformer {
return Encoder{CP: cp}
return _Encoder{CP: cp}
}

// Encoder is a transformer implementation that converts UTF8 strings to ANSI strings.
type Encoder struct {
// _Encoder is a transformer implementation that converts UTF8 strings to ANSI strings.
type _Encoder struct {
CP uintptr
}

// Reset does nothing in Encoder
func (f Encoder) Reset() {}
// Reset does nothing in _Encoder
func (f _Encoder) Reset() {}

// Transform converts the UTF8 string in src to an ANSI string and stores it in dst.
func (f Encoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
func (f _Encoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
for len(src) > 0 {
// println("called Transform")
n := bytes.IndexByte(src, '\n')
Expand Down

0 comments on commit 4a80ad6

Please sign in to comment.