View | Details | Raw Unified | Return to bug 36098
Collapse All | Expand All

(-)a/tools/python/xen/xend/sxp.py (-6 / +5 lines)
 Lines 305-313   class Parser: Link Here 
305
            self.state.parent.buf += d
305
            self.state.parent.buf += d
306
            self.pop_state()
306
            self.pop_state()
307
            
307
            
308
        def hexdigit(c, d):
308
        def hexdigit(c):
309
            self.state.val *= 16
309
            self.state.val *= 16
310
            self.state.val += ord(c) - ord(d)
310
            self.state.val += int(c, 16)
311
            self.state.buf += c
311
            self.state.buf += c
312
            if self.state.val < 0 or self.state.val > 0xff:
312
            if self.state.val < 0 or self.state.val > 0xff:
313
                raise ParseError(self, "invalid hex escape: out of range " + self.state.buf)
313
                raise ParseError(self, "invalid hex escape: out of range " + self.state.buf)
 Lines 317-327   class Parser: Link Here 
317
        if self.at_eof():
317
        if self.at_eof():
318
            raise ParseError(self, "unexpected EOF")
318
            raise ParseError(self, "unexpected EOF")
319
        elif '0' <= c <= '9':
319
        elif '0' <= c <= '9':
320
            hexdigit(c, '0')
320
            hexdigit(c)
321
        elif 'A' <= c <= 'F':
321
        elif 'A' <= c <= 'F':
322
            hexdigit(c, 'A')
322
            hexdigit(c)
323
        elif 'a' <= c <= 'f':
323
        elif 'a' <= c <= 'f':
324
            hexdigit(c, 'a')
324
            hexdigit(c)
325
        elif len(buf):
325
        elif len(buf):
326
            hexdone()
326
            hexdone()
327
            self.input_char(c)
327
            self.input_char(c)
328
- 

Return to bug 36098