| 205 | } |
| 206 | |
| 207 | func parseHunkSide(s string, sign byte) (start, count int, ok bool) { |
| 208 | if len(s) == 0 || s[0] != sign { |
| 209 | return 0, 0, false |
| 210 | } |
| 211 | body := s[1:] |
| 212 | commaIdx := strings.IndexByte(body, ',') |
| 213 | if commaIdx == -1 { |
| 214 | n, err := strconv.Atoi(body) |
| 215 | if err != nil { |
| 216 | return 0, 0, false |
| 217 | } |
| 218 | return n, 1, true |
| 219 | } |
| 220 | start, err := strconv.Atoi(body[:commaIdx]) |
| 221 | if err != nil { |
| 222 | return 0, 0, false |
| 223 | } |
| 224 | count, err = strconv.Atoi(body[commaIdx+1:]) |
| 225 | if err != nil { |
| 226 | return 0, 0, false |
| 227 | } |
| 228 | return start, count, true |
| 229 | } |