Skip to content
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

Xcode 9 Beta Warnings #43

Closed
EverGod opened this issue Jul 27, 2017 · 6 comments
Closed

Xcode 9 Beta Warnings #43

EverGod opened this issue Jul 27, 2017 · 6 comments

Comments

@EverGod
Copy link

EverGod commented Jul 27, 2017

Xcode compiler complains "Overlapping accesses to 'name', but modification requires exclusive access; consider copying to a local variable"

DeviceGuru.swift file (lines 23 & 25).
warnings

  1. sysctl(&name, 2, nil, &size, &name, 0)
  2. sysctl(&name, 2, &hw_machine, &size, &name, 0)
@DarkoDamjanovic
Copy link

DarkoDamjanovic commented Aug 25, 2017

Just created a second "name" var. Like this:

  class open func hardwareString() -> String {
    var name: [Int32] = [CTL_HW, HW_MACHINE]
    var name2: [Int32] = [CTL_HW, HW_MACHINE]
    var size: Int = 2
    sysctl(&name, 2, nil, &size, &name2, 0)
    var hw_machine = [CChar](repeating: 0, count: Int(size))
    sysctl(&name, 2, &hw_machine, &size, &name2, 0)
    
    let hardware: String = String(cString: hw_machine)
    return hardware
  }

Works for me.

@phatmann
Copy link
Contributor

@DarkoDamjanovic Can you submit a pull request?

@DarkoDamjanovic
Copy link

@phatmann I am not sure if this fix is the correct way of doing it. Do you know more?

@phatmann
Copy link
Contributor

Seems like a perfect fix to me.

@DarkoDamjanovic
Copy link

I just saw that there is already a pull request for this error. And it seems better then mine:

#41

@InderKumarRathore
Copy link
Owner

Hi guys sorry for the delay, but I was waiting for the GM Seed. I've downloaded the latest GM Seed xcode9 and merged the pull request #41

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

No branches or pull requests

4 participants