Merge pull request #201 from fangyincheng/ignore_fields

Ignore fields
diff --git a/.gitignore b/.gitignore
index 1363720..fc62e8a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
 .idea
+vendor
 coverage.txt
diff --git a/string.go b/string.go
index 6a217c5..a2a24ce 100644
--- a/string.go
+++ b/string.go
@@ -218,10 +218,7 @@
 // ::= [x00-x1f] <utf8-data>         # string of length 0-31
 // ::= [x30-x34] <utf8-data>         # string of length 0-1023
 func (d *Decoder) getStringLength(tag byte) (int, error) {
-	var (
-		err    error
-		length int
-	)
+	var length int
 
 	switch {
 	case tag >= BC_STRING_DIRECT && tag <= STRING_DIRECT_MAX:
@@ -251,16 +248,15 @@
 		return length, nil
 
 	default:
-		return -1, perrors.WithStack(err)
+		return -1, perrors.Errorf("string decode: unknown tag %b", tag)
 	}
 }
 
 func (d *Decoder) decString(flag int32) (string, error) {
 	var (
-		tag      byte
-		chunkLen int
-		last     bool
-		s        string
+		tag  byte
+		last bool
+		s    string
 	)
 
 	if flag != TAG_READ {
@@ -315,11 +311,10 @@
 			last = true
 		}
 
-		charLen, err := d.getStringLength(tag)
+		chunkLen, err := d.getStringLength(tag)
 		if err != nil {
 			return s, perrors.WithStack(err)
 		}
-		chunkLen = charLen
 		bytesBuf := make([]byte, chunkLen<<2)
 		offset := 0
 
@@ -342,20 +337,11 @@
 						last = true
 					}
 
-					charLen, err = d.getStringLength(b)
+					chunkLen, err = d.getStringLength(b)
 					if err != nil {
 						return s, perrors.WithStack(err)
 					}
-
-					if chunkLen < 0 {
-						chunkLen = 0
-					}
-					if charLen < 0 {
-						charLen = 0
-					}
-
-					chunkLen += charLen
-					remain, cap := len(bytesBuf)-offset, charLen<<2
+					remain, cap := len(bytesBuf)-offset, chunkLen<<2
 					if remain < cap {
 						grow := len(bytesBuf) + cap
 						bs := make([]byte, grow)