GitHub PullRequestReviewCommentEvent at 2014-03-07 08:39:38
Repository: dolphin
Actor: delroth
Payload: {"comment":{"url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/comments/10376268","id":10376268,"diff_hunk":"@@ -305,55 +306,28 @@ s32 CWII_IPC_HLE_Device_net_kd_request::NWC24MakeUserID(u64* nwc24_id, u32 holly\n \treturn WC24_OK;\n }\n \n-std::string MacAddressToString(u8* mac)\n-{\n-\treturn StringFromFormat(\"%02\" PRIx8 \":%02\" PRIx8 \":%02\" PRIx8 \":\" \n-\t                        \"%02\" PRIx8 \":%02\" PRIx8 \":%02\" PRIx8,\n-\t                        mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);\n-}\n-\n void SaveMacAddress(u8* mac)\n {\n \tSConfig::GetInstance().m_WirelessMac = MacAddressToString(mac);\n \tSConfig::GetInstance().SaveSettings();\n }\n \n-void GenerateMacAddress(u8* mac)\n-{\n-\tmac[0] = 0x00;\n-\tmac[1] = 0x17;\n-\tmac[2] = 0xAB;\n-\tmac[3] = rand() & 0xFF;\n-\tmac[4] = rand() & 0xFF;\n-\tmac[5] = rand() & 0xFF;\n-}\n-\n void GetMacAddress(u8* mac)\n {\n+\t// Parse MAC address from config, and generate a new one if it doesn't\n+\t// exist or can't be parsed.\n \tstd::string wireless_mac = SConfig::GetInstance().m_WirelessMac;\n-\tif (!wireless_mac.empty())\n+\tif (!StringToMacAddress(wireless_mac, mac))\n \t{\n-\t\tmemset(mac, 0, 6);\n-\t\tif ((sscanf(wireless_mac.c_str(), \n-\t\t            \" %\" SCNx8 \":%\" SCNx8 \":%\" SCNx8 \":%\" SCNx8 \":%\" SCNx8 \":%\" SCNx8 \" \",\n-\t\t            &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5]) != 6) &&\n-\t\t    (sscanf(wireless_mac.c_str(), \n-\t\t            \" %\" SCNx8 \"-%\" SCNx8 \"-%\" SCNx8 \"-%\" SCNx8 \"-%\" SCNx8 \"-%\" SCNx8 \" \",\n-\t\t            &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5]) != 6))\n+\t\tGenerateMacAddress(IOS, mac);\n+\t\tSaveMacAddress(mac);\n+\t\tif (!wireless_mac.empty())\n \t\t{\n-\t\t\t// Unable to parse the MAC address, generate a new one instead.\n-\t\t\tGenerateMacAddress(mac);\n-\t\t\tSaveMacAddress(mac);\n \t\t\tERROR_LOG(WII_IPC_NET, \"The MAC provided (%s) is invalid. We have \"\\\n \t\t\t                       \"generated another one for you.\",\n-\t\t\t                       wireless_mac.c_str());\n+\t\t\t\t\t\t\t\t   MacAddressToString(mac).c_str());","path":"Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net.cpp","position":60,"original_position":60,"commit_id":"18e397c733a66ddfa26d991e6719c364261cd393","original_commit_id":"18e397c733a66ddfa26d991e6719c364261cd393","user":{"login":"delroth","id":202798,"avatar_url":"https://gravatar.com/avatar/a7c333ee5d59519be7b757f917a950ba?d=https%3A%2F%2Fidenticons.github.com%2F5154f46b5aff96f20d15d031d9bacf7f.png&r=x","gravatar_id":"a7c333ee5d59519be7b757f917a950ba","url":"https://api.github.com/users/delroth","html_url":"https://github.com/delroth","followers_url":"https://api.github.com/users/delroth/followers","following_url":"https://api.github.com/users/delroth/following{/other_user}","gists_url":"https://api.github.com/users/delroth/gists{/gist_id}","starred_url":"https://api.github.com/users/delroth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delroth/subscriptions","organizations_url":"https://api.github.com/users/delroth/orgs","repos_url":"https://api.github.com/users/delroth/repos","events_url":"https://api.github.com/users/delroth/events{/privacy}","received_events_url":"https://api.github.com/users/delroth/received_events","type":"User","site_admin":false},"body":"Tabs vs. spaces.","created_at":"2014-03-07T08:39:38Z","updated_at":"2014-03-07T08:39:38Z","html_url":"https://github.com/dolphin-emu/dolphin/pull/141#discussion_r10376268","pull_request_url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/141","_links":{"self":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/comments/10376268"},"html":{"href":"https://github.com/dolphin-emu/dolphin/pull/141#discussion_r10376268"},"pull_request":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/141"}}}}