summaryrefslogtreecommitdiff
path: root/unxml.go
diff options
context:
space:
mode:
Diffstat (limited to 'unxml.go')
-rw-r--r--unxml.go17
1 files changed, 7 insertions, 10 deletions
diff --git a/unxml.go b/unxml.go
index fee5690..a312410 100644
--- a/unxml.go
+++ b/unxml.go
@@ -164,17 +164,14 @@ func (r *ElementReader) Read(out []byte) (int, error) {
continue
}
text := r.xr.tokenizer.Text()
- lentext := len(text)
- if lentext < lenout {
- //fmt.Printf("HAD SPACE: %q, count: %d\n", text, r.xr.count)
- n = copy(out[r.xr.count:], text)
- r.xr.count += n
- lenout -= n
- } else {
+ //fmt.Printf("HAD SPACE: %q, count: %d\n", text, r.xr.count)
+ n = copy(out[r.xr.count:], text)
+ r.xr.count += n
+ lenout -= n
+ if n < len(text) {
//fmt.Printf("HAD NO SPACE: wrote: %q, count: %d, lenout: %d\n", text[:lenout], r.xr.count, lenout)
- n = copy(out[r.xr.count:], text[:lenout])
- r.xr.count += n
- r.xr.lastread = text[lenout:]
+ r.xr.lastread = text[n:]
+ //fmt.Printf("lastread is now: %q\n", text[lenout:])
return r.xr.count, err
}