Joshua Haberman
fa8b605f78
Implemented MiniDescriptors for proto2 enums.
...
An enum MiniDescriptor simply encodes a set of valid `int32_t` values, so that the protobuf parser can test whether a given enum value is known or not.
The format implemented here is novel and needs to be documented. In short, the format is:
1. base92 values 0-31: 5-bit mask indicating presence or absence of the next five enum values.
2. base92 values 60-91: varint indicating skip over a region of enum values.
Negative enum values are encoded as their `uint32_t` equivalent.
PiperOrigin-RevId: 442892799
3 years ago
Joshua Haberman
afffa9eaeb
Two Ruby changes to unblock the release
3 years ago
Joshua Haberman
91713481fd
Clang format.
3 years ago
Joshua Haberman
50c1298f32
Added conformance test variant to exercise dynamic minitable building.
3 years ago
Joshua Haberman
4586eea766
Fixed clang-format.
3 years ago
Joshua Haberman
532dc1f0f0
Renamed a few more constants to the new style.
...
These are not in the public API and so were not prioritized before.
No functional change here, just renames.
3 years ago
Joshua Haberman
dbd5dbed46
Fixed pointer tagging on 32-bit builds.
3 years ago
Joshua Haberman
b1c5104ae2
Two small spelling fixes.
...
We should get a codespell presubmit going.
3 years ago
Joshua Haberman
6d2ab885be
Fix clang-format.
3 years ago
Joshua Haberman
4a01577cce
Two fixes to upb/def.c
...
1. Be tolerant of messages that extend more than one message set.
2. Implemented missing upb_MethodDef_Index() method.
3 years ago
Joshua Haberman
ecc8bae4ce
Fix for proto2 files that use proto3 enums.
3 years ago
Joshua Haberman
7984ebf52d
Fixed error message.
3 years ago
Joshua Haberman
9bb1787f27
Added fuzzing of symtab build, and fixed a handful of minor bugs.
3 years ago
Joshua Haberman
992448eefe
Addressed PR comments.
3 years ago
Joshua Haberman
9715597895
Fixed clang-format.
3 years ago
Joshua Haberman
2e141b24fc
Addressed PR comments.
3 years ago
Joshua Haberman
b11e161ebb
Fixed UBSAN error.
3 years ago
Joshua Haberman
85072ce04e
Fixed a bug in enum layout generation.
3 years ago
Joshua Haberman
65a85a63c8
Fixed two bugs with proto2 enums:
...
1. The mask was getting improperly truncated for values 32-63.
2. We were not handling duplicated enum values.
3 years ago
Joshua Haberman
c56fe27f88
Fix mistake in previous rename: upb_MessageDef_FindFieldByNameWithSize.
3 years ago
Joshua Haberman
13434560e0
WIP.
3 years ago
Joshua Haberman
032400a03e
Fixed data corruption when total hasbits are a power of two.
3 years ago
Joshua Haberman
606308c639
Added back missing underscore.
3 years ago
Joshua Haberman
75b6291e40
Renamed upb_FieldType_* -> kUpb_FieldType_*
3 years ago
Joshua Haberman
392531c14f
Fixed test by implementing FindMethodByName().
3 years ago
Joshua Haberman
fcf1db32b1
Fixed a few extraneous wrappings.
3 years ago
Joshua Haberman
499c2cc8b1
upb_extreg, upb_msg
3 years ago
Joshua Haberman
1c955f37ce
Mass API rename and clang-reformat ( #485 )
...
* Wave 1: upb_fielddef.
* upb_fielddef itself.
* upb_oneofdef.
* upb_msgdef.
* ExtensionRange.
* upb_enumdef
* upb_enumvaldef
* upb_filedef
* upb_methoddef
* upb_servicedef
* upb_symtab
* upb_defpool_init
* upb_wellknown and upb_syntax_t
* Some constants.
* upb_status
* upb_strview
* upb_arena
* upb.h constants
* reflection
* encode
* JSON decode.
* json encode.
* msg_internal.
* Formatted with clang-format.
* Some naming fixups and comment reformatting.
* More refinements.
* A few more stragglers.
* Fixed PyObject_HEAD with semicolon. Removed TODO entries.
3 years ago
Joshua Haberman
00c106f551
Addressed PR comments.
3 years ago
Joshua Haberman
7a24340a26
Fixed some more tests.
3 years ago
Joshua Haberman
fc725be5bc
Implemented proper unescaping of bytes defaults.
3 years ago
Joshua Haberman
aee30144cc
Fixed a couple bugs.
3 years ago
Joshua Haberman
54b605026d
Fixed a bug in ListFields().
3 years ago
Joshua Haberman
d2283ed219
Verify extension ranges, and addressed PR comments.
3 years ago
Joshua Haberman
df77ca5dbb
Check extension field numbers against extension ranges.
...
This makes extension checking more strict in most cases.
However it also fixes a bug with MessageSet where we were being
too strict. MessageSet allows larger extension numbers than
normal extensions do.
3 years ago
Joshua Haberman
7576a3bfc1
Avoid NULL + 0 when adding a list of 0 extensions.
3 years ago
Joshua Haberman
1845997498
Added comments.
3 years ago
Stan Hu
53250c8504
Fix encoding/decoding for def-to-proto on big-endian systems
...
In a big-endian system, the 64-bit value of 1 is represented as:
```
0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x1
```
However, when `d.int32_val` is used, this truncates this and takes the
first four bytes:
```
0x0 0x0 0x0 0x0
```
As a result, we lose the value of 1 from this truncation and the value
beocmes 0. This doesn't happen in a little-endian system because the 1
is in the lowest memory address, so truncating the value to 32 bits
doesn't change anything.
Previously the DefToProto test was failing on a big-endian system
because this truncation caused the key to be incorrectly set to 0.
We now use the type-specific functions
(e.g. `upb_fielddef_defaultint32`) to do this conversion.
Closes https://github.com/protocolbuffers/upb/issues/442
3 years ago
Joshua Haberman
d0795a29d9
Test for def_to_proto is working.
3 years ago
Joshua Haberman
f7980b7ed1
Restructured for simplicity and fixed fasttable parser.
3 years ago
Joshua Haberman
3d437bbcab
Some pre-PR fixes.
3 years ago
Joshua Haberman
7771a0515b
Addressed PR comments.
3 years ago
Joshua Haberman
16f763e4d6
Addressed PR comments.
3 years ago
Joshua Haberman
9d26c706e0
Removed dependency on popcount() intrinsic.
3 years ago
Joshua Haberman
7907ed913b
Expanded the test to cover packed fields also.
3 years ago
Joshua Haberman
401e1747b5
Addressed PR feedback.
3 years ago
Joshua Haberman
cc03669a17
Several changes to defs.
...
Biggest/key changes:
1. Defs are now nested per the .proto file syntax.
2. Options are parsed and vended.
3 years ago
Joshua Haberman
2484d12c1c
Addressed PR comments.
3 years ago
Joshua Haberman
8c916941b0
MSET -> MSGSET
3 years ago
Joshua Haberman
6f89034249
Implemented support for MessageSet.
3 years ago