google-protobuf 3.3.0-x64-mingw32 → 3.4.0.1-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of google-protobuf might be problematic. Click here for more details.

@@ -2966,6 +2966,17 @@ class upb::FileDef {
2966
2966
  const char* package() const;
2967
2967
  bool set_package(const char* package, Status* s);
2968
2968
 
2969
+ /* Sets the php class prefix which is prepended to all php generated classes
2970
+ * from this .proto. Default is empty. */
2971
+ const char* phpprefix() const;
2972
+ bool set_phpprefix(const char* phpprefix, Status* s);
2973
+
2974
+ /* Use this option to change the namespace of php generated classes. Default
2975
+ * is empty. When this option is empty, the package name will be used for
2976
+ * determining the namespace. */
2977
+ const char* phpnamespace() const;
2978
+ bool set_phpnamespace(const char* phpnamespace, Status* s);
2979
+
2969
2980
  /* Syntax for the file. Defaults to proto2. */
2970
2981
  upb_syntax_t syntax() const;
2971
2982
  void set_syntax(upb_syntax_t syntax);
@@ -3019,6 +3030,8 @@ UPB_REFCOUNTED_CMETHODS(upb_filedef, upb_filedef_upcast)
3019
3030
 
3020
3031
  const char *upb_filedef_name(const upb_filedef *f);
3021
3032
  const char *upb_filedef_package(const upb_filedef *f);
3033
+ const char *upb_filedef_phpprefix(const upb_filedef *f);
3034
+ const char *upb_filedef_phpnamespace(const upb_filedef *f);
3022
3035
  upb_syntax_t upb_filedef_syntax(const upb_filedef *f);
3023
3036
  size_t upb_filedef_defcount(const upb_filedef *f);
3024
3037
  size_t upb_filedef_depcount(const upb_filedef *f);
@@ -3028,6 +3041,10 @@ const upb_filedef *upb_filedef_dep(const upb_filedef *f, size_t i);
3028
3041
  bool upb_filedef_freeze(upb_filedef *f, upb_status *s);
3029
3042
  bool upb_filedef_setname(upb_filedef *f, const char *name, upb_status *s);
3030
3043
  bool upb_filedef_setpackage(upb_filedef *f, const char *package, upb_status *s);
3044
+ bool upb_filedef_setphpprefix(upb_filedef *f, const char *phpprefix,
3045
+ upb_status *s);
3046
+ bool upb_filedef_setphpnamespace(upb_filedef *f, const char *phpnamespace,
3047
+ upb_status *s);
3031
3048
  bool upb_filedef_setsyntax(upb_filedef *f, upb_syntax_t syntax, upb_status *s);
3032
3049
 
3033
3050
  bool upb_filedef_adddef(upb_filedef *f, upb_def *def, const void *ref_donor,
@@ -3786,6 +3803,18 @@ inline const char* FileDef::package() const {
3786
3803
  inline bool FileDef::set_package(const char* package, Status* s) {
3787
3804
  return upb_filedef_setpackage(this, package, s);
3788
3805
  }
3806
+ inline const char* FileDef::phpprefix() const {
3807
+ return upb_filedef_phpprefix(this);
3808
+ }
3809
+ inline bool FileDef::set_phpprefix(const char* phpprefix, Status* s) {
3810
+ return upb_filedef_setphpprefix(this, phpprefix, s);
3811
+ }
3812
+ inline const char* FileDef::phpnamespace() const {
3813
+ return upb_filedef_phpnamespace(this);
3814
+ }
3815
+ inline bool FileDef::set_phpnamespace(const char* phpnamespace, Status* s) {
3816
+ return upb_filedef_setphpnamespace(this, phpnamespace, s);
3817
+ }
3789
3818
  inline int FileDef::def_count() const {
3790
3819
  return upb_filedef_defcount(this);
3791
3820
  }
@@ -4000,6 +4029,8 @@ struct upb_filedef {
4000
4029
 
4001
4030
  const char *name;
4002
4031
  const char *package;
4032
+ const char *phpprefix;
4033
+ const char *phpnamespace;
4003
4034
  upb_syntax_t syntax;
4004
4035
 
4005
4036
  upb_inttable defs;
@@ -7206,6 +7237,8 @@ UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_java_string
7206
7237
  UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_javanano_use_deprecated_package(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 38); }
7207
7238
  UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_objc_class_prefix(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 36); }
7208
7239
  UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_optimize_for(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 9); }
7240
+ UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_php_class_prefix(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 40); }
7241
+ UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_php_namespace(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 41); }
7209
7242
  UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_py_generic_services(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 18); }
7210
7243
  UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_uninterpreted_option(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 999); }
7211
7244
  UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MessageOptions_f_deprecated(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_MessageOptions_is(m)); return upb_msgdef_itof(m, 3); }
@@ -8304,16 +8337,8 @@ UPB_INLINE upb_decoderet upb_decoderet_make(const char *p, uint64_t val) {
8304
8337
  return ret;
8305
8338
  }
8306
8339
 
8307
- /* Four functions for decoding a varint of at most eight bytes. They are all
8308
- * functionally identical, but are implemented in different ways and likely have
8309
- * different performance profiles. We keep them around for performance testing.
8310
- *
8311
- * Note that these functions may not read byte-by-byte, so they must not be used
8312
- * unless there are at least eight bytes left in the buffer! */
8313
8340
  upb_decoderet upb_vdecode_max8_branch32(upb_decoderet r);
8314
8341
  upb_decoderet upb_vdecode_max8_branch64(upb_decoderet r);
8315
- upb_decoderet upb_vdecode_max8_wright(upb_decoderet r);
8316
- upb_decoderet upb_vdecode_max8_massimino(upb_decoderet r);
8317
8342
 
8318
8343
  /* Template for a function that checks the first two bytes with branching
8319
8344
  * and dispatches 2-10 bytes with a separate function. Note that this may read
@@ -8338,8 +8363,6 @@ UPB_INLINE upb_decoderet upb_vdecode_check2_ ## name(const char *_p) { \
8338
8363
 
8339
8364
  UPB_VARINT_DECODER_CHECK2(branch32, upb_vdecode_max8_branch32)
8340
8365
  UPB_VARINT_DECODER_CHECK2(branch64, upb_vdecode_max8_branch64)
8341
- UPB_VARINT_DECODER_CHECK2(wright, upb_vdecode_max8_wright)
8342
- UPB_VARINT_DECODER_CHECK2(massimino, upb_vdecode_max8_massimino)
8343
8366
  #undef UPB_VARINT_DECODER_CHECK2
8344
8367
 
8345
8368
  /* Our canonical functions for decoding varints, based on the currently
@@ -8351,10 +8374,6 @@ UPB_INLINE upb_decoderet upb_vdecode_fast(const char *p) {
8351
8374
  return upb_vdecode_check2_branch32(p);
8352
8375
  }
8353
8376
 
8354
- UPB_INLINE upb_decoderet upb_vdecode_max8_fast(upb_decoderet r) {
8355
- return upb_vdecode_max8_massimino(r);
8356
- }
8357
-
8358
8377
 
8359
8378
  /* Encoding *******************************************************************/
8360
8379
 
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -80,7 +80,7 @@ module Google
80
80
  end
81
81
 
82
82
  def to_f
83
- self.seconds + (self.nanos.to_f / 1_000_000_000)
83
+ self.seconds + (self.nanos.quo(1_000_000_000))
84
84
  end
85
85
  end
86
86
 
data/tests/basic.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
3
  require 'google/protobuf'
4
+ require 'json'
4
5
  require 'test/unit'
5
6
 
6
7
  # ------------- generated code --------------
@@ -1173,6 +1174,8 @@ module BasicTest
1173
1174
 
1174
1175
  json_text = TestMessage.encode_json(m)
1175
1176
  m2 = TestMessage.decode_json(json_text)
1177
+ puts m.inspect
1178
+ puts m2.inspect
1176
1179
  assert m == m2
1177
1180
 
1178
1181
  # Crash case from GitHub issue 283.
@@ -1184,21 +1187,135 @@ module BasicTest
1184
1187
  Foo.encode_json(Foo.new(bar: bar, baz: [baz1, baz2]))
1185
1188
  end
1186
1189
 
