| 1 | package plist |
| 2 | |
| 3 | import "io" |
| 4 | |
| 5 | type countedWriter struct { |
| 6 | io.Writer |
| 7 | nbytes int |
| 8 | } |
| 9 | |
| 10 | func (w *countedWriter) Write(p []byte) (int, error) { |
| 11 | n, err := w.Writer.Write(p) |
| 12 | w.nbytes += n |
| 13 | return n, err |
| 14 | } |
| 15 | |
| 16 | func (w *countedWriter) BytesWritten() int { |
| 17 | return w.nbytes |
| 18 | } |
| 19 | |
| 20 | func unsignedGetBase(s string) (string, int) { |
| 21 | if len(s) > 1 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X') { |
| 22 | return s[2:], 16 |
| 23 | } |
| 24 | return s, 10 |
| 25 | } |