pull/17682/head
Nathan Baulch 4 months ago
parent cb845a5962
commit d41762d137
No known key found for this signature in database
  1. 2
      WORKSPACE.bzlmod
  2. 2
      bazel/private/upb_proto_library_internal/aspect.bzl
  3. 4
      conformance/ConformanceJava.java
  4. 4
      conformance/ConformanceJavaLite.java
  5. 2
      conformance/conformance_test_runner.cc
  6. 2
      csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/DeprecatedMemberTest.cs
  7. 2
      csharp/src/Google.Protobuf.Test/DeprecatedMemberTest.cs
  8. BIN
      csharp/src/Google.Protobuf.Test/testprotos.pb
  9. 2
      csharp/src/Google.Protobuf/Reflection/Descriptor.pb.cs
  10. 4
      csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs
  11. 2
      csharp/src/Google.Protobuf/WellKnownTypes/Api.pb.cs
  12. 2
      java/core/src/main/java/com/google/protobuf/ByteString.java
  13. 2
      java/core/src/main/java/com/google/protobuf/CodedOutputStream.java
  14. 2
      java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java
  15. 2
      java/core/src/main/java/com/google/protobuf/RuntimeVersion.java
  16. 2
      java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java
  17. 6
      java/core/src/test/java/com/google/protobuf/MessageTest.java
  18. 2
      java/core/src/test/java/com/google/protobuf/RuntimeVersionTest.java
  19. 2
      java/test/linkage-monitor-check-bom/pom.xml
  20. 4
      java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java
  21. 6
      objectivec/DevTools/pddm.py
  22. 2
      objectivec/GPBAny.pbobjc.h
  23. 2
      objectivec/GPBApi.pbobjc.h
  24. 2
      objectivec/GPBDescriptor.m
  25. 2
      objectivec/GPBDuration.pbobjc.h
  26. 2
      objectivec/GPBMessage.h
  27. 2
      objectivec/GPBTimestamp.pbobjc.h
  28. 2
      objectivec/Tests/GPBCodedInputStreamTests.m
  29. 2
      objectivec/Tests/GPBCodedOutputStreamTests.m
  30. 12
      objectivec/Tests/GPBMessageTests.m
  31. 2
      objectivec/Tests/GPBUnknownFieldSetTest.m
  32. 2
      objectivec/Tests/GPBUnknownFieldsTest.m
  33. 2
      objectivec/Tests/unittest_objc.proto
  34. 2
      php/ext/google/protobuf/php-upb.h
  35. 14
      php/src/Google/Protobuf/Internal/AnyBase.php
  36. 2
      php/tests/GeneratedClassTest.php
  37. 4
      pkg/build_systems.bzl
  38. 4
      python/google/protobuf/internal/descriptor_pool_test.py
  39. 2
      python/google/protobuf/internal/descriptor_pool_test1.proto
  40. 2
      python/google/protobuf/internal/json_format_test.py
  41. 2
      python/google/protobuf/internal/python_message.py
  42. 6
      python/google/protobuf/internal/reflection_test.py
  43. 2
      python/google/protobuf/internal/timestamp_test.py
  44. 2
      python/google/protobuf/internal/well_known_types.py
  45. 2
      python/google/protobuf/pyext/message.cc
  46. 2
      python/google/protobuf/runtime_version.py
  47. 2
      ruby/ext/google/protobuf_c/ruby-upb.h
  48. 2
      rust/codegen_traits.rs
  49. 2
      rust/defs.bzl
  50. 2
      src/google/protobuf/api.proto
  51. 4
      src/google/protobuf/compiler/command_line_interface_unittest.cc
  52. 4
      src/google/protobuf/compiler/cpp/field_generators/message_field.cc
  53. 2
      src/google/protobuf/compiler/cpp/helpers.h
  54. 2
      src/google/protobuf/compiler/java/doc_comment.cc
  55. 2
      src/google/protobuf/compiler/objectivec/helpers.cc
  56. 2
      src/google/protobuf/compiler/objectivec/message.cc
  57. 12
      src/google/protobuf/compiler/parser_unittest.cc
  58. 4
      src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc
  59. 6
      src/google/protobuf/descriptor.cc
  60. 2
      src/google/protobuf/descriptor.proto
  61. 2
      src/google/protobuf/extension_set_unittest.cc
  62. 2
      src/google/protobuf/io/printer_unittest.cc
  63. 2
      src/google/protobuf/io/zero_copy_stream_unittest.cc
  64. 2
      src/google/protobuf/lazy_repeated_field.h
  65. 4
      src/google/protobuf/lazy_repeated_field_heavy.cc
  66. 2
      src/google/protobuf/lite_unittest.cc
  67. 4
      src/google/protobuf/map_test.inc
  68. 4
      src/google/protobuf/message_lite.h
  69. 2
      src/google/protobuf/port_def.inc
  70. 2
      src/google/protobuf/reflection_visit_fields_test.cc
  71. 2
      src/google/protobuf/serial_arena.h
  72. 2
      src/google/protobuf/text_format.cc
  73. 4
      src/google/protobuf/text_format_unittest.cc
  74. 76
      src/google/protobuf/util/field_mask_util_test.cc
  75. 6
      src/google/protobuf/util/message_differencer_unittest.cc
  76. 16
      third_party/utf8_range/README.md
  77. 2
      third_party/utf8_range/boost.cpp
  78. 4
      third_party/utf8_range/main.c
  79. 2
      third_party/utf8_range/range-avx2.c
  80. 2
      third_party/utf8_range/range-neon.c
  81. 2
      third_party/utf8_range/range-sse.c
  82. 2
      third_party/utf8_range/utf8_to_utf16/main.c
  83. 4
      upb/cmake/CMakeLists.txt
  84. 2
      upb/cmake/README.md
  85. 2
      upb/cmake/make_cmakelists.py
  86. 2
      upb/io/string.h
  87. 2
      upb/io/tokenizer.c
  88. 4
      upb/test/fuzz_util.h
  89. 2
      upb/text/debug_string.h
  90. 2
      upb/wire/decode.h

@ -21,7 +21,7 @@ ruby_runtime("system_ruby")
register_toolchains("@system_ruby//:toolchain")
# Follwing are just needed to run conformance tests, not really needed to support them via MODULE.bazel
# Following are just needed to run conformance tests, not really needed to support them via MODULE.bazel
# For testing runtime against old gencode from a previous major version.
http_archive(

@ -258,7 +258,7 @@ def upb_proto_aspect_impl(
`cc_info` field. The aspect will ensure that each compilation action can compile and link
against this provider's cc_info for all proto_library() deps.
dep_cc_provider: For aspects that depend on other aspects, this is the provider of the aspect
that we depend on. The aspect wil be able to include the header files from this provider.
that we depend on. The aspect will be able to include the header files from this provider.
file_provider: A provider that this aspect will attach to the target to expose the source
files generated by this aspect. These files are primarily useful for returning in
DefaultInfo(), so users who build the upb_*proto_library() rule directly can view the

@ -70,7 +70,7 @@ class ConformanceJava {
}
private enum BinaryDecoderType {
BTYE_STRING_DECODER,
BYTE_STRING_DECODER,
BYTE_ARRAY_DECODER,
ARRAY_BYTE_BUFFER_DECODER,
READONLY_ARRAY_BYTE_BUFFER_DECODER,
@ -84,7 +84,7 @@ class ConformanceJava {
ByteString bytes, BinaryDecoderType type, Parser<T> parser, ExtensionRegistry extensions)
throws InvalidProtocolBufferException {
switch (type) {
case BTYE_STRING_DECODER:
case BYTE_STRING_DECODER:
case BYTE_ARRAY_DECODER:
return parser.parseFrom(bytes, extensions);
case ARRAY_BYTE_BUFFER_DECODER:

@ -67,7 +67,7 @@ class ConformanceJavaLite {
}
private enum BinaryDecoderType {
BTYE_STRING_DECODER,
BYTE_STRING_DECODER,
BYTE_ARRAY_DECODER,
ARRAY_BYTE_BUFFER_DECODER,
READONLY_ARRAY_BYTE_BUFFER_DECODER,
@ -84,7 +84,7 @@ class ConformanceJavaLite {
ExtensionRegistryLite extensions)
throws InvalidProtocolBufferException {
switch (type) {
case BTYE_STRING_DECODER:
case BYTE_STRING_DECODER:
case BYTE_ARRAY_DECODER:
return parser.parseFrom(bytes, extensions);
case ARRAY_BYTE_BUFFER_DECODER:

@ -158,7 +158,7 @@ void UsageError() {
" output files.\n\n");
fprintf(stderr, " --test <test_name> Only run\n");
fprintf(stderr,
" the specified test. Mulitple tests\n"
" the specified test. Multiple tests\n"
" can be specified by repeating the \n"
" flag.\n\n");
fprintf(stderr,

@ -23,7 +23,7 @@ namespace Google.Protobuf
}
[Test]
public void TestDepreatedPrimitiveValue()
public void TestDeprecatedPrimitiveValue()
{
AssertIsDeprecated(typeof(TestDeprecatedFields).GetProperty("DeprecatedInt32"));
}

@ -25,7 +25,7 @@ namespace Google.Protobuf
}
[Test]
public void TestDepreatedPrimitiveValue() =>
public void TestDeprecatedPrimitiveValue() =>
AssertIsDeprecated(typeof(TestDeprecatedFields).GetProperty(nameof(TestDeprecatedFields.DeprecatedInt32)));
[Test]

@ -313,7 +313,7 @@ namespace Google.Protobuf.Reflection {
[pbr::OriginalName("EDITION_2024")] _2024 = 1001,
/// <summary>
/// Placeholder editions for testing feature resolution. These should not be
/// used or relyed on outside of tests.
/// used or relied on outside of tests.
/// </summary>
[pbr::OriginalName("EDITION_1_TEST_ONLY")] _1TestOnly = 1,
[pbr::OriginalName("EDITION_2_TEST_ONLY")] _2TestOnly = 2,

@ -113,11 +113,11 @@ namespace Google.Protobuf.Reflection
internal void CrossLink()
{
IDescriptor lookup = File.DescriptorPool.LookupSymbol(Proto.InputType, this);
if (lookup is not MessageDescriptor inpoutType)
if (lookup is not MessageDescriptor inputType)
{
throw new DescriptorValidationException(this, "\"" + Proto.InputType + "\" is not a message type.");
}
InputType = inpoutType;
InputType = inputType;
lookup = File.DescriptorPool.LookupSymbol(Proto.OutputType, this);
if (lookup is not MessageDescriptor outputType)

@ -982,7 +982,7 @@ namespace Google.Protobuf.WellKnownTypes {
/// The mixin construct implies that all methods in `AccessControl` are
/// also declared with same name and request/response types in
/// `Storage`. A documentation generator or annotation processor will
/// see the effective `Storage.GetAcl` method after inherting
/// see the effective `Storage.GetAcl` method after inheriting
/// documentation and annotations as follows:
///
/// service Storage {

@ -1051,7 +1051,7 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
// Implementation note.
// The public methods of this class must be synchronized. ByteStrings
// are guaranteed to be immutable. Without some sort of locking, it could
// be possible for one thread to call toByteSring(), while another thread
// be possible for one thread to call toByteString(), while another thread
// is still modifying the underlying byte array.
private static final byte[] EMPTY_BYTE_ARRAY = new byte[0];

@ -702,7 +702,7 @@ public abstract class CodedOutputStream extends ByteOutput {
This code is ported from the C++ varint implementation.
Implementation notes:
To calcuate varint size, we want to count the number of 7 bit chunks required. Rather than using
To calculate varint size, we want to count the number of 7 bit chunks required. Rather than using
division by 7 to accomplish this, we use multiplication by 9/64. This has a number of important
properties:
* It's roughly 1/7.111111. This makes the 0 bits set case have the same value as the 7 bits set

@ -1593,7 +1593,7 @@ public abstract class GeneratedMessageLite<
@SuppressWarnings("unchecked") // Guaranteed by protoc
T result = instance.newMutableInstance();
try {
// TODO: Try to make input with type CodedInpuStream.ArrayDecoder use
// TODO: Try to make input with type CodedInputStream.ArrayDecoder use
// fast path.
Schema<T> schema = Protobuf.getInstance().schemaFor(result);
schema.mergeFrom(result, CodedInputStreamReader.forCodedInput(input), extensionRegistry);

@ -144,7 +144,7 @@ public final class RuntimeVersion {
private static boolean checkDisabled() {
// Check the environmental variable, and temporarily disable validation if it's set to true.
String disableFlag = java.lang.System.getenv("TEMORARILY_DISABLE_PROTOBUF_VERSION_CHECK");
String disableFlag = java.lang.System.getenv("TEMPORARILY_DISABLE_PROTOBUF_VERSION_CHECK");
if ((disableFlag != null && disableFlag.equals("true"))) {
return true;
}

@ -776,7 +776,7 @@ public class CodedOutputStreamTest {
Coder coder = outputType.newCoder(testAllTypes.getSerializedSize());
testAllTypes.writeTo(coder.stream());
coder.stream().flush();
assertWithMessage("OuputType: " + outputType)
assertWithMessage("OutputType: " + outputType)
.that(fullString)
.isEqualTo(TestAllTypes.parseFrom(coder.toByteArray()).getOptionalString());
}

@ -244,7 +244,7 @@ public class MessageTest {
}
@Test
public void testParseUnititialized() throws Exception {
public void testParseUninitialized() throws Exception {
try {
TestRequired.parseFrom(ByteString.EMPTY);
assertWithMessage("Should have thrown an exception.").fail();
@ -254,7 +254,7 @@ public class MessageTest {
}
@Test
public void testParseNestedUnititialized() throws Exception {
public void testParseNestedUninitialized() throws Exception {
ByteString data =
TestRequiredForeign.newBuilder()
.setOptionalMessage(TEST_REQUIRED_UNINITIALIZED)
@ -301,7 +301,7 @@ public class MessageTest {
}
@Test
public void testDynamicParseUnititialized() throws Exception {
public void testDynamicParseUninitialized() throws Exception {
try {
Descriptors.Descriptor descriptor = TestRequired.getDescriptor();
DynamicMessage.parseFrom(descriptor, ByteString.EMPTY);

@ -126,7 +126,7 @@ public final class RuntimeVersionTest {
}
@Test
public void versionValidation_differentVesionSuffixDisallowed() {
public void versionValidation_differentVersionSuffixDisallowed() {
String gencodeSuffix = "-test";
RuntimeVersion.ProtobufRuntimeVersionException thrown =
assertThrows(

@ -14,7 +14,7 @@
</description>
<properties>
<!--
This verison is ok to kept old. Linkage Monitor overrides this
This version is ok to kept old. Linkage Monitor overrides this
version when checking linakage errors
-->
<protobuf.version>3.23.2</protobuf.version>

@ -224,7 +224,7 @@ public class FieldMaskUtilTest {
}
@Test
public void testSubstract() throws Exception {
public void testSubtract() throws Exception {
// Only test a simple case here and expect
// {@link FieldMaskTreeTest#testRemoveFieldPath} to cover all scenarios.
FieldMask mask1 = FieldMaskUtil.fromString("foo,bar.baz,bar.quz");
@ -234,7 +234,7 @@ public class FieldMaskUtilTest {
}
@Test
public void testSubstract_usingVarArgs() throws Exception {
public void testSubtract_usingVarArgs() throws Exception {
FieldMask mask1 = FieldMaskUtil.fromString("foo,bar.baz,bar.quz.bar");
FieldMask mask2 = FieldMaskUtil.fromString("foo.bar,bar.baz.quz");
FieldMask mask3 = FieldMaskUtil.fromString("bar.quz");

@ -525,8 +525,8 @@ class SourceFile(object):
self.Append(line)
return (True, False)
def BindMacroCollection(self, macro_colletion):
if not macro_colletion:
def BindMacroCollection(self, macro_collection):
if not macro_collection:
return
if self._import_resolver is None:
raise PDDMError('Got an IMPORT-DEFINES without a resolver (line %d):'
@ -541,7 +541,7 @@ class SourceFile(object):
imported_src_file = SourceFile(imported_file, self._import_resolver)
imported_src_file._ParseFile()
for section in imported_src_file._sections:
section.BindMacroCollection(macro_colletion)
section.BindMacroCollection(macro_collection)
except PDDMError as e:
raise PDDMError('%s\n...while importing defines:\n'
' Line %d: %s' %

@ -170,7 +170,7 @@ GPB_FINAL @interface GPBAny : GPBMessage
@property(nonatomic, readwrite, copy, null_resettable) NSData *value;
// NOTE: There are some Objective-C specific methods/properties in
// GPBWellKnownTypes.h that will likey be useful.
// GPBWellKnownTypes.h that will likely be useful.
@end

@ -246,7 +246,7 @@ typedef GPB_ENUM(GPBMixin_FieldNumber) {
* The mixin construct implies that all methods in `AccessControl` are
* also declared with same name and request/response types in
* `Storage`. A documentation generator or annotation processor will
* see the effective `Storage.GetAcl` method after inherting
* see the effective `Storage.GetAcl` method after inheriting
* documentation and annotations as follows:
*
* service Storage {

@ -1152,7 +1152,7 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
@"Internal error: If a MessageSet extension is set, the data type must be a message.");
NSAssert((desc->options & GPBExtensionRepeated) == 0,
@"Internal Error: MessageSet extension can't be repeated.");
// NOTE: Could also check that the exteneded class is a MessageSet, but that would force the
// NOTE: Could also check that the extended class is a MessageSet, but that would force the
// ObjC runtime to start up that class and that isn't desirable here.
}
#endif

@ -125,7 +125,7 @@ GPB_FINAL @interface GPBDuration : GPBMessage
@property(nonatomic, readwrite) int32_t nanos;
// NOTE: There are some Objective-C specific methods/properties in
// GPBWellKnownTypes.h that will likey be useful.
// GPBWellKnownTypes.h that will likely be useful.
@end

@ -507,7 +507,7 @@ CF_EXTERN_C_END
/**
* Merges in the data from an `GPBUnknownFields`, meaning the data from the unknown fields gets
* re-parsed so any known fields will be propertly set.
* re-parsed so any known fields will be properly set.
*
* If the intent is to *replace* the message's unknown fields, call `-clearUnknownFields` first.
*

@ -154,7 +154,7 @@ GPB_FINAL @interface GPBTimestamp : GPBMessage
@property(nonatomic, readwrite) int32_t nanos;
// NOTE: There are some Objective-C specific methods/properties in
// GPBWellKnownTypes.h that will likey be useful.
// GPBWellKnownTypes.h that will likely be useful.
@end

@ -559,7 +559,7 @@ static NSData* DataForGroupsOfDepth(NSUInteger depth) {
[self assertReadByteToEndGroupFails:bytes(35, 25, 0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56,
0x34)]; // truncated fixed64
// Mising end group
// Missing end group
[self assertReadByteToEndGroupFails:bytes(35)];
[self assertReadByteToEndGroupFails:bytes(35, 8, 1)];
[self assertReadByteToEndGroupFails:bytes(35, 43)];

@ -329,7 +329,7 @@
// This test exists to verify that CFStrings with embedded NULLs still expose
// their raw buffer if they are backed by UTF8 storage. If this fails, the
// quick/direct access paths in GPBCodedOutputStream that depend on
// CFStringGetCStringPtr need to be re-evalutated (maybe just removed).
// CFStringGetCStringPtr need to be re-evaluated (maybe just removed).
// And yes, we do get NULLs in strings from some servers.
char zeroTest[] = "\0Test\0String";

@ -1732,14 +1732,14 @@
// Mutable copy shouldn't copy autocreated extensions.
TestAllExtensions *message = [TestAllExtensions message];
GPBExtensionDescriptor *optionalGroupExtension = [UnittestRoot optionalGroupExtension];
GPBExtensionDescriptor *optionalNestedMessageExtesion =
GPBExtensionDescriptor *optionalNestedMessageExtension =
[UnittestRoot optionalNestedMessageExtension];
TestAllTypes_OptionalGroup *optionalGroup = [message getExtension:optionalGroupExtension];
optionalGroup.a = 42;
XCTAssertNotNil(optionalGroup);
XCTAssertNotNil([message getExtension:optionalNestedMessageExtesion]);
XCTAssertNotNil([message getExtension:optionalNestedMessageExtension]);
XCTAssertTrue([message hasExtension:optionalGroupExtension]);
XCTAssertFalse([message hasExtension:optionalNestedMessageExtesion]);
XCTAssertFalse([message hasExtension:optionalNestedMessageExtension]);
TestAllExtensions *message2 = [[message copy] autorelease];
@ -1751,11 +1751,11 @@
XCTAssertNotEqual([message getExtension:optionalGroupExtension],
[message2 getExtension:optionalGroupExtension]);
XCTAssertFalse([message2 hasExtension:optionalNestedMessageExtesion]);
XCTAssertFalse([message2 hasExtension:optionalNestedMessageExtension]);
// Intentionally doing a pointer comparison (auto creation should be
// different)
XCTAssertNotEqual([message getExtension:optionalNestedMessageExtesion],
[message2 getExtension:optionalNestedMessageExtesion]);
XCTAssertNotEqual([message getExtension:optionalNestedMessageExtension],
[message2 getExtension:optionalNestedMessageExtension]);
}
- (void)testClearMessageAutocreatedExtension {

@ -515,7 +515,7 @@ static NSData* DataForGroupsOfDepth(NSUInteger depth) {
0x34)
error:NULL]); // truncated fixed64
// Mising end group
// Missing end group
XCTAssertNil([TestEmptyMessage parseFromData:DataFromBytes(35) error:NULL]);
XCTAssertNil([TestEmptyMessage parseFromData:DataFromBytes(35, 8, 1) error:NULL]);
XCTAssertNil([TestEmptyMessage parseFromData:DataFromBytes(35, 43) error:NULL]);

@ -1158,7 +1158,7 @@ static NSData* DataForGroupsOfDepth(NSUInteger depth) {
0x34)
error:NULL]); // truncated fixed64
// Mising end group
// Missing end group
XCTAssertNil([TestEmptyMessage parseFromData:DataFromBytes(35) error:NULL]);
XCTAssertNil([TestEmptyMessage parseFromData:DataFromBytes(35, 8, 1) error:NULL]);
XCTAssertNil([TestEmptyMessage parseFromData:DataFromBytes(35, 43) error:NULL]);

@ -861,7 +861,7 @@ message BoolOnlyMessage {
// of #imports. Within the WKTs, references to each other are just path
// based imports, but when reference from another proto file, they should be
// conditional to support the framework import style.
message WKTRefereceMessage {
message WKTReferenceMessage {
optional google.protobuf.Any an_any = 1;
}

@ -4541,7 +4541,7 @@ enum {
* already has some sub-message fields present. If the sub-message does
* not occur in the binary payload, we will never visit it and discover the
* incomplete sub-message. For this reason, this check is only useful for
* implemting ParseFromString() semantics. For MergeFromString(), a
* implementing ParseFromString() semantics. For MergeFromString(), a
* post-parse validation step will always be necessary. */
kUpb_DecodeOption_CheckRequired = 2,

@ -29,14 +29,14 @@ class AnyBase extends \Google\Protobuf\Internal\Message
throw new \Exception(
"Type url needs to be type.googleapis.com/fully-qulified");
}
$fully_qualifed_name =
$fully_qualified_name =
substr($this->type_url, $url_prifix_len);
// Create message according to fully qualified name.
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
$desc = $pool->getDescriptorByProtoName($fully_qualifed_name);
$desc = $pool->getDescriptorByProtoName($fully_qualified_name);
if (is_null($desc)) {
throw new \Exception("Class ".$fully_qualifed_name
throw new \Exception("Class ".$fully_qualified_name
." hasn't been added to descriptor pool");
}
$klass = $desc->getClass();
@ -66,8 +66,8 @@ class AnyBase extends \Google\Protobuf\Internal\Message
// Set type url.
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
$desc = $pool->getDescriptorByClassName(get_class($msg));
$fully_qualifed_name = $desc->getFullName();
$this->type_url = GPBUtil::TYPE_URL_PREFIX . $fully_qualifed_name;
$fully_qualified_name = $desc->getFullName();
$this->type_url = GPBUtil::TYPE_URL_PREFIX . $fully_qualified_name;
}
/**
@ -79,8 +79,8 @@ class AnyBase extends \Google\Protobuf\Internal\Message
{
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
$desc = $pool->getDescriptorByClassName($klass);
$fully_qualifed_name = $desc->getFullName();
$type_url = GPBUtil::TYPE_URL_PREFIX . $fully_qualifed_name;
$fully_qualified_name = $desc->getFullName();
$type_url = GPBUtil::TYPE_URL_PREFIX . $fully_qualified_name;
return $this->type_url === $type_url;
}
}

@ -797,7 +797,7 @@ class GeneratedClassTest extends TestBase
$this->assertSame(TestNamespace\NestedEnum::ZERO, $m->getNestedEnum());
}
public function testMesssagesAndEnumsWithEmptyPhpNamespace()
public function testMessagesAndEnumsWithEmptyPhpNamespace()
{
$m = new TestEmptyNamespace();
$n = new TestEmptyNamespace\NestedMessage();

@ -311,8 +311,8 @@ For C++ rules, the following are generated:
For proto_library, the following are generated:
{libname}_proto_srcs: contains the srcs from the `proto_library` rule.
{libname}_srcs: contains syntesized paths for generated C++ sources.
{libname}_hdrs: contains syntesized paths for generated C++ headers.
{libname}_srcs: contains synthesized paths for generated C++ sources.
{libname}_hdrs: contains synthesized paths for generated C++ headers.
""",
implementation = _cmake_file_list_impl,

@ -173,11 +173,11 @@ class DescriptorPoolTestBase(object):
def testCrossFileServicesByName(self):
descriptor_pool_test1_pb2.DESCRIPTOR.services_by_name[
'DescriporPoolTestService'
'DescriptorPoolTestService'
],
with self.assertRaises(KeyError):
descriptor_pool_test2_pb2.DESCRIPTOR.services_by_name[
'DescriporPoolTestService'
'DescriptorPoolTestService'
]
def testFindFileContainingSymbolFailure(self):

@ -18,7 +18,7 @@ extend DescriptorPoolTest1 {
optional TopLevelEnumTest1 top_level_extension_test1 = 1000;
}
service DescriporPoolTestService {}
service DescriptorPoolTestService {}
message DescriptorPoolTest1 {
extensions 1000 to max;

@ -1111,7 +1111,7 @@ class JsonFormatTest(JsonFormatBase):
json_format.Parse(text, message)
self.assertEqual(message.bytes_value, b'\x01\x02')
def testParseBadIdentifer(self):
def testParseBadIdentifier(self):
self.CheckError(
'{int32Value: 1}',
(

@ -988,7 +988,7 @@ def _InternalUnpackAny(msg):
if descriptor is None:
return None
# Unable to import message_factory at top becaue of circular import.
# Unable to import message_factory at top because of circular import.
# pylint: disable=g-import-not-at-top
from google.protobuf import message_factory
message_class = message_factory.GetMessageClass(descriptor)

@ -2654,7 +2654,7 @@ class ByteSizeTest(unittest.TestCase):
@testing_refleaks.TestCase
class SerializationTest(unittest.TestCase):
def testSerializeEmtpyMessage(self):
def testSerializeEmptyMessage(self):
first_proto = unittest_pb2.TestAllTypes()
second_proto = unittest_pb2.TestAllTypes()
serialized = first_proto.SerializeToString()
@ -3203,11 +3203,11 @@ class SerializationTest(unittest.TestCase):
self.assertEqual([1, 2, 3], proto.repeated_int32)
def testInitArgsUnknownFieldName(self):
def InitalizeEmptyMessageWithExtraKeywordArg():
def InitializeEmptyMessageWithExtraKeywordArg():
unused_proto = unittest_pb2.TestEmptyMessage(unknown='unknown')
self._CheckRaises(
ValueError,
InitalizeEmptyMessageWithExtraKeywordArg,
InitializeEmptyMessageWithExtraKeywordArg,
'Protocol message TestEmptyMessage has no "unknown" field.')
def testInitRequiredKwargs(self):

@ -29,7 +29,7 @@ class TimestampTest(unittest.TestCase):
321, timestamp.to_microseconds(timestamp.from_microseconds(321))
)
def test_timstamp_current(self):
def test_timestamp_current(self):
# It is not easy to check with current time. For test coverage only.
self.assertNotEqual(8 * 3600, timestamp.from_current_time().seconds)

@ -242,7 +242,7 @@ class Timestamp(object):
Otherwise, returns a timezone-aware datetime in the input timezone.
"""
# Using datetime.fromtimestamp for this would avoid constructing an extra
# timedelta object and possibly an extra datetime. Unfortuantely, that has
# timedelta object and possibly an extra datetime. Unfortunately, that has
# the disadvantage of not handling the full precision (on all platforms, see
# https://github.com/python/cpython/issues/109849) or full range (on some
# platforms, see https://github.com/python/cpython/issues/110042) of

@ -928,7 +928,7 @@ int DeleteRepeatedField(CMessage* self, const FieldDescriptor* field_descriptor,
// arena is used, we fallback to ReleaseLast (but ABSL_DCHECK to find/fix
// it).
//
// Note that arena is likely null and ABSL_DCHECK and ReleaesLast might be
// Note that arena is likely null and ABSL_DCHECK and ReleaseLast might be
// redundant. The current approach takes extra cautious path not to disrupt
// production.
Message* sub_message =

@ -65,7 +65,7 @@ def ValidateProtobufRuntimeVersion(
runtime.
"""
disable_flag = os.getenv('TEMORARILY_DISABLE_PROTOBUF_VERSION_CHECK')
disable_flag = os.getenv('TEMPORARILY_DISABLE_PROTOBUF_VERSION_CHECK')
if disable_flag is not None and disable_flag.lower() == 'true':
return

@ -4543,7 +4543,7 @@ enum {
* already has some sub-message fields present. If the sub-message does
* not occur in the binary payload, we will never visit it and discover the
* incomplete sub-message. For this reason, this check is only useful for
* implemting ParseFromString() semantics. For MergeFromString(), a
* implementing ParseFromString() semantics. For MergeFromString(), a
* post-parse validation step will always be necessary. */
kUpb_DecodeOption_CheckRequired = 2,

@ -5,7 +5,7 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
//! Traits that are implemeted by codegen types.
//! Traits that are implemented by codegen types.
use crate::__internal::SealedInternal;
use crate::__runtime::RawMessage;

@ -92,7 +92,7 @@ def _rust_proto_library_impl(ctx):
#
# When the aspect visits proto_libraries, it doesn't know and cannot deduce the name of the
# rust_proto_library (although the name of rust_proto_libraries is consistently ending with
# _rust_proto, we can't rely on all proto_libraires to have a name consistently ending with
# _rust_proto, we can't rely on all proto_libraries to have a name consistently ending with
# _proto), therefore we have to modify it after the fact here.
#
# Since Starlark providers are frozen once they leave the _impl function that defines them,

@ -166,7 +166,7 @@ message Method {
// The mixin construct implies that all methods in `AccessControl` are
// also declared with same name and request/response types in
// `Storage`. A documentation generator or annotation processor will
// see the effective `Storage.GetAcl` method after inherting
// see the effective `Storage.GetAcl` method after inheriting
// documentation and annotations as follows:
//
// service Storage {

@ -977,7 +977,7 @@ TEST_F(CommandLineInterfaceTest,
ExpectNoErrors();
}
TEST_F(CommandLineInterfaceTest, ReportsTransitiveMisingImports_LeafFirst) {
TEST_F(CommandLineInterfaceTest, ReportsTransitiveMissingImports_LeafFirst) {
CreateTempFile("unused.proto",
"syntax = \"proto2\";\n"
"message Unused {}\n");
@ -998,7 +998,7 @@ TEST_F(CommandLineInterfaceTest, ReportsTransitiveMisingImports_LeafFirst) {
"bar.proto:2:1: warning: Import unused.proto is unused.");
}
TEST_F(CommandLineInterfaceTest, ReportsTransitiveMisingImports_LeafLast) {
TEST_F(CommandLineInterfaceTest, ReportsTransitiveMissingImports_LeafLast) {
CreateTempFile("unused.proto",
"syntax = \"proto2\";\n"
"message Unused {}\n");

@ -293,7 +293,7 @@ void SingularMessage::GenerateInlineAccessorDefinitions(io::Printer* p) const {
if (value != nullptr) {
//~ When $Submsg$ is a cross-file type, have to read the arena
//~ through the virtual method, because the type isn't defined in
//~ this file, only forward-declated.
//~ this file, only forward-declared.
$pb$::Arena* submessage_arena = $base_cast$(value)->GetArena();
if (message_arena != submessage_arena) {
value = $pbi$::GetOwnedMessage(message_arena, value, submessage_arena);
@ -353,7 +353,7 @@ void SingularMessage::GenerateMergingCode(io::Printer* p) const {
} else {
// Important: we set `hasbits` after we copied the field. There are cases
// where people assign root values to child values or vice versa which
// are not always checked, so we delay this change becoming 'visibile'
// are not always checked, so we delay this change becoming 'visible'
// until after we copied the message.
// TODO enforces this as undefined behavior in debug builds.
p->Emit(R"cc(

@ -787,7 +787,7 @@ void ListAllTypesForServices(const FileDescriptor* fd,
// missing to insert in the extension table in ExtensionSet.
//
// For services, the TU unconditionally pins the request/response objects.
// This is the status quo for simplicitly to avoid modifying the RPC layer. It
// This is the status quo for simplicity to avoid modifying the RPC layer. It
// might be improved in the future.
bool UsingImplicitWeakDescriptor(const FileDescriptor* file,
const Options& options);

@ -157,7 +157,7 @@ static void WriteDocCommentBodyForLocation(io::Printer* printer,
for (size_t i = 0; i < lines.size(); i++) {
// Lines should start with a single space and any extraneous leading
// spaces should be stripped. For lines starting with a /, the leading
// space will prevent putting it right after the leading asterick from
// space will prevent putting it right after the leading asterisk from
// closing the comment.
std::string line = lines[i];
line.erase(line.begin(),

@ -357,7 +357,7 @@ void EmitCommentsString(io::Printer* printer, const GenerationOptions& opts,
for (absl::string_view l : raw_lines) {
lines.push_back(absl::StrReplaceAll(
// Strip any trailing whitespace to avoid any warnings on the generated
// code; but only stip one leading white space as that tends to be
// code; but only strip one leading white space as that tends to be
// carried over from the .proto file, and we don't want extra spaces,
// the formatting below will ensure there is a space.
// NOTE: There could be >1 leading whitespace if the .proto file has

@ -348,7 +348,7 @@ void MessageGenerator::GenerateMessageHeader(io::Printer* printer) const {
}
printer->Emit(R"objc(
// NOTE: There are some Objective-C specific methods/properties in
// GPBWellKnownTypes.h that will likey be useful.
// GPBWellKnownTypes.h that will likely be useful.
)objc");
printer->Emit("\n");
}}},

@ -226,7 +226,7 @@ TEST_F(ParserTest, StopAfterSyntaxIdentifierWithErrors) {
EXPECT_EQ("1:9: Expected syntax identifier.\n", error_collector_.text_);
}
TEST_F(ParserTest, WarnIfSyntaxIdentifierOmmitted) {
TEST_F(ParserTest, WarnIfSyntaxIdentifierOmitted) {
SetupParser("message A {}");
FileDescriptorProto file;
CaptureTestStderr();
@ -2627,7 +2627,7 @@ TEST_F(ParserValidationErrorTest, ResolvedUndefinedError) {
" to start from the outermost scope.\n");
}
TEST_F(ParserValidationErrorTest, ResovledUndefinedOptionError) {
TEST_F(ParserValidationErrorTest, ResolvedUndefinedOptionError) {
// Build descriptor message in test pool
FileDescriptorProto descriptor_proto;
DescriptorProto::descriptor()->file()->CopyTo(&descriptor_proto);
@ -2695,7 +2695,7 @@ class CompareDescriptorNames {
}
};
// Sorts nested DescriptorProtos of a DescriptoProto, by name.
// Sorts nested DescriptorProtos of a DescriptorProto, by name.
void SortMessages(DescriptorProto* descriptor_proto) {
int size = descriptor_proto->nested_type_size();
// recursively sort; we can't guarantee the order of nested messages either
@ -2764,7 +2764,7 @@ TEST_F(ParseDescriptorDebugTest, TestAllDescriptorTypes) {
original_file->CopyTo(&expected);
StripEmptyOptions(expected);
// Get the DebugString of the unittest.proto FileDecriptor, which includes
// Get the DebugString of the unittest.proto FileDescriptor, which includes
// all other descriptor types
std::string debug_string = original_file->DebugString();
@ -2776,7 +2776,7 @@ TEST_F(ParseDescriptorDebugTest, TestAllDescriptorTypes) {
ASSERT_EQ("", error_collector_.text_) << "Failed to parse:\n" << debug_string;
// We now have a FileDescriptorProto, but to compare with the expected we
// need to link to a FileDecriptor, then output back to a proto. We'll
// need to link to a FileDescriptor, then output back to a proto. We'll
// also need to give it the same name as the original.
parsed.set_name("google/protobuf/unittest.proto");
// We need the imported dependency before we can build our parsed proto
@ -2824,7 +2824,7 @@ TEST_F(ParseDescriptorDebugTest, TestCustomOptions) {
ASSERT_EQ("", error_collector_.text_);
// We now have a FileDescriptorProto, but to compare with the expected we
// need to link to a FileDecriptor, then output back to a proto. We'll
// need to link to a FileDescriptor, then output back to a proto. We'll
// also need to give it the same name as the original.
parsed.set_name(original_file->name());

@ -97,11 +97,11 @@ TEST(RubyGeneratorTest, Proto3ImplicitPackageTest) {
RubyTest("/ruby_generated_pkg_implicit");
}
TEST(RubyGeneratorTest, Proto3ExplictPackageTest) {
TEST(RubyGeneratorTest, Proto3ExplicitPackageTest) {
RubyTest("/ruby_generated_pkg_explicit");
}
TEST(RubyGeneratorTest, Proto3ExplictLegacyPackageTest) {
TEST(RubyGeneratorTest, Proto3ExplicitLegacyPackageTest) {
RubyTest("/ruby_generated_pkg_explicit_legacy");
}

@ -9330,8 +9330,8 @@ bool DescriptorBuilder::OptionInterpreter::SetOptionValue(
// the pool's mutex, and the latter method locks it again.
Symbol symbol =
builder_->FindSymbolNotEnforcingDeps(fully_qualified_name);
if (auto* candicate_descriptor = symbol.enum_value_descriptor()) {
if (candicate_descriptor->type() != enum_type) {
if (auto* candidate_descriptor = symbol.enum_value_descriptor()) {
if (candidate_descriptor->type() != enum_type) {
return AddValueError([&] {
return absl::StrCat(
"Enum type \"", enum_type->full_name(),
@ -9340,7 +9340,7 @@ bool DescriptorBuilder::OptionInterpreter::SetOptionValue(
"\". This appears to be a value from a sibling type.");
});
} else {
enum_value = candicate_descriptor;
enum_value = candidate_descriptor;
}
}
} else {

@ -80,7 +80,7 @@ enum Edition {
EDITION_2024 = 1001;
// Placeholder editions for testing feature resolution. These should not be
// used or relyed on outside of tests.
// used or relied on outside of tests.
EDITION_1_TEST_ONLY = 1;
EDITION_2_TEST_ONLY = 2;
EDITION_99997_TEST_ONLY = 99997;

@ -148,7 +148,7 @@ TEST(ExtensionSetTest, SetAllocatedExtension) {
message.SetAllocatedExtension(unittest::optional_foreign_message_extension,
new unittest::ForeignMessage());
// SetAllocatedExtension with nullptr is equivalent to ClearExtenion.
// SetAllocatedExtension with nullptr is equivalent to ClearExtension.
message.SetAllocatedExtension(unittest::optional_foreign_message_extension,
nullptr);
EXPECT_FALSE(

@ -610,7 +610,7 @@ TEST_F(PrinterTest, EmitConsumeAfter) {
"};\n");
}
TEST_F(PrinterTest, EmitWithSubstituionListener) {
TEST_F(PrinterTest, EmitWithSubstitutionListener) {
std::vector<std::string> seen;
Printer printer(output());
const auto emit = [&] {

@ -1179,7 +1179,7 @@ TEST(CordOutputStreamTest, ProperHintCreatesSingleFlatCord) {
EXPECT_EQ(flat, std::string(2000, 'a'));
}
TEST(CordOutputStreamTest, SizeHintDicatesTotalSize) {
TEST(CordOutputStreamTest, SizeHintDictatesTotalSize) {
absl::Cord cord(std::string(500, 'a'));
CordOutputStream output(std::move(cord), 2000);
void* data;

@ -1016,7 +1016,7 @@ class LazyRepeatedPtrField {
return ParseWithOuterContext(value, view, ctx, &prototype,
maybe_uninitialized);
})) {
// If this is called by eager verficiation, ctx != nullptr and logging
// If this is called by eager verification, ctx != nullptr and logging
// parsing error in that case is likely redundant because the parsing will
// fail anyway. Users who care about parsing errors would have already
// checked the return value and others may find the error log unexpected.

@ -100,7 +100,7 @@ void VerifyConsistency(LazyRepeatedPtrField::LogicalState state,
// Bail out on parse failure as it can result in false positive
// inconsistency and ABSL_CHECK failure. Warn instead.
ABSL_LOG(WARNING)
<< "Verify skipped due to parse falure: RepeatedPtrField of "
<< "Verify skipped due to parse failure: RepeatedPtrField of "
<< prototype->GetTypeName();
return;
}
@ -326,7 +326,7 @@ uint8_t* LazyRepeatedPtrField::InternalWrite(
[] { return true; },
[&](const auto& cord) {
// `set_missing_required = false` to avoid checking require fields
// (simialr to Message::ParsePartial*).
// (similar to Message::ParsePartial*).
return ParseWithOuterContext(
reinterpret_cast<RepeatedPtrFieldBase*>(&value), cord,
/*ctx=*/nullptr, prototype, /*set_missing_required=*/false);

@ -1329,7 +1329,7 @@ TEST(LiteBasicTest, CodedInputStreamRollback) {
}
}
// Two arbitary types
// Two arbitrary types
using CastType1 = protobuf_unittest::TestAllTypesLite;
using CastType2 = protobuf_unittest::TestPackedTypesLite;

@ -1009,7 +1009,7 @@ TEST_F(MapImplTest, EraseSingleByKey) {
EXPECT_EQ(0, map_.erase(key));
}
TEST_F(MapImplTest, EraseMutipleByKey) {
TEST_F(MapImplTest, EraseMultipleByKey) {
// erase in one specific order to trigger corner cases
for (int i = 0; i < 5; i++) {
map_[i] = i;
@ -2732,7 +2732,7 @@ TEST(GeneratedMapFieldTest, Proto2UnknownEnum) {
EXPECT_EQ(UNITTEST::PROTO2_MAP_ENUM_FOO, to.known_map_field().at(0));
}
TEST(GeneratedMapFieldTest, Proto2UknownEnumThrowsAwayUnknownData) {
TEST(GeneratedMapFieldTest, Proto2UnknownEnumThrowsAwayUnknownData) {
UNITTEST::TestEnumMap to;
// 101: {
// 1: 2

@ -97,7 +97,7 @@ class PROTOBUF_EXPORT CachedSize {
}
void Set(Scalar desired) const noexcept {
// Avoid writing the value when it is zero. This prevents writing to gloabl
// Avoid writing the value when it is zero. This prevents writing to global
// default instances, which might be in readonly memory.
if (ABSL_PREDICT_FALSE(desired == 0)) {
if (Get() == 0) return;
@ -120,7 +120,7 @@ class PROTOBUF_EXPORT CachedSize {
}
void Set(Scalar desired) const noexcept {
// Avoid writing the value when it is zero. This prevents writing to gloabl
// Avoid writing the value when it is zero. This prevents writing to global
// default instances, which might be in readonly memory.
if (ABSL_PREDICT_FALSE(desired == 0)) {
if (Get() == 0) return;

@ -660,7 +660,7 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3),
#define PROTOBUF_UNUSED
#endif
// For the toolchains that support it, evalutes to `true` if the input is
// For the toolchains that support it, evaluates to `true` if the input is
// determined to be a compile time constant after optimizations have happened
// (like inlining and constant propagation). A `false` result means that the
// compiler could not determine it is constant (it might still be but couldn't

@ -200,7 +200,7 @@ TEST_P(VisitFieldsTest, MutateNothingByVisitIdempotent) {
MutateNothingByVisit(*message_);
// Checking the identity by comparing serialize bytes is discouraged, but this
// allows us to be type-agnositc for this test. Also, the back to back
// allows us to be type-agnostic for this test. Also, the back to back
// serialization should be stable.
EXPECT_EQ(data, message_->SerializeAsString());
}

@ -174,7 +174,7 @@ class PROTOBUF_EXPORT SerialArena {
new_list);
// We need to unpoison this memory before filling it in case it has been
// poisoned by another santizer client.
// poisoned by another sanitizer client.
PROTOBUF_UNPOISON_MEMORY_REGION(
new_list + cached_block_length_,
(new_size - cached_block_length_) * sizeof(CachedBlock*));

@ -1094,7 +1094,7 @@ class TextFormat::Parser::ParserImpl {
return true;
}
// If allow_field_numer_ or allow_unknown_field_ is true, we should able
// If allow_field_number_ or allow_unknown_field_ is true, we should able
// to parse integer identifiers.
if ((allow_field_number_ || allow_unknown_field_ ||
allow_unknown_extension_) &&

@ -1212,7 +1212,7 @@ TEST_F(TextFormatTest, FieldsPopulatedCorrectly) {
}
{
// The address returned by the field is a string_view, which is a separate
// alocation. Check address directly.
// allocation. Check address directly.
no_op_fields = {};
const absl::string_view parse_string = "optional_string: \"\"";
EXPECT_TRUE(parser.ParseFromString(parse_string, &proto));
@ -1221,7 +1221,7 @@ TEST_F(TextFormatTest, FieldsPopulatedCorrectly) {
}
{
// The address returned by the field is a string_view, which is a separate
// alocation. Check address directly.
// allocation. Check address directly.
no_op_fields = {};
const absl::string_view parse_string = "optional_bytes: \"\"";
EXPECT_TRUE(parser.ParseFromString(parse_string, &proto));

@ -173,7 +173,7 @@ TEST(FieldMaskUtilTest, GetFieldDescriptors) {
TestAllTypes::descriptor(), "repeated_nested_message.bb", nullptr));
}
TEST(FieldMaskUtilTest, TestIsVaildPath) {
TEST(FieldMaskUtilTest, TestIsValidPath) {
EXPECT_TRUE(FieldMaskUtil::IsValidPath<TestAllTypes>("optional_int32"));
EXPECT_FALSE(FieldMaskUtil::IsValidPath<TestAllTypes>("optional_nonexist"));
EXPECT_TRUE(
@ -737,7 +737,7 @@ TEST(FieldMaskUtilTest, TrimMessage) {
TEST(FieldMaskUtilTest, TrimMessageReturnValue) {
FieldMask mask;
TestAllTypes trimed_msg;
TestAllTypes trimmed_msg;
TestAllTypes default_msg;
// Field mask on optional field.
@ -746,59 +746,59 @@ TEST(FieldMaskUtilTest, TrimMessageReturnValue) {
// Verify that if a message is updated by FieldMaskUtil::TrimMessage(), the
// function returns true.
// Test on primary field.
trimed_msg.set_optional_string("abc");
EXPECT_TRUE(FieldMaskUtil::TrimMessage(mask, &trimed_msg));
EXPECT_EQ(trimed_msg.DebugString(), default_msg.DebugString());
trimed_msg.Clear();
trimmed_msg.set_optional_string("abc");
EXPECT_TRUE(FieldMaskUtil::TrimMessage(mask, &trimmed_msg));
EXPECT_EQ(trimmed_msg.DebugString(), default_msg.DebugString());
trimmed_msg.Clear();
// Test on repeated primary field.
trimed_msg.add_repeated_string("abc");
trimed_msg.add_repeated_string("def");
EXPECT_TRUE(FieldMaskUtil::TrimMessage(mask, &trimed_msg));
EXPECT_EQ(trimed_msg.DebugString(), default_msg.DebugString());
trimed_msg.Clear();
trimmed_msg.add_repeated_string("abc");
trimmed_msg.add_repeated_string("def");
EXPECT_TRUE(FieldMaskUtil::TrimMessage(mask, &trimmed_msg));
EXPECT_EQ(trimmed_msg.DebugString(), default_msg.DebugString());
trimmed_msg.Clear();
// Test on nested message.
trimed_msg.mutable_optional_nested_message()->set_bb(123);
EXPECT_TRUE(FieldMaskUtil::TrimMessage(mask, &trimed_msg));
EXPECT_EQ(trimed_msg.DebugString(), default_msg.DebugString());
trimed_msg.Clear();
trimmed_msg.mutable_optional_nested_message()->set_bb(123);
EXPECT_TRUE(FieldMaskUtil::TrimMessage(mask, &trimmed_msg));
EXPECT_EQ(trimmed_msg.DebugString(), default_msg.DebugString());
trimmed_msg.Clear();
// Test on repeated nested message.
trimed_msg.add_repeated_nested_message()->set_bb(123);
trimed_msg.add_repeated_nested_message()->set_bb(456);
EXPECT_TRUE(FieldMaskUtil::TrimMessage(mask, &trimed_msg));
EXPECT_EQ(trimed_msg.DebugString(), default_msg.DebugString());
trimed_msg.Clear();
trimmed_msg.add_repeated_nested_message()->set_bb(123);
trimmed_msg.add_repeated_nested_message()->set_bb(456);
EXPECT_TRUE(FieldMaskUtil::TrimMessage(mask, &trimmed_msg));
EXPECT_EQ(trimmed_msg.DebugString(), default_msg.DebugString());
trimmed_msg.Clear();
// Test on oneof field.
trimed_msg.set_oneof_uint32(123);
EXPECT_TRUE(FieldMaskUtil::TrimMessage(mask, &trimed_msg));
EXPECT_EQ(trimed_msg.DebugString(), default_msg.DebugString());
trimed_msg.Clear();
trimmed_msg.set_oneof_uint32(123);
EXPECT_TRUE(FieldMaskUtil::TrimMessage(mask, &trimmed_msg));
EXPECT_EQ(trimmed_msg.DebugString(), default_msg.DebugString());
trimmed_msg.Clear();
// If there is no field set other then those allowlisted,
// FieldMaskUtil::TrimMessage() should return false.
trimed_msg.set_optional_int32(123);
EXPECT_FALSE(FieldMaskUtil::TrimMessage(mask, &trimed_msg));
EXPECT_EQ(trimed_msg.optional_int32(), 123);
trimed_msg.Clear();
trimmed_msg.set_optional_int32(123);
EXPECT_FALSE(FieldMaskUtil::TrimMessage(mask, &trimmed_msg));
EXPECT_EQ(trimmed_msg.optional_int32(), 123);
trimmed_msg.Clear();
// Field mask on repeated field.
FieldMaskUtil::FromString("repeated_string", &mask);
trimed_msg.add_repeated_string("abc");
trimed_msg.add_repeated_string("def");
EXPECT_FALSE(FieldMaskUtil::TrimMessage(mask, &trimed_msg));
EXPECT_EQ(trimed_msg.repeated_string(0), "abc");
EXPECT_EQ(trimed_msg.repeated_string(1), "def");
trimed_msg.Clear();
trimmed_msg.add_repeated_string("abc");
trimmed_msg.add_repeated_string("def");
EXPECT_FALSE(FieldMaskUtil::TrimMessage(mask, &trimmed_msg));
EXPECT_EQ(trimmed_msg.repeated_string(0), "abc");
EXPECT_EQ(trimmed_msg.repeated_string(1), "def");
trimmed_msg.Clear();
// Field mask on nested message.
FieldMaskUtil::FromString("optional_nested_message.bb", &mask);
trimed_msg.mutable_optional_nested_message()->set_bb(123);
EXPECT_FALSE(FieldMaskUtil::TrimMessage(mask, &trimed_msg));
EXPECT_EQ(trimed_msg.optional_nested_message().bb(), 123);
trimed_msg.Clear();
trimmed_msg.mutable_optional_nested_message()->set_bb(123);
EXPECT_FALSE(FieldMaskUtil::TrimMessage(mask, &trimmed_msg));
EXPECT_EQ(trimmed_msg.optional_nested_message().bb(), 123);
trimmed_msg.Clear();
// TODO: field mask on repeated nested message is not yet
// supported.

@ -1601,7 +1601,7 @@ TEST(MessageDifferencerTest, RepeatedFieldSmartSetTest) {
protobuf_unittest::TestField elem1_1, elem2_1, elem3_1;
protobuf_unittest::TestField elem1_2, elem2_2, elem3_2;
// Only one field is different for each pair of elememts
// Only one field is different for each pair of elements
elem1_1.set_a(1);
elem1_2.set_a(0);
elem1_1.set_b(1);
@ -1708,7 +1708,7 @@ TEST(MessageDifferencerTest, RepeatedFieldSmartSet_MultipleMatches) {
protobuf_unittest::TestField elem1_1, elem2_1, elem3_1;
protobuf_unittest::TestField elem2_2, elem3_2;
// Only one field is different for each pair of elememts
// Only one field is different for each pair of elements
elem1_1.set_a(1);
elem1_1.set_b(1);
elem1_1.set_c(1);
@ -3534,7 +3534,7 @@ TEST_F(ComparisonTest, AllThreeTest) {
Run());
}
TEST_F(ComparisonTest, SandwhichTest) {
TEST_F(ComparisonTest, SandwichTest) {
proto1_.clear_optional_int64();
proto1_.clear_optional_uint32();

@ -23,7 +23,7 @@ Four UTF-8 validation methods are compared on both x86 and Arm platforms. Benchm
* Run "make" to build. Built and tested with gcc-7.3.
* Run "./utf8" to see all command line options.
* Benchmark
* Run "./utf8 bench" to bechmark all algorithms with [default test file](https://raw.githubusercontent.com/cyb70289/utf8/master/UTF-8-demo.txt).
* Run "./utf8 bench" to benchmark all algorithms with [default test file](https://raw.githubusercontent.com/cyb70289/utf8/master/UTF-8-demo.txt).
* Run "./utf8 bench size NUM" to benchmark specified string size.
* Run "./utf8 test" to test all algorithms with positive and negative test cases.
* To benchmark or test specific algorithm, run something like "./utf8 bench range".
@ -123,8 +123,8 @@ To implement above operations efficiently with SIMD:
* For 16 input bytes, use lookup table to map C0..DF to 1, E0..EF to 2, F0..FF to 3, others to 0. Save to first_len.
* Map C0..FF to 8, we get range indices for First Byte.
* Shift first_len one byte, we get range indices for Second Byte.
* Saturate substract first_len by one(3->2, 2->1, 1->0, 0->0), then shift two bytes, we get range indices for Third Byte.
* Saturate substract first_len by two(3->1, 2->0, 1->0, 0->0), then shift three bytes, we get range indices for Fourth Byte.
* Saturate subtract first_len by one(3->2, 2->1, 1->0, 0->0), then shift two bytes, we get range indices for Third Byte.
* Saturate subtract first_len by two(3->1, 2->0, 1->0, 0->0), then shift three bytes, we get range indices for Fourth Byte.
Example(assume no previous data)
@ -191,8 +191,8 @@ NEON ```tbl``` instruction is very convenient for table lookup:
Leverage these features, we can solve the problem with as few as **two** operations:
* Precreate a 16x2 lookup table, where table[0]=2, table[13]=3, table[16]=3, table[20]=4, table[others]=0.
* Substract input bytes with E0 (E0 -> 0, ED -> 13, F0 -> 16, F4 -> 20).
* Use the substracted byte as index of lookup table and get range adjustment directly.
* Subtract input bytes with E0 (E0 -> 0, ED -> 13, F0 -> 16, F4 -> 20).
* Use the subtracted byte as index of lookup table and get range adjustment directly.
* For indices less than 32, we get zero or required adjustment value per input byte
* For out of bound indices, we get zero per ```tbl``` behaviour
@ -208,10 +208,10 @@ We can still leverage these features to solve the problem in **five** operations
* Precreate two tables:
* table_df[1] = 2, table_df[14] = 3, table_df[others] = 0
* table_ef[1] = 3, table_ef[5] = 4, table_ef[others] = 0
* Substract input bytes with EF (E0 -> 241, ED -> 254, F0 -> 1, F4 -> 5) to get the temporary indices
* Subtract input bytes with EF (E0 -> 241, ED -> 254, F0 -> 1, F4 -> 5) to get the temporary indices
* Get range index for E0,ED
* Saturate substract temporary indices with 240 (E0 -> 1, ED -> 14, all values below 240 becomes 0)
* Use substracted indices to look up table_df, get the correct adjustment
* Saturate subtract temporary indices with 240 (E0 -> 1, ED -> 14, all values below 240 becomes 0)
* Use subtracted indices to look up table_df, get the correct adjustment
* Get range index for F0,F4
* Saturate add temporary indices with 112(0x70) (F0 -> 0x71, F4 -> 0x75, all values above 16 will be larger than 128(7-th bit set))
* Use added indices to look up table_ef, get the correct adjustment (index 0x71,0x75 returns 1st,5th elements, per ```pshufb``` behaviour)

@ -2,7 +2,7 @@
using namespace std;
/* Return 0 on sucess, -1 on error */
/* Return 0 on success, -1 on error */
extern "C" int utf8_boost(const unsigned char* data, int len) {
try {
boost::locale::conv::utf_to_utf<char>(data, data + len,

@ -222,7 +222,7 @@ static int test_manual(const struct ftab *ftab)
}
for (int i = 0; i < sizeof(neg)/sizeof(neg[0]); ++i) {
if (ftab->func(neg[i].data, neg[i].len) == 0) {
printf("FAILED negitive test: ");
printf("FAILED negative test: ");
print_test(neg[i].data, neg[i].len);
return -1;
}
@ -256,7 +256,7 @@ static int test_manual(const struct ftab *ftab)
while (buf_len >= 1 && buf[buf_len-1] <= 0x7F)
--buf_len;
if (buf_len && ftab->func(buf, buf_len-1) == 0) {
printf("FAILED negitive test: ");
printf("FAILED negative test: ");
print_test(buf, buf_len);
return -1;
}

@ -175,7 +175,7 @@ int utf8_range_avx2(const unsigned char *data, int len)
range = _mm256_or_si256(range, tmp2);
/*
* Now we have below range indices caluclated
* Now we have below range indices calculated
* Correct cases:
* - 8 for C0~FF
* - 3 for 1st byte after F0~FF

@ -163,7 +163,7 @@ int utf8_range(const unsigned char *data, int len)
range = vorrq_u8(range, tmp2);
/*
* Now we have below range indices caluclated
* Now we have below range indices calculated
* Correct cases:
* - 8 for C0~FF
* - 3 for 1st byte after F0~FF

@ -150,7 +150,7 @@ int utf8_range(const unsigned char *data, int len)
range = _mm_or_si128(range, tmp);
/*
* Now we have below range indices caluclated
* Now we have below range indices calculated
* Correct cases:
* - 8 for C0~FF
* - 3 for 1st byte after F0~FF

@ -197,7 +197,7 @@ static int test_manual(const struct ftab *ftab, unsigned short *buf16,
ret = ftab->func(neg[i].data, neg[i].len, buf16, &len16);
_ret = utf8_to16_iconv(neg[i].data, neg[i].len, _buf16, &_len16);
if (ret != _ret || len16 != _len16 || memcmp(buf16, _buf16, len16)) {
printf("FAILED negitive test(%d:%d, %lu:%lu): ",
printf("FAILED negative test(%d:%d, %lu:%lu): ",
ret, _ret, len16, _len16);
print_test(neg[i].data, neg[i].len);
return -1;

@ -73,7 +73,7 @@ add_library(generated_code_support__only_for_generated_code_do_not_use__i_give_p
target_include_directories(generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../cmake>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINRARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
)
target_link_libraries(generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me INTERFACE
base
@ -90,7 +90,7 @@ add_library(generated_cpp_support__only_for_generated_code_do_not_use__i_give_pe
target_include_directories(generated_cpp_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../cmake>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINRARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
)

@ -19,5 +19,5 @@ scripts in this directory. We want to avoid having two separate sources of
truth that both need to be updated when a file is added or removed.
This directory also contains some generated files that would be created
on the fly during a Bazel build. These are automaticaly kept in sync by
on the fly during a Bazel build. These are automatically kept in sync by
the Bazel test `//cmake:test_generated_files`.

@ -58,7 +58,7 @@ add_library(%(name)s %(type)s
target_include_directories(%(name)s %(keyword)s
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../cmake>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINRARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
)
"""

@ -38,7 +38,7 @@ typedef struct {
upb_Arena* arena_;
} upb_String;
// Initialize an already-allocted upb_String object.
// Initialize an already-allocated upb_String object.
UPB_INLINE bool upb_String_Init(upb_String* s, upb_Arena* a) {
static const int kDefaultCapacity = 16;

@ -403,7 +403,7 @@ static void ConsumeString(upb_Tokenizer* t, char delimiter) {
}
// Read and consume a number, returning TYPE_FLOAT or TYPE_INTEGER depending
// on what was read. This needs to know if the first characer was a zero in
// on what was read. This needs to know if the first character was a zero in
// order to correctly recognize hex and octal numbers. It also needs to know
// whether the first character was a '.' to parse floating point correctly.
static upb_TokenType ConsumeNumber(upb_Tokenizer* t, bool started_with_zero,

@ -19,11 +19,11 @@ namespace upb {
namespace fuzz {
struct MiniTableFuzzInput {
// MiniDescripotrs for N messages, in the format accepted by
// MiniDescriptors for N messages, in the format accepted by
// upb_MiniTable_Build().
std::vector<std::string> mini_descriptors;
// MiniDescripotrs for N enums, in the format accepted by
// MiniDescriptors for N enums, in the format accepted by
// upb_MiniTableEnum_Build().
std::vector<std::string> enum_mini_descriptors;

@ -21,7 +21,7 @@
extern "C" {
#endif
/* Encodes the given |msg| to a psuedo-text format: Instead of printing field
/* Encodes the given |msg| to a pseudo-text format: Instead of printing field
* name to value entries, it will print field number to value entries; much like
* how unknown fields are printed in upb_TextEncode in this directory's
* encode.h. |mt| should correspond to the |msg|'s minitable.

@ -45,7 +45,7 @@ enum {
* already has some sub-message fields present. If the sub-message does
* not occur in the binary payload, we will never visit it and discover the
* incomplete sub-message. For this reason, this check is only useful for
* implemting ParseFromString() semantics. For MergeFromString(), a
* implementing ParseFromString() semantics. For MergeFromString(), a
* post-parse validation step will always be necessary. */
kUpb_DecodeOption_CheckRequired = 2,

Loading…
Cancel
Save