Fix spelling in strings and comments
This commit is contained in:
parent
cae3b0cbb6
commit
3808d091f8
39 changed files with 67 additions and 67 deletions
|
@ -37,7 +37,7 @@ mark_as_advanced(protobuf_BUILD_EXAMPLES_MULTITEST)
|
||||||
if(protobuf_BUILD_EXAMPLES_MULTITEST)
|
if(protobuf_BUILD_EXAMPLES_MULTITEST)
|
||||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
|
||||||
#Build using the legacy compatiblity module.
|
#Build using the legacy compatibility module.
|
||||||
add_examples_build(examples-legacy
|
add_examples_build(examples-legacy
|
||||||
"-Dprotobuf_DIR:PATH=${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}"
|
"-Dprotobuf_DIR:PATH=${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}"
|
||||||
"-Dprotobuf_MODULE_COMPATIBLE:BOOL=TRUE"
|
"-Dprotobuf_MODULE_COMPATIBLE:BOOL=TRUE"
|
||||||
|
@ -49,7 +49,7 @@ if(protobuf_BUILD_EXAMPLES_MULTITEST)
|
||||||
"-Dprotobuf_DIR:PATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}"
|
"-Dprotobuf_DIR:PATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}"
|
||||||
)
|
)
|
||||||
|
|
||||||
#Build using the installed library in legacy compatiblity mode.
|
#Build using the installed library in legacy compatibility mode.
|
||||||
add_examples_build(examples-installed-legacy
|
add_examples_build(examples-installed-legacy
|
||||||
"-Dprotobuf_DIR:PATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}"
|
"-Dprotobuf_DIR:PATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}"
|
||||||
"-Dprotobuf_MODULE_COMPATIBLE:BOOL=TRUE"
|
"-Dprotobuf_MODULE_COMPATIBLE:BOOL=TRUE"
|
||||||
|
|
|
@ -58,7 +58,7 @@ class ConformanceJavaLite {
|
||||||
}
|
}
|
||||||
case JSON_PAYLOAD: {
|
case JSON_PAYLOAD: {
|
||||||
return Conformance.ConformanceResponse.newBuilder().setSkipped(
|
return Conformance.ConformanceResponse.newBuilder().setSkipped(
|
||||||
"Lite runtime does not suport Json Formant.").build();
|
"Lite runtime does not support JSON format.").build();
|
||||||
}
|
}
|
||||||
case PAYLOAD_NOT_SET: {
|
case PAYLOAD_NOT_SET: {
|
||||||
throw new RuntimeException("Request didn't have payload.");
|
throw new RuntimeException("Request didn't have payload.");
|
||||||
|
@ -78,7 +78,7 @@ class ConformanceJavaLite {
|
||||||
|
|
||||||
case JSON:
|
case JSON:
|
||||||
return Conformance.ConformanceResponse.newBuilder().setSkipped(
|
return Conformance.ConformanceResponse.newBuilder().setSkipped(
|
||||||
"Lite runtime does not suport Json Formant.").build();
|
"Lite runtime does not support JSON format.").build();
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
throw new RuntimeException("Unexpected request output.");
|
throw new RuntimeException("Unexpected request output.");
|
||||||
|
|
|
@ -88,7 +88,7 @@ Compatibility Notice
|
||||||
|
|
||||||
* Protobuf minor version releases are backwards-compatible. If your code
|
* Protobuf minor version releases are backwards-compatible. If your code
|
||||||
can build/run against the old version, it's expected to build/run against
|
can build/run against the old version, it's expected to build/run against
|
||||||
the new version as well. Both binary compatibility and source compatbility
|
the new version as well. Both binary compatibility and source compatibility
|
||||||
are guaranteed for minor version releases if the user follows the guideline
|
are guaranteed for minor version releases if the user follows the guideline
|
||||||
described in this section.
|
described in this section.
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ Compatibility Notice
|
||||||
|
|
||||||
* APIs marked with the @ExperimentalApi annotation are subject to change. They
|
* APIs marked with the @ExperimentalApi annotation are subject to change. They
|
||||||
can be modified in any way, or even removed, at any time. Don't use them if
|
can be modified in any way, or even removed, at any time. Don't use them if
|
||||||
compatiblity is needed. If your code is a library itself (i.e. it is used on
|
compatibility is needed. If your code is a library itself (i.e. it is used on
|
||||||
the CLASSPATH of users outside your own control), you should not use
|
the CLASSPATH of users outside your own control), you should not use
|
||||||
experimental APIs, unless you repackage them (e.g. using ProGuard).
|
experimental APIs, unless you repackage them (e.g. using ProGuard).
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ previously released versions.
|
||||||
|
|
||||||
## Directory Layout
|
## Directory Layout
|
||||||
|
|
||||||
For each released protobuf version we are testing compatiblity with, there
|
For each released protobuf version we are testing compatibility with, there
|
||||||
is a sub-directory with the following layout (take v2.5.0 as an example):
|
is a sub-directory with the following layout (take v2.5.0 as an example):
|
||||||
|
|
||||||
* v2.5.0
|
* v2.5.0
|
||||||
|
@ -47,4 +47,4 @@ For each version, the test script will test:
|
||||||
* only upgrading more_protos to the new version
|
* only upgrading more_protos to the new version
|
||||||
|
|
||||||
and see whether everything builds/runs fine. Both source compatibility and
|
and see whether everything builds/runs fine. Both source compatibility and
|
||||||
binary compatiblity will be tested.
|
binary compatibility will be tested.
|
||||||
|
|
|
@ -11,7 +11,7 @@ TEST_VERSION=`grep "^ <version>.*</version>" pom.xml | sed "s| <version>\(.*\)
|
||||||
|
|
||||||
# The old version of protobuf that we are testing compatibility against. This
|
# The old version of protobuf that we are testing compatibility against. This
|
||||||
# is usually the same as TEST_VERSION (i.e., we use the tests extracted from
|
# is usually the same as TEST_VERSION (i.e., we use the tests extracted from
|
||||||
# that version to test compatibilty of the newest runtime against it), but it
|
# that version to test compatibility of the newest runtime against it), but it
|
||||||
# is also possible to use this same test set to test the compatibiilty of the
|
# is also possible to use this same test set to test the compatibiilty of the
|
||||||
# latest version against other versions.
|
# latest version against other versions.
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
@ -40,7 +40,7 @@ esac
|
||||||
# Extract the latest protobuf version number.
|
# Extract the latest protobuf version number.
|
||||||
VERSION_NUMBER=`grep "^ <version>.*</version>" ../../pom.xml | sed "s| <version>\(.*\)</version>|\1|"`
|
VERSION_NUMBER=`grep "^ <version>.*</version>" ../../pom.xml | sed "s| <version>\(.*\)</version>|\1|"`
|
||||||
|
|
||||||
echo "Running compatibilty tests between $VERSION_NUMBER and $OLD_VERSION"
|
echo "Running compatibility tests between $VERSION_NUMBER and $OLD_VERSION"
|
||||||
|
|
||||||
# Check protoc
|
# Check protoc
|
||||||
[ -f ../../../src/protoc ] || {
|
[ -f ../../../src/protoc ] || {
|
||||||
|
@ -55,7 +55,7 @@ echo "Running compatibilty tests between $VERSION_NUMBER and $OLD_VERSION"
|
||||||
popd
|
popd
|
||||||
}
|
}
|
||||||
|
|
||||||
# Download old version source for the compatiblity test
|
# Download old version source for the compatibility test
|
||||||
[ -d protobuf ] || {
|
[ -d protobuf ] || {
|
||||||
git clone https://github.com/google/protobuf.git
|
git clone https://github.com/google/protobuf.git
|
||||||
cd protobuf
|
cd protobuf
|
||||||
|
@ -92,7 +92,7 @@ mvn clean test \
|
||||||
# jar against the new runtime directly without recompile.
|
# jar against the new runtime directly without recompile.
|
||||||
|
|
||||||
# Collect all test dependencies in a single jar file (except for protobuf) to
|
# Collect all test dependencies in a single jar file (except for protobuf) to
|
||||||
# make it easier to run binary compatibilty test (where we will need to run
|
# make it easier to run binary compatibility test (where we will need to run
|
||||||
# the jar files directly).
|
# the jar files directly).
|
||||||
cd deps
|
cd deps
|
||||||
mvn assembly:single
|
mvn assembly:single
|
||||||
|
|
|
@ -498,7 +498,7 @@ public abstract class AbstractMessage
|
||||||
* override this method.
|
* override this method.
|
||||||
*/
|
*/
|
||||||
void markClean() {
|
void markClean() {
|
||||||
throw new IllegalStateException("Should be overriden by subclasses.");
|
throw new IllegalStateException("Should be overridden by subclasses.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -510,7 +510,7 @@ public abstract class AbstractMessage
|
||||||
* override this method.
|
* override this method.
|
||||||
*/
|
*/
|
||||||
void dispose() {
|
void dispose() {
|
||||||
throw new IllegalStateException("Should be overriden by subclasses.");
|
throw new IllegalStateException("Should be overridden by subclasses.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===============================================================
|
// ===============================================================
|
||||||
|
@ -605,7 +605,7 @@ public abstract class AbstractMessage
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated from v3.0.0-beta-3+, for compatiblity with v2.5.0 and v2.6.1
|
* @deprecated from v3.0.0-beta-3+, for compatibility with v2.5.0 and v2.6.1
|
||||||
* generated code.
|
* generated code.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -614,7 +614,7 @@ public abstract class AbstractMessage
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
/**
|
/**
|
||||||
* @deprecated from v3.0.0-beta-3+, for compatiblity with v2.5.0 and v2.6.1
|
* @deprecated from v3.0.0-beta-3+, for compatibility with v2.5.0 and v2.6.1
|
||||||
* generated code.
|
* generated code.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -623,7 +623,7 @@ public abstract class AbstractMessage
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
/**
|
/**
|
||||||
* @deprecated from v3.0.0-beta-3+, for compatiblity with v2.5.0 and v2.6.1
|
* @deprecated from v3.0.0-beta-3+, for compatibility with v2.5.0 and v2.6.1
|
||||||
* generated code.
|
* generated code.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -632,7 +632,7 @@ public abstract class AbstractMessage
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
/**
|
/**
|
||||||
* @deprecated from v3.0.0-beta-3+, for compatiblity with v2.5.0 and v2.6.1
|
* @deprecated from v3.0.0-beta-3+, for compatibility with v2.5.0 and v2.6.1
|
||||||
* generated code.
|
* generated code.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
|
|
@ -87,17 +87,17 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
|
||||||
* Empty {@code ByteString}.
|
* Empty {@code ByteString}.
|
||||||
*/
|
*/
|
||||||
public static final ByteString EMPTY = new LiteralByteString(Internal.EMPTY_BYTE_ARRAY);
|
public static final ByteString EMPTY = new LiteralByteString(Internal.EMPTY_BYTE_ARRAY);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An interface to efficiently copy {@code byte[]}.
|
* An interface to efficiently copy {@code byte[]}.
|
||||||
*
|
*
|
||||||
* <p>One of the noticable costs of copying a byte[] into a new array using
|
* <p>One of the noticeable costs of copying a byte[] into a new array using
|
||||||
* {@code System.arraycopy} is nullification of a new buffer before the copy. It has been shown
|
* {@code System.arraycopy} is nullification of a new buffer before the copy. It has been shown
|
||||||
* the Hotspot VM is capable to intrisicfy {@code Arrays.copyOfRange} operation to avoid this
|
* the Hotspot VM is capable to intrisicfy {@code Arrays.copyOfRange} operation to avoid this
|
||||||
* expensive nullification and provide substantial performance gain. Unfortunately this does not
|
* expensive nullification and provide substantial performance gain. Unfortunately this does not
|
||||||
* hold on Android runtimes and could make the copy slightly slower due to additional code in
|
* hold on Android runtimes and could make the copy slightly slower due to additional code in
|
||||||
* the {@code Arrays.copyOfRange}. Thus we provide two different implementation for array copier
|
* the {@code Arrays.copyOfRange}. Thus we provide two different implementation for array copier
|
||||||
* for Hotspot and Android runtimes.
|
* for Hotspot and Android runtimes.
|
||||||
*/
|
*/
|
||||||
private interface ByteArrayCopier {
|
private interface ByteArrayCopier {
|
||||||
/**
|
/**
|
||||||
|
@ -105,7 +105,7 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
|
||||||
*/
|
*/
|
||||||
byte[] copyFrom(byte[] bytes, int offset, int size);
|
byte[] copyFrom(byte[] bytes, int offset, int size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Implementation of {@code ByteArrayCopier} which uses {@link System#arraycopy}. */
|
/** Implementation of {@code ByteArrayCopier} which uses {@link System#arraycopy}. */
|
||||||
private static final class SystemByteArrayCopier implements ByteArrayCopier {
|
private static final class SystemByteArrayCopier implements ByteArrayCopier {
|
||||||
@Override
|
@Override
|
||||||
|
@ -115,7 +115,7 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Implementation of {@code ByteArrayCopier} which uses {@link Arrays#copyOfRange}. */
|
/** Implementation of {@code ByteArrayCopier} which uses {@link Arrays#copyOfRange}. */
|
||||||
private static final class ArraysByteArrayCopier implements ByteArrayCopier {
|
private static final class ArraysByteArrayCopier implements ByteArrayCopier {
|
||||||
@Override
|
@Override
|
||||||
|
@ -123,7 +123,7 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
|
||||||
return Arrays.copyOfRange(bytes, offset, offset + size);
|
return Arrays.copyOfRange(bytes, offset, offset + size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final ByteArrayCopier byteArrayCopier;
|
private static final ByteArrayCopier byteArrayCopier;
|
||||||
static {
|
static {
|
||||||
boolean isAndroid = true;
|
boolean isAndroid = true;
|
||||||
|
@ -132,7 +132,7 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
isAndroid = false;
|
isAndroid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
byteArrayCopier = isAndroid ? new SystemByteArrayCopier() : new ArraysByteArrayCopier();
|
byteArrayCopier = isAndroid ? new SystemByteArrayCopier() : new ArraysByteArrayCopier();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
|
||||||
public static ByteString copyFrom(byte[] bytes) {
|
public static ByteString copyFrom(byte[] bytes) {
|
||||||
return copyFrom(bytes, 0, bytes.length);
|
return copyFrom(bytes, 0, bytes.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wraps the given bytes into a {@code ByteString}. Intended for internal only
|
* Wraps the given bytes into a {@code ByteString}. Intended for internal only
|
||||||
* usage to force a classload of ByteString before LiteralByteString.
|
* usage to force a classload of ByteString before LiteralByteString.
|
||||||
|
@ -402,7 +402,7 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
|
||||||
* immutable tree of byte arrays ("chunks") of the stream data. The
|
* immutable tree of byte arrays ("chunks") of the stream data. The
|
||||||
* first chunk is small, with subsequent chunks each being double
|
* first chunk is small, with subsequent chunks each being double
|
||||||
* the size, up to 8K.
|
* the size, up to 8K.
|
||||||
*
|
*
|
||||||
* <p>Each byte read from the input stream will be copied twice to ensure
|
* <p>Each byte read from the input stream will be copied twice to ensure
|
||||||
* that the resulting ByteString is truly immutable.
|
* that the resulting ByteString is truly immutable.
|
||||||
*
|
*
|
||||||
|
@ -1226,7 +1226,7 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
|
||||||
return String.format("<ByteString@%s size=%d>",
|
return String.format("<ByteString@%s size=%d>",
|
||||||
Integer.toHexString(System.identityHashCode(this)), size());
|
Integer.toHexString(System.identityHashCode(this)), size());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class implements a {@link com.google.protobuf.ByteString} backed by a
|
* This class implements a {@link com.google.protobuf.ByteString} backed by a
|
||||||
* single array of bytes, contiguous in memory. It supports substring by
|
* single array of bytes, contiguous in memory. It supports substring by
|
||||||
|
@ -1450,7 +1450,7 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is used to represent the substring of a {@link ByteString} over a
|
* This class is used to represent the substring of a {@link ByteString} over a
|
||||||
* single byte array. In terms of the public API of {@link ByteString}, you end
|
* single byte array. In terms of the public API of {@link ByteString}, you end
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class LiteEqualsAndHashTest extends TestCase {
|
||||||
// correctly when linked only against the lite library.
|
// correctly when linked only against the lite library.
|
||||||
|
|
||||||
// We do however do some basic testing to make sure that equals is actually
|
// We do however do some basic testing to make sure that equals is actually
|
||||||
// overriden to test for value equality rather than simple object equality.
|
// overridden to test for value equality rather than simple object equality.
|
||||||
|
|
||||||
// Check that two identical objs are equal.
|
// Check that two identical objs are equal.
|
||||||
Foo foo1a = Foo.newBuilder()
|
Foo foo1a = Foo.newBuilder()
|
||||||
|
|
|
@ -156,7 +156,7 @@ public final class MessageNanoPrinter {
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// If hazzer does't exist or returns false, no need to continue
|
// If hazzer doesn't exist or returns false, no need to continue
|
||||||
if (!(Boolean) hazzer.invoke(object)) {
|
if (!(Boolean) hazzer.invoke(object)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
** store pointers or integers of at least 32 bits (upb isn't really useful on
|
** store pointers or integers of at least 32 bits (upb isn't really useful on
|
||||||
** systems where sizeof(void*) < 4).
|
** systems where sizeof(void*) < 4).
|
||||||
**
|
**
|
||||||
** The table must be homogenous (all values of the same type). In debug
|
** The table must be homogeneous (all values of the same type). In debug
|
||||||
** mode, we check this on insert and lookup.
|
** mode, we check this on insert and lookup.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -349,7 +349,7 @@ class Descriptor(_NestedDescriptorBase):
|
||||||
Args:
|
Args:
|
||||||
proto: An empty descriptor_pb2.DescriptorProto.
|
proto: An empty descriptor_pb2.DescriptorProto.
|
||||||
"""
|
"""
|
||||||
# This function is overriden to give a better doc comment.
|
# This function is overridden to give a better doc comment.
|
||||||
super(Descriptor, self).CopyToProto(proto)
|
super(Descriptor, self).CopyToProto(proto)
|
||||||
|
|
||||||
|
|
||||||
|
@ -626,7 +626,7 @@ class EnumDescriptor(_NestedDescriptorBase):
|
||||||
Args:
|
Args:
|
||||||
proto: An empty descriptor_pb2.EnumDescriptorProto.
|
proto: An empty descriptor_pb2.EnumDescriptorProto.
|
||||||
"""
|
"""
|
||||||
# This function is overriden to give a better doc comment.
|
# This function is overridden to give a better doc comment.
|
||||||
super(EnumDescriptor, self).CopyToProto(proto)
|
super(EnumDescriptor, self).CopyToProto(proto)
|
||||||
|
|
||||||
|
|
||||||
|
@ -747,7 +747,7 @@ class ServiceDescriptor(_NestedDescriptorBase):
|
||||||
Args:
|
Args:
|
||||||
proto: An empty descriptor_pb2.ServiceDescriptorProto.
|
proto: An empty descriptor_pb2.ServiceDescriptorProto.
|
||||||
"""
|
"""
|
||||||
# This function is overriden to give a better doc comment.
|
# This function is overridden to give a better doc comment.
|
||||||
super(ServiceDescriptor, self).CopyToProto(proto)
|
super(ServiceDescriptor, self).CopyToProto(proto)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -347,7 +347,7 @@ class TestGeneratorMetaclass(type):
|
||||||
iterable conforms to the test pattern, the injected methods will be picked
|
iterable conforms to the test pattern, the injected methods will be picked
|
||||||
up as tests by the unittest framework.
|
up as tests by the unittest framework.
|
||||||
|
|
||||||
In general, it is supposed to be used in conjuction with the
|
In general, it is supposed to be used in conjunction with the
|
||||||
Parameters decorator.
|
Parameters decorator.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
** store pointers or integers of at least 32 bits (upb isn't really useful on
|
** store pointers or integers of at least 32 bits (upb isn't really useful on
|
||||||
** systems where sizeof(void*) < 4).
|
** systems where sizeof(void*) < 4).
|
||||||
**
|
**
|
||||||
** The table must be homogenous (all values of the same type). In debug
|
** The table must be homogeneous (all values of the same type). In debug
|
||||||
** mode, we check this on insert and lookup.
|
** mode, we check this on insert and lookup.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@ module Google
|
||||||
external_enumerator.each_with_index do |val, i|
|
external_enumerator.each_with_index do |val, i|
|
||||||
result = yield(val)
|
result = yield(val)
|
||||||
results << result
|
results << result
|
||||||
#nil means no change occured from yield; usually occurs when #to_a is called
|
#nil means no change occurred from yield; usually occurs when #to_a is called
|
||||||
if result
|
if result
|
||||||
repeated_field[i] = result if result != val
|
repeated_field[i] = result if result != val
|
||||||
end
|
end
|
||||||
|
|
|
@ -614,7 +614,7 @@ CommandLineInterface::MemoryOutputStream::~MemoryOutputStream() {
|
||||||
} else {
|
} else {
|
||||||
// This was an OpenForInsert().
|
// This was an OpenForInsert().
|
||||||
|
|
||||||
// If the data doens't end with a clean line break, add one.
|
// If the data doesn't end with a clean line break, add one.
|
||||||
if (!data_.empty() && data_[data_.size() - 1] != '\n') {
|
if (!data_.empty() && data_[data_.size() - 1] != '\n') {
|
||||||
data_.push_back('\n');
|
data_.push_back('\n');
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ class MessageGenerator {
|
||||||
|
|
||||||
// Header stuff.
|
// Header stuff.
|
||||||
|
|
||||||
// Return names for foward declarations of this class and all its nested
|
// Return names for forward declarations of this class and all its nested
|
||||||
// types. A given key in {class,enum}_names will map from a class name to the
|
// types. A given key in {class,enum}_names will map from a class name to the
|
||||||
// descriptor that was responsible for its inclusion in the map. This can be
|
// descriptor that was responsible for its inclusion in the map. This can be
|
||||||
// used to associate the descriptor with the code generated for it.
|
// used to associate the descriptor with the code generated for it.
|
||||||
|
|
|
@ -243,7 +243,7 @@ inline bool HasGenericServices(const FileDescriptor *file, bool enforce_lite) {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool IsLazy(const FieldDescriptor* descriptor, bool enforce_lite) {
|
inline bool IsLazy(const FieldDescriptor* descriptor, bool enforce_lite) {
|
||||||
// Currently, the proto-lite version suports lazy field.
|
// Currently, the proto-lite version supports lazy field.
|
||||||
// TODO(niwasaki): Support lazy fields also for other proto runtimes.
|
// TODO(niwasaki): Support lazy fields also for other proto runtimes.
|
||||||
if (HasDescriptorMethods(descriptor->file(), enforce_lite)) {
|
if (HasDescriptorMethods(descriptor->file(), enforce_lite)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -715,7 +715,7 @@ GenerateInterfaceMembers(io::Printer* printer) const {
|
||||||
// NOTE: the same method in the implementation class actually returns
|
// NOTE: the same method in the implementation class actually returns
|
||||||
// com.google.protobuf.ProtocolStringList (a subclass of List). It's
|
// com.google.protobuf.ProtocolStringList (a subclass of List). It's
|
||||||
// changed between protobuf 2.5.0 release and protobuf 2.6.1 release.
|
// changed between protobuf 2.5.0 release and protobuf 2.6.1 release.
|
||||||
// To retain binary compatibilty with both 2.5.0 and 2.6.1 generated
|
// To retain binary compatibility with both 2.5.0 and 2.6.1 generated
|
||||||
// code, we make this interface method return List so both methods
|
// code, we make this interface method return List so both methods
|
||||||
// with different return types exist in the compiled byte code.
|
// with different return types exist in the compiled byte code.
|
||||||
"$deprecation$java.util.List<java.lang.String>\n"
|
"$deprecation$java.util.List<java.lang.String>\n"
|
||||||
|
|
|
@ -151,7 +151,7 @@ string StripProto(const string& filename) {
|
||||||
return StripSuffixString(filename, suffix);
|
return StripSuffixString(filename, suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Given a filename like foo/bar/baz.proto, returns the correspoding JavaScript
|
// Given a filename like foo/bar/baz.proto, returns the corresponding JavaScript
|
||||||
// file foo/bar/baz.js.
|
// file foo/bar/baz.js.
|
||||||
string GetJSFilename(const string& filename) {
|
string GetJSFilename(const string& filename) {
|
||||||
return StripProto(filename) + "_pb.js";
|
return StripProto(filename) + "_pb.js";
|
||||||
|
|
|
@ -228,7 +228,7 @@ int FieldGenerator::ExtraRuntimeHasBitsNeeded(void) const {
|
||||||
void FieldGenerator::SetExtraRuntimeHasBitsBase(int index_base) {
|
void FieldGenerator::SetExtraRuntimeHasBitsBase(int index_base) {
|
||||||
// NOTE: src/google/protobuf/compiler/plugin.cc makes use of cerr for some
|
// NOTE: src/google/protobuf/compiler/plugin.cc makes use of cerr for some
|
||||||
// error cases, so it seems to be ok to use as a back door for errors.
|
// error cases, so it seems to be ok to use as a back door for errors.
|
||||||
cerr << "Error: should have overriden SetExtraRuntimeHasBitsBase()." << endl;
|
cerr << "Error: should have overridden SetExtraRuntimeHasBitsBase()." << endl;
|
||||||
cerr.flush();
|
cerr.flush();
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ class LIBPROTOBUF_EXPORT Parser {
|
||||||
// it. Returns true if no errors occurred, false otherwise.
|
// it. Returns true if no errors occurred, false otherwise.
|
||||||
bool Parse(io::Tokenizer* input, FileDescriptorProto* file);
|
bool Parse(io::Tokenizer* input, FileDescriptorProto* file);
|
||||||
|
|
||||||
// Optional fetaures:
|
// Optional features:
|
||||||
|
|
||||||
// DEPRECATED: New code should use the SourceCodeInfo embedded in the
|
// DEPRECATED: New code should use the SourceCodeInfo embedded in the
|
||||||
// FileDescriptorProto.
|
// FileDescriptorProto.
|
||||||
|
|
|
@ -2126,7 +2126,7 @@ inline void GeneratedMessageReflection::ClearOneofField(
|
||||||
inline void GeneratedMessageReflection::ClearOneof(
|
inline void GeneratedMessageReflection::ClearOneof(
|
||||||
Message* message, const OneofDescriptor* oneof_descriptor) const {
|
Message* message, const OneofDescriptor* oneof_descriptor) const {
|
||||||
// TODO(jieluo): Consider to cache the unused object instead of deleting
|
// TODO(jieluo): Consider to cache the unused object instead of deleting
|
||||||
// it. It will be much faster if an aplication switches a lot from
|
// it. It will be much faster if an application switches a lot from
|
||||||
// a few oneof fields. Time/space tradeoff
|
// a few oneof fields. Time/space tradeoff
|
||||||
uint32 oneof_case = GetOneofCase(*message, oneof_descriptor);
|
uint32 oneof_case = GetOneofCase(*message, oneof_descriptor);
|
||||||
if (oneof_case > 0) {
|
if (oneof_case > 0) {
|
||||||
|
|
|
@ -329,7 +329,7 @@ class LIBPROTOBUF_EXPORT Tokenizer {
|
||||||
// depending on what was read. This needs to know if the first
|
// depending on what was read. This needs to know if the first
|
||||||
// character was a zero in order to correctly recognize hex and octal
|
// character was a zero in order to correctly recognize hex and octal
|
||||||
// numbers.
|
// numbers.
|
||||||
// It also needs to know if the first characted was a . to parse floating
|
// It also needs to know if the first character was a . to parse floating
|
||||||
// point correctly.
|
// point correctly.
|
||||||
TokenType ConsumeNumber(bool started_with_zero, bool started_with_dot);
|
TokenType ConsumeNumber(bool started_with_zero, bool started_with_dot);
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ class LIBPROTOBUF_EXPORT MapEntryBase : public Message {
|
||||||
// reflection, its in-memory type is the same as generated message with the same
|
// reflection, its in-memory type is the same as generated message with the same
|
||||||
// fields. However, in order to decide the in-memory type of key/value, we need
|
// fields. However, in order to decide the in-memory type of key/value, we need
|
||||||
// to know both their cpp type in generated api and proto type. In
|
// to know both their cpp type in generated api and proto type. In
|
||||||
// implmentation, all in-memory types have related wire format functions to
|
// implementation, all in-memory types have related wire format functions to
|
||||||
// support except ArenaStringPtr. Therefore, we need to define another type with
|
// support except ArenaStringPtr. Therefore, we need to define another type with
|
||||||
// supporting wire format functions. Since this type is only used as return type
|
// supporting wire format functions. Since this type is only used as return type
|
||||||
// of MapEntry accessors, it's named MapEntry accessor type.
|
// of MapEntry accessors, it's named MapEntry accessor type.
|
||||||
|
|
|
@ -54,7 +54,7 @@ class ContendedMapCleanTest;
|
||||||
class GeneratedMessageReflection;
|
class GeneratedMessageReflection;
|
||||||
class MapFieldAccessor;
|
class MapFieldAccessor;
|
||||||
|
|
||||||
// This class provides accesss to map field using reflection, which is the same
|
// This class provides access to map field using reflection, which is the same
|
||||||
// as those provided for RepeatedPtrField<Message>. It is used for internal
|
// as those provided for RepeatedPtrField<Message>. It is used for internal
|
||||||
// reflection implentation only. Users should never use this directly.
|
// reflection implentation only. Users should never use this directly.
|
||||||
class LIBPROTOBUF_EXPORT MapFieldBase {
|
class LIBPROTOBUF_EXPORT MapFieldBase {
|
||||||
|
@ -208,7 +208,7 @@ class TypeDefinedMapFieldBase : public MapFieldBase {
|
||||||
virtual void SetMapIteratorValue(MapIterator* map_iter) const = 0;
|
virtual void SetMapIteratorValue(MapIterator* map_iter) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// This class provides accesss to map field using generated api. It is used for
|
// This class provides access to map field using generated api. It is used for
|
||||||
// internal generated message implentation only. Users should never use this
|
// internal generated message implentation only. Users should never use this
|
||||||
// directly.
|
// directly.
|
||||||
template <typename Key, typename T,
|
template <typename Key, typename T,
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace google {
|
||||||
namespace protobuf {
|
namespace protobuf {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
// This class provides accesss to map field using generated api. It is used for
|
// This class provides access to map field using generated api. It is used for
|
||||||
// internal generated message implentation only. Users should never use this
|
// internal generated message implentation only. Users should never use this
|
||||||
// directly.
|
// directly.
|
||||||
template <typename Key, typename T,
|
template <typename Key, typename T,
|
||||||
|
|
|
@ -81,7 +81,7 @@ message TestArenaMapLite {
|
||||||
map_int32_foreign_message_no_arena = 18;
|
map_int32_foreign_message_no_arena = 18;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test embeded message with required fields
|
// Test embedded message with required fields
|
||||||
message TestRequiredMessageMapLite {
|
message TestRequiredMessageMapLite {
|
||||||
map<int32, TestRequiredLite> map_field = 1;
|
map<int32, TestRequiredLite> map_field = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -502,7 +502,7 @@ static void StressTestIterators(int n, bool test_old_style_proto2_maps) {
|
||||||
// Test old iterator vs new iterator, with table modification in between.
|
// Test old iterator vs new iterator, with table modification in between.
|
||||||
TestOldVersusNewIterator<Map<int, int>::const_iterator>(n % 3, &m);
|
TestOldVersusNewIterator<Map<int, int>::const_iterator>(n % 3, &m);
|
||||||
TestOldVersusNewIterator<Map<int, int>::iterator>(n % (1 + (n / 40)), &m);
|
TestOldVersusNewIterator<Map<int, int>::iterator>(n % (1 + (n / 40)), &m);
|
||||||
// Finally, ensure erase(iterator) doesn't reorder anything, becuase that is
|
// Finally, ensure erase(iterator) doesn't reorder anything, because that is
|
||||||
// what its documentation says.
|
// what its documentation says.
|
||||||
m[last_key] = m[last_key ^ 999] = 0;
|
m[last_key] = m[last_key ^ 999] = 0;
|
||||||
vector<Map<int, int>::iterator> v;
|
vector<Map<int, int>::iterator> v;
|
||||||
|
|
|
@ -83,7 +83,7 @@ enum MapEnum {
|
||||||
MAP_ENUM_BAZ = 2;
|
MAP_ENUM_BAZ = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test embeded message with required fields
|
// Test embedded message with required fields
|
||||||
message TestRequiredMessageMap {
|
message TestRequiredMessageMap {
|
||||||
map<int32, TestRequired> map_field = 1;
|
map<int32, TestRequired> map_field = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -356,7 +356,7 @@ class LIBPROTOBUF_EXPORT RepeatedFieldAccessor {
|
||||||
virtual void Swap(Field* data, const RepeatedFieldAccessor* other_mutator,
|
virtual void Swap(Field* data, const RepeatedFieldAccessor* other_mutator,
|
||||||
Field* other_data) const = 0;
|
Field* other_data) const = 0;
|
||||||
|
|
||||||
// Create an iterator that points at the begining of the repeated field.
|
// Create an iterator that points at the beginning of the repeated field.
|
||||||
virtual Iterator* BeginIterator(const Field* data) const = 0;
|
virtual Iterator* BeginIterator(const Field* data) const = 0;
|
||||||
// Create an iterator that points at the end of the repeated field.
|
// Create an iterator that points at the end of the repeated field.
|
||||||
virtual Iterator* EndIterator(const Field* data) const = 0;
|
virtual Iterator* EndIterator(const Field* data) const = 0;
|
||||||
|
|
|
@ -2363,7 +2363,7 @@ template<typename T> class RepeatedPtrFieldBackInsertIterator
|
||||||
RepeatedPtrField<T>* field_;
|
RepeatedPtrField<T>* field_;
|
||||||
};
|
};
|
||||||
|
|
||||||
// A back inserter for RepeatedPtrFields that inserts by transfering ownership
|
// A back inserter for RepeatedPtrFields that inserts by transferring ownership
|
||||||
// of a pointer.
|
// of a pointer.
|
||||||
template<typename T> class AllocatedRepeatedPtrFieldBackInsertIterator
|
template<typename T> class AllocatedRepeatedPtrFieldBackInsertIterator
|
||||||
: public std::iterator<std::output_iterator_tag, T> {
|
: public std::iterator<std::output_iterator_tag, T> {
|
||||||
|
|
|
@ -94,7 +94,7 @@ class LIBPROTOBUF_EXPORT RepeatedFieldAccessor {
|
||||||
virtual void Swap(Field* data, const RepeatedFieldAccessor* other_mutator,
|
virtual void Swap(Field* data, const RepeatedFieldAccessor* other_mutator,
|
||||||
Field* other_data) const = 0;
|
Field* other_data) const = 0;
|
||||||
|
|
||||||
// Create an iterator that points at the begining of the repeated field.
|
// Create an iterator that points at the beginning of the repeated field.
|
||||||
virtual Iterator* BeginIterator(const Field* data) const = 0;
|
virtual Iterator* BeginIterator(const Field* data) const = 0;
|
||||||
// Create an iterator that points at the end of the repeated field.
|
// Create an iterator that points at the end of the repeated field.
|
||||||
virtual Iterator* EndIterator(const Field* data) const = 0;
|
virtual Iterator* EndIterator(const Field* data) const = 0;
|
||||||
|
|
|
@ -208,7 +208,7 @@ class LIBPROTOBUF_EXPORT CheckedArrayByteSink : public ByteSink {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implementation of ByteSink that allocates an internal buffer (a char array)
|
// Implementation of ByteSink that allocates an internal buffer (a char array)
|
||||||
// and expands it as needed to accomodate appended data (similar to a string),
|
// and expands it as needed to accommodate appended data (similar to a string),
|
||||||
// and allows the caller to take ownership of the internal buffer via the
|
// and allows the caller to take ownership of the internal buffer via the
|
||||||
// GetBuffer() method. The buffer returned from GetBuffer() must be deleted by
|
// GetBuffer() method. The buffer returned from GetBuffer() must be deleted by
|
||||||
// the caller with delete[]. GetBuffer() also sets the internal buffer to be
|
// the caller with delete[]. GetBuffer() also sets the internal buffer to be
|
||||||
|
|
|
@ -189,7 +189,7 @@ bool DefaultFieldComparator::CompareDoubleOrFloat(const FieldDescriptor& field,
|
||||||
return MathUtil::AlmostEquals(value_1, value_2);
|
return MathUtil::AlmostEquals(value_1, value_2);
|
||||||
} else {
|
} else {
|
||||||
// Use user-provided fraction and margin. Since they are stored as
|
// Use user-provided fraction and margin. Since they are stored as
|
||||||
// doubles, we explicitely cast them to types of values provided. This
|
// doubles, we explicitly cast them to types of values provided. This
|
||||||
// is very likely to fail if provided values are not numeric.
|
// is very likely to fail if provided values are not numeric.
|
||||||
return MathUtil::WithinFractionOrMargin(
|
return MathUtil::WithinFractionOrMargin(
|
||||||
value_1, value_2, static_cast<T>(tolerance->fraction),
|
value_1, value_2, static_cast<T>(tolerance->fraction),
|
||||||
|
|
|
@ -184,7 +184,7 @@ class LIBPROTOBUF_EXPORT ProtoWriter : public StructuredObjectWriter {
|
||||||
return static_cast<ProtoElement*>(BaseElement::parent());
|
return static_cast<ProtoElement*>(BaseElement::parent());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if the index is already taken by a preceeding oneof input.
|
// Returns true if the index is already taken by a preceding oneof input.
|
||||||
bool IsOneofIndexTaken(int32 index);
|
bool IsOneofIndexTaken(int32 index);
|
||||||
|
|
||||||
// Marks the oneof 'index' as taken. Future inputs to this oneof will
|
// Marks the oneof 'index' as taken. Future inputs to this oneof will
|
||||||
|
|
|
@ -1386,7 +1386,7 @@ bool MessageDifferencer::MatchRepeatedFieldIndices(
|
||||||
if (key_comparator != NULL || IsTreatedAsSet(repeated_field)) {
|
if (key_comparator != NULL || IsTreatedAsSet(repeated_field)) {
|
||||||
if (scope_ == PARTIAL) {
|
if (scope_ == PARTIAL) {
|
||||||
// When partial matching is enabled, Compare(a, b) && Compare(a, c)
|
// When partial matching is enabled, Compare(a, b) && Compare(a, c)
|
||||||
// doesn't neccessarily imply Compare(b, c). Therefore a naive greedy
|
// doesn't necessarily imply Compare(b, c). Therefore a naive greedy
|
||||||
// algorithm will fail to find a maximum matching.
|
// algorithm will fail to find a maximum matching.
|
||||||
// Here we use the argumenting path algorithm.
|
// Here we use the argumenting path algorithm.
|
||||||
MaximumMatcher::NodeMatchCallback* callback =
|
MaximumMatcher::NodeMatchCallback* callback =
|
||||||
|
|
|
@ -278,7 +278,7 @@ class LIBPROTOBUF_EXPORT MessageDifferencer {
|
||||||
const Message& message2,
|
const Message& message2,
|
||||||
const vector<SpecificField>& field_path) { }
|
const vector<SpecificField>& field_path) { }
|
||||||
|
|
||||||
// Report that an unkown field is ignored. (see comment above).
|
// Report that an unknown field is ignored. (see comment above).
|
||||||
// Note this is a different function since the last SpecificField in field
|
// Note this is a different function since the last SpecificField in field
|
||||||
// path has a null field. This could break existing Reporter.
|
// path has a null field. This could break existing Reporter.
|
||||||
virtual void ReportUnknownFieldIgnored(
|
virtual void ReportUnknownFieldIgnored(
|
||||||
|
|
|
@ -2349,7 +2349,7 @@ TEST_F(ComparisonTest, RepeatedMapFieldTest_RepeatedMessageKey) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ComparisonTest, RepeatedSetOptionTest_Unknown) {
|
TEST_F(ComparisonTest, RepeatedSetOptionTest_Unknown) {
|
||||||
// Currently, as_set option doens't have affects on unknown field.
|
// Currently, as_set option doesn't have affects on unknown field.
|
||||||
// If needed, this feature will be added by request.
|
// If needed, this feature will be added by request.
|
||||||
repeated_field_as_set();
|
repeated_field_as_set();
|
||||||
unknown1_->AddGroup(245)->AddFixed32(248, 1);
|
unknown1_->AddGroup(245)->AddFixed32(248, 1);
|
||||||
|
|
|
@ -315,7 +315,7 @@ inline void WireFormat::VerifyUTF8String(const char* data, int size,
|
||||||
WireFormatLite::VerifyUtf8String(
|
WireFormatLite::VerifyUtf8String(
|
||||||
data, size, static_cast<WireFormatLite::Operation>(op), NULL);
|
data, size, static_cast<WireFormatLite::Operation>(op), NULL);
|
||||||
#else
|
#else
|
||||||
// Avoid the compiler warning about unsued variables.
|
// Avoid the compiler warning about unused variables.
|
||||||
(void)data; (void)size; (void)op;
|
(void)data; (void)size; (void)op;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue