diff --git a/benchmarks/Makefile.am b/benchmarks/Makefile.am index 6f63a4cc22..81183657e1 100644 --- a/benchmarks/Makefile.am +++ b/benchmarks/Makefile.am @@ -126,7 +126,7 @@ java_benchmark_testing_files = \ java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java javac_middleman: $(java_benchmark_testing_files) protoc_middleman protoc_middleman2 - cp -r $(srcdir)/java tmp + cp -r $(srcdir)/java tmp mkdir -p tmp/java/lib cp $(top_srcdir)/java/core/target/*.jar tmp/java/lib/protobuf-java.jar cd tmp/java && mvn clean compile assembly:single -Dprotobuf.version=$(PACKAGE_VERSION) && cd ../.. @@ -253,7 +253,7 @@ go_protoc_middleman: make_tmp_dir $(top_srcdir)/src/protoc$(EXEEXT) $(benchmarks oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_proto2_message4) ) touch go_protoc_middleman -go-benchmark: go_protoc_middleman +go-benchmark: go_protoc_middleman @echo "Writing shortcut script go-benchmark..." @echo '#! /bin/bash' > go-benchmark @echo 'cd $(srcdir)/go' >> go-benchmark @@ -265,7 +265,7 @@ go-benchmark: go_protoc_middleman @echo 'cd ..' >> go-benchmark @chmod +x go-benchmark -go: go_protoc_middleman go-benchmark +go: go_protoc_middleman go-benchmark ./go-benchmark $(all_data) ############# GO RULES END ############## @@ -322,9 +322,9 @@ $(cpp_no_group_benchmarks_protoc_outputs_proto2_header): cpp_no_group_protoc_mid generate_cpp_no_group_benchmark_code: cp $(srcdir)/cpp/cpp_benchmark.cc gogo/cpp_no_group/cpp_benchmark.cc sed -i -e "s/\#include \"datasets/\#include \"gogo\/cpp_no_group\/datasets/g" gogo/cpp_no_group/cpp_benchmark.cc - sed -i -e "s/\#include \"benchmarks.pb.h/\#include \"gogo\/cpp_no_group\/benchmarks.pb.h/g" gogo/cpp_no_group/cpp_benchmark.cc + sed -i -e "s/\#include \"benchmarks.pb.h/\#include \"gogo\/cpp_no_group\/benchmarks.pb.h/g" gogo/cpp_no_group/cpp_benchmark.cc touch generate_cpp_no_group_benchmark_code - + bin_PROGRAMS += cpp-no-group-benchmark cpp_no_group_benchmark_LDADD = $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/third_party/benchmark/src/libbenchmark.a cpp_no_group_benchmark_SOURCES = gogo/cpp_no_group/cpp_benchmark.cc @@ -343,7 +343,7 @@ nodist_cpp_no_group_benchmark_SOURCES = \ cpp_no_group: cpp_no_group_protoc_middleman generate_gogo_data cpp-no-group-benchmark ./cpp-no-group-benchmark $(gogo_data) - + gogo_proto_middleman: protoc-gen-gogoproto mkdir -p "tmp/gogo_proto" oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I$(srcdir) -I$(top_srcdir) --plugin=protoc-gen-gogoproto --gogoproto_out=$$oldpwd/tmp/gogo_proto $(benchmarks_protoc_inputs) $(benchmarks_protoc_inputs_benchmark_wrapper) $(benchmarks_protoc_inputs_proto2) ) @@ -355,7 +355,7 @@ generate_gogo_data: protoc_middleman protoc_middleman2 gogo-data-scrubber mkdir -p `dirname $(gogo_data)` ./gogo-data-scrubber $(all_data) $(gogo_data) touch generate_gogo_data - + make_tmp_dir_gogo: mkdir -p tmp/go_no_group/benchmark_code mkdir -p tmp/gogofast/benchmark_code @@ -435,10 +435,10 @@ gogo-benchmark: go_no_group: go_no_group_protoc_middleman generate_gogo_data generate_all_gogo_benchmark_code gogo-benchmark ./gogo-benchmark go_no_group $(gogo_data) - -gogofast: gogofast_protoc_middleman generate_gogo_data gogo-benchmark generate_all_gogo_benchmark_code + +gogofast: gogofast_protoc_middleman generate_gogo_data gogo-benchmark generate_all_gogo_benchmark_code ./gogo-benchmark gogofast $(gogo_data) - + gogofaster: gogofaster_protoc_middleman generate_gogo_data gogo-benchmark generate_all_gogo_benchmark_code ./gogo-benchmark gogofaster $(gogo_data) @@ -448,7 +448,7 @@ gogoslick: gogoslick_protoc_middleman generate_gogo_data gogo-benchmark generat ############# GOGO RULES END ############ - + ############ UTIL RULES BEGIN ############ bin_PROGRAMS += protoc-gen-gogoproto gogo-data-scrubber protoc-gen-proto2_to_proto3 proto3-data-stripper @@ -481,7 +481,7 @@ nodist_proto3_data_stripper_SOURCES = \ $(benchmarks_protoc_outputs_proto2_header) \ $(benchmarks_protoc_outputs_header) - + ############ UTIL RULES END ############ ############ PROTO3 PREPARATION BEGIN ############# @@ -510,7 +510,7 @@ proto3_middleman_php: proto3_proto_middleman php-benchmark: proto3_middleman_php generate_proto3_data mkdir -p "tmp/php/Google/Protobuf/Benchmark" && cp php/PhpBenchmark.php "tmp/php/Google/Protobuf/Benchmark" - cp php/autoload.php "tmp/php" + cp php/autoload.php "tmp/php" @echo "Writing shortcut script php-benchmark..." @echo '#! /bin/bash' > php-benchmark @echo 'export PROTOBUF_PHP_SRCDIR="$$(cd $(top_srcdir) && pwd)/php/src"' >> php-benchmark @@ -527,8 +527,8 @@ php_c_extension: cd $(top_srcdir)/php/ext/google/protobuf && phpize && ./configure CFLAGS='-O3' && make -j8 php-c-benchmark: proto3_middleman_php generate_proto3_data php_c_extension php_c_extension - mkdir -p "tmp/php/Google/Protobuf/Benchmark" && cp php/PhpBenchmark.php "tmp/php/Google/Protobuf/Benchmark" - cp php/autoload.php "tmp/php" + mkdir -p "tmp/php/Google/Protobuf/Benchmark" && cp php/PhpBenchmark.php "tmp/php/Google/Protobuf/Benchmark" + cp php/autoload.php "tmp/php" @echo "Writing shortcut script php-c-benchmark..." @echo '#! /bin/bash' > php-c-benchmark @echo 'export PROTOBUF_PHP_SRCDIR="$$(cd $(top_srcdir) && pwd)/php/src"' >> php-c-benchmark @@ -654,4 +654,4 @@ CLEANFILES = \ clean-local: -rm -rf tmp/* - + diff --git a/benchmarks/README.md b/benchmarks/README.md index 72885886a7..486b2f954b 100644 --- a/benchmarks/README.md +++ b/benchmarks/README.md @@ -3,7 +3,7 @@ This directory contains benchmarking schemas and data sets that you can use to test a variety of performance scenarios against your -protobuf language runtime. If you are looking for performance +protobuf language runtime. If you are looking for performance numbers of officially support languages, see [here]( https://github.com/protocolbuffers/protobuf/blob/master/docs/performance.md) @@ -45,8 +45,8 @@ And you also need to make sure `pkg-config` is installed. ### Go Go protobufs are maintained at [github.com/golang/protobuf]( -http://github.com/golang/protobuf). If not done already, you need to install the -toolchain and the Go protoc-gen-go plugin for protoc. +http://github.com/golang/protobuf). If not done already, you need to install the +toolchain and the Go protoc-gen-go plugin for protoc. To install protoc-gen-go, run: @@ -59,7 +59,7 @@ The first command installs `protoc-gen-go` into the `bin` directory in your loca The second command adds the `bin` directory to your `PATH` so that `protoc` can locate the plugin later. ### PHP -PHP benchmark's requirement is the same as PHP protobuf's requirements. The benchmark will automaticly +PHP benchmark's requirement is the same as PHP protobuf's requirements. The benchmark will automaticly include PHP protobuf's src and build the c extension if required. ### Node.js diff --git a/benchmarks/java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java b/benchmarks/java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java index c766d74ee4..a4402481b0 100644 --- a/benchmarks/java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java +++ b/benchmarks/java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java @@ -24,8 +24,8 @@ import java.util.ArrayList; import java.util.List; // Caliper set CICompilerCount to 1 for making sure compilation doesn't run in parallel with itself, -// This makes TieredCompilation not working. We just disable TieredCompilation by default. In master -// branch this has been disabled by default in caliper: +// This makes TieredCompilation not working. We just disable TieredCompilation by default. In master +// branch this has been disabled by default in caliper: // https://github.com/google/caliper/blob/master/caliper-runner/src/main/java/com/google/caliper/runner/target/Jvm.java#L38:14 // But this haven't been added into most recent release. @VmOptions("-XX:-TieredCompilation") @@ -89,7 +89,7 @@ public class ProtoCaliperBenchmark { return com.google.protobuf.benchmarks.BenchmarkMessage4.GoogleMessage4.getDefaultInstance(); } }; - + abstract ExtensionRegistry getExtensionRegistry(); abstract Message getDefaultInstance(); } @@ -97,7 +97,7 @@ public class ProtoCaliperBenchmark { private BenchmarkMessageType benchmarkMessageType; @Param("") private String dataFile; - + private byte[] inputData; private BenchmarkDataset benchmarkDataset; private Message defaultMessage; @@ -125,7 +125,7 @@ public class ProtoCaliperBenchmark { + benchmarkDataset.getMessageName()); } } - + @BeforeExperiment void setUp() throws IOException { if (!dataFile.equals("")) { @@ -145,7 +145,7 @@ public class ProtoCaliperBenchmark { inputStreamList = new ArrayList(); inputStringList = new ArrayList(); sampleMessageList = new ArrayList(); - + for (int i = 0; i < benchmarkDataset.getPayloadCount(); i++) { byte[] singleInputData = benchmarkDataset.getPayload(i).toByteArray(); inputDataList.add(benchmarkDataset.getPayload(i).toByteArray()); @@ -156,8 +156,8 @@ public class ProtoCaliperBenchmark { defaultMessage.newBuilderForType().mergeFrom(singleInputData, extensions).build()); } } - - + + @Benchmark void serializeToByteArray(int reps) throws IOException { if (sampleMessageList.size() == 0) { @@ -165,11 +165,11 @@ public class ProtoCaliperBenchmark { } for (int i = 0; i < reps; i++) { for (int j = 0; j < sampleMessageList.size(); j++) { - sampleMessageList.get(j).toByteArray(); + sampleMessageList.get(j).toByteArray(); } } } - + @Benchmark void serializeToMemoryStream(int reps) throws IOException { if (sampleMessageList.size() == 0) { @@ -178,11 +178,11 @@ public class ProtoCaliperBenchmark { for (int i = 0; i < reps; i++) { for (int j = 0; j < sampleMessageList.size(); j++) { ByteArrayOutputStream output = new ByteArrayOutputStream(); - sampleMessageList.get(j).writeTo(output); + sampleMessageList.get(j).writeTo(output); } } } - + @Benchmark void deserializeFromByteArray(int reps) throws IOException { if (inputDataList.size() == 0) { @@ -195,7 +195,7 @@ public class ProtoCaliperBenchmark { } } } - + @Benchmark void deserializeFromMemoryStream(int reps) throws IOException { if (inputStreamList.size() == 0) { diff --git a/benchmarks/js/benchmark_suite.js b/benchmarks/js/benchmark_suite.js index c95024b2e2..c5c3e5105a 100644 --- a/benchmarks/js/benchmark_suite.js +++ b/benchmarks/js/benchmark_suite.js @@ -9,8 +9,8 @@ function newBenchmark(messageName, filename, language) { }) .on("start", function() { process.stdout.write( - "benchmarking message " + messageName - + " of dataset file " + filename + "benchmarking message " + messageName + + " of dataset file " + filename + "'s performance ..." + "\n\n"); }) .on("cycle", function(event) { @@ -21,7 +21,7 @@ function newBenchmark(messageName, filename, language) { return 1 / (bench.stats.mean + bench.stats.moe); } benches.forEach(function(val, index) { - benches[index] = getHz(val); + benches[index] = getHz(val); }); }), benches: benches diff --git a/benchmarks/js/js_benchmark.js b/benchmarks/js/js_benchmark.js index 875be68139..c44fee01c3 100644 --- a/benchmarks/js/js_benchmark.js +++ b/benchmarks/js/js_benchmark.js @@ -30,7 +30,7 @@ process.argv.forEach(function(filename, index) { json_file = filename.replace(/^--json_output=/, ''); return; } - + var benchmarkDataset = proto.benchmarks.BenchmarkDataset.deserializeBinary(fs.readFileSync(filename)); var messageList = []; @@ -40,7 +40,7 @@ process.argv.forEach(function(filename, index) { messageList.push(message.deserializeBinary(onePayload)); totalBytes += onePayload.length; }); - + var senarios = benchmarkSuite.newBenchmark( benchmarkDataset.getMessageName(), filename, "js"); senarios.suite @@ -48,14 +48,14 @@ process.argv.forEach(function(filename, index) { benchmarkDataset.getPayloadList().forEach(function(onePayload) { var protoType = getNewPrototype(benchmarkDataset.getMessageName()); protoType.deserializeBinary(onePayload); - }); + }); }) .add("js serialize", function() { var protoType = getNewPrototype(benchmarkDataset.getMessageName()); messageList.forEach(function(message) { message.serializeBinary(); }); - }) + }) .run({"Async": false}); results.push({ @@ -66,9 +66,9 @@ process.argv.forEach(function(filename, index) { } }) - console.log("Throughput for deserialize: " + console.log("Throughput for deserialize: " + senarios.benches[0] * totalBytes / 1024 / 1024 + "MB/s" ); - console.log("Throughput for serialize: " + console.log("Throughput for serialize: " + senarios.benches[1] * totalBytes / 1024 / 1024 + "MB/s" ); console.log(""); }); diff --git a/benchmarks/php/PhpBenchmark.php b/benchmarks/php/PhpBenchmark.php index 2c5245d853..d3db61d248 100644 --- a/benchmarks/php/PhpBenchmark.php +++ b/benchmarks/php/PhpBenchmark.php @@ -33,7 +33,7 @@ class BenchmarkMethod (new $args[1]())->mergeFromString($payloads->offsetGet($i)); } } - + // $args: array of message static function serialize(&$args) { foreach ($args as &$temp_message) { @@ -49,7 +49,7 @@ class Benchmark private $benchmark_time; private $total_bytes; private $coefficient; - + public function __construct($benchmark_name, $args, $total_bytes, $benchmark_time = 5.0) { $this->args = $args; @@ -58,7 +58,7 @@ class Benchmark $this->total_bytes = $total_bytes; $this->coefficient = pow (10, 0) / pow(2, 20); } - + public function runBenchmark() { $t = $this->runBenchmarkWithTimes(1); $times = ceil($this->benchmark_time / $t); @@ -66,7 +66,7 @@ class Benchmark ($times == 1 ? $t : $this->runBenchmarkWithTimes($times)) * $this->coefficient; } - + private function runBenchmarkWithTimes($times) { $st = microtime(true); for ($i = 0; $i < $times; $i++) { @@ -109,14 +109,14 @@ function runBenchmark($file, $behavior_prefix) { array_push($message_list, $new_message); $total_bytes += strlen($payloads->offsetGet($i)); } - + $parse_benchmark = new Benchmark( "\Google\Protobuf\Benchmark\BenchmarkMethod::parse", array($dataset, $message_name), $total_bytes); $serialize_benchmark = new Benchmark( "\Google\Protobuf\Benchmark\BenchmarkMethod::serialize", $message_list, $total_bytes); - + return array( "filename" => $file, "benchmarks" => array( @@ -139,7 +139,7 @@ foreach ($argv as $index => $arg) { if ($arg == "--json") { $json_output = true; } else if (strpos($arg, "--behavior_prefix") == 0) { - $behavior_prefix = str_replace("--behavior_prefix=", "", $arg); + $behavior_prefix = str_replace("--behavior_prefix=", "", $arg); } } diff --git a/benchmarks/protobuf.js/protobufjs_benchmark.js b/benchmarks/protobuf.js/protobufjs_benchmark.js index 2629e9f46f..19e54972b8 100644 --- a/benchmarks/protobuf.js/protobufjs_benchmark.js +++ b/benchmarks/protobuf.js/protobufjs_benchmark.js @@ -30,7 +30,7 @@ process.argv.forEach(function(filename, index) { messageList.push(message.decode(onePayload)); totalBytes += onePayload.length; }); - + var senarios = benchmarkSuite.newBenchmark( benchmarkDataset.messageName, filename, "protobufjs"); senarios.suite @@ -38,14 +38,14 @@ process.argv.forEach(function(filename, index) { benchmarkDataset.payload.forEach(function(onePayload) { var protoType = getNewPrototype(benchmarkDataset.messageName); protoType.decode(onePayload); - }); + }); }) .add("protobuf.js static encoding", function() { var protoType = getNewPrototype(benchmarkDataset.messageName); messageList.forEach(function(message) { protoType.encode(message).finish(); }); - }) + }) .run({"Async": false}); results.push({ @@ -56,9 +56,9 @@ process.argv.forEach(function(filename, index) { } }) - console.log("Throughput for decoding: " + console.log("Throughput for decoding: " + senarios.benches[0] * totalBytes / 1024 / 1024 + "MB/s" ); - console.log("Throughput for encoding: " + console.log("Throughput for encoding: " + senarios.benches[1] * totalBytes / 1024 / 1024 + "MB/s" ); console.log(""); }); diff --git a/benchmarks/python/py_benchmark.py b/benchmarks/python/py_benchmark.py index d29175e2bc..f2c7bccbe8 100755 --- a/benchmarks/python/py_benchmark.py +++ b/benchmarks/python/py_benchmark.py @@ -8,7 +8,7 @@ import fnmatch import json parser = argparse.ArgumentParser(description="Python protobuf benchmark") -parser.add_argument("data_files", metavar="dataFile", nargs="+", +parser.add_argument("data_files", metavar="dataFile", nargs="+", help="testing data files.") parser.add_argument("--json", action="store_const", dest="json", const="yes", default="no", @@ -138,14 +138,14 @@ class Benchmark: t = timeit.timeit(stmt="%s(%s)" % (self.test_method, test_method_args), setup=self.full_setup_code(setup_method_args), number=reps); - return self.total_bytes * 1.0 / 2 ** 20 / (1.0 * t / reps * self.full_iteration) - + return self.total_bytes * 1.0 / 2 ** 20 / (1.0 * t / reps * self.full_iteration) + if __name__ == "__main__": results = [] for file in args.data_files: results.append(run_one_test(file)) - + if args.json != "no": print(json.dumps(results)) else: diff --git a/benchmarks/util/result_parser.py b/benchmarks/util/result_parser.py index 8f26dd2888..e3d8e423d3 100755 --- a/benchmarks/util/result_parser.py +++ b/benchmarks/util/result_parser.py @@ -295,6 +295,6 @@ def get_result_from_file(cpp_file="", if php_file != "": __parse_php_result(php_file, "php") if php_c_file != "": - __parse_php_result(php_c_file, "php") + __parse_php_result(php_c_file, "php") return __results diff --git a/benchmarks/util/result_uploader.py b/benchmarks/util/result_uploader.py index 021cc54622..2a35d9694d 100755 --- a/benchmarks/util/result_uploader.py +++ b/benchmarks/util/result_uploader.py @@ -60,7 +60,7 @@ def upload_result(result_list, metadata): new_result["labels"] = labels_string[1:] new_result["timestamp"] = _INITIAL_TIME print(labels_string) - + bq = big_query_utils.create_big_query() row = big_query_utils.make_row(str(uuid.uuid4()), new_result) if not big_query_utils.insert_rows(bq, _PROJECT_ID, _DATASET, @@ -91,7 +91,7 @@ if __name__ == "__main__": default="") parser.add_argument("-php_c", "--php_c_input_file", help="The php with c ext benchmark result file's name", - default="") + default="") args = parser.parse_args() metadata = get_metadata() diff --git a/cmake/README.md b/cmake/README.md index 29f7669517..96aaf4f97d 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -130,11 +130,11 @@ It will generate *Visual Studio* solution file *protobuf.sln* in current directo If the *gmock* directory does not exist, and you do not want to build protobuf unit tests, you need to add *cmake* command argument `-Dprotobuf_BUILD_TESTS=OFF` to disable testing. -To make a *Visual Studio* file for Visual Studio 15 2017, create the *Visual Studio* +To make a *Visual Studio* file for Visual Studio 15 2017, create the *Visual Studio* solution file above and edit the CmakeCache file. - + C:Path\to\protobuf\cmake\build\solution\CMakeCache - + Then create the *Visual Studio* solution file again Compiling @@ -177,9 +177,9 @@ You should see output similar to: Running main() from gmock_main.cc [==========] Running 1546 tests from 165 test cases. - + ... - + [==========] 1546 tests from 165 test cases ran. (2529 ms total) [ PASSED ] 1546 tests. @@ -198,7 +198,7 @@ To run specific tests: [ RUN ] AnyTest.TestIs [ OK ] AnyTest.TestIs (0 ms) [----------] 3 tests from AnyTest (1 ms total) - + [----------] Global test environment tear-down [==========] 3 tests from 1 test case ran. (2 ms total) [ PASSED ] 3 tests. @@ -310,7 +310,7 @@ If you already have ZLIB library and headers at some other location on your syst -DZLIB_INCLUDE_DIR= -DZLIB_LIB= - + Build and testing protobuf as usual. Notes on Compiler Warnings diff --git a/cmake/protobuf-config.cmake.in b/cmake/protobuf-config.cmake.in index 18054687b9..29e39d88af 100644 --- a/cmake/protobuf-config.cmake.in +++ b/cmake/protobuf-config.cmake.in @@ -37,7 +37,7 @@ function(protobuf_generate) if(NOT protobuf_generate_PROTOC_OUT_DIR) set(protobuf_generate_PROTOC_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) endif() - + if(protobuf_generate_EXPORT_MACRO AND protobuf_generate_LANGUAGE STREQUAL cpp) set(_dll_export_decl "dllexport_decl=${protobuf_generate_EXPORT_MACRO}:") endif() diff --git a/cmake/version.rc.in b/cmake/version.rc.in index cbce1e5389..aeeaadf8c5 100644 --- a/cmake/version.rc.in +++ b/cmake/version.rc.in @@ -23,7 +23,7 @@ VS_VERSION_INFO VERSIONINFO FILETYPE VFT_DLL BEGIN BLOCK "VarFileInfo" - BEGIN + BEGIN // English language (0x409) and the Windows Unicode codepage (1200) VALUE "Translation", 0x409, 1200 END diff --git a/conformance/ConformanceJava.java b/conformance/ConformanceJava.java index 008f3bc7ae..e5e15943af 100644 --- a/conformance/ConformanceJava.java +++ b/conformance/ConformanceJava.java @@ -57,7 +57,7 @@ class ConformanceJava { buf[3] = (byte)(val >> 24); writeToStdout(buf); } - + private enum BinaryDecoderType { BTYE_STRING_DECODER, BYTE_ARRAY_DECODER, @@ -69,11 +69,11 @@ class ConformanceJava { } private static class BinaryDecoder { - public MessageType decode (ByteString bytes, BinaryDecoderType type, + public MessageType decode (ByteString bytes, BinaryDecoderType type, Parser parser, ExtensionRegistry extensions) throws InvalidProtocolBufferException { switch (type) { - case BTYE_STRING_DECODER: + case BTYE_STRING_DECODER: return parser.parseFrom(bytes, extensions); case BYTE_ARRAY_DECODER: return parser.parseFrom(bytes.toByteArray(), extensions); @@ -94,7 +94,7 @@ class ConformanceJava { } catch (InvalidProtocolBufferException e) { throw e; } - } + } case DIRECT_BYTE_BUFFER_DECODER: { ByteBuffer buffer = ByteBuffer.allocateDirect(bytes.size()); bytes.copyTo(buffer); @@ -135,7 +135,7 @@ class ConformanceJava { ArrayList messages = new ArrayList (); ArrayList exceptions = new ArrayList (); - + for (int i = 0; i < BinaryDecoderType.values().length; i++) { messages.add(null); exceptions.add(null); @@ -273,7 +273,7 @@ class ConformanceJava { throw new RuntimeException("Unspecified output format."); case PROTOBUF: { - ByteString MessageString = testMessage.toByteString(); + ByteString MessageString = testMessage.toByteString(); return Conformance.ConformanceResponse.newBuilder().setProtobufPayload(MessageString).build(); } diff --git a/conformance/conformance_ruby.rb b/conformance/conformance_ruby.rb index df63bf7ced..0e2126e018 100755 --- a/conformance/conformance_ruby.rb +++ b/conformance/conformance_ruby.rb @@ -54,7 +54,7 @@ def do_test(request) elsif request.message_type.eql?('protobuf_test_messages.proto2.TestAllTypesProto2') response.skipped = "Ruby doesn't support proto2" return response - else + else fail "Protobuf request doesn't have specific payload type" end diff --git a/conformance/third_party/jsoncpp/json.h b/conformance/third_party/jsoncpp/json.h index 42e7e7f4ad..32fd0720d4 100644 --- a/conformance/third_party/jsoncpp/json.h +++ b/conformance/third_party/jsoncpp/json.h @@ -6,28 +6,28 @@ // ////////////////////////////////////////////////////////////////////// /* -The JsonCpp library's source code, including accompanying documentation, +The JsonCpp library's source code, including accompanying documentation, tests and demonstration applications, are licensed under the following conditions... -The author (Baptiste Lepilleur) explicitly disclaims copyright in all -jurisdictions which recognize such a disclaimer. In such jurisdictions, +The author (Baptiste Lepilleur) explicitly disclaims copyright in all +jurisdictions which recognize such a disclaimer. In such jurisdictions, this software is released into the Public Domain. In jurisdictions which do not recognize Public Domain property (e.g. Germany as of 2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is released under the terms of the MIT License (see below). -In jurisdictions which recognize Public Domain property, the user of this -software may choose to accept it either as 1) Public Domain, 2) under the -conditions of the MIT License (see below), or 3) under the terms of dual +In jurisdictions which recognize Public Domain property, the user of this +software may choose to accept it either as 1) Public Domain, 2) under the +conditions of the MIT License (see below), or 3) under the terms of dual Public Domain/MIT License conditions described here, as they choose. The MIT License is about as close to Public Domain as a license can get, and is described in clear, concise terms at: http://en.wikipedia.org/wiki/MIT_License - + The full text of the MIT License follows: ======================================================================== @@ -434,7 +434,7 @@ protected: /** Exceptions which the user cannot easily avoid. * * E.g. out-of-memory (when we use malloc), stack-overflow, malicious input - * + * * \remark derived from Json::Exception */ class JSON_API RuntimeError : public Exception { @@ -445,7 +445,7 @@ public: /** Exceptions thrown by JSON_ASSERT/JSON_FAIL macros. * * These are precondition-violations (user bugs) and internal errors (our bugs). - * + * * \remark derived from Json::Exception */ class JSON_API LogicError : public Exception { @@ -1570,7 +1570,7 @@ public: - `"rejectDupKeys": false or true` - If true, `parse()` returns false when a key is duplicated within an object. - `"allowSpecialFloats": false or true` - - If true, special float values (NaNs and infinities) are allowed + - If true, special float values (NaNs and infinities) are allowed and their values are lossfree restorable. You can examine 'settings_` yourself diff --git a/conformance/third_party/jsoncpp/jsoncpp.cpp b/conformance/third_party/jsoncpp/jsoncpp.cpp index f803962ade..4d3e0f2f31 100644 --- a/conformance/third_party/jsoncpp/jsoncpp.cpp +++ b/conformance/third_party/jsoncpp/jsoncpp.cpp @@ -6,28 +6,28 @@ // ////////////////////////////////////////////////////////////////////// /* -The JsonCpp library's source code, including accompanying documentation, +The JsonCpp library's source code, including accompanying documentation, tests and demonstration applications, are licensed under the following conditions... -The author (Baptiste Lepilleur) explicitly disclaims copyright in all -jurisdictions which recognize such a disclaimer. In such jurisdictions, +The author (Baptiste Lepilleur) explicitly disclaims copyright in all +jurisdictions which recognize such a disclaimer. In such jurisdictions, this software is released into the Public Domain. In jurisdictions which do not recognize Public Domain property (e.g. Germany as of 2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is released under the terms of the MIT License (see below). -In jurisdictions which recognize Public Domain property, the user of this -software may choose to accept it either as 1) Public Domain, 2) under the -conditions of the MIT License (see below), or 3) under the terms of dual +In jurisdictions which recognize Public Domain property, the user of this +software may choose to accept it either as 1) Public Domain, 2) under the +conditions of the MIT License (see below), or 3) under the terms of dual Public Domain/MIT License conditions described here, as they choose. The MIT License is about as close to Public Domain as a license can get, and is described in clear, concise terms at: http://en.wikipedia.org/wiki/MIT_License - + The full text of the MIT License follows: ======================================================================== @@ -207,7 +207,7 @@ static inline void fixNumericLocale(char* begin, char* end) { #include #if defined(_MSC_VER) -#if !defined(WINCE) && defined(__STDC_SECURE_LIB__) && _MSC_VER >= 1500 // VC++ 9.0 and above +#if !defined(WINCE) && defined(__STDC_SECURE_LIB__) && _MSC_VER >= 1500 // VC++ 9.0 and above #define snprintf sprintf_s #elif _MSC_VER >= 1900 // VC++ 14.0 and above #define snprintf std::snprintf @@ -4029,7 +4029,7 @@ Value& Path::make(Value& root) const { #define snprintf std::snprintf #endif -#if defined(__BORLANDC__) +#if defined(__BORLANDC__) #include #define isfinite _finite #define snprintf _snprintf @@ -5096,7 +5096,7 @@ StreamWriter* StreamWriterBuilder::newStreamWriter() const std::string cs_str = settings_["commentStyle"].asString(); bool eyc = settings_["enableYAMLCompatibility"].asBool(); bool dnp = settings_["dropNullPlaceholders"].asBool(); - bool usf = settings_["useSpecialFloats"].asBool(); + bool usf = settings_["useSpecialFloats"].asBool(); unsigned int pre = settings_["precision"].asUInt(); CommentStyle::Enum cs = CommentStyle::All; if (cs_str == "All") { diff --git a/csharp/CHANGES.txt b/csharp/CHANGES.txt index a87cd4d5df..8574b7c4a3 100644 --- a/csharp/CHANGES.txt +++ b/csharp/CHANGES.txt @@ -26,7 +26,7 @@ Changes: - Optimized enum parsing. Fixes: -- Fix for bug in limited input stream's Position, Introduced Position on +- Fix for bug in limited input stream's Position, Introduced Position on output stream - Fix for writing a character to a JSON output overflows allocated buffer - Optimize FromBase64String to return Empty when presented with empty string. @@ -47,14 +47,14 @@ Changes: - Added 'Unsafe' static type in ByteString to allow direct buffer access Fixes: -- Issue 50: The XML serializer will fail to deserialize a message with empty +- Issue 50: The XML serializer will fail to deserialize a message with empty child message - Issue 45: Use of 'item' as a field name causes AmbiguousMatchException - Issue 49: Generated nested static Types class should be partial - Issue 38: Disable CLSCompliant warnings (3021) - Issue 40: proto_path does not work for command-line file names - Issue 54: should retire all bytes in buffer (bufferSize) -- Issue 43: Fix to correct identical 'umbrella_classname' options from trying +- Issue 43: Fix to correct identical 'umbrella_classname' options from trying to write to the same filename. =============================================================================== @@ -66,7 +66,7 @@ Features: NONE, GENERIC, INTERFACE, or IRPCDISPATCH - Added interfaces IRpcDispatch and IRpcServerStub to provide for blocking services and implementations. -- Added ProtoGen.exe command-line argument "--protoc_dir=" to specify the +- Added ProtoGen.exe command-line argument "--protoc_dir=" to specify the location of protoc.exe. - Extracted interfaces for ICodedInputStream and ICodedOutputStream to allow custom implementation of writers with both speed and size optimizations. @@ -86,9 +86,9 @@ Fixes: - Issue 16: Does not integrate well with other tooling - Issue 19: Support for negative enum values - Issue 26: AddRange in GeneratedBuilder iterates twice. -- Issue 27: Remove XML documentation output from test projects to clear +- Issue 27: Remove XML documentation output from test projects to clear warnings/errors. -- Issue 28: Circular message dependencies result in null default values for +- Issue 28: Circular message dependencies result in null default values for Message fields. - Issue 29: Message classes generated have a public default constructor. You can disable private ctor generation with the option generate_private_ctor. @@ -109,14 +109,14 @@ RELEASE NOTES - Version 2.3.0.277 =============================================================================== Features: -- Added cls_compliance option to generate attributes indicating +- Added cls_compliance option to generate attributes indicating non-CLS-compliance. - Added file_extension option to control the generated output file's extension. - Added umbrella_namespace option to place the umbrella class into a nested - namespace to address issues with proto files having the same name as a + namespace to address issues with proto files having the same name as a message it contains. - Added output_directory option to set the output path for the source file(s). -- Added ignore_google_protobuf option to avoid generating code for includes +- Added ignore_google_protobuf option to avoid generating code for includes from the google.protobuf package. - Added the LITE framework (Google.ProtoBuffersLite.dll) and the ability to generate code with "option optimize_for = LITE_RUNTIME;". diff --git a/csharp/README.md b/csharp/README.md index aafef16ada..9aab782da1 100644 --- a/csharp/README.md +++ b/csharp/README.md @@ -10,7 +10,7 @@ You will also want to install the `Google.Protobuf.Tools` NuGet package, which contains precompiled version of `protoc.exe` and a copy of well known `.proto` files under the package's `tools` directory. -To generate C# files from your `.proto` files, invoke `protoc` with the +To generate C# files from your `.proto` files, invoke `protoc` with the `--csharp_out` option. Supported platforms @@ -37,8 +37,8 @@ later. Although *users* of this project are only expected to have Visual Studio 2012 or later, *developers* of the library are required to have Visual Studio 2017 or later, as the library uses C# 6 features -in its implementation, as well as the new Visual Studio 2017 csproj -format. These features have no impact when using the compiled code - +in its implementation, as well as the new Visual Studio 2017 csproj +format. These features have no impact when using the compiled code - they're only relevant when building the `Google.Protobuf` assembly. In order to run and debug the AddressBook example in the IDE, you must @@ -56,19 +56,19 @@ run using the Visual Studio Test Explorer or `dotnet test`. .NET 3.5 ======== -We don't officially support .NET 3.5. However, there has been some effort -to make enabling .NET 3.5 support relatively painless in case you require it. -There's no guarantee that this will continue in the future, so rely on .NET +We don't officially support .NET 3.5. However, there has been some effort +to make enabling .NET 3.5 support relatively painless in case you require it. +There's no guarantee that this will continue in the future, so rely on .NET 3.5 support at your peril. -To enable .NET 3.5 support, you must edit the `TargetFrameworks` elements of -[src/Google.Protobuf/Google.Protobuf.csproj](src/Google.Protobuf/Google.Protobuf.csproj) -(and [src/Google.Protobuf.Test/Google.Protobuf.Test.csproj](src/Google.Protobuf.Test/Google.Protobuf.Test.csproj) -if you want to run the unit tests): +To enable .NET 3.5 support, you must edit the `TargetFrameworks` elements of +[src/Google.Protobuf/Google.Protobuf.csproj](src/Google.Protobuf/Google.Protobuf.csproj) +(and [src/Google.Protobuf.Test/Google.Protobuf.Test.csproj](src/Google.Protobuf.Test/Google.Protobuf.Test.csproj) +if you want to run the unit tests): -Open the .csproj file in a text editor and simply add `net35` to the list of -target frameworks, noting that the `TargetFrameworks` element appears twice in -the file (once in the first `PropertyGroup` element, and again in the second +Open the .csproj file in a text editor and simply add `net35` to the list of +target frameworks, noting that the `TargetFrameworks` element appears twice in +the file (once in the first `PropertyGroup` element, and again in the second `PropertyGroup` element, i.e., the one with the conditional). History of C# protobufs diff --git a/csharp/compatibility_tests/v3.0.0/protos/csharp/protos/unittest_issues.proto b/csharp/compatibility_tests/v3.0.0/protos/csharp/protos/unittest_issues.proto index 7bec1f8017..b6178bf1af 100644 --- a/csharp/compatibility_tests/v3.0.0/protos/csharp/protos/unittest_issues.proto +++ b/csharp/compatibility_tests/v3.0.0/protos/csharp/protos/unittest_issues.proto @@ -20,7 +20,7 @@ message Issue307 { // Old issue 13: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=13 // New issue 309: https://github.com/protocolbuffers/protobuf/issues/309 - + // message A { // optional int32 _A = 1; // } @@ -101,21 +101,21 @@ message TestJsonFieldOrdering { // that will require fixing other tests in multiple platforms. // Alternatively, consider just adding this to // unittest_proto3.proto if multiple platforms want it. - + int32 plain_int32 = 4; oneof o1 { string o1_string = 2; int32 o1_int32 = 5; } - + string plain_string = 1; - + oneof o2 { int32 o2_int32 = 6; string o2_string = 3; } - + } message TestJsonName { diff --git a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/MapFieldTest.cs b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/MapFieldTest.cs index 9c8459073c..3b4e1d33b1 100644 --- a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/MapFieldTest.cs +++ b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/MapFieldTest.cs @@ -86,7 +86,7 @@ namespace Google.Protobuf.Collections var map = new MapField(); Assert.Throws(() => map[null] = new ForeignMessage()); } - + [Test] public void AddPreservesInsertionOrder() { @@ -471,7 +471,7 @@ namespace Google.Protobuf.Collections keys.CopyTo(array, 1); CollectionAssert.AreEqual(new[] { null, "foo", "x", null }, array); } - + // Just test keys - we know the implementation is the same for values [Test] public void NonGenericViewCopyTo() diff --git a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs index f430b06bed..e8a3d360c2 100644 --- a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs +++ b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs @@ -59,7 +59,7 @@ namespace Google.Protobuf.Compatibility [TestCase(typeof(string), typeof(int), false)] [TestCase(typeof(int), typeof(int), true)] [TestCase(typeof(ValueType), typeof(int), true)] - [TestCase(typeof(long), typeof(int), false)] // + [TestCase(typeof(long), typeof(int), false)] // public void IsAssignableFrom(Type target, Type argument, bool expected) { Assert.AreEqual(expected, TypeExtensions.IsAssignableFrom(target, argument)); diff --git a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj index 06d07b9f4a..6bc1e0ca4d 100644 --- a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj +++ b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj @@ -18,7 +18,7 @@ -