From f3b7af24f67a763dcb64b448ffb56e4ff8dac184 Mon Sep 17 00:00:00 2001 From: Rafi Kamal Date: Tue, 3 Sep 2019 18:11:21 -0700 Subject: [PATCH 01/14] Change update_version to update the generated code --- update_version.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/update_version.py b/update_version.py index bbb0dba350..f5f28542cb 100755 --- a/update_version.py +++ b/update_version.py @@ -128,6 +128,7 @@ def UpdateCpp(): 'static const int kMinHeaderVersionForProtoc = %s;' % cpp_version, line) return line + def RewritePortDef(line): line = re.sub( r'^#define PROTOBUF_VERSION .*$', @@ -148,8 +149,31 @@ def UpdateCpp(): line) return line + def RewritePbH(line): + line = re.sub( + r'^#if PROTOBUF_VERSION < .*$', + '#if PROTOBUF_VERSION < %s' % cpp_version, + line) + line = re.sub( + r'^#if .* < PROTOBUF_MIN_PROTOC_VERSION$', + '#if %s < PROTOBUF_MIN_PROTOC_VERSION' % cpp_version, + line) + return line + RewriteTextFile('src/google/protobuf/stubs/common.h', RewriteCommon) RewriteTextFile('src/google/protobuf/port_def.inc', RewritePortDef) + RewriteTextFile('src/google/protobuf/any.pb.h', RewritePbH) + RewriteTextFile('src/google/protobuf/api.pb.h', RewritePbH) + RewriteTextFile('src/google/protobuf/descriptor.pb.h', RewritePbH) + RewriteTextFile('src/google/protobuf/duration.pb.h', RewritePbH) + RewriteTextFile('src/google/protobuf/empty.pb.h', RewritePbH) + RewriteTextFile('src/google/protobuf/field_mask.pb.h', RewritePbH) + RewriteTextFile('src/google/protobuf/source_context.pb.h', RewritePbH) + RewriteTextFile('src/google/protobuf/struct.pb.h', RewritePbH) + RewriteTextFile('src/google/protobuf/timestamp.pb.h', RewritePbH) + RewriteTextFile('src/google/protobuf/type.pb.h', RewritePbH) + RewriteTextFile('src/google/protobuf/wrappers.pb.h', RewritePbH) + RewriteTextFile('src/google/protobuf/compiler/plugin.pb.h', RewritePbH) def UpdateCsharp(): From 9c0d61c33351aff69db8d6acc72fc257ae9a86d0 Mon Sep 17 00:00:00 2001 From: Rafi Kamal Date: Tue, 3 Sep 2019 18:57:30 -0700 Subject: [PATCH 02/14] Update CHANGES.txt for version 3.10.0 --- CHANGES.txt | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index d3cc7b8615..74689bd674 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,65 @@ +2019-09-03 version 3.10.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + C++ + * Switch the proto parser to the faster MOMI parser. + * Properly escape Struct keys in the proto3 JSON serializer. + * Fix crash on uninitialized map entries. + * Informed the compiler of has-bit invariant to produce better code + * Unused imports of files defining descriptor extensions will now be reported + * Add proto2::util::RemoveSubranges to remove multiple subranges in linear time. + * Added BaseTextGenerator::GetCurrentIndentationSize() + * Made implicit weak fields compatible with the Apple linker + * Support 32 bit values for ProtoStreamObjectWriter to Struct. + * Removed the internal-only header coded_stream_inl.h and the internal-only methods defined there. + * Enforced no SWIG wrapping of descriptor_database.h (other headers already had this restriction). + * Implementation of the equivalent of the MOMI parser for serialization. This removes one of the two serialization routines, by making the fast array serialization routine completely general. SerializeToCodedStream can now be implemented in terms of the much much faster array serialization. The array serialization regresses slightly, but when array serialization is not possible this wins big. + * Do not convert unknown field name to snake case to accurately report error. + * Fix a UBSAN warnings. (#6333) + * Add podspec for C++ (#6404) + * protoc: fix source code info location for missing label (#6436) + * C++ Add move constructor for Reflection's SetString (#6477) + + Java + * Call loadDescriptor outside of synchronized block to remove one possible source of deadlock. + * Have oneof enums implement a separate interface (other than EnumLite) for clarity. + * Opensource Android Memory Accessors + * Update TextFormat to make use of the new TypeRegistry. + * Support getFieldBuilder and getRepeatedFieldBuilder in ExtendableBuilder + * Update JsonFormat to make use of the new TypeRegistry. + * Add proguard config generator for GmmBenchmarkSuiteLite. + * Change ProtobufArrayList to use Object[] instead of ArrayList for 5-10% faster parsing + * Implement ProtobufArrayList.add(E) for 20% (5%-40%) faster overall protolite2 parsing + * Make a copy of JsonFormat.TypeRegistry at the protobuf top level package. This will eventually replace JsonFormat.TypeRegistry. + * Fix javadoc warnings in generated files (#6231) + * Java: Add Automatic-Module-Name entries to the Manifest (#6568) + + Python + * Add descriptor methods in descriptor_pool are deprecated. + * Uses explicit imports to prevent multithread test failures in py3. + * Added __delitem__ for Python extension dict + * Update six version to 1.12.0 and fix legacy_create_init issue (#6391) + + JavaScript + * Remove deprecated boolean option to getResultBase64String(). + * Fix sint64 zig-zag encoding. + * Simplify hash64 string conversion to avoid DIGIT array. Should reduce overhead if these functions aren't used, and be more efficient by avoiding linear array searches. + * Change the parameter types of binaryReaderFn in ExtensionFieldBinaryInfo to (number, ?, ?). + * Create dates.ts and time_of_days.ts to mirror Java versions. This is a near-identical conversion of c.g.type.util.{Dates,TimeOfDays} respectively. + * Migrate moneys to TypeScript. + + Ruby + * Fix scope resolution for Google namespace (#5878) + * Support hashes for struct initializers (#5716) + * Optimized away the creation of empty string objects. (#6502) + * Roll forward Ruby upb changes now that protobuf Ruby build is fixed (#5866) + * Optimized layout_mark() for Ruby (#6521) + * Optimization for layout_init() (#6547) + * Fix for GC of Ruby map frames. (#6533) + + Other + * Override CocoaPods module to lowercase (#6464) + + 2019-06-28 version 3.9.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) C++ From 398d37f95f56b4c285436dc8c62fcdd2f64a914a Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Wed, 4 Sep 2019 14:41:27 -0700 Subject: [PATCH 03/14] Sync upb (#6614) * Sync upb https://github.com/protocolbuffers/upb/pull/209 * Update upb https://github.com/protocolbuffers/upb/pull/210 --- php/ext/google/protobuf/upb.c | 68 +++++++------------------------- php/ext/google/protobuf/upb.h | 24 +---------- ruby/ext/google/protobuf_c/upb.c | 68 +++++++------------------------- ruby/ext/google/protobuf_c/upb.h | 24 +---------- 4 files changed, 32 insertions(+), 152 deletions(-) diff --git a/php/ext/google/protobuf/upb.c b/php/ext/google/protobuf/upb.c index c1a5431d34..a65264afbb 100644 --- a/php/ext/google/protobuf/upb.c +++ b/php/ext/google/protobuf/upb.c @@ -1536,7 +1536,8 @@ static upb_tabkey strcopy(lookupkey_t k2, upb_alloc *a) { char *str = upb_malloc(a, k2.str.len + sizeof(uint32_t) + 1); if (str == NULL) return 0; memcpy(str, &len, sizeof(uint32_t)); - memcpy(str + sizeof(uint32_t), k2.str.str, k2.str.len + 1); + memcpy(str + sizeof(uint32_t), k2.str.str, k2.str.len); + str[sizeof(uint32_t) + k2.str.len] = '\0'; return (uintptr_t)str; } @@ -6309,12 +6310,10 @@ static void set_bytecode_handlers(mgroup *g) { /* TODO(haberman): allow this to be constructed for an arbitrary set of dest * handlers and other mgroups (but verify we have a transitive closure). */ -const mgroup *mgroup_new(const upb_handlers *dest, bool allowjit, bool lazy) { +const mgroup *mgroup_new(const upb_handlers *dest, bool lazy) { mgroup *g; compiler *c; - UPB_UNUSED(allowjit); - g = newgroup(); c = newcompiler(g, lazy); find_methods(c, dest); @@ -6359,7 +6358,6 @@ upb_pbcodecache *upb_pbcodecache_new(upb_handlercache *dest) { if (!c) return NULL; c->dest = dest; - c->allow_jit = true; c->lazy = false; c->arena = upb_arena_new(); @@ -6369,13 +6367,12 @@ upb_pbcodecache *upb_pbcodecache_new(upb_handlercache *dest) { } void upb_pbcodecache_free(upb_pbcodecache *c) { - size_t i; + upb_inttable_iter i; - for (i = 0; i < upb_inttable_count(&c->groups); i++) { - upb_value v; - bool ok = upb_inttable_lookup(&c->groups, i, &v); - UPB_ASSERT(ok); - freegroup((void*)upb_value_getconstptr(v)); + upb_inttable_begin(&i, &c->groups); + for(; !upb_inttable_done(&i); upb_inttable_next(&i)) { + upb_value val = upb_inttable_iter_value(&i); + freegroup((void*)upb_value_getconstptr(val)); } upb_inttable_uninit(&c->groups); @@ -6383,15 +6380,6 @@ void upb_pbcodecache_free(upb_pbcodecache *c) { upb_gfree(c); } -bool upb_pbcodecache_allowjit(const upb_pbcodecache *c) { - return c->allow_jit; -} - -void upb_pbcodecache_setallowjit(upb_pbcodecache *c, bool allow) { - UPB_ASSERT(upb_inttable_count(&c->groups) == 0); - c->allow_jit = allow; -} - void upb_pbdecodermethodopts_setlazy(upb_pbcodecache *c, bool lazy) { UPB_ASSERT(upb_inttable_count(&c->groups) == 0); c->lazy = lazy; @@ -6404,11 +6392,14 @@ const upb_pbdecodermethod *upb_pbcodecache_get(upb_pbcodecache *c, const upb_handlers *h; const mgroup *g; - /* Right now we build a new DecoderMethod every time. - * TODO(haberman): properly cache methods by their true key. */ h = upb_handlercache_get(c->dest, md); - g = mgroup_new(h, c->allow_jit, c->lazy); - upb_inttable_push(&c->groups, upb_value_constptr(g)); + if (upb_inttable_lookupptr(&c->groups, md, &v)) { + g = upb_value_getconstptr(v); + } else { + g = mgroup_new(h, c->lazy); + ok = upb_inttable_insertptr(&c->groups, md, upb_value_constptr(g)); + UPB_ASSERT(ok); + } ok = upb_inttable_lookupptr(&g->methods, h, &v); UPB_ASSERT(ok); @@ -6490,16 +6481,6 @@ static size_t stacksize(upb_pbdecoder *d, size_t entries) { static size_t callstacksize(upb_pbdecoder *d, size_t entries) { UPB_UNUSED(d); -#ifdef UPB_USE_JIT_X64 - if (d->method_->is_native_) { - /* Each native stack frame needs two pointers, plus we need a few frames for - * the enter/exit trampolines. */ - size_t ret = entries * sizeof(void*) * 2; - ret += sizeof(void*) * 10; - return ret; - } -#endif - return entries * sizeof(uint32_t*); } @@ -7315,17 +7296,6 @@ void *upb_pbdecoder_startbc(void *closure, const void *pc, size_t size_hint) { return d; } -void *upb_pbdecoder_startjit(void *closure, const void *hd, size_t size_hint) { - upb_pbdecoder *d = closure; - UPB_UNUSED(hd); - UPB_UNUSED(size_hint); - d->top->end_ofs = UINT64_MAX; - d->bufstart_ofs = 0; - d->call_len = 0; - d->skip = 0; - return d; -} - bool upb_pbdecoder_end(void *closure, const void *handler_data) { upb_pbdecoder *d = closure; const upb_pbdecodermethod *method = handler_data; @@ -7351,14 +7321,6 @@ bool upb_pbdecoder_end(void *closure, const void *handler_data) { end = offset(d); d->top->end_ofs = end; -#ifdef UPB_USE_JIT_X64 - if (method->is_native_) { - const mgroup *group = (const mgroup*)method->group; - if (d->top != d->stack) - d->stack->end_ofs = 0; - group->jit_code(closure, method->code_base.ptr, &dummy, 0, NULL); - } else -#endif { const uint32_t *p = d->pc; d->stack->end_ofs = end; diff --git a/php/ext/google/protobuf/upb.h b/php/ext/google/protobuf/upb.h index a07cfa4579..0a55baf010 100644 --- a/php/ext/google/protobuf/upb.h +++ b/php/ext/google/protobuf/upb.h @@ -6343,7 +6343,7 @@ struct upb_pbcodecache { bool allow_jit; bool lazy; - /* Array of mgroups. */ + /* Map of upb_msgdef -> mgroup. */ upb_inttable groups; }; @@ -6359,15 +6359,6 @@ typedef struct { /* The bytecode for our methods, if any exists. Owned by us. */ uint32_t *bytecode; uint32_t *bytecode_end; - -#ifdef UPB_USE_JIT_X64 - /* JIT-generated machine code, if any. */ - upb_string_handlerfunc *jit_code; - /* The size of the jit_code (required to munmap()). */ - size_t jit_size; - char *debug_info; - void *dl; -#endif } mgroup; /* The maximum that any submessages can be nested. Matches proto2's limit. @@ -6478,19 +6469,10 @@ struct upb_pbdecoder { size_t stack_size; upb_status *status; - -#ifdef UPB_USE_JIT_X64 - /* Used momentarily by the generated code to store a value while a user - * function is called. */ - uint32_t tmp_len; - - const void *saved_rsp; -#endif }; /* Decoder entry points; used as handlers. */ void *upb_pbdecoder_startbc(void *closure, const void *pc, size_t size_hint); -void *upb_pbdecoder_startjit(void *closure, const void *hd, size_t size_hint); size_t upb_pbdecoder_decode(void *closure, const void *hd, const char *buf, size_t size, const upb_bufhandle *handle); bool upb_pbdecoder_end(void *closure, const void *handler_data); @@ -6514,10 +6496,6 @@ extern const char *kPbDecoderSubmessageTooLong; /* Access to decoderplan members needed by the decoder. */ const char *upb_pbdecoder_getopname(unsigned int op); -/* JIT codegen entry point. */ -void upb_pbdecoder_jit(mgroup *group); -void upb_pbdecoder_freejit(mgroup *group); - /* A special label that means "do field dispatch for this message and branch to * wherever that takes you." */ #define LABEL_DISPATCH 0 diff --git a/ruby/ext/google/protobuf_c/upb.c b/ruby/ext/google/protobuf_c/upb.c index c1a5431d34..a65264afbb 100644 --- a/ruby/ext/google/protobuf_c/upb.c +++ b/ruby/ext/google/protobuf_c/upb.c @@ -1536,7 +1536,8 @@ static upb_tabkey strcopy(lookupkey_t k2, upb_alloc *a) { char *str = upb_malloc(a, k2.str.len + sizeof(uint32_t) + 1); if (str == NULL) return 0; memcpy(str, &len, sizeof(uint32_t)); - memcpy(str + sizeof(uint32_t), k2.str.str, k2.str.len + 1); + memcpy(str + sizeof(uint32_t), k2.str.str, k2.str.len); + str[sizeof(uint32_t) + k2.str.len] = '\0'; return (uintptr_t)str; } @@ -6309,12 +6310,10 @@ static void set_bytecode_handlers(mgroup *g) { /* TODO(haberman): allow this to be constructed for an arbitrary set of dest * handlers and other mgroups (but verify we have a transitive closure). */ -const mgroup *mgroup_new(const upb_handlers *dest, bool allowjit, bool lazy) { +const mgroup *mgroup_new(const upb_handlers *dest, bool lazy) { mgroup *g; compiler *c; - UPB_UNUSED(allowjit); - g = newgroup(); c = newcompiler(g, lazy); find_methods(c, dest); @@ -6359,7 +6358,6 @@ upb_pbcodecache *upb_pbcodecache_new(upb_handlercache *dest) { if (!c) return NULL; c->dest = dest; - c->allow_jit = true; c->lazy = false; c->arena = upb_arena_new(); @@ -6369,13 +6367,12 @@ upb_pbcodecache *upb_pbcodecache_new(upb_handlercache *dest) { } void upb_pbcodecache_free(upb_pbcodecache *c) { - size_t i; + upb_inttable_iter i; - for (i = 0; i < upb_inttable_count(&c->groups); i++) { - upb_value v; - bool ok = upb_inttable_lookup(&c->groups, i, &v); - UPB_ASSERT(ok); - freegroup((void*)upb_value_getconstptr(v)); + upb_inttable_begin(&i, &c->groups); + for(; !upb_inttable_done(&i); upb_inttable_next(&i)) { + upb_value val = upb_inttable_iter_value(&i); + freegroup((void*)upb_value_getconstptr(val)); } upb_inttable_uninit(&c->groups); @@ -6383,15 +6380,6 @@ void upb_pbcodecache_free(upb_pbcodecache *c) { upb_gfree(c); } -bool upb_pbcodecache_allowjit(const upb_pbcodecache *c) { - return c->allow_jit; -} - -void upb_pbcodecache_setallowjit(upb_pbcodecache *c, bool allow) { - UPB_ASSERT(upb_inttable_count(&c->groups) == 0); - c->allow_jit = allow; -} - void upb_pbdecodermethodopts_setlazy(upb_pbcodecache *c, bool lazy) { UPB_ASSERT(upb_inttable_count(&c->groups) == 0); c->lazy = lazy; @@ -6404,11 +6392,14 @@ const upb_pbdecodermethod *upb_pbcodecache_get(upb_pbcodecache *c, const upb_handlers *h; const mgroup *g; - /* Right now we build a new DecoderMethod every time. - * TODO(haberman): properly cache methods by their true key. */ h = upb_handlercache_get(c->dest, md); - g = mgroup_new(h, c->allow_jit, c->lazy); - upb_inttable_push(&c->groups, upb_value_constptr(g)); + if (upb_inttable_lookupptr(&c->groups, md, &v)) { + g = upb_value_getconstptr(v); + } else { + g = mgroup_new(h, c->lazy); + ok = upb_inttable_insertptr(&c->groups, md, upb_value_constptr(g)); + UPB_ASSERT(ok); + } ok = upb_inttable_lookupptr(&g->methods, h, &v); UPB_ASSERT(ok); @@ -6490,16 +6481,6 @@ static size_t stacksize(upb_pbdecoder *d, size_t entries) { static size_t callstacksize(upb_pbdecoder *d, size_t entries) { UPB_UNUSED(d); -#ifdef UPB_USE_JIT_X64 - if (d->method_->is_native_) { - /* Each native stack frame needs two pointers, plus we need a few frames for - * the enter/exit trampolines. */ - size_t ret = entries * sizeof(void*) * 2; - ret += sizeof(void*) * 10; - return ret; - } -#endif - return entries * sizeof(uint32_t*); } @@ -7315,17 +7296,6 @@ void *upb_pbdecoder_startbc(void *closure, const void *pc, size_t size_hint) { return d; } -void *upb_pbdecoder_startjit(void *closure, const void *hd, size_t size_hint) { - upb_pbdecoder *d = closure; - UPB_UNUSED(hd); - UPB_UNUSED(size_hint); - d->top->end_ofs = UINT64_MAX; - d->bufstart_ofs = 0; - d->call_len = 0; - d->skip = 0; - return d; -} - bool upb_pbdecoder_end(void *closure, const void *handler_data) { upb_pbdecoder *d = closure; const upb_pbdecodermethod *method = handler_data; @@ -7351,14 +7321,6 @@ bool upb_pbdecoder_end(void *closure, const void *handler_data) { end = offset(d); d->top->end_ofs = end; -#ifdef UPB_USE_JIT_X64 - if (method->is_native_) { - const mgroup *group = (const mgroup*)method->group; - if (d->top != d->stack) - d->stack->end_ofs = 0; - group->jit_code(closure, method->code_base.ptr, &dummy, 0, NULL); - } else -#endif { const uint32_t *p = d->pc; d->stack->end_ofs = end; diff --git a/ruby/ext/google/protobuf_c/upb.h b/ruby/ext/google/protobuf_c/upb.h index 7181ddc561..e49c7dee0b 100644 --- a/ruby/ext/google/protobuf_c/upb.h +++ b/ruby/ext/google/protobuf_c/upb.h @@ -6336,7 +6336,7 @@ struct upb_pbcodecache { bool allow_jit; bool lazy; - /* Array of mgroups. */ + /* Map of upb_msgdef -> mgroup. */ upb_inttable groups; }; @@ -6352,15 +6352,6 @@ typedef struct { /* The bytecode for our methods, if any exists. Owned by us. */ uint32_t *bytecode; uint32_t *bytecode_end; - -#ifdef UPB_USE_JIT_X64 - /* JIT-generated machine code, if any. */ - upb_string_handlerfunc *jit_code; - /* The size of the jit_code (required to munmap()). */ - size_t jit_size; - char *debug_info; - void *dl; -#endif } mgroup; /* The maximum that any submessages can be nested. Matches proto2's limit. @@ -6471,19 +6462,10 @@ struct upb_pbdecoder { size_t stack_size; upb_status *status; - -#ifdef UPB_USE_JIT_X64 - /* Used momentarily by the generated code to store a value while a user - * function is called. */ - uint32_t tmp_len; - - const void *saved_rsp; -#endif }; /* Decoder entry points; used as handlers. */ void *upb_pbdecoder_startbc(void *closure, const void *pc, size_t size_hint); -void *upb_pbdecoder_startjit(void *closure, const void *hd, size_t size_hint); size_t upb_pbdecoder_decode(void *closure, const void *hd, const char *buf, size_t size, const upb_bufhandle *handle); bool upb_pbdecoder_end(void *closure, const void *handler_data); @@ -6507,10 +6489,6 @@ extern const char *kPbDecoderSubmessageTooLong; /* Access to decoderplan members needed by the decoder. */ const char *upb_pbdecoder_getopname(unsigned int op); -/* JIT codegen entry point. */ -void upb_pbdecoder_jit(mgroup *group); -void upb_pbdecoder_freejit(mgroup *group); - /* A special label that means "do field dispatch for this message and branch to * wherever that takes you." */ #define LABEL_DISPATCH 0 From 56bf637221dfbc1dd6db64d8231f7bbf600e1bdd Mon Sep 17 00:00:00 2001 From: Rafi Kamal Date: Wed, 4 Sep 2019 13:26:56 -0700 Subject: [PATCH 04/14] Update protobuf version --- Protobuf-C++.podspec | 2 +- Protobuf.podspec | 2 +- configure.ac | 2 +- csharp/Google.Protobuf.Tools.nuspec | 2 +- .../Google.Protobuf/Google.Protobuf.csproj | 2 +- java/bom/pom.xml | 2 +- java/pom.xml | 2 +- js/package.json | 2 +- php/ext/google/protobuf/package.xml | 26 ++++++++++++++----- php/ext/google/protobuf/protobuf.h | 2 +- protoc-artifacts/pom.xml | 2 +- python/google/protobuf/__init__.py | 2 +- ruby/google-protobuf.gemspec | 2 +- src/Makefile.am | 2 +- src/google/protobuf/any.pb.h | 4 +-- src/google/protobuf/api.pb.h | 4 +-- src/google/protobuf/compiler/plugin.pb.h | 4 +-- src/google/protobuf/descriptor.pb.h | 4 +-- src/google/protobuf/duration.pb.h | 4 +-- src/google/protobuf/empty.pb.h | 4 +-- src/google/protobuf/field_mask.pb.h | 4 +-- src/google/protobuf/port_def.inc | 8 +++--- src/google/protobuf/source_context.pb.h | 4 +-- src/google/protobuf/struct.pb.h | 4 +-- src/google/protobuf/stubs/common.h | 8 +++--- src/google/protobuf/timestamp.pb.h | 4 +-- src/google/protobuf/type.pb.h | 4 +-- src/google/protobuf/wrappers.pb.h | 4 +-- 28 files changed, 65 insertions(+), 51 deletions(-) diff --git a/Protobuf-C++.podspec b/Protobuf-C++.podspec index ffcb1a744c..be42c3eac1 100644 --- a/Protobuf-C++.podspec +++ b/Protobuf-C++.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Protobuf-C++' - s.version = '3.9.0-rc1' + s.version = '3.10.0-rc1' s.summary = 'Protocol Buffers v3 runtime library for C++.' s.homepage = 'https://github.com/google/protobuf' s.license = '3-Clause BSD License' diff --git a/Protobuf.podspec b/Protobuf.podspec index 0caca28f71..3c82cbab47 100644 --- a/Protobuf.podspec +++ b/Protobuf.podspec @@ -5,7 +5,7 @@ # dependent projects use the :git notation to refer to the library. Pod::Spec.new do |s| s.name = 'Protobuf' - s.version = '3.9.1' + s.version = '3.10.0-rc1' s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.' s.homepage = 'https://github.com/protocolbuffers/protobuf' s.license = '3-Clause BSD License' diff --git a/configure.ac b/configure.ac index 6dc48daae6..40ed7079ab 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ AC_PREREQ(2.59) # In the SVN trunk, the version should always be the next anticipated release # version with the "-pre" suffix. (We used to use "-SNAPSHOT" but this pushed # the size of one file name in the dist tarfile over the 99-char limit.) -AC_INIT([Protocol Buffers],[3.9.1],[protobuf@googlegroups.com],[protobuf]) +AC_INIT([Protocol Buffers],[3.10.0-rc-1],[protobuf@googlegroups.com],[protobuf]) AM_MAINTAINER_MODE([enable]) diff --git a/csharp/Google.Protobuf.Tools.nuspec b/csharp/Google.Protobuf.Tools.nuspec index 87372b6c94..cefd9162d2 100644 --- a/csharp/Google.Protobuf.Tools.nuspec +++ b/csharp/Google.Protobuf.Tools.nuspec @@ -5,7 +5,7 @@ Google Protocol Buffers tools Tools for Protocol Buffers - Google's data interchange format. See project site for more info. - 3.9.1 + 3.10.0-rc1 Google Inc. protobuf-packages https://github.com/protocolbuffers/protobuf/blob/master/LICENSE diff --git a/csharp/src/Google.Protobuf/Google.Protobuf.csproj b/csharp/src/Google.Protobuf/Google.Protobuf.csproj index 222f0fc56c..0789959957 100644 --- a/csharp/src/Google.Protobuf/Google.Protobuf.csproj +++ b/csharp/src/Google.Protobuf/Google.Protobuf.csproj @@ -4,7 +4,7 @@ C# runtime library for Protocol Buffers - Google's data interchange format. Copyright 2015, Google Inc. Google Protocol Buffers - 3.9.1 + 3.10.0-rc1 6 Google Inc. netstandard1.0;netstandard2.0;net45 diff --git a/java/bom/pom.xml b/java/bom/pom.xml index 792febb7b5..4686fab218 100644 --- a/java/bom/pom.xml +++ b/java/bom/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-bom - 3.9.1 + 3.10.0-rc-1 pom Protocol Buffers [BOM] diff --git a/java/pom.xml b/java/pom.xml index 246aa47566..4fe9ad98cc 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.9.1 + 3.10.0-rc-1 pom Protocol Buffers [Parent] diff --git a/js/package.json b/js/package.json index 37dfe67e3f..dded7164e9 100644 --- a/js/package.json +++ b/js/package.json @@ -1,6 +1,6 @@ { "name": "google-protobuf", - "version": "3.9.1", + "version": "3.10.0-rc.1", "description": "Protocol Buffers for JavaScript", "main": "google-protobuf.js", "files": [ diff --git a/php/ext/google/protobuf/package.xml b/php/ext/google/protobuf/package.xml index 5430bc9703..23273e72f3 100644 --- a/php/ext/google/protobuf/package.xml +++ b/php/ext/google/protobuf/package.xml @@ -10,15 +10,15 @@ protobuf-opensource@google.com yes - 2019-08-02 - + 2019-09-04 + - 3.9.1 - 3.9.1 + 3.10.0RC1 + 3.10.0 - stable - stable + beta + beta 3-Clause BSD License GA release. @@ -389,5 +389,19 @@ G A release. 3-Clause BSD License GA release. + + + 3.10.0RC1 + 3.10.0 + + + beta + beta + + 2019-09-04 + + 3-Clause BSD License + GA release. + diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h index a4219d0c43..9e67b224f2 100644 --- a/php/ext/google/protobuf/protobuf.h +++ b/php/ext/google/protobuf/protobuf.h @@ -37,7 +37,7 @@ #include "upb.h" #define PHP_PROTOBUF_EXTNAME "protobuf" -#define PHP_PROTOBUF_VERSION "3.9.1" +#define PHP_PROTOBUF_VERSION "3.10.0RC1" #define MAX_LENGTH_OF_INT64 20 #define SIZEOF_INT64 8 diff --git a/protoc-artifacts/pom.xml b/protoc-artifacts/pom.xml index 99c6a64494..84ef078651 100644 --- a/protoc-artifacts/pom.xml +++ b/protoc-artifacts/pom.xml @@ -8,7 +8,7 @@ com.google.protobuf protoc - 3.9.1 + 3.10.0-rc-1 pom Protobuf Compiler diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py index d75ab244da..640a5d01ac 100755 --- a/python/google/protobuf/__init__.py +++ b/python/google/protobuf/__init__.py @@ -30,7 +30,7 @@ # Copyright 2007 Google Inc. All Rights Reserved. -__version__ = '3.9.1' +__version__ = '3.10.0rc1' if __name__ != '__main__': try: diff --git a/ruby/google-protobuf.gemspec b/ruby/google-protobuf.gemspec index 95c2c89164..7114d4baf5 100644 --- a/ruby/google-protobuf.gemspec +++ b/ruby/google-protobuf.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = "google-protobuf" - s.version = "3.9.1" + s.version = "3.10.0.rc.1" git_tag = "v#{s.version.to_s.sub('.rc.', '-rc')}" # Converts X.Y.Z.rc.N to vX.Y.Z-rcN, used for the git tag s.licenses = ["BSD-3-Clause"] s.summary = "Protocol Buffers" diff --git a/src/Makefile.am b/src/Makefile.am index a06f298356..9f33a44395 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -18,7 +18,7 @@ else PTHREAD_DEF = endif -PROTOBUF_VERSION = 20:1:0 +PROTOBUF_VERSION = 21:0:0 if GCC # Turn on all warnings except for sign comparison (we ignore sign comparison diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h index d85bb6c436..04b7e9d128 100644 --- a/src/google/protobuf/any.pb.h +++ b/src/google/protobuf/any.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 3009000 +#if PROTOBUF_VERSION < 30010000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3009001 < PROTOBUF_MIN_PROTOC_VERSION +#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h index 4ced2978c9..ed4043ea6c 100644 --- a/src/google/protobuf/api.pb.h +++ b/src/google/protobuf/api.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 3009000 +#if PROTOBUF_VERSION < 30010000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3009001 < PROTOBUF_MIN_PROTOC_VERSION +#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h index e35ce26542..94971ff986 100644 --- a/src/google/protobuf/compiler/plugin.pb.h +++ b/src/google/protobuf/compiler/plugin.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 3009000 +#if PROTOBUF_VERSION < 30010000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3009001 < PROTOBUF_MIN_PROTOC_VERSION +#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index 8776c68e9a..81342ccea2 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 3009000 +#if PROTOBUF_VERSION < 30010000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3009001 < PROTOBUF_MIN_PROTOC_VERSION +#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/duration.pb.h b/src/google/protobuf/duration.pb.h index 414b4284a3..5cc32bb763 100644 --- a/src/google/protobuf/duration.pb.h +++ b/src/google/protobuf/duration.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 3009000 +#if PROTOBUF_VERSION < 30010000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3009001 < PROTOBUF_MIN_PROTOC_VERSION +#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/empty.pb.h b/src/google/protobuf/empty.pb.h index 055b0763f9..fe637e4462 100644 --- a/src/google/protobuf/empty.pb.h +++ b/src/google/protobuf/empty.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 3009000 +#if PROTOBUF_VERSION < 30010000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3009001 < PROTOBUF_MIN_PROTOC_VERSION +#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/field_mask.pb.h b/src/google/protobuf/field_mask.pb.h index ac0e2c229e..ecaba1479f 100644 --- a/src/google/protobuf/field_mask.pb.h +++ b/src/google/protobuf/field_mask.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 3009000 +#if PROTOBUF_VERSION < 30010000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3009001 < PROTOBUF_MIN_PROTOC_VERSION +#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc index 766b3bb27a..1ac28bf9ce 100644 --- a/src/google/protobuf/port_def.inc +++ b/src/google/protobuf/port_def.inc @@ -288,14 +288,14 @@ // Shared google3/opensource definitions. ////////////////////////////////////// -#define PROTOBUF_VERSION 3009001 -#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 3009000 -#define PROTOBUF_MIN_PROTOC_VERSION 3009000 +#define PROTOBUF_VERSION 30010000 +#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 30010000 +#define PROTOBUF_MIN_PROTOC_VERSION 30010000 #define PROTOBUF_VERSION_SUFFIX "" // The minimum library version which works with the current version of the // headers. -#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3009000 +#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 30010000 #if defined(GOOGLE_PROTOBUF_NO_RTTI) && GOOGLE_PROTOBUF_NO_RTTI #define PROTOBUF_RTTI 0 diff --git a/src/google/protobuf/source_context.pb.h b/src/google/protobuf/source_context.pb.h index 7ef7613fc3..e17c5b63b9 100644 --- a/src/google/protobuf/source_context.pb.h +++ b/src/google/protobuf/source_context.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 3009000 +#if PROTOBUF_VERSION < 30010000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3009001 < PROTOBUF_MIN_PROTOC_VERSION +#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/struct.pb.h b/src/google/protobuf/struct.pb.h index 244bbbe677..505e9e8ff3 100644 --- a/src/google/protobuf/struct.pb.h +++ b/src/google/protobuf/struct.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 3009000 +#if PROTOBUF_VERSION < 30010000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3009001 < PROTOBUF_MIN_PROTOC_VERSION +#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h index 3515cba917..c78a192ff8 100644 --- a/src/google/protobuf/stubs/common.h +++ b/src/google/protobuf/stubs/common.h @@ -81,7 +81,7 @@ namespace internal { // The current version, represented as a single integer to make comparison // easier: major * 10^6 + minor * 10^3 + micro -#define GOOGLE_PROTOBUF_VERSION 3009001 +#define GOOGLE_PROTOBUF_VERSION 30010000 // A suffix string for alpha, beta or rc releases. Empty for stable releases. #define GOOGLE_PROTOBUF_VERSION_SUFFIX "" @@ -89,15 +89,15 @@ namespace internal { // The minimum header version which works with the current version of // the library. This constant should only be used by protoc's C++ code // generator. -static const int kMinHeaderVersionForLibrary = 3009000; +static const int kMinHeaderVersionForLibrary = 30010000; // The minimum protoc version which works with the current version of the // headers. -#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3009000 +#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 30010000 // The minimum header version which works with the current version of // protoc. This constant should only be used in VerifyVersion(). -static const int kMinHeaderVersionForProtoc = 3009000; +static const int kMinHeaderVersionForProtoc = 30010000; // Verifies that the headers and libraries are compatible. Use the macro // below to call this. diff --git a/src/google/protobuf/timestamp.pb.h b/src/google/protobuf/timestamp.pb.h index dda0fc1c66..6172eb4f44 100644 --- a/src/google/protobuf/timestamp.pb.h +++ b/src/google/protobuf/timestamp.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 3009000 +#if PROTOBUF_VERSION < 30010000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3009001 < PROTOBUF_MIN_PROTOC_VERSION +#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/type.pb.h b/src/google/protobuf/type.pb.h index 88feaadfc1..2431969e34 100644 --- a/src/google/protobuf/type.pb.h +++ b/src/google/protobuf/type.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 3009000 +#if PROTOBUF_VERSION < 30010000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3009001 < PROTOBUF_MIN_PROTOC_VERSION +#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/wrappers.pb.h b/src/google/protobuf/wrappers.pb.h index a28a7b4e57..4172a8cbbe 100644 --- a/src/google/protobuf/wrappers.pb.h +++ b/src/google/protobuf/wrappers.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 3009000 +#if PROTOBUF_VERSION < 30010000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3009001 < PROTOBUF_MIN_PROTOC_VERSION +#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. From 63fc2810460a8c3c35360afa50d3a11ec8201df6 Mon Sep 17 00:00:00 2001 From: Rafi Kamal Date: Thu, 5 Sep 2019 10:15:17 -0700 Subject: [PATCH 05/14] Update protobuf version --- java/core/pom.xml | 2 +- java/lite/pom.xml | 2 +- java/util/pom.xml | 2 +- php/ext/google/protobuf/package.xml | 18 ++++++++++++++++-- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/java/core/pom.xml b/java/core/pom.xml index b152d2f25a..9f39ffef71 100644 --- a/java/core/pom.xml +++ b/java/core/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.9.1 + 3.10.0-rc-1 protobuf-java diff --git a/java/lite/pom.xml b/java/lite/pom.xml index 0d9da14928..ac6d29803b 100644 --- a/java/lite/pom.xml +++ b/java/lite/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.9.1 + 3.10.0-rc-1 protobuf-javalite diff --git a/java/util/pom.xml b/java/util/pom.xml index fe10c72ef0..12f0bc2a8c 100644 --- a/java/util/pom.xml +++ b/java/util/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.9.1 + 3.10.0-rc-1 protobuf-java-util diff --git a/php/ext/google/protobuf/package.xml b/php/ext/google/protobuf/package.xml index 23273e72f3..ae19d656d2 100644 --- a/php/ext/google/protobuf/package.xml +++ b/php/ext/google/protobuf/package.xml @@ -10,8 +10,8 @@ protobuf-opensource@google.com yes - 2019-09-04 - + 2019-09-05 + 3.10.0RC1 3.10.0 @@ -403,5 +403,19 @@ G A release. 3-Clause BSD License GA release. + + + 3.10.0RC1 + 3.10.0 + + + beta + beta + + 2019-09-05 + + 3-Clause BSD License + GA release. + From c9af9a553984555ff540536c5426a0f492bff296 Mon Sep 17 00:00:00 2001 From: Rafi Kamal Date: Thu, 12 Sep 2019 13:02:02 -0700 Subject: [PATCH 06/14] Fix update_version.py, so that PROTOBUF_VERSION is always a 9 digit number. --- src/google/protobuf/any.pb.h | 4 ++-- src/google/protobuf/api.pb.h | 4 ++-- src/google/protobuf/compiler/plugin.pb.h | 4 ++-- src/google/protobuf/descriptor.pb.h | 4 ++-- src/google/protobuf/duration.pb.h | 4 ++-- src/google/protobuf/empty.pb.h | 4 ++-- src/google/protobuf/field_mask.pb.h | 4 ++-- src/google/protobuf/port_def.inc | 8 ++++---- src/google/protobuf/source_context.pb.h | 4 ++-- src/google/protobuf/struct.pb.h | 4 ++-- src/google/protobuf/stubs/common.h | 8 ++++---- src/google/protobuf/timestamp.pb.h | 4 ++-- src/google/protobuf/type.pb.h | 4 ++-- src/google/protobuf/wrappers.pb.h | 4 ++-- update_version.py | 14 +++++++------- 15 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h index 04b7e9d128..87106efe3d 100644 --- a/src/google/protobuf/any.pb.h +++ b/src/google/protobuf/any.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 30010000 +#if PROTOBUF_VERSION < 3010000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION +#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h index ed4043ea6c..336c548a3c 100644 --- a/src/google/protobuf/api.pb.h +++ b/src/google/protobuf/api.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 30010000 +#if PROTOBUF_VERSION < 3010000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION +#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h index 94971ff986..4eaa9038d4 100644 --- a/src/google/protobuf/compiler/plugin.pb.h +++ b/src/google/protobuf/compiler/plugin.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 30010000 +#if PROTOBUF_VERSION < 3010000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION +#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index 81342ccea2..59b85ec356 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 30010000 +#if PROTOBUF_VERSION < 3010000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION +#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/duration.pb.h b/src/google/protobuf/duration.pb.h index 5cc32bb763..ecb69690fe 100644 --- a/src/google/protobuf/duration.pb.h +++ b/src/google/protobuf/duration.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 30010000 +#if PROTOBUF_VERSION < 3010000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION +#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/empty.pb.h b/src/google/protobuf/empty.pb.h index fe637e4462..488db4eb08 100644 --- a/src/google/protobuf/empty.pb.h +++ b/src/google/protobuf/empty.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 30010000 +#if PROTOBUF_VERSION < 3010000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION +#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/field_mask.pb.h b/src/google/protobuf/field_mask.pb.h index ecaba1479f..f948425900 100644 --- a/src/google/protobuf/field_mask.pb.h +++ b/src/google/protobuf/field_mask.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 30010000 +#if PROTOBUF_VERSION < 3010000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION +#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc index 1ac28bf9ce..cec8526ecc 100644 --- a/src/google/protobuf/port_def.inc +++ b/src/google/protobuf/port_def.inc @@ -288,14 +288,14 @@ // Shared google3/opensource definitions. ////////////////////////////////////// -#define PROTOBUF_VERSION 30010000 -#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 30010000 -#define PROTOBUF_MIN_PROTOC_VERSION 30010000 +#define PROTOBUF_VERSION 3010000 +#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 3010000 +#define PROTOBUF_MIN_PROTOC_VERSION 3010000 #define PROTOBUF_VERSION_SUFFIX "" // The minimum library version which works with the current version of the // headers. -#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 30010000 +#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3010000 #if defined(GOOGLE_PROTOBUF_NO_RTTI) && GOOGLE_PROTOBUF_NO_RTTI #define PROTOBUF_RTTI 0 diff --git a/src/google/protobuf/source_context.pb.h b/src/google/protobuf/source_context.pb.h index e17c5b63b9..690530fd26 100644 --- a/src/google/protobuf/source_context.pb.h +++ b/src/google/protobuf/source_context.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 30010000 +#if PROTOBUF_VERSION < 3010000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION +#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/struct.pb.h b/src/google/protobuf/struct.pb.h index 505e9e8ff3..3df0c97e02 100644 --- a/src/google/protobuf/struct.pb.h +++ b/src/google/protobuf/struct.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 30010000 +#if PROTOBUF_VERSION < 3010000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION +#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h index c78a192ff8..20608784ac 100644 --- a/src/google/protobuf/stubs/common.h +++ b/src/google/protobuf/stubs/common.h @@ -81,7 +81,7 @@ namespace internal { // The current version, represented as a single integer to make comparison // easier: major * 10^6 + minor * 10^3 + micro -#define GOOGLE_PROTOBUF_VERSION 30010000 +#define GOOGLE_PROTOBUF_VERSION 3010000 // A suffix string for alpha, beta or rc releases. Empty for stable releases. #define GOOGLE_PROTOBUF_VERSION_SUFFIX "" @@ -89,15 +89,15 @@ namespace internal { // The minimum header version which works with the current version of // the library. This constant should only be used by protoc's C++ code // generator. -static const int kMinHeaderVersionForLibrary = 30010000; +static const int kMinHeaderVersionForLibrary = 3010000; // The minimum protoc version which works with the current version of the // headers. -#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 30010000 +#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3010000 // The minimum header version which works with the current version of // protoc. This constant should only be used in VerifyVersion(). -static const int kMinHeaderVersionForProtoc = 30010000; +static const int kMinHeaderVersionForProtoc = 3010000; // Verifies that the headers and libraries are compatible. Use the macro // below to call this. diff --git a/src/google/protobuf/timestamp.pb.h b/src/google/protobuf/timestamp.pb.h index 6172eb4f44..d67d5cc6a5 100644 --- a/src/google/protobuf/timestamp.pb.h +++ b/src/google/protobuf/timestamp.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 30010000 +#if PROTOBUF_VERSION < 3010000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION +#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/type.pb.h b/src/google/protobuf/type.pb.h index 2431969e34..95a29a78ae 100644 --- a/src/google/protobuf/type.pb.h +++ b/src/google/protobuf/type.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 30010000 +#if PROTOBUF_VERSION < 3010000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION +#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/wrappers.pb.h b/src/google/protobuf/wrappers.pb.h index 4172a8cbbe..7f1b9a9738 100644 --- a/src/google/protobuf/wrappers.pb.h +++ b/src/google/protobuf/wrappers.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 30010000 +#if PROTOBUF_VERSION < 3010000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION +#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/update_version.py b/update_version.py index f5f28542cb..9ba1a3b64a 100755 --- a/update_version.py +++ b/update_version.py @@ -24,7 +24,7 @@ Example: exit(1) NEW_VERSION = sys.argv[1] -NEW_VERSION_INFO = NEW_VERSION.split('.') +NEW_VERSION_INFO = [int(x) for x in NEW_VERSION.split('.')] if len(NEW_VERSION_INFO) != 3: print """ [ERROR] Version must be in the format .. @@ -99,7 +99,7 @@ def UpdateConfigure(): def UpdateCpp(): - cpp_version = '%s00%s00%s' % ( + cpp_version = '%d%03d%03d' % ( NEW_VERSION_INFO[0], NEW_VERSION_INFO[1], NEW_VERSION_INFO[2]) def RewriteCommon(line): line = re.sub( @@ -110,7 +110,7 @@ def UpdateCpp(): r'^#define PROTOBUF_VERSION .*$', '#define PROTOBUF_VERSION %s' % cpp_version, line) - if NEW_VERSION_INFO[2] == '0': + if NEW_VERSION_INFO[2] == 0: line = re.sub( r'^#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC .*$', '#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC %s' % cpp_version, @@ -134,7 +134,7 @@ def UpdateCpp(): r'^#define PROTOBUF_VERSION .*$', '#define PROTOBUF_VERSION %s' % cpp_version, line) - if NEW_VERSION_INFO[2] == '0': + if NEW_VERSION_INFO[2] == 0: line = re.sub( r'^#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC .*$', '#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC %s' % cpp_version, @@ -228,7 +228,7 @@ def UpdateJavaScript(): def UpdateMakefile(): protobuf_version_offset = 11 - expected_major_version = '3' + expected_major_version = 3 if NEW_VERSION_INFO[0] != expected_major_version: print """[ERROR] Major protobuf version has changed. Please update update_version.py to readjust the protobuf_version_offset and @@ -237,8 +237,8 @@ always increasing. """ exit(1) - protobuf_version_info = '%s:%s:0' % ( - int(NEW_VERSION_INFO[1]) + protobuf_version_offset, NEW_VERSION_INFO[2]) + protobuf_version_info = '%d:%d:0' % ( + NEW_VERSION_INFO[1] + protobuf_version_offset, NEW_VERSION_INFO[2]) RewriteTextFile('src/Makefile.am', lambda line : re.sub( r'^PROTOBUF_VERSION = .*$', From 5021cd3419b75e4483c6686298aebf847dac4fcb Mon Sep 17 00:00:00 2001 From: Rafi Kamal Date: Thu, 12 Sep 2019 13:50:24 -0700 Subject: [PATCH 07/14] Update protobuf version --- Protobuf-C++.podspec | 2 +- Protobuf.podspec | 2 +- configure.ac | 2 +- csharp/Google.Protobuf.Tools.nuspec | 2 +- .../Google.Protobuf/Google.Protobuf.csproj | 2 +- java/bom/pom.xml | 2 +- java/core/pom.xml | 2 +- java/lite/pom.xml | 2 +- java/pom.xml | 2 +- java/util/pom.xml | 2 +- js/package.json | 2 +- php/ext/google/protobuf/package.xml | 24 +++++++++++++++---- php/ext/google/protobuf/protobuf.h | 2 +- protoc-artifacts/pom.xml | 2 +- python/google/protobuf/__init__.py | 2 +- ruby/google-protobuf.gemspec | 2 +- 16 files changed, 34 insertions(+), 20 deletions(-) diff --git a/Protobuf-C++.podspec b/Protobuf-C++.podspec index be42c3eac1..6cb72b8291 100644 --- a/Protobuf-C++.podspec +++ b/Protobuf-C++.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Protobuf-C++' - s.version = '3.10.0-rc1' + s.version = '3.10.0' s.summary = 'Protocol Buffers v3 runtime library for C++.' s.homepage = 'https://github.com/google/protobuf' s.license = '3-Clause BSD License' diff --git a/Protobuf.podspec b/Protobuf.podspec index 3c82cbab47..4726206b58 100644 --- a/Protobuf.podspec +++ b/Protobuf.podspec @@ -5,7 +5,7 @@ # dependent projects use the :git notation to refer to the library. Pod::Spec.new do |s| s.name = 'Protobuf' - s.version = '3.10.0-rc1' + s.version = '3.10.0' s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.' s.homepage = 'https://github.com/protocolbuffers/protobuf' s.license = '3-Clause BSD License' diff --git a/configure.ac b/configure.ac index 40ed7079ab..fdc155e4ed 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ AC_PREREQ(2.59) # In the SVN trunk, the version should always be the next anticipated release # version with the "-pre" suffix. (We used to use "-SNAPSHOT" but this pushed # the size of one file name in the dist tarfile over the 99-char limit.) -AC_INIT([Protocol Buffers],[3.10.0-rc-1],[protobuf@googlegroups.com],[protobuf]) +AC_INIT([Protocol Buffers],[3.10.0],[protobuf@googlegroups.com],[protobuf]) AM_MAINTAINER_MODE([enable]) diff --git a/csharp/Google.Protobuf.Tools.nuspec b/csharp/Google.Protobuf.Tools.nuspec index cefd9162d2..2bcf1d16e6 100644 --- a/csharp/Google.Protobuf.Tools.nuspec +++ b/csharp/Google.Protobuf.Tools.nuspec @@ -5,7 +5,7 @@ Google Protocol Buffers tools Tools for Protocol Buffers - Google's data interchange format. See project site for more info. - 3.10.0-rc1 + 3.10.0 Google Inc. protobuf-packages https://github.com/protocolbuffers/protobuf/blob/master/LICENSE diff --git a/csharp/src/Google.Protobuf/Google.Protobuf.csproj b/csharp/src/Google.Protobuf/Google.Protobuf.csproj index 0789959957..9fade056b9 100644 --- a/csharp/src/Google.Protobuf/Google.Protobuf.csproj +++ b/csharp/src/Google.Protobuf/Google.Protobuf.csproj @@ -4,7 +4,7 @@ C# runtime library for Protocol Buffers - Google's data interchange format. Copyright 2015, Google Inc. Google Protocol Buffers - 3.10.0-rc1 + 3.10.0 6 Google Inc. netstandard1.0;netstandard2.0;net45 diff --git a/java/bom/pom.xml b/java/bom/pom.xml index 4686fab218..919a0ad46e 100644 --- a/java/bom/pom.xml +++ b/java/bom/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-bom - 3.10.0-rc-1 + 3.10.0 pom Protocol Buffers [BOM] diff --git a/java/core/pom.xml b/java/core/pom.xml index 9f39ffef71..cc35abcf5b 100644 --- a/java/core/pom.xml +++ b/java/core/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.10.0-rc-1 + 3.10.0 protobuf-java diff --git a/java/lite/pom.xml b/java/lite/pom.xml index ac6d29803b..5d2e76051c 100644 --- a/java/lite/pom.xml +++ b/java/lite/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.10.0-rc-1 + 3.10.0 protobuf-javalite diff --git a/java/pom.xml b/java/pom.xml index 4fe9ad98cc..c5f16f7dcd 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.10.0-rc-1 + 3.10.0 pom Protocol Buffers [Parent] diff --git a/java/util/pom.xml b/java/util/pom.xml index 12f0bc2a8c..d9b0a2e70c 100644 --- a/java/util/pom.xml +++ b/java/util/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.10.0-rc-1 + 3.10.0 protobuf-java-util diff --git a/js/package.json b/js/package.json index dded7164e9..6f85241c92 100644 --- a/js/package.json +++ b/js/package.json @@ -1,6 +1,6 @@ { "name": "google-protobuf", - "version": "3.10.0-rc.1", + "version": "3.10.0", "description": "Protocol Buffers for JavaScript", "main": "google-protobuf.js", "files": [ diff --git a/php/ext/google/protobuf/package.xml b/php/ext/google/protobuf/package.xml index ae19d656d2..21e82cefa1 100644 --- a/php/ext/google/protobuf/package.xml +++ b/php/ext/google/protobuf/package.xml @@ -10,15 +10,15 @@ protobuf-opensource@google.com yes - 2019-09-05 - + 2019-09-12 + - 3.10.0RC1 + 3.10.0 3.10.0 - beta - beta + stable + stable 3-Clause BSD License GA release. @@ -417,5 +417,19 @@ G A release. 3-Clause BSD License GA release. + + + 3.10.0 + 3.10.0 + + + stable + stable + + 2019-09-12 + + 3-Clause BSD License + GA release. + diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h index 9e67b224f2..2ec39611cb 100644 --- a/php/ext/google/protobuf/protobuf.h +++ b/php/ext/google/protobuf/protobuf.h @@ -37,7 +37,7 @@ #include "upb.h" #define PHP_PROTOBUF_EXTNAME "protobuf" -#define PHP_PROTOBUF_VERSION "3.10.0RC1" +#define PHP_PROTOBUF_VERSION "3.10.0" #define MAX_LENGTH_OF_INT64 20 #define SIZEOF_INT64 8 diff --git a/protoc-artifacts/pom.xml b/protoc-artifacts/pom.xml index 84ef078651..29569ac4c2 100644 --- a/protoc-artifacts/pom.xml +++ b/protoc-artifacts/pom.xml @@ -8,7 +8,7 @@ com.google.protobuf protoc - 3.10.0-rc-1 + 3.10.0 pom Protobuf Compiler diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py index 640a5d01ac..3566a7cca2 100755 --- a/python/google/protobuf/__init__.py +++ b/python/google/protobuf/__init__.py @@ -30,7 +30,7 @@ # Copyright 2007 Google Inc. All Rights Reserved. -__version__ = '3.10.0rc1' +__version__ = '3.10.0' if __name__ != '__main__': try: diff --git a/ruby/google-protobuf.gemspec b/ruby/google-protobuf.gemspec index 7114d4baf5..3e90c8c95e 100644 --- a/ruby/google-protobuf.gemspec +++ b/ruby/google-protobuf.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = "google-protobuf" - s.version = "3.10.0.rc.1" + s.version = "3.10.0" git_tag = "v#{s.version.to_s.sub('.rc.', '-rc')}" # Converts X.Y.Z.rc.N to vX.Y.Z-rcN, used for the git tag s.licenses = ["BSD-3-Clause"] s.summary = "Protocol Buffers" From 2610eb6675f36062a70a105fccd436468169393c Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Mon, 16 Sep 2019 15:35:53 -0700 Subject: [PATCH 08/14] Add license (#6651) --- php/ext/google/protobuf/type_check.c | 54 ++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/php/ext/google/protobuf/type_check.c b/php/ext/google/protobuf/type_check.c index e037e638a6..af35b90318 100644 --- a/php/ext/google/protobuf/type_check.c +++ b/php/ext/google/protobuf/type_check.c @@ -28,6 +28,60 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// The Zend Engine License, version 2.00 +// Copyright (c) 1999-2002 Zend Technologies Ltd. All rights reserved. +// -------------------------------------------------------------------- +// +// Redistribution and use in source and binary forms, with or without +// modification, is permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// 3. The names "Zend" and "Zend Engine" must not be used to endorse +// or promote products derived from this software without prior +// permission from Zend Technologies Ltd. For written permission, +// please contact license@zend.com. +// +// 4. Zend Technologies Ltd. may publish revised and/or new versions +// of the license from time to time. Each version will be given a +// distinguishing version number. +// Once covered code has been published under a particular version +// of the license, you may always continue to use it under the +// terms of that version. You may also choose to use such covered +// code under the terms of any subsequent version of the license +// published by Zend Technologies Ltd. No one other than Zend +// Technologies Ltd. has the right to modify the terms applicable +// to covered code created under this License. +// +// 5. Redistributions of any form whatsoever must retain the following +// acknowledgment: +// "This product includes the Zend Engine, freely available at +// http://www.zend.com" +// +// 6. All advertising materials mentioning features or use of this +// software must display the following acknowledgment: +// "The Zend Engine is freely available at http://www.zend.com" +// +// THIS SOFTWARE IS PROVIDED BY ZEND TECHNOLOGIES LTD. ``AS IS'' AND +// ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ZEND +// TECHNOLOGIES LTD. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. + #include #include From 33da4715ea4ffc723223eb223baa726e15462e5a Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Fri, 20 Sep 2019 10:52:34 -0400 Subject: [PATCH 09/14] [ObjC] Don't use unions and instead use memcpy for the type swaps. (#6672) The code in question hasn't change in a long time so the cause of https://github.com/firebase/firebase-ios-sdk/issues/3851 still appears to be an Xcode 11 clang change/bug; but this does appear to be slightly better code for the work being done. Cleanup along the way for #6679 --- objectivec/GPBUtilities_PackagePrivate.h | 28 ++++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/objectivec/GPBUtilities_PackagePrivate.h b/objectivec/GPBUtilities_PackagePrivate.h index ed424ce399..336a745ca1 100644 --- a/objectivec/GPBUtilities_PackagePrivate.h +++ b/objectivec/GPBUtilities_PackagePrivate.h @@ -71,27 +71,31 @@ GPB_INLINE void GPBDebugCheckRuntimeVersion() { // Conversion functions for de/serializing floating point types. GPB_INLINE int64_t GPBConvertDoubleToInt64(double v) { - union { double f; int64_t i; } u; - u.f = v; - return u.i; + GPBInternalCompileAssert(sizeof(double) == sizeof(int64_t), double_not_64_bits); + int64_t result; + memcpy(&result, &v, sizeof(result)); + return result; } GPB_INLINE int32_t GPBConvertFloatToInt32(float v) { - union { float f; int32_t i; } u; - u.f = v; - return u.i; + GPBInternalCompileAssert(sizeof(float) == sizeof(int32_t), float_not_32_bits); + int32_t result; + memcpy(&result, &v, sizeof(result)); + return result; } GPB_INLINE double GPBConvertInt64ToDouble(int64_t v) { - union { double f; int64_t i; } u; - u.i = v; - return u.f; + GPBInternalCompileAssert(sizeof(double) == sizeof(int64_t), double_not_64_bits); + double result; + memcpy(&result, &v, sizeof(result)); + return result; } GPB_INLINE float GPBConvertInt32ToFloat(int32_t v) { - union { float f; int32_t i; } u; - u.i = v; - return u.f; + GPBInternalCompileAssert(sizeof(float) == sizeof(int32_t), float_not_32_bits); + float result; + memcpy(&result, &v, sizeof(result)); + return result; } GPB_INLINE int32_t GPBLogicalRightShift32(int32_t value, int32_t spaces) { From 397e017c8024cef060cfcdf870f264424c189791 Mon Sep 17 00:00:00 2001 From: dmaclach Date: Fri, 20 Sep 2019 08:19:45 -0700 Subject: [PATCH 10/14] Remove OSReadLittle* due to alignment requirements (#6678) The OSReadLittleInt64 function as defined by Apple reduces down to: `return *(volatile uint64_t *)((uintptr_t)base + byteOffset);` which means we are type-punning using a cast. On ARMv7 and other aligned architectures this can cause crashes. Minimal example: https://gist.github.com/dmaclach/b10b0a71ae614d304c067cb9bd264336 Fixes #6679 --- objectivec/GPBCodedInputStream.m | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/objectivec/GPBCodedInputStream.m b/objectivec/GPBCodedInputStream.m index 57d04dde38..4c8d640fda 100644 --- a/objectivec/GPBCodedInputStream.m +++ b/objectivec/GPBCodedInputStream.m @@ -93,14 +93,22 @@ static int8_t ReadRawByte(GPBCodedInputStreamState *state) { static int32_t ReadRawLittleEndian32(GPBCodedInputStreamState *state) { CheckSize(state, sizeof(int32_t)); - int32_t value = OSReadLittleInt32(state->bytes, state->bufferPos); + // Not using OSReadLittleInt32 because it has undocumented dependency + // on reads being aligned. + int32_t value; + memcpy(&value, state->bytes + state->bufferPos, sizeof(int32_t)); + value = OSSwapLittleToHostInt32(value); state->bufferPos += sizeof(int32_t); return value; } static int64_t ReadRawLittleEndian64(GPBCodedInputStreamState *state) { CheckSize(state, sizeof(int64_t)); - int64_t value = OSReadLittleInt64(state->bytes, state->bufferPos); + // Not using OSReadLittleInt64 because it has undocumented dependency + // on reads being aligned. + int64_t value; + memcpy(&value, state->bytes + state->bufferPos, sizeof(int64_t)); + value = OSSwapLittleToHostInt64(value); state->bufferPos += sizeof(int64_t); return value; } From 61b6670a2ac5f5ca9e34113ef784ee1ce7e226fe Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Tue, 24 Sep 2019 17:10:24 -0700 Subject: [PATCH 11/14] Fixed leap year handling by reworking upb_mktime() -> upb_timegm(). (#6695) The new function name also better reflects the semantics of the function. Like timegm(), this function always converts to/from UTC, not local time. --- ruby/ext/google/protobuf_c/upb.c | 64 ++++++++++++-------------------- ruby/tests/common_tests.rb | 12 ++++++ 2 files changed, 35 insertions(+), 41 deletions(-) diff --git a/ruby/ext/google/protobuf_c/upb.c b/ruby/ext/google/protobuf_c/upb.c index a65264afbb..bc87ea64e9 100644 --- a/ruby/ext/google/protobuf_c/upb.c +++ b/ruby/ext/google/protobuf_c/upb.c @@ -10117,46 +10117,28 @@ static void start_timestamp_zone(upb_json_parser *p, const char *ptr) { capture_begin(p, ptr); } -#define EPOCH_YEAR 1970 -#define TM_YEAR_BASE 1900 - -static bool isleap(int year) { - return (year % 4) == 0 && (year % 100 != 0 || (year % 400) == 0); -} - -const unsigned short int __mon_yday[2][13] = { - /* Normal years. */ - { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }, - /* Leap years. */ - { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 } -}; - -int64_t epoch(int year, int yday, int hour, int min, int sec) { - int64_t years = year - EPOCH_YEAR; - - int64_t leap_days = years / 4 - years / 100 + years / 400; - - int64_t days = years * 365 + yday + leap_days; - int64_t hours = days * 24 + hour; - int64_t mins = hours * 60 + min; - int64_t secs = mins * 60 + sec; - return secs; -} - - -static int64_t upb_mktime(const struct tm *tp) { - int sec = tp->tm_sec; - int min = tp->tm_min; - int hour = tp->tm_hour; - int mday = tp->tm_mday; - int mon = tp->tm_mon; - int year = tp->tm_year + TM_YEAR_BASE; - - /* Calculate day of year from year, month, and day of month. */ - int mon_yday = ((__mon_yday[isleap(year)][mon]) - 1); - int yday = mon_yday + mday; - - return epoch(year, yday, hour, min, sec); +/* epoch_days(1970, 1, 1) == 1970-01-01 == 0. */ +static int epoch_days(int year, int month, int day) { + static const uint16_t month_yday[12] = {0, 31, 59, 90, 120, 151, + 181, 212, 243, 273, 304, 334}; + int febs_since_0 = month > 2 ? year + 1 : year; + int leap_days_since_0 = div_round_up(febs_since_0, 4) - + div_round_up(febs_since_0, 100) + + div_round_up(febs_since_0, 400); + int days_since_0 = + 365 * year + month_yday[month - 1] + (day - 1) + leap_days_since_0; + + /* Convert from 0-epoch (0001-01-01 BC) to Unix Epoch (1970-01-01 AD). + * Since the "BC" system does not have a year zero, 1 BC == year zero. */ + return days_since_0 - 719528; +} + +static int64_t upb_timegm(const struct tm *tp) { + int64_t ret = epoch_days(tp->tm_year + 1900, tp->tm_mon + 1, tp->tm_mday); + ret = (ret * 24) + tp->tm_hour; + ret = (ret * 60) + tp->tm_min; + ret = (ret * 60) + tp->tm_sec; + return ret; } static bool end_timestamp_zone(upb_json_parser *p, const char *ptr) { @@ -10186,7 +10168,7 @@ static bool end_timestamp_zone(upb_json_parser *p, const char *ptr) { } /* Normalize tm */ - seconds = upb_mktime(&p->tm); + seconds = upb_timegm(&p->tm); /* Check timestamp boundary */ if (seconds < -62135596800) { diff --git a/ruby/tests/common_tests.rb b/ruby/tests/common_tests.rb index b1d1d6cde2..1417f5be32 100644 --- a/ruby/tests/common_tests.rb +++ b/ruby/tests/common_tests.rb @@ -1462,6 +1462,18 @@ module CommonTests assert_raise(Google::Protobuf::TypeError) { m.timestamp = 2.4 } assert_raise(Google::Protobuf::TypeError) { m.timestamp = '4' } assert_raise(Google::Protobuf::TypeError) { m.timestamp = proto_module::TimeMessage.new } + + def test_time(year, month, day) + str = ("\"%04d-%02d-%02dT00:00:00.000+00:00\"" % [year, month, day]) + t = Google::Protobuf::Timestamp.decode_json(str) + time = Time.new(year, month, day, 0, 0, 0, "+00:00") + assert_equal t.seconds, time.to_i + end + + (1970..2010).each do |year| + test_time(year, 2, 28) + test_time(year, 3, 01) + end end def test_converts_duration From 3f323c5b99256a3bb708578339df6043761f6837 Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Tue, 24 Sep 2019 18:26:02 -0700 Subject: [PATCH 12/14] Fix incorrect leap day for Timestamp in php (#6696) --- conformance/binary_json_conformance_suite.cc | 4 ++ php/ext/google/protobuf/upb.c | 50 +++++++++----------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/conformance/binary_json_conformance_suite.cc b/conformance/binary_json_conformance_suite.cc index 81f4a7ffd5..e7f31245b2 100644 --- a/conformance/binary_json_conformance_suite.cc +++ b/conformance/binary_json_conformance_suite.cc @@ -2224,6 +2224,10 @@ void BinaryAndJsonConformanceSuite::RunSuiteImpl() { })", "repeated_timestamp: {seconds: -62135596800}" "repeated_timestamp: {seconds: 253402300799 nanos: 999999999}"); + RunValidJsonTest( + "TimestampLeap", REQUIRED, + R"({"optionalTimestamp": "1993-02-10T00:00:00.000Z"})", + "optional_timestamp: {seconds: 729302400}"); RunValidJsonTest("TimestampWithPositiveOffset", REQUIRED, R"({"optionalTimestamp": "1970-01-01T08:00:01+08:00"})", "optional_timestamp: {seconds: 1}"); diff --git a/php/ext/google/protobuf/upb.c b/php/ext/google/protobuf/upb.c index a65264afbb..be9d730d2e 100644 --- a/php/ext/google/protobuf/upb.c +++ b/php/ext/google/protobuf/upb.c @@ -10131,32 +10131,28 @@ const unsigned short int __mon_yday[2][13] = { { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 } }; -int64_t epoch(int year, int yday, int hour, int min, int sec) { - int64_t years = year - EPOCH_YEAR; - - int64_t leap_days = years / 4 - years / 100 + years / 400; - - int64_t days = years * 365 + yday + leap_days; - int64_t hours = days * 24 + hour; - int64_t mins = hours * 60 + min; - int64_t secs = mins * 60 + sec; - return secs; -} - - -static int64_t upb_mktime(const struct tm *tp) { - int sec = tp->tm_sec; - int min = tp->tm_min; - int hour = tp->tm_hour; - int mday = tp->tm_mday; - int mon = tp->tm_mon; - int year = tp->tm_year + TM_YEAR_BASE; - - /* Calculate day of year from year, month, and day of month. */ - int mon_yday = ((__mon_yday[isleap(year)][mon]) - 1); - int yday = mon_yday + mday; - - return epoch(year, yday, hour, min, sec); +/* epoch_days(1970, 1, 1) == 1970-01-01 == 0. */ +static int epoch_days(int year, int month, int day) { + static const uint16_t month_yday[12] = {0, 31, 59, 90, 120, 151, + 181, 212, 243, 273, 304, 334}; + int febs_since_0 = month > 2 ? year + 1 : year; + int leap_days_since_0 = div_round_up(febs_since_0, 4) - + div_round_up(febs_since_0, 100) + + div_round_up(febs_since_0, 400); + int days_since_0 = + 365 * year + month_yday[month - 1] + (day - 1) + leap_days_since_0; + + /* Convert from 0-epoch (0001-01-01 BC) to Unix Epoch (1970-01-01 AD). + * Since the "BC" system does not have a year zero, 1 BC == year zero. */ + return days_since_0 - 719528; +} + +static int64_t upb_timegm(const struct tm *tp) { + int64_t ret = epoch_days(tp->tm_year + 1900, tp->tm_mon + 1, tp->tm_mday); + ret = (ret * 24) + tp->tm_hour; + ret = (ret * 60) + tp->tm_min; + ret = (ret * 60) + tp->tm_sec; + return ret; } static bool end_timestamp_zone(upb_json_parser *p, const char *ptr) { @@ -10186,7 +10182,7 @@ static bool end_timestamp_zone(upb_json_parser *p, const char *ptr) { } /* Normalize tm */ - seconds = upb_mktime(&p->tm); + seconds = upb_timegm(&p->tm); /* Check timestamp boundary */ if (seconds < -62135596800) { From f50204dab41650a8673996c9dec06b0f0fde2495 Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Mon, 30 Sep 2019 15:53:30 -0700 Subject: [PATCH 13/14] Initialize well known type values (#6713) (#6714) * Initialize well known type values Also fixes #6667 * Revert unwanted change --- php/ext/google/protobuf/message.c | 128 ++++++++++++++++-------------- php/tests/encode_decode_test.php | 9 +++ php/tests/memory_leak_test.php | 1 + php/tests/proto/test.proto | 5 ++ 4 files changed, 82 insertions(+), 61 deletions(-) diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c index d60124ef08..303f5d4741 100644 --- a/php/ext/google/protobuf/message.c +++ b/php/ext/google/protobuf/message.c @@ -1770,19 +1770,19 @@ zend_class_entry* api_type; // Init class entry. PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Api", Api, api) - zend_declare_property_null(api_type, "name", strlen("name"), - ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_string(api_type, "name", strlen("name"), "", + ZEND_ACC_PRIVATE TSRMLS_CC); zend_declare_property_null(api_type, "methods", strlen("methods"), ZEND_ACC_PRIVATE TSRMLS_CC); zend_declare_property_null(api_type, "options", strlen("options"), ZEND_ACC_PRIVATE TSRMLS_CC); - zend_declare_property_null(api_type, "version", strlen("version"), - ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_string(api_type, "version", strlen("version"), "", + ZEND_ACC_PRIVATE TSRMLS_CC); zend_declare_property_null(api_type, "source_context", strlen("source_context"), ZEND_ACC_PRIVATE TSRMLS_CC); zend_declare_property_null(api_type, "mixins", strlen("mixins"), ZEND_ACC_PRIVATE TSRMLS_CC); - zend_declare_property_null(api_type, "syntax", strlen("syntax"), + zend_declare_property_long(api_type, "syntax", strlen("syntax"), 0, ZEND_ACC_PRIVATE TSRMLS_CC); PHP_PROTO_INIT_SUBMSGCLASS_END @@ -1816,7 +1816,7 @@ zend_class_entry* bool_value_type; // Init class entry. PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\BoolValue", BoolValue, bool_value) - zend_declare_property_null(bool_value_type, "value", strlen("value"), + zend_declare_property_bool(bool_value_type, "value", strlen("value"), 0, ZEND_ACC_PRIVATE TSRMLS_CC); PHP_PROTO_INIT_SUBMSGCLASS_END @@ -1844,8 +1844,8 @@ zend_class_entry* bytes_value_type; // Init class entry. PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\BytesValue", BytesValue, bytes_value) - zend_declare_property_null(bytes_value_type, "value", strlen("value"), - ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_string(bytes_value_type, "value", strlen("value"), "", + ZEND_ACC_PRIVATE TSRMLS_CC); PHP_PROTO_INIT_SUBMSGCLASS_END PHP_METHOD(BytesValue, __construct) { @@ -1872,8 +1872,8 @@ zend_class_entry* double_value_type; // Init class entry. PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\DoubleValue", DoubleValue, double_value) - zend_declare_property_null(double_value_type, "value", strlen("value"), - ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_double(double_value_type, "value", strlen("value"), 0, + ZEND_ACC_PRIVATE TSRMLS_CC); PHP_PROTO_INIT_SUBMSGCLASS_END PHP_METHOD(DoubleValue, __construct) { @@ -1908,15 +1908,15 @@ zend_class_entry* enum_type; // Init class entry. PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Enum", Enum, enum) - zend_declare_property_null(enum_type, "name", strlen("name"), - ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_string(enum_type, "name", strlen("name"), "", + ZEND_ACC_PRIVATE TSRMLS_CC); zend_declare_property_null(enum_type, "enumvalue", strlen("enumvalue"), ZEND_ACC_PRIVATE TSRMLS_CC); zend_declare_property_null(enum_type, "options", strlen("options"), ZEND_ACC_PRIVATE TSRMLS_CC); zend_declare_property_null(enum_type, "source_context", strlen("source_context"), ZEND_ACC_PRIVATE TSRMLS_CC); - zend_declare_property_null(enum_type, "syntax", strlen("syntax"), + zend_declare_property_long(enum_type, "syntax", strlen("syntax"), 0, ZEND_ACC_PRIVATE TSRMLS_CC); PHP_PROTO_INIT_SUBMSGCLASS_END @@ -1952,9 +1952,9 @@ zend_class_entry* enum_value_type; // Init class entry. PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\EnumValue", EnumValue, enum_value) - zend_declare_property_null(enum_value_type, "name", strlen("name"), - ZEND_ACC_PRIVATE TSRMLS_CC); - zend_declare_property_null(enum_value_type, "number", strlen("number"), + zend_declare_property_string(enum_value_type, "name", strlen("name"), "", + ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_long(enum_value_type, "number", strlen("number"), 0, ZEND_ACC_PRIVATE TSRMLS_CC); zend_declare_property_null(enum_value_type, "options", strlen("options"), ZEND_ACC_PRIVATE TSRMLS_CC); @@ -2032,26 +2032,27 @@ zend_class_entry* field_type; // Init class entry. PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Field", Field, field) - zend_declare_property_null(field_type, "kind", strlen("kind"), + zend_declare_property_long(field_type, "kind", strlen("kind"), 0, ZEND_ACC_PRIVATE TSRMLS_CC); - zend_declare_property_null(field_type, "cardinality", strlen("cardinality"), + zend_declare_property_long(field_type, "cardinality", strlen("cardinality"), + 0, ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_long(field_type, "number", strlen("number"), 0, ZEND_ACC_PRIVATE TSRMLS_CC); - zend_declare_property_null(field_type, "number", strlen("number"), - ZEND_ACC_PRIVATE TSRMLS_CC); - zend_declare_property_null(field_type, "name", strlen("name"), - ZEND_ACC_PRIVATE TSRMLS_CC); - zend_declare_property_null(field_type, "type_url", strlen("type_url"), - ZEND_ACC_PRIVATE TSRMLS_CC); - zend_declare_property_null(field_type, "oneof_index", strlen("oneof_index"), - ZEND_ACC_PRIVATE TSRMLS_CC); - zend_declare_property_null(field_type, "packed", strlen("packed"), + zend_declare_property_string(field_type, "name", strlen("name"), "", + ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_string(field_type, "type_url", strlen("type_url"), "", + ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_long(field_type, "oneof_index", strlen("oneof_index"), + 0, ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_bool(field_type, "packed", strlen("packed"), false, ZEND_ACC_PRIVATE TSRMLS_CC); zend_declare_property_null(field_type, "options", strlen("options"), ZEND_ACC_PRIVATE TSRMLS_CC); - zend_declare_property_null(field_type, "json_name", strlen("json_name"), - ZEND_ACC_PRIVATE TSRMLS_CC); - zend_declare_property_null(field_type, "default_value", strlen("default_value"), - ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_string(field_type, "json_name", strlen("json_name"), + "", ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_string(field_type, "default_value", + strlen("default_value"), "", + ZEND_ACC_PRIVATE TSRMLS_CC); PHP_PROTO_INIT_SUBMSGCLASS_END PHP_METHOD(Field, __construct) { @@ -2087,8 +2088,8 @@ zend_class_entry* float_value_type; // Init class entry. PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\FloatValue", FloatValue, float_value) - zend_declare_property_null(float_value_type, "value", strlen("value"), - ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_double(float_value_type, "value", strlen("value"), 0, + ZEND_ACC_PRIVATE TSRMLS_CC); PHP_PROTO_INIT_SUBMSGCLASS_END PHP_METHOD(FloatValue, __construct) { @@ -2138,7 +2139,7 @@ zend_class_entry* int32_value_type; // Init class entry. PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Int32Value", Int32Value, int32_value) - zend_declare_property_null(int32_value_type, "value", strlen("value"), + zend_declare_property_long(int32_value_type, "value", strlen("value"), 0, ZEND_ACC_PRIVATE TSRMLS_CC); PHP_PROTO_INIT_SUBMSGCLASS_END @@ -2166,7 +2167,7 @@ zend_class_entry* int64_value_type; // Init class entry. PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Int64Value", Int64Value, int64_value) - zend_declare_property_null(int64_value_type, "value", strlen("value"), + zend_declare_property_long(int64_value_type, "value", strlen("value"), 0, ZEND_ACC_PRIVATE TSRMLS_CC); PHP_PROTO_INIT_SUBMSGCLASS_END @@ -2234,19 +2235,23 @@ zend_class_entry* method_type; // Init class entry. PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Method", Method, method) - zend_declare_property_null(method_type, "name", strlen("name"), - ZEND_ACC_PRIVATE TSRMLS_CC); - zend_declare_property_null(method_type, "request_type_url", strlen("request_type_url"), - ZEND_ACC_PRIVATE TSRMLS_CC); - zend_declare_property_null(method_type, "request_streaming", strlen("request_streaming"), + zend_declare_property_string(method_type, "name", strlen("name"), "", + ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_string(method_type, "request_type_url", + strlen("request_type_url"), "", + ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_bool(method_type, "request_streaming", + strlen("request_streaming"), 0, ZEND_ACC_PRIVATE TSRMLS_CC); - zend_declare_property_null(method_type, "response_type_url", strlen("response_type_url"), - ZEND_ACC_PRIVATE TSRMLS_CC); - zend_declare_property_null(method_type, "response_streaming", strlen("response_streaming"), + zend_declare_property_string(method_type, "response_type_url", + strlen("response_type_url"), "", + ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_bool(method_type, "response_streaming", + strlen("response_streaming"), 0, ZEND_ACC_PRIVATE TSRMLS_CC); zend_declare_property_null(method_type, "options", strlen("options"), ZEND_ACC_PRIVATE TSRMLS_CC); - zend_declare_property_null(method_type, "syntax", strlen("syntax"), + zend_declare_property_long(method_type, "syntax", strlen("syntax"), 0, ZEND_ACC_PRIVATE TSRMLS_CC); PHP_PROTO_INIT_SUBMSGCLASS_END @@ -2282,10 +2287,10 @@ zend_class_entry* mixin_type; // Init class entry. PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Mixin", Mixin, mixin) - zend_declare_property_null(mixin_type, "name", strlen("name"), - ZEND_ACC_PRIVATE TSRMLS_CC); - zend_declare_property_null(mixin_type, "root", strlen("root"), - ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_string(mixin_type, "name", strlen("name"), "", + ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_string(mixin_type, "root", strlen("root"), "", + ZEND_ACC_PRIVATE TSRMLS_CC); PHP_PROTO_INIT_SUBMSGCLASS_END PHP_METHOD(Mixin, __construct) { @@ -2315,8 +2320,8 @@ zend_class_entry* option_type; // Init class entry. PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Option", Option, option) - zend_declare_property_null(option_type, "name", strlen("name"), - ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_string(option_type, "name", strlen("name"), "", + ZEND_ACC_PRIVATE TSRMLS_CC); zend_declare_property_null(option_type, "value", strlen("value"), ZEND_ACC_PRIVATE TSRMLS_CC); PHP_PROTO_INIT_SUBMSGCLASS_END @@ -2346,8 +2351,9 @@ zend_class_entry* source_context_type; // Init class entry. PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\SourceContext", SourceContext, source_context) - zend_declare_property_null(source_context_type, "file_name", strlen("file_name"), - ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_string(source_context_type, "file_name", + strlen("file_name"), "", + ZEND_ACC_PRIVATE TSRMLS_CC); PHP_PROTO_INIT_SUBMSGCLASS_END PHP_METHOD(SourceContext, __construct) { @@ -2374,8 +2380,8 @@ zend_class_entry* string_value_type; // Init class entry. PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\StringValue", StringValue, string_value) - zend_declare_property_null(string_value_type, "value", strlen("value"), - ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_string(string_value_type, "value", strlen("value"), "", + ZEND_ACC_PRIVATE TSRMLS_CC); PHP_PROTO_INIT_SUBMSGCLASS_END PHP_METHOD(StringValue, __construct) { @@ -2440,17 +2446,17 @@ zend_class_entry* type_type; // Init class entry. PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Type", Type, type) - zend_declare_property_null(type_type, "name", strlen("name"), - ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_string(type_type, "name", strlen("name"), "", + ZEND_ACC_PRIVATE TSRMLS_CC); zend_declare_property_null(type_type, "fields", strlen("fields"), ZEND_ACC_PRIVATE TSRMLS_CC); - zend_declare_property_null(type_type, "oneofs", strlen("oneofs"), - ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_string(type_type, "oneofs", strlen("oneofs"), "", + ZEND_ACC_PRIVATE TSRMLS_CC); zend_declare_property_null(type_type, "options", strlen("options"), ZEND_ACC_PRIVATE TSRMLS_CC); zend_declare_property_null(type_type, "source_context", strlen("source_context"), ZEND_ACC_PRIVATE TSRMLS_CC); - zend_declare_property_null(type_type, "syntax", strlen("syntax"), + zend_declare_property_long(type_type, "syntax", strlen("syntax"), 0, ZEND_ACC_PRIVATE TSRMLS_CC); PHP_PROTO_INIT_SUBMSGCLASS_END @@ -2483,7 +2489,7 @@ zend_class_entry* u_int32_value_type; // Init class entry. PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\UInt32Value", UInt32Value, u_int32_value) - zend_declare_property_null(u_int32_value_type, "value", strlen("value"), + zend_declare_property_long(u_int32_value_type, "value", strlen("value"), 0, ZEND_ACC_PRIVATE TSRMLS_CC); PHP_PROTO_INIT_SUBMSGCLASS_END @@ -2511,7 +2517,7 @@ zend_class_entry* u_int64_value_type; // Init class entry. PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\UInt64Value", UInt64Value, u_int64_value) - zend_declare_property_null(u_int64_value_type, "value", strlen("value"), + zend_declare_property_long(u_int64_value_type, "value", strlen("value"), 0, ZEND_ACC_PRIVATE TSRMLS_CC); PHP_PROTO_INIT_SUBMSGCLASS_END diff --git a/php/tests/encode_decode_test.php b/php/tests/encode_decode_test.php index f2a50180c6..26b765652d 100644 --- a/php/tests/encode_decode_test.php +++ b/php/tests/encode_decode_test.php @@ -5,6 +5,7 @@ require_once('test_util.php'); use Google\Protobuf\RepeatedField; use Google\Protobuf\GPBType; +use Foo\TestStringValue; use Foo\TestAny; use Foo\TestEnum; use Foo\TestMessage; @@ -167,6 +168,14 @@ class EncodeDecodeTest extends TestBase $this->assertSame("\"a\"", $m->serializeToJsonString()); } + public function testEncodeStringValue() + { + $m = new TestStringValue(['field' => new StringValue(['value' => ''])]); + var_dump($m->getField()); + var_dump($m->serializeToJsonString()); + $this->assertSame("{\"field\":\"\"}", $m->serializeToJsonString()); + } + public function testDecodeTopLevelBytesValue() { $m = new BytesValue(); diff --git a/php/tests/memory_leak_test.php b/php/tests/memory_leak_test.php index 142f467669..2873f34432 100644 --- a/php/tests/memory_leak_test.php +++ b/php/tests/memory_leak_test.php @@ -31,6 +31,7 @@ require_once('generated/Foo/TestPackedMessage.php'); require_once('generated/Foo/TestPhpDoc.php'); require_once('generated/Foo/TestRandomFieldOrder.php'); require_once('generated/Foo/TestReverseFieldOrder.php'); +require_once('generated/Foo/TestStringValue.php'); require_once('generated/Foo/TestUnpackedMessage.php'); require_once('generated/Foo/testLowerCaseMessage.php'); require_once('generated/Foo/testLowerCaseEnum.php'); diff --git a/php/tests/proto/test.proto b/php/tests/proto/test.proto index 715f08b832..ea00fec88d 100644 --- a/php/tests/proto/test.proto +++ b/php/tests/proto/test.proto @@ -1,6 +1,7 @@ syntax = "proto3"; import 'google/protobuf/any.proto'; +import 'google/protobuf/wrappers.proto'; import 'google/protobuf/struct.proto'; import 'proto/test_include.proto'; import 'proto/test_no_namespace.proto'; @@ -207,3 +208,7 @@ enum testLowerCaseEnum { message TestAny { google.protobuf.Any any = 1; } + +message TestStringValue { + google.protobuf.StringValue field = 1; +} From 1a57c13086d16cc2a76f2dd6a16138b2be4713a8 Mon Sep 17 00:00:00 2001 From: Rafi Kamal Date: Wed, 2 Oct 2019 17:06:22 -0700 Subject: [PATCH 14/14] Update CHANGES.txt with changes since 3.10.0-RC1 --- CHANGES.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 74689bd674..5aaee72856 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -46,6 +46,10 @@ * Change the parameter types of binaryReaderFn in ExtensionFieldBinaryInfo to (number, ?, ?). * Create dates.ts and time_of_days.ts to mirror Java versions. This is a near-identical conversion of c.g.type.util.{Dates,TimeOfDays} respectively. * Migrate moneys to TypeScript. + + PHP + * Fix incorrect leap day for Timestamp (#6696) + * Initialize well known type values (#6713) Ruby * Fix scope resolution for Google namespace (#5878) @@ -55,6 +59,11 @@ * Optimized layout_mark() for Ruby (#6521) * Optimization for layout_init() (#6547) * Fix for GC of Ruby map frames. (#6533) + * Fixed leap year handling by reworking upb_mktime() -> upb_timegm(). (#6695) + + Objective C + * Remove OSReadLittle* due to alignment requirements (#6678) + * Don't use unions and instead use memcpy for the type swaps. (#6672) Other * Override CocoaPods module to lowercase (#6464)