Skip to content

NSUUID improvements #69

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

Merged
merged 7 commits into from
Dec 8, 2015
Merged

NSUUID improvements #69

merged 7 commits into from
Dec 8, 2015

Conversation

0xced
Copy link
Contributor

@0xced 0xced commented Dec 8, 2015

  • Implement isEqual and hash
  • Do not crash when initialised with NSUUID(UUIDBytes: nil)
  • Fix UUIDString implementation
  • Implement a sensible description

if (bytes != nil) {
memcpy(unsafeBitCast(buffer, UnsafeMutablePointer<Void>.self), UnsafePointer<Void>(bytes), 16)
} else {
memset(unsafeBitCast(buffer, UnsafeMutablePointer<Void>.self), 0, 16)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually the darwin implementation crashes when nil is passed so perhaps a precondition assertion would be more correct

@phausler
Copy link
Contributor

phausler commented Dec 8, 2015

overall this looks good, the behavior of the nil initializer is a bit undefined on darwin so that is just a minor issue if any; once conflicts are resolved by a rebase this looks good to go to me

@0xced
Copy link
Contributor Author

0xced commented Dec 8, 2015

I rebased and resolved conflicts. I did not change the check against nil, so the init(UUIDBytes:) function returns the Nil UUID (00000000-0000-0000-0000-000000000000) instead of crashing when passed a nil argument.

@0xced 0xced force-pushed the NSUUID branch 2 times, most recently from 7001407 to 5bed24a Compare December 8, 2015 21:45
parkera added a commit that referenced this pull request Dec 8, 2015
@parkera parkera merged commit aa720c6 into swiftlang:master Dec 8, 2015
@parkera
Copy link
Contributor

parkera commented Dec 8, 2015

Thanks!

@0xced 0xced deleted the NSUUID branch December 9, 2015 00:07
kateinoigakukun pushed a commit to kateinoigakukun/swift-corelibs-foundation that referenced this pull request Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants