code review 4801074: go-charset: change ErrorString to NewError (issue4801074)

40 views
Skip to first unread message

rogp...@gmail.com

unread,
Aug 3, 2011, 8:17:45 AM8/3/11
to golan...@googlegroups.com, re...@codereview.appspotmail.com
Reviewers: golang-nuts_googlegroups.com,

Message:
Hello golan...@googlegroups.com,

I'd like you to review this change to
https://go-charset.googlecode.com/hg


Description:
go-charset: change ErrorString to NewError
also fix SetFinalizer call.

Please review this at http://codereview.appspot.com/4801074/

Affected files:
M charset/charset.go
M charset/iconv/iconv.go
M charset/utf16.go


Index: charset/charset.go
===================================================================
--- a/charset/charset.go
+++ b/charset/charset.go
@@ -11,7 +11,7 @@
"utf8"
)

-const errNotFound = os.ErrorString("charset: character set not found")
+const errNotFound = os.NewError("charset: character set not found")

// CharsetDir is the data file directory.
var CharsetDir = "/usr/local/lib/go-charset/data"
Index: charset/iconv/iconv.go
===================================================================
--- a/charset/iconv/iconv.go
+++ b/charset/iconv/iconv.go
@@ -128,12 +128,12 @@

if cd == C.iconv_open_error {
if err == os.EINVAL {
- return nil, os.ErrorString("iconv: conversion not supported")
+ return nil, os.NewError("iconv: conversion not supported")
}
return nil, err
}
t := &iconvTranslator{cd: cd}
- runtime.SetFinalizer(t, func() {
+ runtime.SetFinalizer(t, func(*iconvTranslator) {
C.iconv_close(cd)
})
return t, nil
Index: charset/utf16.go
===================================================================
--- a/charset/utf16.go
+++ b/charset/utf16.go
@@ -90,7 +90,7 @@
case "":
return nil, nil
}
- return nil, os.ErrorString("charset: unknown utf16 endianness")
+ return nil, os.NewError("charset: unknown utf16 endianness")
}


Reply all
Reply to author
Forward
0 new messages