| OLD | NEW |
| 1 # Protocol Buffers - Google's data interchange format | 1 # Protocol Buffers - Google's data interchange format |
| 2 # Copyright 2008 Google Inc. All rights reserved. | 2 # Copyright 2008 Google Inc. All rights reserved. |
| 3 # http://code.google.com/p/protobuf/ | 3 # http://code.google.com/p/protobuf/ |
| 4 # | 4 # |
| 5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
| 6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
| 7 # met: | 7 # met: |
| 8 # | 8 # |
| 9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
| 10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 Then, for every field of every message class we construct an actual decoder. | 80 Then, for every field of every message class we construct an actual decoder. |
| 81 That decoder goes into a dict indexed by tag, so when we decode a message | 81 That decoder goes into a dict indexed by tag, so when we decode a message |
| 82 we repeatedly read a tag, look up the corresponding decoder, and invoke it. | 82 we repeatedly read a tag, look up the corresponding decoder, and invoke it. |
| 83 """ | 83 """ |
| 84 | 84 |
| 85 __author__ = 'kenton@google.com (Kenton Varda)' | 85 __author__ = 'kenton@google.com (Kenton Varda)' |
| 86 | 86 |
| 87 import struct | 87 import struct |
| 88 import sys ##PY25 | 88 import sys ##PY25 |
| 89 _PY2 = sys.version_info[0] < 3 ##PY25 | 89 _PY2 = sys.version_info[0] < 3 ##PY25 |
| 90 from google.protobuf.internal import encoder | 90 from protobuf26.internal import encoder |
| 91 from google.protobuf.internal import wire_format | 91 from protobuf26.internal import wire_format |
| 92 from google.protobuf import message | 92 from protobuf26 import message |
| 93 | 93 |
| 94 | 94 |
| 95 # This will overflow and thus become IEEE-754 "infinity". We would use | 95 # This will overflow and thus become IEEE-754 "infinity". We would use |
| 96 # "float('inf')" but it doesn't work on Windows pre-Python-2.6. | 96 # "float('inf')" but it doesn't work on Windows pre-Python-2.6. |
| 97 _POS_INF = 1e10000 | 97 _POS_INF = 1e10000 |
| 98 _NEG_INF = -_POS_INF | 98 _NEG_INF = -_POS_INF |
| 99 _NAN = _POS_INF * 0 | 99 _NAN = _POS_INF * 0 |
| 100 | 100 |
| 101 | 101 |
| 102 # This is not for optimization, but rather to avoid conflicts with local | 102 # This is not for optimization, but rather to avoid conflicts with local |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 tag (in which case the calling loop should break). | 822 tag (in which case the calling loop should break). |
| 823 """ | 823 """ |
| 824 | 824 |
| 825 # The wire type is always in the first byte since varints are little-endian. | 825 # The wire type is always in the first byte since varints are little-endian. |
| 826 wire_type = ord(tag_bytes[0:1]) & wiretype_mask | 826 wire_type = ord(tag_bytes[0:1]) & wiretype_mask |
| 827 return WIRETYPE_TO_SKIPPER[wire_type](buffer, pos, end) | 827 return WIRETYPE_TO_SKIPPER[wire_type](buffer, pos, end) |
| 828 | 828 |
| 829 return SkipField | 829 return SkipField |
| 830 | 830 |
| 831 SkipField = _FieldSkipper() | 831 SkipField = _FieldSkipper() |
| OLD | NEW |