protoc 2.6.1.1 → 2.6.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (479) hide show
  1. checksums.yaml +4 -4
  2. data/ext/protoc/Makefile.in +10 -13
  3. data/ext/protoc/extconf.rb +0 -1
  4. data/ext/protoc/protobuf/CHANGES.txt +593 -0
  5. data/ext/protoc/protobuf/CONTRIBUTORS.txt +93 -0
  6. data/ext/protoc/protobuf/INSTALL.txt +237 -0
  7. data/ext/protoc/protobuf/LICENSE +33 -0
  8. data/ext/protoc/protobuf/Makefile.am +267 -0
  9. data/ext/protoc/protobuf/README.md +167 -0
  10. data/ext/protoc/protobuf/autogen.sh +41 -0
  11. data/ext/protoc/protobuf/benchmarks/ProtoBench.java +203 -0
  12. data/ext/protoc/protobuf/benchmarks/google_message1.dat +0 -0
  13. data/ext/protoc/protobuf/benchmarks/google_message2.dat +0 -0
  14. data/ext/protoc/protobuf/benchmarks/google_size.proto +136 -0
  15. data/ext/protoc/protobuf/benchmarks/google_speed.proto +136 -0
  16. data/ext/protoc/protobuf/benchmarks/readme.txt +50 -0
  17. data/ext/protoc/protobuf/configure.ac +159 -0
  18. data/ext/protoc/protobuf/editors/README.txt +5 -0
  19. data/ext/protoc/protobuf/editors/proto.vim +105 -0
  20. data/ext/protoc/protobuf/editors/protobuf-mode.el +220 -0
  21. data/ext/protoc/protobuf/examples/AddPerson.java +95 -0
  22. data/ext/protoc/protobuf/examples/ListPeople.java +50 -0
  23. data/ext/protoc/protobuf/examples/Makefile +58 -0
  24. data/ext/protoc/protobuf/examples/README.txt +29 -0
  25. data/ext/protoc/protobuf/examples/add_person.cc +95 -0
  26. data/ext/protoc/protobuf/examples/add_person.py +58 -0
  27. data/ext/protoc/protobuf/examples/addressbook.proto +30 -0
  28. data/ext/protoc/protobuf/examples/list_people.cc +68 -0
  29. data/ext/protoc/protobuf/examples/list_people.py +38 -0
  30. data/ext/protoc/protobuf/generate_descriptor_proto.sh +33 -0
  31. data/ext/protoc/protobuf/java/README.txt +96 -0
  32. data/ext/protoc/protobuf/java/pom.xml +217 -0
  33. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/AbstractMessage.java +466 -0
  34. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/AbstractMessageLite.java +355 -0
  35. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/AbstractParser.java +253 -0
  36. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/BlockingRpcChannel.java +51 -0
  37. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/BlockingService.java +64 -0
  38. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/BoundedByteString.java +163 -0
  39. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ByteString.java +1022 -0
  40. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/CodedInputStream.java +1311 -0
  41. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/CodedOutputStream.java +1297 -0
  42. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Descriptors.java +2238 -0
  43. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/DynamicMessage.java +622 -0
  44. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Extension.java +96 -0
  45. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ExtensionRegistry.java +392 -0
  46. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ExtensionRegistryLite.java +185 -0
  47. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/FieldSet.java +907 -0
  48. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/GeneratedMessage.java +2213 -0
  49. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/GeneratedMessageLite.java +949 -0
  50. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Internal.java +391 -0
  51. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java +122 -0
  52. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LazyField.java +154 -0
  53. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LazyFieldLite.java +176 -0
  54. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LazyStringArrayList.java +367 -0
  55. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LazyStringList.java +163 -0
  56. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LiteralByteString.java +362 -0
  57. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Message.java +244 -0
  58. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/MessageLite.java +320 -0
  59. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java +60 -0
  60. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/MessageOrBuilder.java +143 -0
  61. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/MessageReflection.java +931 -0
  62. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Parser.java +261 -0
  63. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ProtocolMessageEnum.java +58 -0
  64. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ProtocolStringList.java +48 -0
  65. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java +696 -0
  66. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RopeByteString.java +957 -0
  67. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RpcCallback.java +47 -0
  68. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RpcChannel.java +71 -0
  69. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RpcController.java +118 -0
  70. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RpcUtil.java +134 -0
  71. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Service.java +117 -0
  72. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ServiceException.java +52 -0
  73. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/SingleFieldBuilder.java +241 -0
  74. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/SmallSortedMap.java +618 -0
  75. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/TextFormat.java +1984 -0
  76. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/UninitializedMessageException.java +99 -0
  77. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/UnknownFieldSet.java +995 -0
  78. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java +205 -0
  79. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Utf8.java +349 -0
  80. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/WireFormat.java +163 -0
  81. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/AbstractMessageTest.java +527 -0
  82. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/BoundedByteStringTest.java +68 -0
  83. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/ByteStringTest.java +759 -0
  84. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/CheckUtf8Test.java +141 -0
  85. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/CodedInputStreamTest.java +769 -0
  86. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/CodedOutputStreamTest.java +401 -0
  87. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/DeprecatedFieldTest.java +80 -0
  88. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/DescriptorsTest.java +735 -0
  89. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/DynamicMessageTest.java +326 -0
  90. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java +48 -0
  91. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/GeneratedMessageTest.java +1515 -0
  92. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/IsValidUtf8Test.java +180 -0
  93. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java +421 -0
  94. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyFieldLiteTest.java +134 -0
  95. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyFieldTest.java +121 -0
  96. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyMessageLiteTest.java +319 -0
  97. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyStringArrayListTest.java +174 -0
  98. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java +143 -0
  99. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java +85 -0
  100. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LiteTest.java +148 -0
  101. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LiteralByteStringTest.java +396 -0
  102. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/MessageTest.java +353 -0
  103. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/NestedBuildersTest.java +185 -0
  104. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/ParserTest.java +381 -0
  105. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java +190 -0
  106. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java +97 -0
  107. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/RopeByteStringTest.java +115 -0
  108. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/ServiceTest.java +320 -0
  109. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/SingleFieldBuilderTest.java +155 -0
  110. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/SmallSortedMapTest.java +420 -0
  111. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/TestBadIdentifiers.java +96 -0
  112. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/TestUtil.java +4124 -0
  113. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/TextFormatTest.java +994 -0
  114. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/UnknownFieldSetTest.java +653 -0
  115. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java +227 -0
  116. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/WireFormatTest.java +606 -0
  117. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/lazy_fields_lite.proto +61 -0
  118. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/lite_equals_and_hash.proto +55 -0
  119. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/multiple_files_test.proto +77 -0
  120. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/nested_builders_test.proto +53 -0
  121. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/nested_extension.proto +46 -0
  122. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/nested_extension_lite.proto +48 -0
  123. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/non_nested_extension.proto +49 -0
  124. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/non_nested_extension_lite.proto +50 -0
  125. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/outer_class_name_test.proto +38 -0
  126. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/outer_class_name_test2.proto +42 -0
  127. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/outer_class_name_test3.proto +43 -0
  128. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_bad_identifiers.proto +157 -0
  129. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_check_utf8.proto +50 -0
  130. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_check_utf8_size.proto +51 -0
  131. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_custom_options.proto +43 -0
  132. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_extra_interfaces.proto +60 -0
  133. data/ext/protoc/protobuf/m4/ac_system_extensions.m4 +37 -0
  134. data/ext/protoc/protobuf/m4/acx_check_suncc.m4 +75 -0
  135. data/ext/protoc/protobuf/m4/acx_pthread.m4 +397 -0
  136. data/ext/protoc/protobuf/m4/stl_hash.m4 +72 -0
  137. data/ext/protoc/protobuf/more_tests/Makefile +41 -0
  138. data/ext/protoc/protobuf/post_process_dist.sh +60 -0
  139. data/ext/protoc/protobuf/protobuf-lite.pc.in +13 -0
  140. data/ext/protoc/protobuf/protobuf.pc.in +14 -0
  141. data/ext/protoc/protobuf/python/README.txt +105 -0
  142. data/ext/protoc/protobuf/python/ez_setup.py +284 -0
  143. data/ext/protoc/protobuf/python/google/__init__.py +1 -0
  144. data/ext/protoc/protobuf/python/google/protobuf/__init__.py +0 -0
  145. data/ext/protoc/protobuf/python/google/protobuf/descriptor.py +849 -0
  146. data/ext/protoc/protobuf/python/google/protobuf/descriptor_database.py +137 -0
  147. data/ext/protoc/protobuf/python/google/protobuf/descriptor_pool.py +643 -0
  148. data/ext/protoc/protobuf/python/google/protobuf/internal/__init__.py +0 -0
  149. data/ext/protoc/protobuf/python/google/protobuf/internal/api_implementation.cc +139 -0
  150. data/ext/protoc/protobuf/python/google/protobuf/internal/api_implementation.py +89 -0
  151. data/ext/protoc/protobuf/python/google/protobuf/internal/api_implementation_default_test.py +63 -0
  152. data/ext/protoc/protobuf/python/google/protobuf/internal/containers.py +269 -0
  153. data/ext/protoc/protobuf/python/google/protobuf/internal/cpp_message.py +663 -0
  154. data/ext/protoc/protobuf/python/google/protobuf/internal/decoder.py +831 -0
  155. data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_database_test.py +63 -0
  156. data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_pool_test.py +564 -0
  157. data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_pool_test1.proto +94 -0
  158. data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_pool_test2.proto +70 -0
  159. data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_python_test.py +54 -0
  160. data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_test.py +669 -0
  161. data/ext/protoc/protobuf/python/google/protobuf/internal/encoder.py +788 -0
  162. data/ext/protoc/protobuf/python/google/protobuf/internal/enum_type_wrapper.py +89 -0
  163. data/ext/protoc/protobuf/python/google/protobuf/internal/factory_test1.proto +57 -0
  164. data/ext/protoc/protobuf/python/google/protobuf/internal/factory_test2.proto +92 -0
  165. data/ext/protoc/protobuf/python/google/protobuf/internal/generator_test.py +343 -0
  166. data/ext/protoc/protobuf/python/google/protobuf/internal/message_factory_python_test.py +54 -0
  167. data/ext/protoc/protobuf/python/google/protobuf/internal/message_factory_test.py +131 -0
  168. data/ext/protoc/protobuf/python/google/protobuf/internal/message_listener.py +78 -0
  169. data/ext/protoc/protobuf/python/google/protobuf/internal/message_python_test.py +54 -0
  170. data/ext/protoc/protobuf/python/google/protobuf/internal/message_test.py +681 -0
  171. data/ext/protoc/protobuf/python/google/protobuf/internal/missing_enum_values.proto +50 -0
  172. data/ext/protoc/protobuf/python/google/protobuf/internal/more_extensions.proto +58 -0
  173. data/ext/protoc/protobuf/python/google/protobuf/internal/more_extensions_dynamic.proto +49 -0
  174. data/ext/protoc/protobuf/python/google/protobuf/internal/more_messages.proto +51 -0
  175. data/ext/protoc/protobuf/python/google/protobuf/internal/python_message.py +1251 -0
  176. data/ext/protoc/protobuf/python/google/protobuf/internal/reflection_test.py +2934 -0
  177. data/ext/protoc/protobuf/python/google/protobuf/internal/service_reflection_test.py +136 -0
  178. data/ext/protoc/protobuf/python/google/protobuf/internal/symbol_database_test.py +120 -0
  179. data/ext/protoc/protobuf/python/google/protobuf/internal/test_bad_identifiers.proto +52 -0
  180. data/ext/protoc/protobuf/python/google/protobuf/internal/test_util.py +662 -0
  181. data/ext/protoc/protobuf/python/google/protobuf/internal/text_encoding_test.py +68 -0
  182. data/ext/protoc/protobuf/python/google/protobuf/internal/text_format_test.py +743 -0
  183. data/ext/protoc/protobuf/python/google/protobuf/internal/type_checkers.py +328 -0
  184. data/ext/protoc/protobuf/python/google/protobuf/internal/unknown_fields_test.py +231 -0
  185. data/ext/protoc/protobuf/python/google/protobuf/internal/wire_format.py +268 -0
  186. data/ext/protoc/protobuf/python/google/protobuf/internal/wire_format_test.py +253 -0
  187. data/ext/protoc/protobuf/python/google/protobuf/message.py +284 -0
  188. data/ext/protoc/protobuf/python/google/protobuf/message_factory.py +155 -0
  189. data/ext/protoc/protobuf/python/google/protobuf/pyext/README +6 -0
  190. data/ext/protoc/protobuf/python/google/protobuf/pyext/__init__.py +0 -0
  191. data/ext/protoc/protobuf/python/google/protobuf/pyext/cpp_message.py +61 -0
  192. data/ext/protoc/protobuf/python/google/protobuf/pyext/descriptor.cc +357 -0
  193. data/ext/protoc/protobuf/python/google/protobuf/pyext/descriptor.h +96 -0
  194. data/ext/protoc/protobuf/python/google/protobuf/pyext/descriptor_cpp2_test.py +58 -0
  195. data/ext/protoc/protobuf/python/google/protobuf/pyext/extension_dict.cc +338 -0
  196. data/ext/protoc/protobuf/python/google/protobuf/pyext/extension_dict.h +123 -0
  197. data/ext/protoc/protobuf/python/google/protobuf/pyext/message.cc +2561 -0
  198. data/ext/protoc/protobuf/python/google/protobuf/pyext/message.h +305 -0
  199. data/ext/protoc/protobuf/python/google/protobuf/pyext/message_factory_cpp2_test.py +56 -0
  200. data/ext/protoc/protobuf/python/google/protobuf/pyext/proto2_api_test.proto +38 -0
  201. data/ext/protoc/protobuf/python/google/protobuf/pyext/python.proto +66 -0
  202. data/ext/protoc/protobuf/python/google/protobuf/pyext/python_protobuf.h +57 -0
  203. data/ext/protoc/protobuf/python/google/protobuf/pyext/reflection_cpp2_generated_test.py +94 -0
  204. data/ext/protoc/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc +763 -0
  205. data/ext/protoc/protobuf/python/google/protobuf/pyext/repeated_composite_container.h +172 -0
  206. data/ext/protoc/protobuf/python/google/protobuf/pyext/repeated_scalar_container.cc +825 -0
  207. data/ext/protoc/protobuf/python/google/protobuf/pyext/repeated_scalar_container.h +112 -0
  208. data/ext/protoc/protobuf/python/google/protobuf/pyext/scoped_pyobject_ptr.h +95 -0
  209. data/ext/protoc/protobuf/python/google/protobuf/reflection.py +205 -0
  210. data/ext/protoc/protobuf/python/google/protobuf/service.py +226 -0
  211. data/ext/protoc/protobuf/python/google/protobuf/service_reflection.py +284 -0
  212. data/ext/protoc/protobuf/python/google/protobuf/symbol_database.py +185 -0
  213. data/ext/protoc/protobuf/python/google/protobuf/text_encoding.py +110 -0
  214. data/ext/protoc/protobuf/python/google/protobuf/text_format.py +873 -0
  215. data/ext/protoc/protobuf/python/mox.py +1401 -0
  216. data/ext/protoc/protobuf/python/setup.py +201 -0
  217. data/ext/protoc/protobuf/python/stubout.py +140 -0
  218. data/ext/protoc/protobuf/src/Makefile.am +418 -0
  219. data/ext/protoc/protobuf/src/google/protobuf/SEBS +240 -0
  220. data/ext/protoc/protobuf/src/google/protobuf/compiler/code_generator.cc +84 -0
  221. data/ext/protoc/protobuf/src/google/protobuf/compiler/code_generator.h +145 -0
  222. data/ext/protoc/protobuf/src/google/protobuf/compiler/command_line_interface.cc +1603 -0
  223. data/ext/protoc/protobuf/src/google/protobuf/compiler/command_line_interface.h +378 -0
  224. data/ext/protoc/protobuf/src/google/protobuf/compiler/command_line_interface_unittest.cc +1654 -0
  225. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc +158 -0
  226. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.cc +288 -0
  227. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.h +103 -0
  228. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.cc +431 -0
  229. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.h +122 -0
  230. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_extension.cc +210 -0
  231. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_extension.h +86 -0
  232. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_field.cc +166 -0
  233. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_field.h +185 -0
  234. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc +665 -0
  235. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_file.h +99 -0
  236. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.cc +125 -0
  237. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.h +72 -0
  238. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc +494 -0
  239. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h +206 -0
  240. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc +2645 -0
  241. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_message.h +175 -0
  242. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.cc +375 -0
  243. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.h +121 -0
  244. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_options.h +58 -0
  245. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc +123 -0
  246. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc +451 -0
  247. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.h +123 -0
  248. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_service.cc +334 -0
  249. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_service.h +118 -0
  250. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.cc +642 -0
  251. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.h +127 -0
  252. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto +132 -0
  253. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_unittest.cc +2074 -0
  254. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_unittest.h +51 -0
  255. data/ext/protoc/protobuf/src/google/protobuf/compiler/importer.cc +480 -0
  256. data/ext/protoc/protobuf/src/google/protobuf/compiler/importer.h +317 -0
  257. data/ext/protoc/protobuf/src/google/protobuf/compiler/importer_unittest.cc +617 -0
  258. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_context.cc +195 -0
  259. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_context.h +95 -0
  260. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_doc_comment.cc +233 -0
  261. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_doc_comment.h +69 -0
  262. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_doc_comment_unittest.cc +67 -0
  263. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_enum.cc +333 -0
  264. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_enum.h +99 -0
  265. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_enum_field.cc +778 -0
  266. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_enum_field.h +158 -0
  267. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_extension.cc +207 -0
  268. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_extension.h +109 -0
  269. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_field.cc +213 -0
  270. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_field.h +162 -0
  271. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_file.cc +534 -0
  272. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_file.h +115 -0
  273. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_generator.cc +158 -0
  274. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_generator.h +72 -0
  275. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_generator_factory.cc +77 -0
  276. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_generator_factory.h +101 -0
  277. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_helpers.cc +737 -0
  278. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_helpers.h +322 -0
  279. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_lazy_message_field.cc +826 -0
  280. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_lazy_message_field.h +121 -0
  281. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_message.cc +1666 -0
  282. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_message.h +140 -0
  283. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_message_field.cc +1343 -0
  284. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_message_field.h +173 -0
  285. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_name_resolver.cc +266 -0
  286. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_name_resolver.h +124 -0
  287. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_plugin_unittest.cc +124 -0
  288. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_primitive_field.cc +877 -0
  289. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_primitive_field.h +160 -0
  290. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_service.cc +473 -0
  291. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_service.h +135 -0
  292. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.cc +201 -0
  293. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.h +90 -0
  294. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_string_field.cc +1056 -0
  295. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_string_field.h +160 -0
  296. data/ext/protoc/protobuf/src/google/protobuf/compiler/main.cc +61 -0
  297. data/ext/protoc/protobuf/src/google/protobuf/compiler/mock_code_generator.cc +240 -0
  298. data/ext/protoc/protobuf/src/google/protobuf/compiler/mock_code_generator.h +117 -0
  299. data/ext/protoc/protobuf/src/google/protobuf/compiler/package_info.h +64 -0
  300. data/ext/protoc/protobuf/src/google/protobuf/compiler/parser.cc +1750 -0
  301. data/ext/protoc/protobuf/src/google/protobuf/compiler/parser.h +522 -0
  302. data/ext/protoc/protobuf/src/google/protobuf/compiler/parser_unittest.cc +2612 -0
  303. data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.cc +163 -0
  304. data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.h +72 -0
  305. data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.pb.cc +1148 -0
  306. data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.pb.h +897 -0
  307. data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.proto +147 -0
  308. data/ext/protoc/protobuf/src/google/protobuf/compiler/python/python_generator.cc +1262 -0
  309. data/ext/protoc/protobuf/src/google/protobuf/compiler/python/python_generator.h +166 -0
  310. data/ext/protoc/protobuf/src/google/protobuf/compiler/python/python_plugin_unittest.cc +118 -0
  311. data/ext/protoc/protobuf/src/google/protobuf/compiler/subprocess.cc +463 -0
  312. data/ext/protoc/protobuf/src/google/protobuf/compiler/subprocess.h +108 -0
  313. data/ext/protoc/protobuf/src/google/protobuf/compiler/test_plugin.cc +51 -0
  314. data/ext/protoc/protobuf/src/google/protobuf/compiler/zip_output_unittest.sh +91 -0
  315. data/ext/protoc/protobuf/src/google/protobuf/compiler/zip_writer.cc +218 -0
  316. data/ext/protoc/protobuf/src/google/protobuf/compiler/zip_writer.h +93 -0
  317. data/ext/protoc/protobuf/src/google/protobuf/descriptor.cc +5420 -0
  318. data/ext/protoc/protobuf/src/google/protobuf/descriptor.h +1691 -0
  319. data/ext/protoc/protobuf/src/google/protobuf/descriptor.pb.cc +9135 -0
  320. data/ext/protoc/protobuf/src/google/protobuf/descriptor.pb.h +6761 -0
  321. data/ext/protoc/protobuf/src/google/protobuf/descriptor.proto +687 -0
  322. data/ext/protoc/protobuf/src/google/protobuf/descriptor_database.cc +543 -0
  323. data/ext/protoc/protobuf/src/google/protobuf/descriptor_database.h +369 -0
  324. data/ext/protoc/protobuf/src/google/protobuf/descriptor_database_unittest.cc +748 -0
  325. data/ext/protoc/protobuf/src/google/protobuf/descriptor_pb2_test.py +54 -0
  326. data/ext/protoc/protobuf/src/google/protobuf/descriptor_unittest.cc +5501 -0
  327. data/ext/protoc/protobuf/src/google/protobuf/dynamic_message.cc +764 -0
  328. data/ext/protoc/protobuf/src/google/protobuf/dynamic_message.h +148 -0
  329. data/ext/protoc/protobuf/src/google/protobuf/dynamic_message_unittest.cc +230 -0
  330. data/ext/protoc/protobuf/src/google/protobuf/extension_set.cc +1663 -0
  331. data/ext/protoc/protobuf/src/google/protobuf/extension_set.h +1234 -0
  332. data/ext/protoc/protobuf/src/google/protobuf/extension_set_heavy.cc +734 -0
  333. data/ext/protoc/protobuf/src/google/protobuf/extension_set_unittest.cc +1095 -0
  334. data/ext/protoc/protobuf/src/google/protobuf/generated_enum_reflection.h +91 -0
  335. data/ext/protoc/protobuf/src/google/protobuf/generated_message_reflection.cc +1683 -0
  336. data/ext/protoc/protobuf/src/google/protobuf/generated_message_reflection.h +504 -0
  337. data/ext/protoc/protobuf/src/google/protobuf/generated_message_reflection_unittest.cc +795 -0
  338. data/ext/protoc/protobuf/src/google/protobuf/generated_message_util.cc +65 -0
  339. data/ext/protoc/protobuf/src/google/protobuf/generated_message_util.h +113 -0
  340. data/ext/protoc/protobuf/src/google/protobuf/io/coded_stream.cc +914 -0
  341. data/ext/protoc/protobuf/src/google/protobuf/io/coded_stream.h +1220 -0
  342. data/ext/protoc/protobuf/src/google/protobuf/io/coded_stream_inl.h +69 -0
  343. data/ext/protoc/protobuf/src/google/protobuf/io/coded_stream_unittest.cc +1378 -0
  344. data/ext/protoc/protobuf/src/google/protobuf/io/gzip_stream.cc +326 -0
  345. data/ext/protoc/protobuf/src/google/protobuf/io/gzip_stream.h +209 -0
  346. data/ext/protoc/protobuf/src/google/protobuf/io/gzip_stream_unittest.sh +44 -0
  347. data/ext/protoc/protobuf/src/google/protobuf/io/package_info.h +54 -0
  348. data/ext/protoc/protobuf/src/google/protobuf/io/printer.cc +198 -0
  349. data/ext/protoc/protobuf/src/google/protobuf/io/printer.h +136 -0
  350. data/ext/protoc/protobuf/src/google/protobuf/io/printer_unittest.cc +285 -0
  351. data/ext/protoc/protobuf/src/google/protobuf/io/strtod.cc +113 -0
  352. data/ext/protoc/protobuf/src/google/protobuf/io/strtod.h +50 -0
  353. data/ext/protoc/protobuf/src/google/protobuf/io/tokenizer.cc +1127 -0
  354. data/ext/protoc/protobuf/src/google/protobuf/io/tokenizer.h +402 -0
  355. data/ext/protoc/protobuf/src/google/protobuf/io/tokenizer_unittest.cc +999 -0
  356. data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream.cc +57 -0
  357. data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream.h +248 -0
  358. data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc +473 -0
  359. data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h +358 -0
  360. data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc +405 -0
  361. data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h +354 -0
  362. data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_unittest.cc +965 -0
  363. data/ext/protoc/protobuf/src/google/protobuf/lite_unittest.cc +350 -0
  364. data/ext/protoc/protobuf/src/google/protobuf/message.cc +358 -0
  365. data/ext/protoc/protobuf/src/google/protobuf/message.h +866 -0
  366. data/ext/protoc/protobuf/src/google/protobuf/message_lite.cc +335 -0
  367. data/ext/protoc/protobuf/src/google/protobuf/message_lite.h +247 -0
  368. data/ext/protoc/protobuf/src/google/protobuf/message_unittest.cc +427 -0
  369. data/ext/protoc/protobuf/src/google/protobuf/package_info.h +64 -0
  370. data/ext/protoc/protobuf/src/google/protobuf/reflection_ops.cc +269 -0
  371. data/ext/protoc/protobuf/src/google/protobuf/reflection_ops.h +81 -0
  372. data/ext/protoc/protobuf/src/google/protobuf/reflection_ops_unittest.cc +475 -0
  373. data/ext/protoc/protobuf/src/google/protobuf/repeated_field.cc +87 -0
  374. data/ext/protoc/protobuf/src/google/protobuf/repeated_field.h +1603 -0
  375. data/ext/protoc/protobuf/src/google/protobuf/repeated_field_reflection_unittest.cc +195 -0
  376. data/ext/protoc/protobuf/src/google/protobuf/repeated_field_unittest.cc +1442 -0
  377. data/ext/protoc/protobuf/src/google/protobuf/service.cc +46 -0
  378. data/ext/protoc/protobuf/src/google/protobuf/service.h +291 -0
  379. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops.h +227 -0
  380. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_arm64_gcc.h +325 -0
  381. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_arm_gcc.h +151 -0
  382. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_arm_qnx.h +146 -0
  383. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h +122 -0
  384. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h +137 -0
  385. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h +225 -0
  386. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_mips_gcc.h +313 -0
  387. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_pnacl.h +73 -0
  388. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_solaris.h +188 -0
  389. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_tsan.h +219 -0
  390. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc +137 -0
  391. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.h +293 -0
  392. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc +112 -0
  393. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_msvc.h +150 -0
  394. data/ext/protoc/protobuf/src/google/protobuf/stubs/common.cc +395 -0
  395. data/ext/protoc/protobuf/src/google/protobuf/stubs/common.h +1226 -0
  396. data/ext/protoc/protobuf/src/google/protobuf/stubs/common_unittest.cc +357 -0
  397. data/ext/protoc/protobuf/src/google/protobuf/stubs/hash.h +232 -0
  398. data/ext/protoc/protobuf/src/google/protobuf/stubs/map_util.h +771 -0
  399. data/ext/protoc/protobuf/src/google/protobuf/stubs/once.cc +99 -0
  400. data/ext/protoc/protobuf/src/google/protobuf/stubs/once.h +166 -0
  401. data/ext/protoc/protobuf/src/google/protobuf/stubs/once_unittest.cc +253 -0
  402. data/ext/protoc/protobuf/src/google/protobuf/stubs/platform_macros.h +103 -0
  403. data/ext/protoc/protobuf/src/google/protobuf/stubs/shared_ptr.h +470 -0
  404. data/ext/protoc/protobuf/src/google/protobuf/stubs/stl_util.h +121 -0
  405. data/ext/protoc/protobuf/src/google/protobuf/stubs/stringprintf.cc +175 -0
  406. data/ext/protoc/protobuf/src/google/protobuf/stubs/stringprintf.h +76 -0
  407. data/ext/protoc/protobuf/src/google/protobuf/stubs/stringprintf_unittest.cc +152 -0
  408. data/ext/protoc/protobuf/src/google/protobuf/stubs/structurally_valid.cc +536 -0
  409. data/ext/protoc/protobuf/src/google/protobuf/stubs/structurally_valid_unittest.cc +40 -0
  410. data/ext/protoc/protobuf/src/google/protobuf/stubs/strutil.cc +1279 -0
  411. data/ext/protoc/protobuf/src/google/protobuf/stubs/strutil.h +562 -0
  412. data/ext/protoc/protobuf/src/google/protobuf/stubs/strutil_unittest.cc +73 -0
  413. data/ext/protoc/protobuf/src/google/protobuf/stubs/substitute.cc +134 -0
  414. data/ext/protoc/protobuf/src/google/protobuf/stubs/substitute.h +170 -0
  415. data/ext/protoc/protobuf/src/google/protobuf/stubs/template_util.h +138 -0
  416. data/ext/protoc/protobuf/src/google/protobuf/stubs/template_util_unittest.cc +130 -0
  417. data/ext/protoc/protobuf/src/google/protobuf/stubs/type_traits.h +336 -0
  418. data/ext/protoc/protobuf/src/google/protobuf/stubs/type_traits_unittest.cc +628 -0
  419. data/ext/protoc/protobuf/src/google/protobuf/test_util.cc +3345 -0
  420. data/ext/protoc/protobuf/src/google/protobuf/test_util.h +215 -0
  421. data/ext/protoc/protobuf/src/google/protobuf/test_util_lite.cc +1585 -0
  422. data/ext/protoc/protobuf/src/google/protobuf/test_util_lite.h +101 -0
  423. data/ext/protoc/protobuf/src/google/protobuf/testdata/bad_utf8_string +1 -0
  424. data/ext/protoc/protobuf/src/google/protobuf/testdata/golden_message +0 -0
  425. data/ext/protoc/protobuf/src/google/protobuf/testdata/golden_message_oneof_implemented +0 -0
  426. data/ext/protoc/protobuf/src/google/protobuf/testdata/golden_packed_fields_message +0 -0
  427. data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_data.txt +134 -0
  428. data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_data_oneof_implemented.txt +129 -0
  429. data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_data_pointy.txt +134 -0
  430. data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_data_pointy_oneof.txt +129 -0
  431. data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_extensions_data.txt +134 -0
  432. data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt +134 -0
  433. data/ext/protoc/protobuf/src/google/protobuf/testing/file.cc +194 -0
  434. data/ext/protoc/protobuf/src/google/protobuf/testing/file.h +97 -0
  435. data/ext/protoc/protobuf/src/google/protobuf/testing/googletest.cc +255 -0
  436. data/ext/protoc/protobuf/src/google/protobuf/testing/googletest.h +102 -0
  437. data/ext/protoc/protobuf/src/google/protobuf/testing/zcgunzip.cc +73 -0
  438. data/ext/protoc/protobuf/src/google/protobuf/testing/zcgzip.cc +79 -0
  439. data/ext/protoc/protobuf/src/google/protobuf/text_format.cc +1746 -0
  440. data/ext/protoc/protobuf/src/google/protobuf/text_format.h +473 -0
  441. data/ext/protoc/protobuf/src/google/protobuf/text_format_unittest.cc +1479 -0
  442. data/ext/protoc/protobuf/src/google/protobuf/unittest.proto +861 -0
  443. data/ext/protoc/protobuf/src/google/protobuf/unittest_custom_options.proto +393 -0
  444. data/ext/protoc/protobuf/src/google/protobuf/unittest_embed_optimize_for.proto +50 -0
  445. data/ext/protoc/protobuf/src/google/protobuf/unittest_empty.proto +37 -0
  446. data/ext/protoc/protobuf/src/google/protobuf/unittest_enormous_descriptor.proto +1046 -0
  447. data/ext/protoc/protobuf/src/google/protobuf/unittest_import.proto +64 -0
  448. data/ext/protoc/protobuf/src/google/protobuf/unittest_import_lite.proto +51 -0
  449. data/ext/protoc/protobuf/src/google/protobuf/unittest_import_public.proto +40 -0
  450. data/ext/protoc/protobuf/src/google/protobuf/unittest_import_public_lite.proto +42 -0
  451. data/ext/protoc/protobuf/src/google/protobuf/unittest_lite.proto +384 -0
  452. data/ext/protoc/protobuf/src/google/protobuf/unittest_lite_imports_nonlite.proto +43 -0
  453. data/ext/protoc/protobuf/src/google/protobuf/unittest_mset.proto +83 -0
  454. data/ext/protoc/protobuf/src/google/protobuf/unittest_no_generic_services.proto +53 -0
  455. data/ext/protoc/protobuf/src/google/protobuf/unittest_optimize_for.proto +66 -0
  456. data/ext/protoc/protobuf/src/google/protobuf/unknown_field_set.cc +265 -0
  457. data/ext/protoc/protobuf/src/google/protobuf/unknown_field_set.h +318 -0
  458. data/ext/protoc/protobuf/src/google/protobuf/unknown_field_set_unittest.cc +599 -0
  459. data/ext/protoc/protobuf/src/google/protobuf/wire_format.cc +1101 -0
  460. data/ext/protoc/protobuf/src/google/protobuf/wire_format.h +336 -0
  461. data/ext/protoc/protobuf/src/google/protobuf/wire_format_lite.cc +471 -0
  462. data/ext/protoc/protobuf/src/google/protobuf/wire_format_lite.h +661 -0
  463. data/ext/protoc/protobuf/src/google/protobuf/wire_format_lite_inl.h +860 -0
  464. data/ext/protoc/protobuf/src/google/protobuf/wire_format_unittest.cc +1120 -0
  465. data/ext/protoc/protobuf/src/solaris/libstdc++.la +51 -0
  466. data/ext/protoc/protobuf/vsprojects/config.h +29 -0
  467. data/ext/protoc/protobuf/vsprojects/convert2008to2005.sh +20 -0
  468. data/ext/protoc/protobuf/vsprojects/extract_includes.bat +50 -0
  469. data/ext/protoc/protobuf/vsprojects/libprotobuf-lite.vcproj +302 -0
  470. data/ext/protoc/protobuf/vsprojects/libprotobuf.vcproj +470 -0
  471. data/ext/protoc/protobuf/vsprojects/libprotoc.vcproj +466 -0
  472. data/ext/protoc/protobuf/vsprojects/lite-test.vcproj +305 -0
  473. data/ext/protoc/protobuf/vsprojects/protobuf.sln +92 -0
  474. data/ext/protoc/protobuf/vsprojects/protoc.vcproj +192 -0
  475. data/ext/protoc/protobuf/vsprojects/readme.txt +114 -0
  476. data/ext/protoc/protobuf/vsprojects/test_plugin.vcproj +209 -0
  477. data/ext/protoc/protobuf/vsprojects/tests.vcproj +681 -0
  478. data/lib/protoc/version.rb +1 -1
  479. metadata +480 -3
@@ -0,0 +1,65 @@
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+
35
+ #include <google/protobuf/generated_message_util.h>
36
+
37
+ #include <limits>
38
+
39
+ namespace google {
40
+ namespace protobuf {
41
+ namespace internal {
42
+
43
+ double Infinity() {
44
+ return std::numeric_limits<double>::infinity();
45
+ }
46
+ double NaN() {
47
+ return std::numeric_limits<double>::quiet_NaN();
48
+ }
49
+
50
+ const ::std::string* empty_string_;
51
+ GOOGLE_PROTOBUF_DECLARE_ONCE(empty_string_once_init_);
52
+
53
+ void DeleteEmptyString() {
54
+ delete empty_string_;
55
+ }
56
+
57
+ void InitEmptyString() {
58
+ empty_string_ = new string;
59
+ OnShutdown(&DeleteEmptyString);
60
+ }
61
+
62
+
63
+ } // namespace internal
64
+ } // namespace protobuf
65
+ } // namespace google
@@ -0,0 +1,113 @@
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+ //
35
+ // This file contains miscellaneous helper code used by generated code --
36
+ // including lite types -- but which should not be used directly by users.
37
+
38
+ #ifndef GOOGLE_PROTOBUF_GENERATED_MESSAGE_UTIL_H__
39
+ #define GOOGLE_PROTOBUF_GENERATED_MESSAGE_UTIL_H__
40
+
41
+ #include <assert.h>
42
+ #include <string>
43
+
44
+ #include <google/protobuf/stubs/once.h>
45
+
46
+ #include <google/protobuf/stubs/common.h>
47
+ namespace google {
48
+
49
+ namespace protobuf {
50
+ namespace internal {
51
+
52
+
53
+ // Annotation for the compiler to emit a deprecation message if a field marked
54
+ // with option 'deprecated=true' is used in the code, or for other things in
55
+ // generated code which are deprecated.
56
+ //
57
+ // For internal use in the pb.cc files, deprecation warnings are suppressed
58
+ // there.
59
+ #undef DEPRECATED_PROTOBUF_FIELD
60
+ #define PROTOBUF_DEPRECATED
61
+
62
+
63
+ // Constants for special floating point values.
64
+ LIBPROTOBUF_EXPORT double Infinity();
65
+ LIBPROTOBUF_EXPORT double NaN();
66
+
67
+ // TODO(jieluo): Change to template. We have tried to use template,
68
+ // but it causes net/rpc/python:rpcutil_test fail (the empty string will
69
+ // init twice). It may related to swig. Change to template after we
70
+ // found the solution.
71
+
72
+ // Default empty string object. Don't use the pointer directly. Instead, call
73
+ // GetEmptyString() to get the reference.
74
+ LIBPROTOBUF_EXPORT extern const ::std::string* empty_string_;
75
+ LIBPROTOBUF_EXPORT extern ProtobufOnceType empty_string_once_init_;
76
+ LIBPROTOBUF_EXPORT void InitEmptyString();
77
+
78
+
79
+ LIBPROTOBUF_EXPORT inline const ::std::string& GetEmptyStringAlreadyInited() {
80
+ assert(empty_string_ != NULL);
81
+ return *empty_string_;
82
+ }
83
+ LIBPROTOBUF_EXPORT inline const ::std::string& GetEmptyString() {
84
+ ::google::protobuf::GoogleOnceInit(&empty_string_once_init_, &InitEmptyString);
85
+ return GetEmptyStringAlreadyInited();
86
+ }
87
+
88
+ // Defined in generated_message_reflection.cc -- not actually part of the lite
89
+ // library.
90
+ //
91
+ // TODO(jasonh): The various callers get this declaration from a variety of
92
+ // places: probably in most cases repeated_field.h. Clean these up so they all
93
+ // get the declaration from this file.
94
+ LIBPROTOBUF_EXPORT int StringSpaceUsedExcludingSelf(const string& str);
95
+
96
+
97
+ // True if IsInitialized() is true for all elements of t. Type is expected
98
+ // to be a RepeatedPtrField<some message type>. It's useful to have this
99
+ // helper here to keep the protobuf compiler from ever having to emit loops in
100
+ // IsInitialized() methods. We want the C++ compiler to inline this or not
101
+ // as it sees fit.
102
+ template <class Type> bool AllAreInitialized(const Type& t) {
103
+ for (int i = t.size(); --i >= 0; ) {
104
+ if (!t.Get(i).IsInitialized()) return false;
105
+ }
106
+ return true;
107
+ }
108
+
109
+ } // namespace internal
110
+ } // namespace protobuf
111
+
112
+ } // namespace google
113
+ #endif // GOOGLE_PROTOBUF_GENERATED_MESSAGE_UTIL_H__
@@ -0,0 +1,914 @@
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+ //
35
+ // This implementation is heavily optimized to make reads and writes
36
+ // of small values (especially varints) as fast as possible. In
37
+ // particular, we optimize for the common case that a read or a write
38
+ // will not cross the end of the buffer, since we can avoid a lot
39
+ // of branching in this case.
40
+
41
+ #include <google/protobuf/io/coded_stream_inl.h>
42
+ #include <algorithm>
43
+ #include <limits.h>
44
+ #include <google/protobuf/io/zero_copy_stream.h>
45
+ #include <google/protobuf/stubs/common.h>
46
+ #include <google/protobuf/stubs/stl_util.h>
47
+
48
+
49
+ namespace google {
50
+ namespace protobuf {
51
+ namespace io {
52
+
53
+ namespace {
54
+
55
+ static const int kMaxVarintBytes = 10;
56
+ static const int kMaxVarint32Bytes = 5;
57
+
58
+
59
+ inline bool NextNonEmpty(ZeroCopyInputStream* input,
60
+ const void** data, int* size) {
61
+ bool success;
62
+ do {
63
+ success = input->Next(data, size);
64
+ } while (success && *size == 0);
65
+ return success;
66
+ }
67
+
68
+ } // namespace
69
+
70
+ // CodedInputStream ==================================================
71
+
72
+ CodedInputStream::~CodedInputStream() {
73
+ if (input_ != NULL) {
74
+ BackUpInputToCurrentPosition();
75
+ }
76
+
77
+ if (total_bytes_warning_threshold_ == -2) {
78
+ GOOGLE_LOG(WARNING) << "The total number of bytes read was " << total_bytes_read_;
79
+ }
80
+ }
81
+
82
+ // Static.
83
+ int CodedInputStream::default_recursion_limit_ = 100;
84
+
85
+
86
+ void CodedOutputStream::EnableAliasing(bool enabled) {
87
+ aliasing_enabled_ = enabled && output_->AllowsAliasing();
88
+ }
89
+
90
+ void CodedInputStream::BackUpInputToCurrentPosition() {
91
+ int backup_bytes = BufferSize() + buffer_size_after_limit_ + overflow_bytes_;
92
+ if (backup_bytes > 0) {
93
+ input_->BackUp(backup_bytes);
94
+
95
+ // total_bytes_read_ doesn't include overflow_bytes_.
96
+ total_bytes_read_ -= BufferSize() + buffer_size_after_limit_;
97
+ buffer_end_ = buffer_;
98
+ buffer_size_after_limit_ = 0;
99
+ overflow_bytes_ = 0;
100
+ }
101
+ }
102
+
103
+ inline void CodedInputStream::RecomputeBufferLimits() {
104
+ buffer_end_ += buffer_size_after_limit_;
105
+ int closest_limit = min(current_limit_, total_bytes_limit_);
106
+ if (closest_limit < total_bytes_read_) {
107
+ // The limit position is in the current buffer. We must adjust
108
+ // the buffer size accordingly.
109
+ buffer_size_after_limit_ = total_bytes_read_ - closest_limit;
110
+ buffer_end_ -= buffer_size_after_limit_;
111
+ } else {
112
+ buffer_size_after_limit_ = 0;
113
+ }
114
+ }
115
+
116
+ CodedInputStream::Limit CodedInputStream::PushLimit(int byte_limit) {
117
+ // Current position relative to the beginning of the stream.
118
+ int current_position = CurrentPosition();
119
+
120
+ Limit old_limit = current_limit_;
121
+
122
+ // security: byte_limit is possibly evil, so check for negative values
123
+ // and overflow.
124
+ if (byte_limit >= 0 &&
125
+ byte_limit <= INT_MAX - current_position) {
126
+ current_limit_ = current_position + byte_limit;
127
+ } else {
128
+ // Negative or overflow.
129
+ current_limit_ = INT_MAX;
130
+ }
131
+
132
+ // We need to enforce all limits, not just the new one, so if the previous
133
+ // limit was before the new requested limit, we continue to enforce the
134
+ // previous limit.
135
+ current_limit_ = min(current_limit_, old_limit);
136
+
137
+ RecomputeBufferLimits();
138
+ return old_limit;
139
+ }
140
+
141
+ void CodedInputStream::PopLimit(Limit limit) {
142
+ // The limit passed in is actually the *old* limit, which we returned from
143
+ // PushLimit().
144
+ current_limit_ = limit;
145
+ RecomputeBufferLimits();
146
+
147
+ // We may no longer be at a legitimate message end. ReadTag() needs to be
148
+ // called again to find out.
149
+ legitimate_message_end_ = false;
150
+ }
151
+
152
+ int CodedInputStream::BytesUntilLimit() const {
153
+ if (current_limit_ == INT_MAX) return -1;
154
+ int current_position = CurrentPosition();
155
+
156
+ return current_limit_ - current_position;
157
+ }
158
+
159
+ void CodedInputStream::SetTotalBytesLimit(
160
+ int total_bytes_limit, int warning_threshold) {
161
+ // Make sure the limit isn't already past, since this could confuse other
162
+ // code.
163
+ int current_position = CurrentPosition();
164
+ total_bytes_limit_ = max(current_position, total_bytes_limit);
165
+ if (warning_threshold >= 0) {
166
+ total_bytes_warning_threshold_ = warning_threshold;
167
+ } else {
168
+ // warning_threshold is negative
169
+ total_bytes_warning_threshold_ = -1;
170
+ }
171
+ RecomputeBufferLimits();
172
+ }
173
+
174
+ int CodedInputStream::BytesUntilTotalBytesLimit() const {
175
+ if (total_bytes_limit_ == INT_MAX) return -1;
176
+ return total_bytes_limit_ - CurrentPosition();
177
+ }
178
+
179
+ void CodedInputStream::PrintTotalBytesLimitError() {
180
+ GOOGLE_LOG(ERROR) << "A protocol message was rejected because it was too "
181
+ "big (more than " << total_bytes_limit_
182
+ << " bytes). To increase the limit (or to disable these "
183
+ "warnings), see CodedInputStream::SetTotalBytesLimit() "
184
+ "in google/protobuf/io/coded_stream.h.";
185
+ }
186
+
187
+ bool CodedInputStream::Skip(int count) {
188
+ if (count < 0) return false; // security: count is often user-supplied
189
+
190
+ const int original_buffer_size = BufferSize();
191
+
192
+ if (count <= original_buffer_size) {
193
+ // Just skipping within the current buffer. Easy.
194
+ Advance(count);
195
+ return true;
196
+ }
197
+
198
+ if (buffer_size_after_limit_ > 0) {
199
+ // We hit a limit inside this buffer. Advance to the limit and fail.
200
+ Advance(original_buffer_size);
201
+ return false;
202
+ }
203
+
204
+ count -= original_buffer_size;
205
+ buffer_ = NULL;
206
+ buffer_end_ = buffer_;
207
+
208
+ // Make sure this skip doesn't try to skip past the current limit.
209
+ int closest_limit = min(current_limit_, total_bytes_limit_);
210
+ int bytes_until_limit = closest_limit - total_bytes_read_;
211
+ if (bytes_until_limit < count) {
212
+ // We hit the limit. Skip up to it then fail.
213
+ if (bytes_until_limit > 0) {
214
+ total_bytes_read_ = closest_limit;
215
+ input_->Skip(bytes_until_limit);
216
+ }
217
+ return false;
218
+ }
219
+
220
+ total_bytes_read_ += count;
221
+ return input_->Skip(count);
222
+ }
223
+
224
+ bool CodedInputStream::GetDirectBufferPointer(const void** data, int* size) {
225
+ if (BufferSize() == 0 && !Refresh()) return false;
226
+
227
+ *data = buffer_;
228
+ *size = BufferSize();
229
+ return true;
230
+ }
231
+
232
+ bool CodedInputStream::ReadRaw(void* buffer, int size) {
233
+ int current_buffer_size;
234
+ while ((current_buffer_size = BufferSize()) < size) {
235
+ // Reading past end of buffer. Copy what we have, then refresh.
236
+ memcpy(buffer, buffer_, current_buffer_size);
237
+ buffer = reinterpret_cast<uint8*>(buffer) + current_buffer_size;
238
+ size -= current_buffer_size;
239
+ Advance(current_buffer_size);
240
+ if (!Refresh()) return false;
241
+ }
242
+
243
+ memcpy(buffer, buffer_, size);
244
+ Advance(size);
245
+
246
+ return true;
247
+ }
248
+
249
+ bool CodedInputStream::ReadString(string* buffer, int size) {
250
+ if (size < 0) return false; // security: size is often user-supplied
251
+ return InternalReadStringInline(buffer, size);
252
+ }
253
+
254
+ bool CodedInputStream::ReadStringFallback(string* buffer, int size) {
255
+ if (!buffer->empty()) {
256
+ buffer->clear();
257
+ }
258
+
259
+ int closest_limit = min(current_limit_, total_bytes_limit_);
260
+ if (closest_limit != INT_MAX) {
261
+ int bytes_to_limit = closest_limit - CurrentPosition();
262
+ if (bytes_to_limit > 0 && size > 0 && size <= bytes_to_limit) {
263
+ buffer->reserve(size);
264
+ }
265
+ }
266
+
267
+ int current_buffer_size;
268
+ while ((current_buffer_size = BufferSize()) < size) {
269
+ // Some STL implementations "helpfully" crash on buffer->append(NULL, 0).
270
+ if (current_buffer_size != 0) {
271
+ // Note: string1.append(string2) is O(string2.size()) (as opposed to
272
+ // O(string1.size() + string2.size()), which would be bad).
273
+ buffer->append(reinterpret_cast<const char*>(buffer_),
274
+ current_buffer_size);
275
+ }
276
+ size -= current_buffer_size;
277
+ Advance(current_buffer_size);
278
+ if (!Refresh()) return false;
279
+ }
280
+
281
+ buffer->append(reinterpret_cast<const char*>(buffer_), size);
282
+ Advance(size);
283
+
284
+ return true;
285
+ }
286
+
287
+
288
+ bool CodedInputStream::ReadLittleEndian32Fallback(uint32* value) {
289
+ uint8 bytes[sizeof(*value)];
290
+
291
+ const uint8* ptr;
292
+ if (BufferSize() >= sizeof(*value)) {
293
+ // Fast path: Enough bytes in the buffer to read directly.
294
+ ptr = buffer_;
295
+ Advance(sizeof(*value));
296
+ } else {
297
+ // Slow path: Had to read past the end of the buffer.
298
+ if (!ReadRaw(bytes, sizeof(*value))) return false;
299
+ ptr = bytes;
300
+ }
301
+ ReadLittleEndian32FromArray(ptr, value);
302
+ return true;
303
+ }
304
+
305
+ bool CodedInputStream::ReadLittleEndian64Fallback(uint64* value) {
306
+ uint8 bytes[sizeof(*value)];
307
+
308
+ const uint8* ptr;
309
+ if (BufferSize() >= sizeof(*value)) {
310
+ // Fast path: Enough bytes in the buffer to read directly.
311
+ ptr = buffer_;
312
+ Advance(sizeof(*value));
313
+ } else {
314
+ // Slow path: Had to read past the end of the buffer.
315
+ if (!ReadRaw(bytes, sizeof(*value))) return false;
316
+ ptr = bytes;
317
+ }
318
+ ReadLittleEndian64FromArray(ptr, value);
319
+ return true;
320
+ }
321
+
322
+ namespace {
323
+
324
+ inline const uint8* ReadVarint32FromArray(
325
+ const uint8* buffer, uint32* value) GOOGLE_ATTRIBUTE_ALWAYS_INLINE;
326
+ inline const uint8* ReadVarint32FromArray(const uint8* buffer, uint32* value) {
327
+ // Fast path: We have enough bytes left in the buffer to guarantee that
328
+ // this read won't cross the end, so we can skip the checks.
329
+ const uint8* ptr = buffer;
330
+ uint32 b;
331
+ uint32 result;
332
+
333
+ b = *(ptr++); result = b ; if (!(b & 0x80)) goto done;
334
+ result -= 0x80;
335
+ b = *(ptr++); result += b << 7; if (!(b & 0x80)) goto done;
336
+ result -= 0x80 << 7;
337
+ b = *(ptr++); result += b << 14; if (!(b & 0x80)) goto done;
338
+ result -= 0x80 << 14;
339
+ b = *(ptr++); result += b << 21; if (!(b & 0x80)) goto done;
340
+ result -= 0x80 << 21;
341
+ b = *(ptr++); result += b << 28; if (!(b & 0x80)) goto done;
342
+ // "result -= 0x80 << 28" is irrevelant.
343
+
344
+ // If the input is larger than 32 bits, we still need to read it all
345
+ // and discard the high-order bits.
346
+ for (int i = 0; i < kMaxVarintBytes - kMaxVarint32Bytes; i++) {
347
+ b = *(ptr++); if (!(b & 0x80)) goto done;
348
+ }
349
+
350
+ // We have overrun the maximum size of a varint (10 bytes). Assume
351
+ // the data is corrupt.
352
+ return NULL;
353
+
354
+ done:
355
+ *value = result;
356
+ return ptr;
357
+ }
358
+
359
+ } // namespace
360
+
361
+ bool CodedInputStream::ReadVarint32Slow(uint32* value) {
362
+ uint64 result;
363
+ // Directly invoke ReadVarint64Fallback, since we already tried to optimize
364
+ // for one-byte varints.
365
+ if (!ReadVarint64Fallback(&result)) return false;
366
+ *value = (uint32)result;
367
+ return true;
368
+ }
369
+
370
+ bool CodedInputStream::ReadVarint32Fallback(uint32* value) {
371
+ if (BufferSize() >= kMaxVarintBytes ||
372
+ // Optimization: We're also safe if the buffer is non-empty and it ends
373
+ // with a byte that would terminate a varint.
374
+ (buffer_end_ > buffer_ && !(buffer_end_[-1] & 0x80))) {
375
+ const uint8* end = ReadVarint32FromArray(buffer_, value);
376
+ if (end == NULL) return false;
377
+ buffer_ = end;
378
+ return true;
379
+ } else {
380
+ // Really slow case: we will incur the cost of an extra function call here,
381
+ // but moving this out of line reduces the size of this function, which
382
+ // improves the common case. In micro benchmarks, this is worth about 10-15%
383
+ return ReadVarint32Slow(value);
384
+ }
385
+ }
386
+
387
+ uint32 CodedInputStream::ReadTagSlow() {
388
+ if (buffer_ == buffer_end_) {
389
+ // Call refresh.
390
+ if (!Refresh()) {
391
+ // Refresh failed. Make sure that it failed due to EOF, not because
392
+ // we hit total_bytes_limit_, which, unlike normal limits, is not a
393
+ // valid place to end a message.
394
+ int current_position = total_bytes_read_ - buffer_size_after_limit_;
395
+ if (current_position >= total_bytes_limit_) {
396
+ // Hit total_bytes_limit_. But if we also hit the normal limit,
397
+ // we're still OK.
398
+ legitimate_message_end_ = current_limit_ == total_bytes_limit_;
399
+ } else {
400
+ legitimate_message_end_ = true;
401
+ }
402
+ return 0;
403
+ }
404
+ }
405
+
406
+ // For the slow path, just do a 64-bit read. Try to optimize for one-byte tags
407
+ // again, since we have now refreshed the buffer.
408
+ uint64 result = 0;
409
+ if (!ReadVarint64(&result)) return 0;
410
+ return static_cast<uint32>(result);
411
+ }
412
+
413
+ uint32 CodedInputStream::ReadTagFallback() {
414
+ const int buf_size = BufferSize();
415
+ if (buf_size >= kMaxVarintBytes ||
416
+ // Optimization: We're also safe if the buffer is non-empty and it ends
417
+ // with a byte that would terminate a varint.
418
+ (buf_size > 0 && !(buffer_end_[-1] & 0x80))) {
419
+ uint32 tag;
420
+ const uint8* end = ReadVarint32FromArray(buffer_, &tag);
421
+ if (end == NULL) {
422
+ return 0;
423
+ }
424
+ buffer_ = end;
425
+ return tag;
426
+ } else {
427
+ // We are commonly at a limit when attempting to read tags. Try to quickly
428
+ // detect this case without making another function call.
429
+ if ((buf_size == 0) &&
430
+ ((buffer_size_after_limit_ > 0) ||
431
+ (total_bytes_read_ == current_limit_)) &&
432
+ // Make sure that the limit we hit is not total_bytes_limit_, since
433
+ // in that case we still need to call Refresh() so that it prints an
434
+ // error.
435
+ total_bytes_read_ - buffer_size_after_limit_ < total_bytes_limit_) {
436
+ // We hit a byte limit.
437
+ legitimate_message_end_ = true;
438
+ return 0;
439
+ }
440
+ return ReadTagSlow();
441
+ }
442
+ }
443
+
444
+ bool CodedInputStream::ReadVarint64Slow(uint64* value) {
445
+ // Slow path: This read might cross the end of the buffer, so we
446
+ // need to check and refresh the buffer if and when it does.
447
+
448
+ uint64 result = 0;
449
+ int count = 0;
450
+ uint32 b;
451
+
452
+ do {
453
+ if (count == kMaxVarintBytes) return false;
454
+ while (buffer_ == buffer_end_) {
455
+ if (!Refresh()) return false;
456
+ }
457
+ b = *buffer_;
458
+ result |= static_cast<uint64>(b & 0x7F) << (7 * count);
459
+ Advance(1);
460
+ ++count;
461
+ } while (b & 0x80);
462
+
463
+ *value = result;
464
+ return true;
465
+ }
466
+
467
+ bool CodedInputStream::ReadVarint64Fallback(uint64* value) {
468
+ if (BufferSize() >= kMaxVarintBytes ||
469
+ // Optimization: We're also safe if the buffer is non-empty and it ends
470
+ // with a byte that would terminate a varint.
471
+ (buffer_end_ > buffer_ && !(buffer_end_[-1] & 0x80))) {
472
+ // Fast path: We have enough bytes left in the buffer to guarantee that
473
+ // this read won't cross the end, so we can skip the checks.
474
+
475
+ const uint8* ptr = buffer_;
476
+ uint32 b;
477
+
478
+ // Splitting into 32-bit pieces gives better performance on 32-bit
479
+ // processors.
480
+ uint32 part0 = 0, part1 = 0, part2 = 0;
481
+
482
+ b = *(ptr++); part0 = b ; if (!(b & 0x80)) goto done;
483
+ part0 -= 0x80;
484
+ b = *(ptr++); part0 += b << 7; if (!(b & 0x80)) goto done;
485
+ part0 -= 0x80 << 7;
486
+ b = *(ptr++); part0 += b << 14; if (!(b & 0x80)) goto done;
487
+ part0 -= 0x80 << 14;
488
+ b = *(ptr++); part0 += b << 21; if (!(b & 0x80)) goto done;
489
+ part0 -= 0x80 << 21;
490
+ b = *(ptr++); part1 = b ; if (!(b & 0x80)) goto done;
491
+ part1 -= 0x80;
492
+ b = *(ptr++); part1 += b << 7; if (!(b & 0x80)) goto done;
493
+ part1 -= 0x80 << 7;
494
+ b = *(ptr++); part1 += b << 14; if (!(b & 0x80)) goto done;
495
+ part1 -= 0x80 << 14;
496
+ b = *(ptr++); part1 += b << 21; if (!(b & 0x80)) goto done;
497
+ part1 -= 0x80 << 21;
498
+ b = *(ptr++); part2 = b ; if (!(b & 0x80)) goto done;
499
+ part2 -= 0x80;
500
+ b = *(ptr++); part2 += b << 7; if (!(b & 0x80)) goto done;
501
+ // "part2 -= 0x80 << 7" is irrelevant because (0x80 << 7) << 56 is 0.
502
+
503
+ // We have overrun the maximum size of a varint (10 bytes). The data
504
+ // must be corrupt.
505
+ return false;
506
+
507
+ done:
508
+ Advance(ptr - buffer_);
509
+ *value = (static_cast<uint64>(part0) ) |
510
+ (static_cast<uint64>(part1) << 28) |
511
+ (static_cast<uint64>(part2) << 56);
512
+ return true;
513
+ } else {
514
+ return ReadVarint64Slow(value);
515
+ }
516
+ }
517
+
518
+ bool CodedInputStream::Refresh() {
519
+ GOOGLE_DCHECK_EQ(0, BufferSize());
520
+
521
+ if (buffer_size_after_limit_ > 0 || overflow_bytes_ > 0 ||
522
+ total_bytes_read_ == current_limit_) {
523
+ // We've hit a limit. Stop.
524
+ int current_position = total_bytes_read_ - buffer_size_after_limit_;
525
+
526
+ if (current_position >= total_bytes_limit_ &&
527
+ total_bytes_limit_ != current_limit_) {
528
+ // Hit total_bytes_limit_.
529
+ PrintTotalBytesLimitError();
530
+ }
531
+
532
+ return false;
533
+ }
534
+
535
+ if (total_bytes_warning_threshold_ >= 0 &&
536
+ total_bytes_read_ >= total_bytes_warning_threshold_) {
537
+ GOOGLE_LOG(WARNING) << "Reading dangerously large protocol message. If the "
538
+ "message turns out to be larger than "
539
+ << total_bytes_limit_ << " bytes, parsing will be halted "
540
+ "for security reasons. To increase the limit (or to "
541
+ "disable these warnings), see "
542
+ "CodedInputStream::SetTotalBytesLimit() in "
543
+ "google/protobuf/io/coded_stream.h.";
544
+
545
+ // Don't warn again for this stream, and print total size at the end.
546
+ total_bytes_warning_threshold_ = -2;
547
+ }
548
+
549
+ const void* void_buffer;
550
+ int buffer_size;
551
+ if (NextNonEmpty(input_, &void_buffer, &buffer_size)) {
552
+ buffer_ = reinterpret_cast<const uint8*>(void_buffer);
553
+ buffer_end_ = buffer_ + buffer_size;
554
+ GOOGLE_CHECK_GE(buffer_size, 0);
555
+
556
+ if (total_bytes_read_ <= INT_MAX - buffer_size) {
557
+ total_bytes_read_ += buffer_size;
558
+ } else {
559
+ // Overflow. Reset buffer_end_ to not include the bytes beyond INT_MAX.
560
+ // We can't get that far anyway, because total_bytes_limit_ is guaranteed
561
+ // to be less than it. We need to keep track of the number of bytes
562
+ // we discarded, though, so that we can call input_->BackUp() to back
563
+ // up over them on destruction.
564
+
565
+ // The following line is equivalent to:
566
+ // overflow_bytes_ = total_bytes_read_ + buffer_size - INT_MAX;
567
+ // except that it avoids overflows. Signed integer overflow has
568
+ // undefined results according to the C standard.
569
+ overflow_bytes_ = total_bytes_read_ - (INT_MAX - buffer_size);
570
+ buffer_end_ -= overflow_bytes_;
571
+ total_bytes_read_ = INT_MAX;
572
+ }
573
+
574
+ RecomputeBufferLimits();
575
+ return true;
576
+ } else {
577
+ buffer_ = NULL;
578
+ buffer_end_ = NULL;
579
+ return false;
580
+ }
581
+ }
582
+
583
+ // CodedOutputStream =================================================
584
+
585
+ CodedOutputStream::CodedOutputStream(ZeroCopyOutputStream* output)
586
+ : output_(output),
587
+ buffer_(NULL),
588
+ buffer_size_(0),
589
+ total_bytes_(0),
590
+ had_error_(false),
591
+ aliasing_enabled_(false) {
592
+ // Eagerly Refresh() so buffer space is immediately available.
593
+ Refresh();
594
+ // The Refresh() may have failed. If the client doesn't write any data,
595
+ // though, don't consider this an error. If the client does write data, then
596
+ // another Refresh() will be attempted and it will set the error once again.
597
+ had_error_ = false;
598
+ }
599
+
600
+ CodedOutputStream::~CodedOutputStream() {
601
+ if (buffer_size_ > 0) {
602
+ output_->BackUp(buffer_size_);
603
+ }
604
+ }
605
+
606
+ bool CodedOutputStream::Skip(int count) {
607
+ if (count < 0) return false;
608
+
609
+ while (count > buffer_size_) {
610
+ count -= buffer_size_;
611
+ if (!Refresh()) return false;
612
+ }
613
+
614
+ Advance(count);
615
+ return true;
616
+ }
617
+
618
+ bool CodedOutputStream::GetDirectBufferPointer(void** data, int* size) {
619
+ if (buffer_size_ == 0 && !Refresh()) return false;
620
+
621
+ *data = buffer_;
622
+ *size = buffer_size_;
623
+ return true;
624
+ }
625
+
626
+ void CodedOutputStream::WriteRaw(const void* data, int size) {
627
+ while (buffer_size_ < size) {
628
+ memcpy(buffer_, data, buffer_size_);
629
+ size -= buffer_size_;
630
+ data = reinterpret_cast<const uint8*>(data) + buffer_size_;
631
+ if (!Refresh()) return;
632
+ }
633
+
634
+ memcpy(buffer_, data, size);
635
+ Advance(size);
636
+ }
637
+
638
+ uint8* CodedOutputStream::WriteRawToArray(
639
+ const void* data, int size, uint8* target) {
640
+ memcpy(target, data, size);
641
+ return target + size;
642
+ }
643
+
644
+
645
+ void CodedOutputStream::WriteAliasedRaw(const void* data, int size) {
646
+ if (size < buffer_size_
647
+ ) {
648
+ WriteRaw(data, size);
649
+ } else {
650
+ if (buffer_size_ > 0) {
651
+ output_->BackUp(buffer_size_);
652
+ total_bytes_ -= buffer_size_;
653
+ buffer_ = NULL;
654
+ buffer_size_ = 0;
655
+ }
656
+
657
+ total_bytes_ += size;
658
+ had_error_ |= !output_->WriteAliasedRaw(data, size);
659
+ }
660
+ }
661
+
662
+ void CodedOutputStream::WriteLittleEndian32(uint32 value) {
663
+ uint8 bytes[sizeof(value)];
664
+
665
+ bool use_fast = buffer_size_ >= sizeof(value);
666
+ uint8* ptr = use_fast ? buffer_ : bytes;
667
+
668
+ WriteLittleEndian32ToArray(value, ptr);
669
+
670
+ if (use_fast) {
671
+ Advance(sizeof(value));
672
+ } else {
673
+ WriteRaw(bytes, sizeof(value));
674
+ }
675
+ }
676
+
677
+ void CodedOutputStream::WriteLittleEndian64(uint64 value) {
678
+ uint8 bytes[sizeof(value)];
679
+
680
+ bool use_fast = buffer_size_ >= sizeof(value);
681
+ uint8* ptr = use_fast ? buffer_ : bytes;
682
+
683
+ WriteLittleEndian64ToArray(value, ptr);
684
+
685
+ if (use_fast) {
686
+ Advance(sizeof(value));
687
+ } else {
688
+ WriteRaw(bytes, sizeof(value));
689
+ }
690
+ }
691
+
692
+ inline uint8* CodedOutputStream::WriteVarint32FallbackToArrayInline(
693
+ uint32 value, uint8* target) {
694
+ target[0] = static_cast<uint8>(value | 0x80);
695
+ if (value >= (1 << 7)) {
696
+ target[1] = static_cast<uint8>((value >> 7) | 0x80);
697
+ if (value >= (1 << 14)) {
698
+ target[2] = static_cast<uint8>((value >> 14) | 0x80);
699
+ if (value >= (1 << 21)) {
700
+ target[3] = static_cast<uint8>((value >> 21) | 0x80);
701
+ if (value >= (1 << 28)) {
702
+ target[4] = static_cast<uint8>(value >> 28);
703
+ return target + 5;
704
+ } else {
705
+ target[3] &= 0x7F;
706
+ return target + 4;
707
+ }
708
+ } else {
709
+ target[2] &= 0x7F;
710
+ return target + 3;
711
+ }
712
+ } else {
713
+ target[1] &= 0x7F;
714
+ return target + 2;
715
+ }
716
+ } else {
717
+ target[0] &= 0x7F;
718
+ return target + 1;
719
+ }
720
+ }
721
+
722
+ void CodedOutputStream::WriteVarint32(uint32 value) {
723
+ if (buffer_size_ >= kMaxVarint32Bytes) {
724
+ // Fast path: We have enough bytes left in the buffer to guarantee that
725
+ // this write won't cross the end, so we can skip the checks.
726
+ uint8* target = buffer_;
727
+ uint8* end = WriteVarint32FallbackToArrayInline(value, target);
728
+ int size = end - target;
729
+ Advance(size);
730
+ } else {
731
+ // Slow path: This write might cross the end of the buffer, so we
732
+ // compose the bytes first then use WriteRaw().
733
+ uint8 bytes[kMaxVarint32Bytes];
734
+ int size = 0;
735
+ while (value > 0x7F) {
736
+ bytes[size++] = (static_cast<uint8>(value) & 0x7F) | 0x80;
737
+ value >>= 7;
738
+ }
739
+ bytes[size++] = static_cast<uint8>(value) & 0x7F;
740
+ WriteRaw(bytes, size);
741
+ }
742
+ }
743
+
744
+ uint8* CodedOutputStream::WriteVarint32FallbackToArray(
745
+ uint32 value, uint8* target) {
746
+ return WriteVarint32FallbackToArrayInline(value, target);
747
+ }
748
+
749
+ inline uint8* CodedOutputStream::WriteVarint64ToArrayInline(
750
+ uint64 value, uint8* target) {
751
+ // Splitting into 32-bit pieces gives better performance on 32-bit
752
+ // processors.
753
+ uint32 part0 = static_cast<uint32>(value );
754
+ uint32 part1 = static_cast<uint32>(value >> 28);
755
+ uint32 part2 = static_cast<uint32>(value >> 56);
756
+
757
+ int size;
758
+
759
+ // Here we can't really optimize for small numbers, since the value is
760
+ // split into three parts. Cheking for numbers < 128, for instance,
761
+ // would require three comparisons, since you'd have to make sure part1
762
+ // and part2 are zero. However, if the caller is using 64-bit integers,
763
+ // it is likely that they expect the numbers to often be very large, so
764
+ // we probably don't want to optimize for small numbers anyway. Thus,
765
+ // we end up with a hardcoded binary search tree...
766
+ if (part2 == 0) {
767
+ if (part1 == 0) {
768
+ if (part0 < (1 << 14)) {
769
+ if (part0 < (1 << 7)) {
770
+ size = 1; goto size1;
771
+ } else {
772
+ size = 2; goto size2;
773
+ }
774
+ } else {
775
+ if (part0 < (1 << 21)) {
776
+ size = 3; goto size3;
777
+ } else {
778
+ size = 4; goto size4;
779
+ }
780
+ }
781
+ } else {
782
+ if (part1 < (1 << 14)) {
783
+ if (part1 < (1 << 7)) {
784
+ size = 5; goto size5;
785
+ } else {
786
+ size = 6; goto size6;
787
+ }
788
+ } else {
789
+ if (part1 < (1 << 21)) {
790
+ size = 7; goto size7;
791
+ } else {
792
+ size = 8; goto size8;
793
+ }
794
+ }
795
+ }
796
+ } else {
797
+ if (part2 < (1 << 7)) {
798
+ size = 9; goto size9;
799
+ } else {
800
+ size = 10; goto size10;
801
+ }
802
+ }
803
+
804
+ GOOGLE_LOG(FATAL) << "Can't get here.";
805
+
806
+ size10: target[9] = static_cast<uint8>((part2 >> 7) | 0x80);
807
+ size9 : target[8] = static_cast<uint8>((part2 ) | 0x80);
808
+ size8 : target[7] = static_cast<uint8>((part1 >> 21) | 0x80);
809
+ size7 : target[6] = static_cast<uint8>((part1 >> 14) | 0x80);
810
+ size6 : target[5] = static_cast<uint8>((part1 >> 7) | 0x80);
811
+ size5 : target[4] = static_cast<uint8>((part1 ) | 0x80);
812
+ size4 : target[3] = static_cast<uint8>((part0 >> 21) | 0x80);
813
+ size3 : target[2] = static_cast<uint8>((part0 >> 14) | 0x80);
814
+ size2 : target[1] = static_cast<uint8>((part0 >> 7) | 0x80);
815
+ size1 : target[0] = static_cast<uint8>((part0 ) | 0x80);
816
+
817
+ target[size-1] &= 0x7F;
818
+ return target + size;
819
+ }
820
+
821
+ void CodedOutputStream::WriteVarint64(uint64 value) {
822
+ if (buffer_size_ >= kMaxVarintBytes) {
823
+ // Fast path: We have enough bytes left in the buffer to guarantee that
824
+ // this write won't cross the end, so we can skip the checks.
825
+ uint8* target = buffer_;
826
+
827
+ uint8* end = WriteVarint64ToArrayInline(value, target);
828
+ int size = end - target;
829
+ Advance(size);
830
+ } else {
831
+ // Slow path: This write might cross the end of the buffer, so we
832
+ // compose the bytes first then use WriteRaw().
833
+ uint8 bytes[kMaxVarintBytes];
834
+ int size = 0;
835
+ while (value > 0x7F) {
836
+ bytes[size++] = (static_cast<uint8>(value) & 0x7F) | 0x80;
837
+ value >>= 7;
838
+ }
839
+ bytes[size++] = static_cast<uint8>(value) & 0x7F;
840
+ WriteRaw(bytes, size);
841
+ }
842
+ }
843
+
844
+ uint8* CodedOutputStream::WriteVarint64ToArray(
845
+ uint64 value, uint8* target) {
846
+ return WriteVarint64ToArrayInline(value, target);
847
+ }
848
+
849
+ bool CodedOutputStream::Refresh() {
850
+ void* void_buffer;
851
+ if (output_->Next(&void_buffer, &buffer_size_)) {
852
+ buffer_ = reinterpret_cast<uint8*>(void_buffer);
853
+ total_bytes_ += buffer_size_;
854
+ return true;
855
+ } else {
856
+ buffer_ = NULL;
857
+ buffer_size_ = 0;
858
+ had_error_ = true;
859
+ return false;
860
+ }
861
+ }
862
+
863
+ int CodedOutputStream::VarintSize32Fallback(uint32 value) {
864
+ if (value < (1 << 7)) {
865
+ return 1;
866
+ } else if (value < (1 << 14)) {
867
+ return 2;
868
+ } else if (value < (1 << 21)) {
869
+ return 3;
870
+ } else if (value < (1 << 28)) {
871
+ return 4;
872
+ } else {
873
+ return 5;
874
+ }
875
+ }
876
+
877
+ int CodedOutputStream::VarintSize64(uint64 value) {
878
+ if (value < (1ull << 35)) {
879
+ if (value < (1ull << 7)) {
880
+ return 1;
881
+ } else if (value < (1ull << 14)) {
882
+ return 2;
883
+ } else if (value < (1ull << 21)) {
884
+ return 3;
885
+ } else if (value < (1ull << 28)) {
886
+ return 4;
887
+ } else {
888
+ return 5;
889
+ }
890
+ } else {
891
+ if (value < (1ull << 42)) {
892
+ return 6;
893
+ } else if (value < (1ull << 49)) {
894
+ return 7;
895
+ } else if (value < (1ull << 56)) {
896
+ return 8;
897
+ } else if (value < (1ull << 63)) {
898
+ return 9;
899
+ } else {
900
+ return 10;
901
+ }
902
+ }
903
+ }
904
+
905
+ uint8* CodedOutputStream::WriteStringWithSizeToArray(const string& str,
906
+ uint8* target) {
907
+ GOOGLE_DCHECK_LE(str.size(), kuint32max);
908
+ target = WriteVarint32ToArray(str.size(), target);
909
+ return WriteStringToArray(str, target);
910
+ }
911
+
912
+ } // namespace io
913
+ } // namespace protobuf
914
+ } // namespace google