Ticket #198: encode-int.diff
| File encode-int.diff, 1.0 KB (added by akaihola, 11 months ago) |
|---|
-
pyamf/amf3.py
1710 1710 if n > 0x40000000: 1711 1711 raise ValueError, "Out of range" 1712 1712 1713 bytes = util.BufferedByteStream()1713 bytes = '' 1714 1714 real_value = None 1715 1715 1716 1716 if n > 0x1fffff: 1717 1717 real_value = n 1718 1718 n >>= 1 1719 bytes .write_uchar(0x80 | ((n >> 21) & 0xff))1719 bytes += chr(0x80 | ((n >> 21) & 0xff)) 1720 1720 1721 1721 if n > 0x3fff: 1722 bytes .write_uchar(0x80 | ((n >> 14) & 0xff))1722 bytes += chr(0x80 | ((n >> 14) & 0xff)) 1723 1723 1724 1724 if n > 0x7f: 1725 bytes .write_uchar(0x80 | ((n >> 7) & 0xff))1725 bytes += chr(0x80 | ((n >> 7) & 0xff)) 1726 1726 1727 1727 if real_value is not None: 1728 1728 n = real_value 1729 1729 1730 1730 if n > 0x1fffff: 1731 bytes .write_uchar(n & 0xff)1731 bytes += chr(n & 0xff) 1732 1732 else: 1733 bytes .write_uchar(n & 0x7f)1733 bytes += chr(n & 0x7f) 1734 1734 1735 return bytes .getvalue()1735 return bytes
