-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes for unkeyed decoding #16
base: master
Are you sure you want to change the base?
Conversation
When the call to decodeString failed, it returned immediately out of the function without assigning the advanced type pointer to outType. Now it breaks out of the switch and updates the pointer at the end of the function.
The call to decodeString doesn't succeed in the case when charValue is NewLabel, as it then calls decodeSharedString, which then tries to check the next character for NullLabel/NewLabel/Default, fails as it is now on the first character of the string. I'm not for sure if decodeString is supposed to be called internally in NSUarchiver. Inside NSUarchiver it is calling decodeSharedString every place else. The difference between decodeString and decodeSharedString is very minor. I opted to just call decodeShareString in readType and it fixed the described issue above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll admit that this PR goes beyond my current knowledge of Darling, so there are some stuff I'm not really able to verify (such as the usage of decodeString
vs decodeSharedString
)
With that being said, the code and commits look good and the code compiles without issues. The type encoding (#
) improvements matches what Apple says in their documentation.
I have one (optional) suggestion and a clarification on your comment.
…wrong retain count Behavior: - decodeObject should return an object that the caller has to explicitly retain - decodeValueOfObjCType:at/decodeArrayOfObjCType:count:at:/decodeValuesOfObjCTypes: implicitly cause the outputted objects to be retained See section titled When to Retain a Decoded Object from: https://preterhuman.net/macstuff/techpubs/macosx/System/Library/Frameworks/Foundation.framework/Versions/C/Resources/English.lproj/Documentation/Reference/ObjC_classic/Classes/NSCoder.html
e384ceb
to
f633ddd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
I'll hold off merging this in-case if @bugaevc wants to also review this PR.
This PR contains fixes to
NSUnarchiver
andNSCoder
to properly decode the NIB from Apple's SimpleCocoaApp, which uses unkeyed coder.Please review commit by commit/ I added a explanation for each of the fixes in the commit body.