summaryrefslogtreecommitdiff
path: root/util.go
diff options
context:
space:
mode:
authorCodeLingo Bot <hello@codelingo.io>2018-12-12 02:30:35 +1300
committerKurt Jung <kurt.w.jung@gmail.com>2018-12-11 08:30:35 -0500
commit95702eead4d148c6111f5a3ef7ef7cbc0c906b49 (patch)
treee5e45521c4ee68d36cbad02aaa69153660fd8797 /util.go
parentfe48001d4389ad79f7402b3c654c03409babac29 (diff)
Fix comments according to best practices by effective go (#217)
* Fix comments according to best practices by effective go * Update font.go * Update fpdf_test.go * Update fpdf.go * Update example.go * Update util.go
Diffstat (limited to 'util.go')
-rw-r--r--util.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/util.go b/util.go
index 0e89bbe..1dad60e 100644
--- a/util.go
+++ b/util.go
@@ -39,7 +39,7 @@ func sprintf(fmtStr string, args ...interface{}) string {
return fmt.Sprintf(fmtStr, args...)
}
-// Returns true if the specified normal file exists
+// fileExist returns true if the specified normal file exists
func fileExist(filename string) (ok bool) {
info, err := os.Stat(filename)
if err == nil {
@@ -50,7 +50,7 @@ func fileExist(filename string) (ok bool) {
return ok
}
-// Returns the size of the specified file; ok will be false
+// fileSize returns the size of the specified file; ok will be false
// if the file does not exist or is not an ordinary file
func fileSize(filename string) (size int64, ok bool) {
info, err := os.Stat(filename)
@@ -61,14 +61,14 @@ func fileSize(filename string) (size int64, ok bool) {
return
}
-// Returns a new buffer populated with the contents of the specified Reader
+// bufferFromReader returns a new buffer populated with the contents of the specified Reader
func bufferFromReader(r io.Reader) (b *bytes.Buffer, err error) {
b = new(bytes.Buffer)
_, err = b.ReadFrom(r)
return
}
-// Returns true if the two specified float slices are equal
+// slicesEqual returns true if the two specified float slices are equal
func slicesEqual(a, b []float64) bool {
if len(a) != len(b) {
return false
@@ -81,7 +81,7 @@ func slicesEqual(a, b []float64) bool {
return true
}
-// Returns a zlib-compressed copy of the specified byte array
+// sliceCompress returns a zlib-compressed copy of the specified byte array
func sliceCompress(data []byte) []byte {
var buf bytes.Buffer
cmp, _ := zlib.NewWriterLevel(&buf, zlib.BestSpeed)
@@ -90,7 +90,7 @@ func sliceCompress(data []byte) []byte {
return buf.Bytes()
}
-// Returns an uncompressed copy of the specified zlib-compressed byte array
+// sliceUncompress returns an uncompressed copy of the specified zlib-compressed byte array
func sliceUncompress(data []byte) (outData []byte, err error) {
inBuf := bytes.NewReader(data)
r, err := zlib.NewReader(inBuf)
@@ -105,7 +105,7 @@ func sliceUncompress(data []byte) (outData []byte, err error) {
return
}
-// Convert UTF-8 to UTF-16BE with BOM; from http://www.fpdf.org/
+// utf8toutf16 converts UTF-8 to UTF-16BE with BOM; from http://www.fpdf.org/
func utf8toutf16(s string) string {
res := make([]byte, 0, 8)
res = append(res, 0xFE, 0xFF)
@@ -137,7 +137,7 @@ func utf8toutf16(s string) string {
return string(res)
}
-// Return a if cnd is true, otherwise b
+// intIf returns a if cnd is true, otherwise b
func intIf(cnd bool, a, b int) int {
if cnd {
return a
@@ -145,7 +145,7 @@ func intIf(cnd bool, a, b int) int {
return b
}
-// Return aStr if cnd is true, otherwise bStr
+// strIf returns aStr if cnd is true, otherwise bStr
func strIf(cnd bool, aStr, bStr string) string {
if cnd {
return aStr