Diffstat (limited to 'noncore/settings/networksettings2/networksettings2/wextensions.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/networksettings2/wextensions.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/noncore/settings/networksettings2/networksettings2/wextensions.cpp b/noncore/settings/networksettings2/networksettings2/wextensions.cpp index 778990c..c10bdc3 100644 --- a/noncore/settings/networksettings2/networksettings2/wextensions.cpp +++ b/noncore/settings/networksettings2/networksettings2/wextensions.cpp | |||
@@ -43,39 +43,43 @@ WExtensions::WExtensions(QString interfaceName): hasWirelessExtensions(false), i | |||
43 | 43 | ||
44 | /** | 44 | /** |
45 | * @return QString the station name of the access point. | 45 | * @return QString the station name of the access point. |
46 | */ | 46 | */ |
47 | QString WExtensions::station(){ | 47 | QString WExtensions::station(){ |
48 | if(!hasWirelessExtensions) | 48 | if(!hasWirelessExtensions) |
49 | return QString(); | 49 | return QString(); |
50 | const char* buffer[200]; | 50 | const char* buffer[200]; |
51 | iwr.u.data.pointer = (caddr_t) buffer; | 51 | iwr.u.data.pointer = (caddr_t) buffer; |
52 | iwr.u.data.length = IW_ESSID_MAX_SIZE; | 52 | iwr.u.data.length = IW_ESSID_MAX_SIZE; |
53 | iwr.u.data.flags = 0; | 53 | iwr.u.data.flags = 0; |
54 | if ( 0 == ioctl( fd, SIOCGIWNICKN, &iwr )){ | 54 | if ( 0 == ioctl( fd, SIOCGIWNICKN, &iwr )){ |
55 | iwr.u.data.pointer[(unsigned int) iwr.u.data.length-1] = '\0'; | 55 | buffer[(unsigned int) iwr.u.data.length-1] = '\0'; |
56 | return QString(iwr.u.data.pointer); | 56 | return (const char *)buffer; |
57 | } | 57 | } |
58 | return QString(); | 58 | return QString::null; |
59 | } | 59 | } |
60 | 60 | ||
61 | /** | 61 | /** |
62 | * @return QString the essid of the host 802.11 access point. | 62 | * @return QString the essid of the host 802.11 access point. |
63 | */ | 63 | */ |
64 | QString WExtensions::essid(){ | 64 | QString WExtensions::essid(){ |
65 | if(!hasWirelessExtensions) | 65 | if(!hasWirelessExtensions) |
66 | return QString(); | 66 | return QString(); |
67 | const char* buffer[200]; | ||
68 | iwr.u.data.pointer = (caddr_t) buffer; | ||
69 | iwr.u.data.length = IW_ESSID_MAX_SIZE; | ||
70 | iwr.u.data.flags = 0; | ||
67 | if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr )){ | 71 | if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr )){ |
68 | iwr.u.essid.pointer[(unsigned int) iwr.u.essid.length] = '\0'; | 72 | buffer[(unsigned int) iwr.u.essid.length] = '\0'; |
69 | return QString(iwr.u.essid.pointer); | 73 | return (const char *)buffer; |
70 | } | 74 | } |
71 | return QString(); | 75 | return QString(); |
72 | } | 76 | } |
73 | 77 | ||
74 | /** | 78 | /** |
75 | * @return QString the mode of interface | 79 | * @return QString the mode of interface |
76 | */ | 80 | */ |
77 | QString WExtensions::mode(){ | 81 | QString WExtensions::mode(){ |
78 | if(!hasWirelessExtensions) | 82 | if(!hasWirelessExtensions) |
79 | return QString(); | 83 | return QString(); |
80 | if ( 0 == ioctl( fd, SIOCGIWMODE, &iwr ) ) | 84 | if ( 0 == ioctl( fd, SIOCGIWMODE, &iwr ) ) |
81 | return QString("%1").arg(iwr.u.mode == IW_MODE_ADHOC ? "Ad-Hoc" : "Managed"); | 85 | return QString("%1").arg(iwr.u.mode == IW_MODE_ADHOC ? "Ad-Hoc" : "Managed"); |