The last attempted (rolled back) resulted in changes in visible behavior:
- It consumed a recursion depth on the input stream (wrong)
- It resulted in different error codes for some malformed/truncated data.
PiperOrigin-RevId: 510415215
For normal fields, closed enums get their out of range values put into unknown
fields, but that wasn't happening for extension fields, this fixes that by
adding the validation during parsing.
Also document on the getExtension API what happens with enums.
Add tests to confirm expected behaviors.
PiperOrigin-RevId: 491356730
- FieldDescriptor:
- Add a new flag to mark when the enum on the field is closed (vs open).
- Support computing the state for when generated sources predate the support.
- EnumDescriptor:
- Support passing flags to the descriptor creation, currently closed is the
only new flag.
- Add an isClosed property to expose the state of the enum.
This does NOT update generation yet, allows things to be tested before the
generation support is added.
PiperOrigin-RevId: 488671606
The minOS version is high enough it can be used, and it avoids the long standing
issue for priority inversion dependent on what callers did with
threading/queues.
objectivec/README.md lists Xcode 10.2 as the minimum, update things accordingly.
- Remove code paths referencing the older versions.
- Remove support from the testing script.
- Minor formatting changes to make thing happy.
- Block clang-format from the PDDM macro definitions to avoid it wrapping
things.
- Don't add clang-format directives to the expansion, easier to handling
it outside of there.
This allows some to use an alternative registry if they have a different
implementation.
This is really just wiring though the change to use the GPBExtensionRegistry
protocol vs the concrete GPBExtensionRegistry through the other apis.
- Update semaphore comment to new scope.
- Use an atomic swap to avoid needing to use the semaphore.
This means the semaphore is create only when extension are auto created (less
memory usage).
* 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
- With the new flags, the syntax isn't needed, so don't pass it.
- To keep library binary compatibility, rename the helpers since one
"Internal" method was called from generated code. Keep a shim with
the old signature to support those generated sources.
For messages that have multiple extension ranges, this will improve things
by avoiding repeated work. For messages with a single range, it should
be a wash.
- Sort the list of set extensions once during serialization and reuse the list.
- Break out of the serialization loop as soon as the loop has moved pasted at
accepted range for field ids.
Using NSCoding with a Message that has extensions is risky because
when reloaded, there is no way to provide a registry through the
NSCoding plumbing, so output a warnings to atleast give developers
a hint about the potential issues.
Haven't been able to make a repo case, but this should "fix" the problem
by avoid it completely.
- Move readOnlySemaphore_ into the .m file so it isn't exposed in any
header.
- Move GPBGetObjectIvarWithField() also to go with the new limited
visibility on the readOnlySemaphore_.
Remove unnecessary retain/releases for GPBFieldDescriptors when
creating implementations with blocks. The descriptors do not need
to be memory managed because they are essentially global constructs
that are guaranteed to be around the lifetime of the app.
This should never happen, but if someone is swizzling or do other
hooking of methods, anything is possible, so this seems slighty
safer than they returning NO.
- Ensure extensions resolution/wiring is happening directly on the
messageClass (incase someone is doing odd things our out classes).
- Make the extension message check match the other class checks in
for mergeFrom/isEqual/etc.
Apple recently updated the docs on dispatch_once to point out
that the storage for the dispatch_once_t must be static or global,
but not something that was ever used before as the implementation
doesn't use a memory barrier. So we drop the use and create the
semaphore when needed and use an atomic swap deal with any
threading races.
- Don't prune the extension registry as that can lead to failures when two
threads are racing.
- If adding the method fails, check and see if it already is bound to decide
the return result. Deals with threading races binding the methods.
- If setting/clearing a repeated field/map that was objects, check the class
before checking the autocreator.
- Just to be paranoid, don’t mutate within copy/mutableCopy for the autocreated
classes to ensure there is less chance of issues if someone does something
really crazy threading wise.
- Some more tests for the internal AutocreatedArray/AutocreatedDictionary
classes to ensure things are working as expected.
- Add Xcode 8.2 to the full_mac_build.sh supported list.
There was a twist code path (that some times showed up due to what happened to
be in memory in failure cases), that would cast a bogus wire type into the
enum, and then fall through switch statements.
Resolve this by validating all wire types when parsing tags and throwing the
error at that point so it can't enter the system.
As added safety, stick in a few asserts for apis that get passed tags to ensure
they also are only seeing valid data.
Bonus: Tweak the parsing loop to skip some work when we get the end marker
(zero tag) instead of still looping through all the fields.