Commit Graph

1031 Commits

Author SHA1 Message Date
Jan Tattermusch
f9e8bf42a9
Merge pull request #8220 from jskeet/bytestrings-with-extensions
Allow FileDescriptors to be parsed with extension registries
2021-02-01 09:02:58 +01:00
James Newton-King
c2b22b90fc
PR feedback 2021-01-28 08:11:52 +13:00
James Newton-King
cb246b8032
Optimize writing small strings 2021-01-27 12:50:48 +13:00
James Newton-King
69223b8386
Clean up 2021-01-21 13:36:00 +13:00
James Newton-King
542c0cc9d3
Fix missing key and test 2021-01-21 13:34:08 +13:00
Jon Skeet
f01d9e5601 Add an extension registry option when parsing file descriptors
This is important when parsing descriptor sets that contain extensions.
(The alternative is to get the descriptor bytes again for individual
elements, e.g. message descriptors, and reparse them with the
appropriate extensions. It's really ugly.)
2021-01-20 08:11:27 +00:00
Jon Skeet
cea3653a2e Include the size of values (and tags) for extensions, even if the value is the default
Fixes #8218.
2021-01-20 08:06:34 +00:00
James Newton-King
6cf068c439
Clean up 2020-12-15 22:09:07 +13:00
James Newton-King
e9cc0b0c23
Optimize MapField serialization by removing MessageAdapter 2020-12-15 21:41:39 +13:00
Jan Tattermusch
930ab0f33d C#: do not use <PublicSign>true</PublicSign> on non-windows 2020-12-14 14:41:42 +01:00
James Newton-King
e794919f6b
PR feedback 2020-11-18 22:54:06 +13:00
James Newton-King
79f5bad83c
Change ByteString to use memory and support unsafe create without copy 2020-11-18 21:58:32 +13:00
Adam Cozzette
17a067dd36 Merge branch '3.14.x' into 3.14.x-202011131455 2020-11-13 15:49:45 -08:00
Adam Cozzette
f3192d6128 Update protobuf version 2020-11-13 11:27:32 -08:00
James Newton-King
e91922a4e7 Additional test 2020-11-13 09:13:01 -08:00
James Newton-King
e57f761e7b Fix parsing negative Int32Value that crosses segment boundary 2020-11-13 09:13:01 -08:00
James Newton-King
fdf4ef62a5
Additional test 2020-11-13 12:17:24 +13:00
James Newton-King
d8800ae2f3
Fix parsing negative Int32Value that crosses segment boundary 2020-11-13 12:11:31 +13:00
Adam Cozzette
1b851b3fe6 Update protobuf version 2020-11-12 12:44:26 -08:00
Adam Cozzette
a8ab1fade9 Update protobuf version 2020-11-10 17:15:32 -08:00
James Newton-King
52618472bc
Remove GOOGLE_PROTOBUF_SUPPORT_SYSTEM_MEMORY 2020-11-06 11:55:26 +13:00
Adam Cozzette
27100b40fd Update protobuf version 2020-11-05 14:30:53 -08:00
Jan Tattermusch
9d9c670589
Merge pull request #7701 from basvdlinden/safe_bytestring_copyfrom_span
annotate ByteString.CopyFrom(ReadOnlySpan<byte>) as SecuritySafeCritical
2020-10-27 12:01:32 +01:00
Jan Tattermusch
151d49436a upgrade System.Memory dependency to 4.5.3 2020-10-22 09:45:39 -07:00
Joshua Haberman
f3cf99c0fb Sync from Piper @328224070
PROTOBUF_SYNC_PIPER
2020-08-24 15:48:43 -07:00
Joshua Haberman
32a94ce353 Merge tag 'refs/tags/sync-piper' into sync-stage
# Conflicts:
#	csharp/src/Google.Protobuf.Test/testprotos.pb
2020-08-17 15:26:33 -07:00
Joshua Haberman
95e6c5b474 Sync from Piper @327110949
PROTOBUF_SYNC_PIPER
2020-08-17 15:26:13 -07:00
Adam Cozzette
58f4260e8e Merged 3.13.x into master 2020-08-17 11:06:11 -07:00
Adam Cozzette
fde7cf7358 Update protobuf version 2020-08-14 15:20:53 -07:00
Adam Cozzette
14982862f5 Removed conflicting C# version line
Somehow we ended up with two conflicting versions listed for C#, so this
commit removes the incorrect one (the correct one is 3.13.0-rc3).
2020-08-14 09:21:30 -07:00
Adam Cozzette
98c2e69f8c Update protobuf version 2020-08-12 14:49:20 -07:00
Peter Newman
e2cc2de304
Fix lots of spelling errors (#7751)
* Fix a typo

* Fix lots of spelling errors

* Fix a few more spelling mistakes

* s/parsable/parseable/

* Don't touch the third party files

* Cloneable is the preferred C# term

* Copyable is the preferred C++ term

* Revert "s/parsable/parseable/"

This reverts commit 534ecf7675.

* Revert unparseable->unparsable corrections
2020-08-10 11:08:25 -07:00
Adam Cozzette
1c587a8059 Updated version to 3.13.0-rc2 2020-08-07 14:44:49 -07:00
Jon Skeet
0d90ff3d72 Fix C# optional field reflection when there are regular fields too
Previous tests didn't spot this as each message was either "all
optional" or "all non-optional", at which point there isn't a problem.
2020-08-07 14:44:49 -07:00
Adam Cozzette
8940150706 Updated version to 3.13.0-rc1. 2020-08-07 14:44:49 -07:00
Jon Skeet
d4ec70fdd3 Fix C# optional field reflection when there are regular fields too
Previous tests didn't spot this as each message was either "all
optional" or "all non-optional", at which point there isn't a problem.
2020-07-14 08:01:05 +01:00
Bas van der Linden
4c1bb4d07b Remove newline 2020-07-12 15:16:33 +02:00
Bas van der Linden
12d7976055 Added test for ByteString.CopyFrom(ReadOnlySpan<byte> bytes) 2020-07-12 15:12:18 +02:00
Bas van der Linden
ead45182aa annotate ByteString.CopyFrom(ReadOnlySpan<byte> bytes) as SecuritySafeCritical 2020-07-12 14:43:42 +02:00
Joshua Haberman
6ba52411d0 Sync from Piper @320514613
PROTOBUF_SYNC_PIPER
2020-07-09 18:17:47 -07:00
Joshua Haberman
25755efc4f Sync from Piper @319848517
PROTOBUF_SYNC_PIPER
2020-07-06 13:54:50 -07:00
James Newton-King
e36163deed
PR feedback 2020-07-01 20:32:29 +12:00
James Newton-King
d4abad8731
Optimize reading strings across segments 2020-07-01 20:32:29 +12:00
Jan Tattermusch
45c8850389 use BinaryPrimitives.WriteUInt64LittleEndian 2020-07-01 07:52:02 +02:00
Jan Tattermusch
1cf4df00cf C# benchmark improvements 2020-07-01 07:52:02 +02:00
Jan Tattermusch
fed7e18193 upgrade dotnet SDK in the CI to 3.1 2020-06-30 08:53:31 -04:00
Jon Skeet
13d712533e Fix C# build by regenerating test protos 2020-06-30 06:52:58 +01:00
Jon Skeet
2c1a46101b Add tests for NullValue not appearing in a oneof at all 2020-06-29 09:30:20 +01:00
Jon Skeet
0dd5fffba3 Fix JSON parsing and formatting of NullValue in C#
The NullValue enum is typically used as part of the Value well-known type, but can be used elsewhere. In previous code, a NullValue field (other than in Value) would result in a JSON value of the string "NULL_VALUE"; it should instead be the null literal.
When parsing, we still accept "NULL_VALUE" as a valid value for NullValue - this new code being unable to parse old data, and comes for free anyway.
2020-06-29 09:30:20 +01:00
Jan Tattermusch
4f0afc7852 optimize WriteRawTag 2020-06-23 20:17:33 +02:00
Jan Tattermusch
2f16981638 optimize WriteVarint64 2020-06-23 17:38:40 +02:00
Jan Tattermusch
9d53fadcac optimize WriteVarint32 2020-06-23 17:23:21 +02:00
Jan Tattermusch
9ca0877db1 optimize WriteRawBytes 2020-06-23 16:55:43 +02:00
Jan Tattermusch
80780bdffa optimize WriteRawByte 2020-06-23 16:53:05 +02:00
Jan Tattermusch
6afd469fe0 optimize WriteFixed32 and WriteFixed64 2020-06-23 16:46:01 +02:00
Jan Tattermusch
17a4b181a0 optimize WriteString 2020-06-23 16:31:29 +02:00
Jan Tattermusch
d3557cab21 WriteFloat improvements 2020-06-23 16:25:49 +02:00
Jan Tattermusch
1f56e5e2a4 remove AggressiveInlining attribute from WritingPrimitives.cs 2020-06-23 15:40:39 +02:00
Phil Felton
115af28e8f Make propertyName public 2020-06-22 11:16:54 +01:00
Joshua Haberman
dfab275eca Sync from Piper @317197168
PROTOBUF_SYNC_PIPER
2020-06-18 15:47:49 -07:00
Joshua Haberman
f77065d4eb Sync from Piper @316511779
PROTOBUF_SYNC_PIPER
2020-06-15 11:48:47 -07:00
Jan Tattermusch
468c3ba8c6 Speed up writing of messages with many fields 2020-06-12 11:34:42 +02:00
Jan Tattermusch
9d6969bec4 Merge remote-tracking branch 'upstream/master' into protobuf_buffer_serialization 2020-06-11 16:40:27 +02:00
Jan Tattermusch
6a69690464 basic version of WriteMessagesBenchmark 2020-06-11 09:28:25 +02:00
Jon Skeet
1dae8fdd62 Add support for proto2 JSON parsing in C# conformance tests 2020-06-11 06:43:29 +01:00
Jon Skeet
ff70af6cfc Changes how JSON formatting works for fields supporting presence
Fixes #7486.

Note that this changes the behavior for message fields where
"WithFormatDefaultValues(true)" has been specified. This is
effectively fixing a bug, but will need to be noted in the release
notes.

Basically, FormatDefaultValues only affects fields that don't
support presence - most commonly, singular primitive non-optional
fields in proto3.
2020-06-11 06:43:29 +01:00
Jan Tattermusch
549dc9a412 optimize writing fixed32 and fixed64, fix benchmark 2020-06-09 17:59:32 +02:00
Jan Tattermusch
5eec497d3b fix C# CompatibilityTests 2020-06-09 16:43:24 +02:00
Jan Tattermusch
e346fde63b remove commented out code 2020-06-08 17:19:19 +02:00
Jan Tattermusch
c06812b0b2 address a few TODOs 2020-06-08 17:13:15 +02:00
Jan Tattermusch
19c0d73fb9 test WriteContext writing with multiple flushes 2020-06-08 17:03:51 +02:00
Jan Tattermusch
53708e2f15 test writing to a stackalloc buffer 2020-06-08 17:03:03 +02:00
Jan Tattermusch
e14a5c8fe6 address a few TODOs 2020-06-08 16:23:33 +02:00
Jan Tattermusch
43dcee2fa9 remove some todos 2020-06-08 15:54:01 +02:00
Jan Tattermusch
3375e251f9 optimize writing non-ascii strings 2020-06-08 15:38:36 +02:00
Jan Tattermusch
3dad187707 add benchmark for writing of NonAsciiStrings 2020-06-08 12:25:19 +02:00
Jan Tattermusch
8a2d5884bf address review comments 2020-06-08 11:19:57 +02:00
Jan Tattermusch
a296413b5a optimize WriteFloat 2020-06-05 14:41:07 +02:00
Jan Tattermusch
886c263a3c initial version of write benchmarks 2020-06-05 14:41:07 +02:00
Jan Tattermusch
a6d1ed1712 annotate ByteString.Span and ByteString.Memory as SecuritySafeCritical 2020-06-03 17:09:03 +02:00
Jan Tattermusch
b2c94974b2 remove a TODO 2020-06-03 17:05:21 +02:00
Jan Tattermusch
56372898cf test writing with different blocksizes 2020-06-03 16:58:02 +02:00
Jan Tattermusch
f9f92a6dd2 increase test coverage 2020-06-03 16:26:05 +02:00
Jan Tattermusch
94e64f2c0b a bit more cleanup 2020-06-03 16:12:16 +02:00
Jan Tattermusch
ba61d76e52 simplify serialization to single span 2020-06-03 15:54:29 +02:00
Jan Tattermusch
b3cdba1cfd increase test coverage 2020-06-03 15:50:07 +02:00
Jan Tattermusch
7bfaaba534 cleanup coded output stream 2020-06-03 15:48:34 +02:00
Jan Tattermusch
9039103637 message extensions + refactor 2020-06-03 15:32:20 +02:00
Jan Tattermusch
8dbf707aa0 add more tests 2020-06-03 14:47:55 +02:00
Jan Tattermusch
1e1d455423 add WriteFloat TODO 2020-06-03 14:46:27 +02:00
Jan Tattermusch
2bce090f32 add more tests 2020-06-03 14:36:39 +02:00
Jan Tattermusch
ecbb29d354 add WriteContext.Flush() method 2020-06-03 14:22:40 +02:00
Jan Tattermusch
3cdc107bda fix bug in RefreshBuffer 2020-06-03 14:11:44 +02:00
Jan Tattermusch
efbadb6c73
Merge pull request #7412 from JamesNK/jamesnk/repeated-fixed-parsing
Improve performance of parsing repeated fixed sized types
2020-06-03 08:55:04 +02:00
Joshua Haberman
b971243fe0 Merge branch '3.12.x' into merge-release-branch 2020-06-02 13:24:30 -07:00
James Newton-King
921bdaaa61
Improve repeated fixed parsing performance 2020-06-03 07:06:27 +12:00
Jan Tattermusch
90d4969bd1 LegacyGeneratedCodeTest now passing 2020-06-02 19:58:04 +02:00
Jan Tattermusch
361c933a58 annotate ByteString.Span and ByteString.Memory as SecuritySafeCritical 2020-06-02 19:58:04 +02:00
Jan Tattermusch
9070389516 regenerate code 2020-06-02 19:58:04 +02:00
Jan Tattermusch
ea1d55927d test are almost passing 2020-06-02 19:58:04 +02:00
Jan Tattermusch
125e4ad267 regenerate C# protos 2020-06-02 19:58:04 +02:00
Jan Tattermusch
d3eddf7e2d make everything build, with some TODOs 2020-06-02 19:58:04 +02:00
Jan Tattermusch
ca7bc464a9 make all writing use WriteContext 2020-06-02 19:58:04 +02:00
Jan Tattermusch
c17af44172 apply SecuritySafeCritical attribute 2020-06-02 19:58:04 +02:00
Jan Tattermusch
5742a64eea fix WriteString bug 2020-06-02 19:58:04 +02:00
Jan Tattermusch
5fc49bdd5a fix a bunch of bugs 2020-06-02 19:58:04 +02:00
Jan Tattermusch
d0e08f546d entire solution builds now 2020-06-02 19:58:04 +02:00
Jan Tattermusch
ee6b20afbe CodedOutputStream adjustments 2020-06-02 19:58:04 +02:00
Jan Tattermusch
f9d9019e27 more progress 2020-06-02 19:58:04 +02:00
Jan Tattermusch
fe147994c8 progress: stuff almost builds now 2020-06-02 19:58:03 +02:00
Jan Tattermusch
a329764603 fix typo in ParserInternalState 2020-06-02 19:58:03 +02:00
Jan Tattermusch
c855561c54 initial implementation of buffer encoding 2020-06-02 19:58:03 +02:00
Jan Tattermusch
7cb5597013
Overcome the ref struct limitation for pre-roslyn compilers by introducing GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE for generated code (#7490)
* enable compatibility mode in codegen

* regenerate protos

* improve readability

* more robust way of figuring out path to old C# compiler

* add recent C# changes
2020-06-02 00:26:25 -07:00
Joshua Haberman
9ce8c330e7
Updated version to 3.12.3 and updated CHANGES.txt. (#7580)
* Updated version to 3.12.3 and updated CHANGES.txt.

* Re-ran generate_descriptor_protos.sh and made it more parallel.
2020-06-01 13:36:50 -07:00
Joshua Haberman
2d654e8198
Merge pull request #7559 from haberman/merge-312
Merge the 3.12.x branch to master
2020-05-27 09:24:57 -07:00
Jan Tattermusch
040b2a6d07 C# project cleanup 2020-05-27 13:59:51 +02:00
Joshua Haberman
c077d949d8 Merge branch '3.12.x' into merge-312 2020-05-26 16:45:43 -07:00
Joshua Haberman
beeb621f50
Update protobuf version (#7557) 2020-05-26 15:46:39 -07:00
Joshua Haberman
6ad138d85a
Update protobuf version (#7535) 2020-05-20 10:54:29 -07:00
Joshua Haberman
9952e36f92
Merge release branch into master. (#7517)
* Added background information about proto3 presence. (#7501)

* Fixed bug in map key sorting for Java TextFormat. (#7508)

Fixes: https://github.com/protocolbuffers/protobuf/issues/7505

* Update protobuf version

* Added a changelog entry about the Java fix. (#7516)
2020-05-16 16:42:02 -07:00
Joshua Haberman
e90b71cdee Update protobuf version 2020-05-15 13:28:07 -07:00
Jan Tattermusch
440a156e1c
Merge pull request #6904 from erikma/dev/erikmav/byteStringMemory
C#: Allow readonly view of byteString's data with ByteString.Memory property
2020-05-13 15:44:01 +02:00
Joshua Haberman
62ab8333c9 Merge branch '3.12.x' into merge-312-branch 2020-05-12 16:59:55 -07:00
Joshua Haberman
f597a24627 Update protobuf version 2020-05-12 12:49:46 -07:00
Jon Skeet
3c3646fa78 Implement HasPresence for C#
FieldDescriptor.HasPresence returns true if both ClearValue and HasValue (on the accessor) can be expected to work. Some fields have a working ClearValue, but no HasValue; HasPresence returns false for those fields.

Generally:

- Extension fields have presence if and only if they're singular
- Repeated fields do not support presence
- Map fields do not support presence
- Message fields support presence
- Oneof fields support presence (this includes synthetic oneof fields, so that covers proto3 optional singular fields)
- Proto2 singular primitive fields support presence
- Proto3 singular primitive fields do not support presence (unless they're in a oneof, covered above)
2020-05-12 10:58:05 -07:00
Jan Tattermusch
fc5ded36bc Merge pull request #7434 from jtattermusch/csharp_expose_options
C#: Get rid of broken GetOption API and expose the "GetOptions()" method on descriptors instead
2020-05-12 10:56:51 -07:00
Jon Skeet
807ea2f352 Fix to C# support library code
(This was the only use of a HasXyz property for a message type.)
2020-05-12 10:54:45 -07:00
Jon Skeet
13df985bff Regenerate C# code based on the previous commit
(This removes the Has/Clear members for message types in proto2.)
2020-05-12 10:54:45 -07:00
Jan Tattermusch
dd013bdf06 regenerate protos 2020-05-11 11:18:49 +02:00
Jan Tattermusch
661c0c4eb8 add tests for selfreferential options 2020-05-11 11:18:49 +02:00
Jan Tattermusch
bf3eef94c1
Merge pull request #7434 from jtattermusch/csharp_expose_options
C#: Get rid of broken GetOption API and expose the "GetOptions()" method on descriptors instead
2020-05-11 09:40:51 +02:00
Jon Skeet
6b0ff74ecf Implement HasPresence for C#
FieldDescriptor.HasPresence returns true if both ClearValue and HasValue (on the accessor) can be expected to work. Some fields have a working ClearValue, but no HasValue; HasPresence returns false for those fields.

Generally:

- Extension fields have presence if and only if they're singular
- Repeated fields do not support presence
- Map fields do not support presence
- Message fields support presence
- Oneof fields support presence (this includes synthetic oneof fields, so that covers proto3 optional singular fields)
- Proto2 singular primitive fields support presence
- Proto3 singular primitive fields do not support presence (unless they're in a oneof, covered above)
2020-05-08 06:17:50 +01:00
Joshua Haberman
2d80a70048 Sync from Piper @310457838
PROTOBUF_SYNC_PIPER
2020-05-07 16:21:50 -07:00
Jan Tattermusch
0688883b52 address review comments 2020-05-06 18:53:36 +02:00
Joshua Haberman
2ac29ae5d4 Sync from Piper @310014675
PROTOBUF_SYNC_PIPER
2020-05-05 13:56:07 -07:00
Jan Tattermusch
a690227398
Merge pull request #7351 from jtattermusch/protobuf_csharp_new_parsing
New Span-based C# parsing logic
2020-05-05 16:57:52 +02:00
Joshua Haberman
c05b55880f Sync from Piper @309848308
PROTOBUF_SYNC_PIPER
2020-05-04 17:10:15 -07:00
Jon Skeet
ed5c874de3 Fix to C# support library code
(This was the only use of a HasXyz property for a message type.)
2020-05-01 09:06:44 +01:00
Jon Skeet
9926c9504b Regenerate C# code based on the previous commit
(This removes the Has/Clear members for message types in proto2.)
2020-05-01 09:06:44 +01:00
Joshua Haberman
a9f11d7d64
Updated version to 3.12.0-rc1. (#7449) 2020-04-30 15:34:10 -07:00
Jan Tattermusch
ff999c9d42 clarify docs 2020-04-29 08:57:53 +02:00
Jan Tattermusch
673245f212 remove unnecessary cast 2020-04-29 08:50:59 +02:00
Jan Tattermusch
402ce8b17f add back GetOption tests 2020-04-28 19:25:06 +02:00
Jan Tattermusch
062c2dc24b add back GetOption methods, but mark them as obsolete 2020-04-28 19:14:27 +02:00
Joshua Haberman
32e5deb1ac Sync from Piper @308829107
PROTOBUF_SYNC_PIPER
2020-04-28 08:40:38 -07:00
Jan Tattermusch
f4ff22026b add a few more tests 2020-04-28 13:59:54 +02:00
Jan Tattermusch
9720ae41c2 adjust CustomOptionsTest.cs 2020-04-28 12:49:29 +02:00
Jan Tattermusch
944055a683 expose Options property on descriptors 2020-04-28 10:49:49 +02:00
Jan Tattermusch
7134d25eb8 Merge remote-tracking branch 'upstream/master' into protobuf_csharp_new_parsing 2020-04-27 13:18:07 +02:00
Jon Skeet
97737072f9 Add reflection support for proto3 optional fields
This is more involved than might be expected because the synthetic oneofs don't generate the properties we would usually expect to see.
2020-04-24 17:39:14 +01:00