1190
+ def test_json_emit_defaults
1191
+ # TODO: Fix JSON in JRuby version.
1192
+ return if RUBY_PLATFORM == "java"
1193
+ m = TestMessage.new
1194
+
1195
+ expected = {
1196
+ optionalInt32: 0,
1197
+ optionalInt64: 0,
1198
+ optionalUint32: 0,
1199
+ optionalUint64: 0,
1200
+ optionalBool: false,
1201
+ optionalFloat: 0,
1202
+ optionalDouble: 0,
1203
+ optionalString: "",
1204
+ optionalBytes: "",
1205
+ optionalEnum: "Default",
1206
+ repeatedInt32: [],
1207
+ repeatedInt64: [],
1208
+ repeatedUint32: [],
1209
+ repeatedUint64: [],
1210
+ repeatedBool: [],
1211
+ repeatedFloat: [],
1212
+ repeatedDouble: [],
1213
+ repeatedString: [],
1214
+ repeatedBytes: [],
1215
+ repeatedMsg: [],
1216
+ repeatedEnum: []
1217
+ }
1218
+
1219
+ actual = TestMessage.encode_json(m, :emit_defaults => true)
1220
+
1221
+ assert JSON.parse(actual, :symbolize_names => true) == expected
1222
+ end
1223
+
1224
+ def test_json_emit_defaults_submsg
1225
+ # TODO: Fix JSON in JRuby version.
1226
+ return if RUBY_PLATFORM == "java"
1227
+ m = TestMessage.new(optional_msg: TestMessage2.new)
1228
+
1229
+ expected = {
1230
+ optionalInt32: 0,
1231
+ optionalInt64: 0,
1232
+ optionalUint32: 0,
1233
+ optionalUint64: 0,
1234
+ optionalBool: false,
1235
+ optionalFloat: 0,
1236
+ optionalDouble: 0,
1237
+ optionalString: "",
1238
+ optionalBytes: "",
1239
+ optionalMsg: {foo: 0},
1240
+ optionalEnum: "Default",
1241
+ repeatedInt32: [],
1242
+ repeatedInt64: [],
1243
+ repeatedUint32: [],
1244
+ repeatedUint64: [],
1245
+ repeatedBool: [],
1246
+ repeatedFloat: [],
1247
+ repeatedDouble: [],
1248
+ repeatedString: [],
1249
+ repeatedBytes: [],
1250
+ repeatedMsg: [],
1251
+ repeatedEnum: []
1252
+ }
1253
+
1254
+ actual = TestMessage.encode_json(m, :emit_defaults => true)
1255
+
1256
+ assert JSON.parse(actual, :symbolize_names => true) == expected
1257
+ end
1258
+
1259
+ def test_json_emit_defaults_repeated_submsg
1260
+ # TODO: Fix JSON in JRuby version.
1261
+ return if RUBY_PLATFORM == "java"
1262
+ m = TestMessage.new(repeated_msg: [TestMessage2.new])
1263
+
1264
+ expected = {
1265
+ optionalInt32: 0,
1266
+ optionalInt64: 0,
1267
+ optionalUint32: 0,
1268
+ optionalUint64: 0,
1269
+ optionalBool: false,
1270
+ optionalFloat: 0,
1271
+ optionalDouble: 0,
1272
+ optionalString: "",
1273
+ optionalBytes: "",
1274
+ optionalEnum: "Default",
1275
+ repeatedInt32: [],
1276
+ repeatedInt64: [],
1277
+ repeatedUint32: [],
1278
+ repeatedUint64: [],
1279
+ repeatedBool: [],
1280
+ repeatedFloat: [],
1281
+ repeatedDouble: [],
1282
+ repeatedString: [],
1283
+ repeatedBytes: [],
1284
+ repeatedMsg: [{foo: 0}],
1285
+ repeatedEnum: []
1286
+ }
1287
+
1288
+ actual = TestMessage.encode_json(m, :emit_defaults => true)
1289
+
1290
+ assert JSON.parse(actual, :symbolize_names => true) == expected
1291
+ end
1292
+
1187
1293
  def test_json_maps
1188
1294
  # TODO: Fix JSON in JRuby version.
1189
1295
  return if RUBY_PLATFORM == "java"
1190
1296
  m = MapMessage.new(:map_string_int32 => {"a" => 1})
1191
- expected = '{"mapStringInt32":{"a":1},"mapStringMsg":{}}'
1192
- expected_preserve = '{"map_string_int32":{"a":1},"map_string_msg":{}}'
1193
- assert MapMessage.encode_json(m) == expected
1297
+ expected = {mapStringInt32: {a: 1}, mapStringMsg: {}}
1298
+ expected_preserve = {map_string_int32: {a: 1}, map_string_msg: {}}
1299
+ assert JSON.parse(MapMessage.encode_json(m), :symbolize_names => true) == expected
1194
1300
 
1195
1301
  json = MapMessage.encode_json(m, :preserve_proto_fieldnames => true)
1196
- assert json == expected_preserve
1302
+ assert JSON.parse(json, :symbolize_names => true) == expected_preserve
1197
1303
 
1198
1304
  m2 = MapMessage.decode_json(MapMessage.encode_json(m))
1199
1305
  assert m == m2
1200
1306
  end
1201
1307
 
1308
+ def test_json_maps_emit_defaults_submsg
1309
+ # TODO: Fix JSON in JRuby version.
1310
+ return if RUBY_PLATFORM == "java"
1311
+ m = MapMessage.new(:map_string_msg => {"a" => TestMessage2.new})
1312
+ expected = {mapStringInt32: {}, mapStringMsg: {a: {foo: 0}}}
1313
+
1314
+ actual = MapMessage.encode_json(m, :emit_defaults => true)
1315
+
1316
+ assert JSON.parse(actual, :symbolize_names => true) == expected
1317
+ end
1318
+
1202
1319
  def test_comparison_with_arbitrary_object
1203
1320
  assert MapMessage.new != nil
1204
1321
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-protobuf
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.4.0.1
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - Protobuf Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-05 00:00:00.000000000 Z
11
+ date: 2017-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler-dock
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  version: '0'
136
136
  requirements: []
137
137
  rubyforge_project:
138
- rubygems_version: 2.6.10
138
+ rubygems_version: 2.6.12
139
139
  signing_key:
140
140
  specification_version: 4
141
141
  summary: Protocol Buffers