diff options
-rw-r--r-- | .travis.yml | 7 | ||||
-rw-r--r-- | Protobuf.podspec | 3 | ||||
-rw-r--r-- | csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs | 43 | ||||
-rw-r--r-- | examples/README.txt | 2 | ||||
-rw-r--r-- | java/core/src/main/java/com/google/protobuf/RopeByteString.java | 2 | ||||
-rw-r--r-- | java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java | 2 | ||||
-rwxr-xr-x | objectivec/DevTools/full_mac_build.sh | 10 | ||||
-rwxr-xr-x | objectivec/DevTools/pddm.py | 3 | ||||
-rw-r--r-- | objectivec/GPBUtilities.m | 2 | ||||
-rw-r--r-- | ruby/ext/google/protobuf_c/upb.c | 2 | ||||
-rw-r--r-- | ruby/src/main/sentinel.proto | 18 | ||||
-rw-r--r-- | src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc | 2 | ||||
-rw-r--r-- | src/google/protobuf/compiler/objectivec/objectivec_helpers.cc | 2 | ||||
-rw-r--r-- | src/google/protobuf/compiler/objectivec/objectivec_helpers.h | 4 | ||||
-rw-r--r-- | src/google/protobuf/dynamic_message.cc | 2 | ||||
-rw-r--r-- | src/google/protobuf/io/gzip_stream.cc | 4 | ||||
-rw-r--r-- | src/google/protobuf/util/field_mask_util.cc | 2 | ||||
-rwxr-xr-x | travis.sh | 15 |
18 files changed, 90 insertions, 35 deletions
diff --git a/.travis.yml b/.travis.yml index e368826f..c0309fab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,8 +7,8 @@ language: cpp os: - linux - osx -# The Objective C build needs Xcode 6.4 or later. -osx_image: xcode7.1 +# The Objective C build needs Xcode 7.0 or later. +osx_image: xcode7.2 script: - ./travis.sh $CONFIG env: @@ -67,5 +67,8 @@ matrix: env: CONFIG=ruby22 - os: osx env: CONFIG=jruby + # Currently showing flake randomly, doesn't trace back to a single commit. + - os: osx + env: CONFIG=objectivec_ios notifications: email: false diff --git a/Protobuf.podspec b/Protobuf.podspec index 73a60222..02c83723 100644 --- a/Protobuf.podspec +++ b/Protobuf.podspec @@ -11,6 +11,9 @@ Pod::Spec.new do |s| s.license = 'New BSD' s.authors = { 'The Protocol Buffers contributors' => 'protobuf@googlegroups.com' } + s.source = { :git => 'https://github.com/google/protobuf.git', + :tag => "v#{s.version}" } + s.source_files = 'objectivec/*.{h,m}', 'objectivec/google/protobuf/Any.pbobjc.{h,m}', 'objectivec/google/protobuf/Api.pbobjc.{h,m}', diff --git a/csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs b/csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs index a2c833fe..5b7185dc 100644 --- a/csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs +++ b/csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs @@ -319,9 +319,10 @@ namespace Google.Protobuf.WellKnownTypes // Merging is odd with wrapper types, due to the way that default values aren't emitted in // the binary stream. In fact we cheat a little bit - a message with an explicitly present default - // value will have that default value ignored. + // value will have that default value ignored. See issue 615. Fixing this would require significant upheaval to + // the FieldCodec side of things. [Test] - public void MergingCornerCase() + public void MergingStreamExplicitValue() { var message = new TestWellKnownTypes { Int32Field = 5 }; @@ -343,10 +344,48 @@ namespace Google.Protobuf.WellKnownTypes message.MergeFrom(bytes); // A normal implementation would have 0 now, as the explicit default would have been overwritten the 5. + // With the FieldCodec for Nullable<int>, we can't tell the difference between an implicit 0 and an explicit 0. Assert.AreEqual(5, message.Int32Field); } [Test] + public void MergingStreamNoValue() + { + var message = new TestWellKnownTypes { Int32Field = 5 }; + + // Create a byte array which an Int32 field, but with no value. + var bytes = new TestWellKnownTypes { Int32Field = 0 }.ToByteArray(); + Assert.AreEqual(2, bytes.Length); // The tag for Int32Field is a single byte, then a byte indicating a 0-length message. + message.MergeFrom(bytes); + + // The "implicit" 0 did *not* overwrite the value. + // (This is the correct behaviour.) + Assert.AreEqual(5, message.Int32Field); + } + + // All permutations of origin/merging value being null, zero (default) or non-default. + // As this is the in-memory version, we don't need to worry about the difference between implicit and explicit 0. + [Test] + [TestCase(null, null, null)] + [TestCase(null, 0, 0)] + [TestCase(null, 5, 5)] + [TestCase(0, null, 0)] + [TestCase(0, 0, 0)] + [TestCase(0, 5, 5)] + [TestCase(5, null, 5)] + [TestCase(5, 0, 5)] + [TestCase(5, 10, 10)] + public void MergingMessageWithZero(int? originValue, int? mergingValue, int? expectedResult) + { + // This differs from the MergingStreamCornerCase because when we merge message *objects*, + // we ignore default values from the "source". + var message1 = new TestWellKnownTypes { Int32Field = originValue }; + var message2 = new TestWellKnownTypes { Int32Field = mergingValue }; + message1.MergeFrom(message2); + Assert.AreEqual(expectedResult, message1.Int32Field); + } + + [Test] public void UnknownFieldInWrapper() { var stream = new MemoryStream(); diff --git a/examples/README.txt b/examples/README.txt index e6f30370..b33f8414 100644 --- a/examples/README.txt +++ b/examples/README.txt @@ -35,7 +35,7 @@ build with all the other examples. See: https://github.com/golang/protobuf for more information about Go protocol buffer support. -First, install the the Protocol Buffers compiler (protoc). +First, install the Protocol Buffers compiler (protoc). Then, install the Go Protocol Buffers plugin ($GOPATH/bin must be in your $PATH for protoc to find it): go get github.com/golang/protobuf/protoc-gen-go diff --git a/java/core/src/main/java/com/google/protobuf/RopeByteString.java b/java/core/src/main/java/com/google/protobuf/RopeByteString.java index 469c90c2..8badfabd 100644 --- a/java/core/src/main/java/com/google/protobuf/RopeByteString.java +++ b/java/core/src/main/java/com/google/protobuf/RopeByteString.java @@ -187,7 +187,7 @@ final class RopeByteString extends ByteString { && leftRope.getTreeDepth() > right.getTreeDepth()) { // Typically for concatenate-built strings the left-side is deeper than // the right. This is our final attempt to concatenate without - // increasing the tree depth. We'll redo the the node on the RHS. This + // increasing the tree depth. We'll redo the node on the RHS. This // is yet another optimization for building the string by repeatedly // concatenating on the right. ByteString newRight = new RopeByteString(leftRope.right, right); diff --git a/java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java b/java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java index 8806395c..f443ee39 100644 --- a/java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java +++ b/java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java @@ -38,7 +38,7 @@ import java.nio.ByteBuffer; * potentially expose the backing buffer of a {@link ByteString} to the application. * * <p><strong>DISCLAIMER:</strong> The methods in this class should only be called if it is - * guaranteed that the the buffer backing the {@link ByteString} will never change! Mutation of a + * guaranteed that the buffer backing the {@link ByteString} will never change! Mutation of a * {@link ByteString} can lead to unexpected and undesirable consequences in your application, * and will likely be difficult to debug. Proceed with caution! */ diff --git a/objectivec/DevTools/full_mac_build.sh b/objectivec/DevTools/full_mac_build.sh index 709aae0a..c8681e26 100755 --- a/objectivec/DevTools/full_mac_build.sh +++ b/objectivec/DevTools/full_mac_build.sh @@ -234,7 +234,7 @@ if [[ "${DO_XCODE_IOS_TESTS}" == "yes" ]] ; then echo "ERROR: Xcode 6.3/6.4 no longer supported for building, please use 7.0 or higher." 1>&2 exit 10 ;; - 7.* ) + 7.1* ) XCODEBUILD_TEST_BASE_IOS+=( -destination "platform=iOS Simulator,name=iPhone 4s,OS=8.1" # 32bit -destination "platform=iOS Simulator,name=iPhone 6,OS=9.0" # 64bit @@ -242,6 +242,14 @@ if [[ "${DO_XCODE_IOS_TESTS}" == "yes" ]] ; then -destination "platform=iOS Simulator,name=iPad Air,OS=9.0" # 64bit ) ;; + 7.* ) + XCODEBUILD_TEST_BASE_IOS+=( + -destination "platform=iOS Simulator,name=iPhone 4s,OS=8.1" # 32bit + -destination "platform=iOS Simulator,name=iPhone 6,OS=9.2" # 64bit + -destination "platform=iOS Simulator,name=iPad 2,OS=8.1" # 32bit + -destination "platform=iOS Simulator,name=iPad Air,OS=9.2" # 64bit + ) + ;; * ) echo "Time to update the simulator targets for Xcode ${XCODE_VERSION}" exit 2 diff --git a/objectivec/DevTools/pddm.py b/objectivec/DevTools/pddm.py index d1b53f5a..9a11fec4 100755 --- a/objectivec/DevTools/pddm.py +++ b/objectivec/DevTools/pddm.py @@ -625,8 +625,7 @@ class SourceFile(object): def main(args): usage = '%prog [OPTIONS] PATH ...' description = ( - 'Processes PDDM directives in the the given paths and write them back' - ' out.' + 'Processes PDDM directives in the given paths and write them back out.' ) parser = optparse.OptionParser(usage=usage, description=description) parser.add_option('--dry-run', diff --git a/objectivec/GPBUtilities.m b/objectivec/GPBUtilities.m index eaa28bbc..d4d6471f 100644 --- a/objectivec/GPBUtilities.m +++ b/objectivec/GPBUtilities.m @@ -1253,7 +1253,7 @@ static void AppendTextFormatForMessageField(GPBMessage *message, if ([fieldName length] == 0) { fieldName = [NSString stringWithFormat:@"%u", GPBFieldNumber(field)]; // If there is only one entry, put the objc name as a comment, other wise - // add it before the the repeated values. + // add it before the repeated values. if (count > 1) { [toStr appendFormat:@"%@# %@\n", lineIndent, field.name]; } else { diff --git a/ruby/ext/google/protobuf_c/upb.c b/ruby/ext/google/protobuf_c/upb.c index 048a163a..9e6aa674 100644 --- a/ruby/ext/google/protobuf_c/upb.c +++ b/ruby/ext/google/protobuf_c/upb.c @@ -8537,7 +8537,7 @@ bool upb_pbdecoder_setmaxnesting(upb_pbdecoder *d, size_t max) { ** to perfectly match the output of reference encoders that always use the ** optimal amount of space for each length. ** -** (2) requires guessing the the size upfront, and if multiple lengths are +** (2) requires guessing the size upfront, and if multiple lengths are ** guessed wrong the minimum required number of memmove() operations may ** be complicated to compute correctly. Implemented properly, it may have ** a useful amortized or average cost, but more investigation is required diff --git a/ruby/src/main/sentinel.proto b/ruby/src/main/sentinel.proto index 89a1ae19..722041ba 100644 --- a/ruby/src/main/sentinel.proto +++ b/ruby/src/main/sentinel.proto @@ -3,13 +3,13 @@ package com.google.protobuf.jruby; option optimize_for = CODE_SIZE; message Sentinel { - optional int32 default_int32 = 1; - optional int64 default_int64 = 2; - optional uint32 default_unit32 = 3; - optional uint64 default_uint64 = 4; - optional string default_string = 5; - optional bool default_bool = 6; - optional float default_float = 7; - optional double default_double = 8; - optional bytes default_bytes = 9; + int32 default_int32 = 1; + int64 default_int64 = 2; + uint32 default_unit32 = 3; + uint64 default_uint64 = 4; + string default_string = 5; + bool default_bool = 6; + float default_float = 7; + double default_double = 8; + bytes default_bytes = 9; } diff --git a/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc b/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc index c3e9fe74..47729e1c 100644 --- a/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc +++ b/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc @@ -107,7 +107,7 @@ class MockGeneratorContext : public GeneratorContext { virtual io::ZeroCopyOutputStream* Open(const string& filename) { string** map_slot = &files_[filename]; - if (*map_slot != NULL) delete *map_slot; + delete *map_slot; *map_slot = new string; return new io::StringOutputStream(*map_slot); diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc index 990aca24..8527b74b 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc @@ -883,7 +883,7 @@ bool Parser::ParseLoop() { StringPiece prefix(line, offset + 1, line.length() - offset - 1); TrimWhitespace(&package); TrimWhitespace(&prefix); - // Don't really worry about error checking the the package/prefix for + // Don't really worry about error checking the package/prefix for // being valid. Assume the file is validated when it is created/edited. (*prefix_map_)[package.ToString()] = prefix.ToString(); } diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.h b/src/google/protobuf/compiler/objectivec/objectivec_helpers.h index 072a2e57..85744862 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.h +++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.h @@ -64,7 +64,7 @@ string FilePath(const FileDescriptor* file); // Gets the name of the root class we'll generate in the file. This class // is not meant for external consumption, but instead contains helpers that -// the rest of the the classes need +// the rest of the classes need string FileClassName(const FileDescriptor* file); // These return the fully-qualified class name corresponding to the given @@ -148,7 +148,7 @@ string BuildCommentsString(const SourceLocation& location); bool ValidateObjCClassPrefix(const FileDescriptor* file, string *out_error); // Generate decode data needed for ObjC's GPBDecodeTextFormatName() to transform -// the input into the the expected output. +// the input into the expected output. class LIBPROTOC_EXPORT TextFormatDecodeData { public: TextFormatDecodeData() {} diff --git a/src/google/protobuf/dynamic_message.cc b/src/google/protobuf/dynamic_message.cc index bb400476..8d689ac8 100644 --- a/src/google/protobuf/dynamic_message.cc +++ b/src/google/protobuf/dynamic_message.cc @@ -419,7 +419,7 @@ DynamicMessage::~DynamicMessage() { } // We need to manually run the destructors for repeated fields and strings, - // just as we ran their constructors in the the DynamicMessage constructor. + // just as we ran their constructors in the DynamicMessage constructor. // We also need to manually delete oneof fields if it is set and is string // or message. // Additionally, if any singular embedded messages have been allocated, we diff --git a/src/google/protobuf/io/gzip_stream.cc b/src/google/protobuf/io/gzip_stream.cc index 1be6c863..9c621b6a 100644 --- a/src/google/protobuf/io/gzip_stream.cc +++ b/src/google/protobuf/io/gzip_stream.cc @@ -241,9 +241,7 @@ void GzipOutputStream::Init(ZeroCopyOutputStream* sub_stream, GzipOutputStream::~GzipOutputStream() { Close(); - if (input_buffer_ != NULL) { - operator delete(input_buffer_); - } + operator delete(input_buffer_); } // private diff --git a/src/google/protobuf/util/field_mask_util.cc b/src/google/protobuf/util/field_mask_util.cc index 29ca9c1e..c59f43aa 100644 --- a/src/google/protobuf/util/field_mask_util.cc +++ b/src/google/protobuf/util/field_mask_util.cc @@ -103,7 +103,7 @@ class FieldMaskTree { // Add a field path into the tree. In a FieldMask, each field path matches // the specified field and also all its sub-fields. If the field path to // add is a sub-path of an existing field path in the tree (i.e., a leaf - // node), it means the tree already matchesthe the given path so nothing will + // node), it means the tree already matches the given path so nothing will // be added to the tree. If the path matches an existing non-leaf node in the // tree, that non-leaf node will be turned into a leaf node with all its // children removed because the path matches all the node's children. @@ -179,8 +179,10 @@ internal_objectivec_common () { } internal_xctool_debug_and_release() { - xctool -configuration Debug "$@" - xctool -configuration Release "$@" + # Always use -reporter plain to avoid escape codes in output (makes travis + # logs easier to read). + xctool -reporter plain -configuration Debug "$@" + xctool -reporter plain -configuration Release "$@" } build_objectivec_ios() { @@ -195,17 +197,20 @@ build_objectivec_ios() { build-tests IOS_DESTINATIONS=( "platform=iOS Simulator,name=iPhone 4s,OS=8.1" # 32bit - "platform=iOS Simulator,name=iPhone 6,OS=9.1" # 64bit + "platform=iOS Simulator,name=iPhone 6,OS=9.2" # 64bit "platform=iOS Simulator,name=iPad 2,OS=8.1" # 32bit - "platform=iOS Simulator,name=iPad Air,OS=9.1" # 64bit + "platform=iOS Simulator,name=iPad Air,OS=9.2" # 64bit ) for i in "${IOS_DESTINATIONS[@]}" ; do + # Throw -newSimulatorInstance in incase it helps with the flake that + # started happening after xctool 0.2.8 got released. internal_xctool_debug_and_release \ -project objectivec/ProtocolBuffers_iOS.xcodeproj \ -scheme ProtocolBuffers \ -sdk iphonesimulator \ -destination "${i}" \ - run-tests + run-tests \ + -newSimulatorInstance done } |