New Upstream Snapshot - golang-github-paulrosania-go-charset

Ready changes

Summary

Merged new upstream version: 0.0~git20190325.0.55c9d7a (was: 0.0~git20151028.0.621bb39).

Resulting package

Built on 2023-01-11T04:22 (took 5m6s)

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-snapshots golang-github-paulrosania-go-charset-dev

Lintian Result

Diff

diff --git a/.travis.yml b/.travis.yml
index 0fe6076..ed84404 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,7 +3,8 @@ sudo: false
 language: go
 
 go:
-  - 1.5.1
+  - 1.12.1
+  - 1.11.6
   - tip
 
 os:
diff --git a/charset/ascii.go b/charset/ascii.go
index ccf3a35..0e73d06 100644
--- a/charset/ascii.go
+++ b/charset/ascii.go
@@ -21,7 +21,7 @@ type codePointError struct {
 }
 
 func (e *codePointError) Error() string {
-	return fmt.Sprintf("Parse error at index %n: Code point %n is undefined in %s", e.i, e.cp, e.charset)
+	return fmt.Sprintf("Parse error at index %d: Code point %d is undefined in %s", e.i, e.cp, e.charset)
 }
 
 func (strict translateFromASCII) Translate(data []byte, eof bool) (int, []byte, error) {
diff --git a/charset/charset.go b/charset/charset.go
index 6ab6cf8..ea441ad 100644
--- a/charset/charset.go
+++ b/charset/charset.go
@@ -6,7 +6,7 @@
 //
 //	import _ "github.com/paulrosania/go-charset/data"
 //
-// It can also made available in a data directory (by settting CharsetDir).
+// It can also made available in a data directory (by setting CharsetDir).
 package charset
 
 import (
diff --git a/charset/charset_test.go b/charset/charset_test.go
index fda2d85..03d0782 100644
--- a/charset/charset_test.go
+++ b/charset/charset_test.go
@@ -177,7 +177,7 @@ func testTranslatingReader(t *testing.T, tr charset.Translator, inReader, outRea
 	}
 	err = checkTranslation(data, outbuf.Bytes())
 	if err != nil {
-		t.Fatalf("translator %T, readers %T, %T, %v\n", err)
+		t.Fatalf("translator %T, readers %T, %T, %v\n", tr, inr, outr, err)
 	}
 }
 
diff --git a/charset/iconv/iconv.go b/charset/iconv/iconv.go
index f7187f5..b0a1202 100644
--- a/charset/iconv/iconv.go
+++ b/charset/iconv/iconv.go
@@ -9,22 +9,34 @@
 //   )
 package iconv
 
-//#cgo darwin LDFLAGS: -liconv
-//#include <stdlib.h>
-//#include <iconv.h>
-//#include <errno.h>
-//iconv_t iconv_open_error = (iconv_t)-1;
-//size_t iconv_error = (size_t)-1;
+/*
+#cgo darwin LDFLAGS: -liconv
+#include <stdlib.h>
+#include <iconv.h>
+#include <errno.h>
+
+iconv_t iconv_open_error = (iconv_t)-1;
+size_t iconv_error = (size_t)-1;
+
+// From: https://github.com/djimenez/iconv-go/blob/master/converter.go
+//
+// As of Go 1.6 passing a pointer to Go pointer will lead to panic
+// Therefore we use this wrapper function, to avoid passing **char directly from go
+size_t call_iconv(iconv_t ctx, char *in, size_t *size_in, char *out, size_t *size_out) {
+	return iconv(ctx, &in, size_in, &out, size_out);
+}
+*/
 import "C"
 import (
 	"errors"
 	"fmt"
-	"github.com/paulrosania/go-charset/charset"
 	"runtime"
 	"strings"
 	"syscall"
 	"unicode/utf8"
 	"unsafe"
+
+	"github.com/paulrosania/go-charset/charset"
 )
 
 type iconvTranslator struct {
@@ -120,7 +132,7 @@ func (p *iconvTranslator) Translate(data []byte, eof bool) (rn int, rd []byte, r
 		ns := len(p.scratch)
 		cScratch := (*C.char)(unsafe.Pointer(&p.scratch[ns : ns+1][0]))
 		nScratch := C.size_t(cap(p.scratch) - ns)
-		r, err := C.iconv(p.cd, &cData, &nData, &cScratch, &nScratch)
+		r, err := C.call_iconv(p.cd, cData, &nData, cScratch, &nScratch)
 
 		p.scratch = p.scratch[0 : cap(p.scratch)-int(nScratch)]
 		n += len(data) - int(nData)
diff --git a/charset/iconv/iconv_test.go b/charset/iconv/iconv_test.go
index 77c639f..d704fb3 100644
--- a/charset/iconv/iconv_test.go
+++ b/charset/iconv/iconv_test.go
@@ -2,12 +2,13 @@ package iconv_test
 
 import (
 	"bytes"
-	"github.com/paulrosania/go-charset/charset"
-	_ "github.com/paulrosania/go-charset/charset/iconv"
 	"io"
 	"strings"
 	"testing"
 	"unicode/utf8"
+
+	"github.com/paulrosania/go-charset/charset"
+	_ "github.com/paulrosania/go-charset/charset/iconv"
 )
 
 // TODO(rog) better than this
diff --git a/cmd/tcs/tcs.go b/cmd/tcs/tcs.go
index 188c2a1..79e60d5 100644
--- a/cmd/tcs/tcs.go
+++ b/cmd/tcs/tcs.go
@@ -4,11 +4,12 @@ import (
 	"bytes"
 	"flag"
 	"fmt"
-	"github.com/paulrosania/go-charset/charset"
-	_ "github.com/paulrosania/go-charset/charset/iconv"
 	"io"
 	"os"
 	"strings"
+
+	"github.com/paulrosania/go-charset/charset"
+	_ "github.com/paulrosania/go-charset/charset/iconv"
 )
 
 var listFlag = flag.Bool("l", false, "list available character sets")
@@ -42,7 +43,7 @@ func main() {
 		var err error
 		f, err = os.Open(flag.Arg(0))
 		if err != nil {
-			fatalf("cannot open %q: %v", err)
+			fatalf("cannot open %q: %v", flag.Arg(0), err)
 		}
 	}
 	r, err := charset.NewReader(*fromCharset, f)
@@ -51,7 +52,7 @@ func main() {
 	}
 	w, err := charset.NewWriter(*toCharset, os.Stdout)
 	if err != nil {
-		fatalf("cannot translate to %q: ", err)
+		fatalf("cannot translate to %q: %v", *toCharset, err)
 	}
 	_, err = io.Copy(w, r)
 	if err != nil {
diff --git a/debian/changelog b/debian/changelog
index 965ea65..f907099 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-golang-github-paulrosania-go-charset (0.0~git20151028.0.621bb39-4) UNRELEASED; urgency=medium
+golang-github-paulrosania-go-charset (0.0~git20190325.0.55c9d7a-1) UNRELEASED; urgency=medium
 
   [ Alexandre Viau ]
   * Point Vcs-* urls to salsa.debian.org.
@@ -6,8 +6,9 @@ golang-github-paulrosania-go-charset (0.0~git20151028.0.621bb39-4) UNRELEASED; u
   [ Debian Janitor ]
   * Remove constraints unnecessary since buster (oldstable):
     + Build-Depends: Drop versioned constraint on dh-golang (>= 1.31).
+  * New upstream snapshot.
 
- -- Alexandre Viau <aviau@debian.org>  Mon, 02 Apr 2018 19:55:43 -0400
+ -- Alexandre Viau <aviau@debian.org>  Wed, 11 Jan 2023 04:18:38 -0000
 
 golang-github-paulrosania-go-charset (0.0~git20151028.0.621bb39-3) unstable; urgency=medium
 
diff --git a/debian/patches/testdata.patch b/debian/patches/testdata.patch
index b07912a..e28a0f8 100644
--- a/debian/patches/testdata.patch
+++ b/debian/patches/testdata.patch
@@ -3,10 +3,11 @@ Forwarded: no
 Author: Dmitry Smirnov <onlyjob@member.fsf.org>
 Description: adjust path to data files to fix tests.
 
---- a/charset/file.go
-+++ b/charset/file.go
-@@ -20,9 +20,9 @@
- 
+Index: golang-github-paulrosania-go-charset.git/charset/file.go
+===================================================================
+--- golang-github-paulrosania-go-charset.git.orig/charset/file.go
++++ golang-github-paulrosania-go-charset.git/charset/file.go
+@@ -21,7 +21,7 @@ func RegisterDataFile(name string, open
  // CharsetDir gives the location of the default data file directory.
  // This directory will be used for files with names that have not
  // been registered with RegisterDataFile.
@@ -15,4 +16,3 @@ Description: adjust path to data files to fix tests.
  
  func readFile(name string) (data []byte, err error) {
  	var r io.ReadCloser
- 	if open := files[name]; open != nil {

Debdiff

File lists identical (after any substitutions)

No differences were encountered in the control files

More details

Full run details