mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 02:36:57 -07:00
fix: fixed deprecation warning on macOS native code
This commit is contained in:
parent
a4c99df51e
commit
575022fac4
1 changed files with 6 additions and 4 deletions
|
@ -18,8 +18,9 @@ int chan2freq(int channel) {
|
||||||
const char *GetSupportedFrequencies(const char *iface) {
|
const char *GetSupportedFrequencies(const char *iface) {
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
NSString *interfaceName = [NSString stringWithUTF8String:iface];
|
NSString *interfaceName = [NSString stringWithUTF8String:iface];
|
||||||
CWInterface *interface = [CWInterface interfaceWithName:interfaceName];
|
CWInterface *interface = [[CWWiFiClient sharedWiFiClient] interfaceWithName: interfaceName];
|
||||||
if (!interface) {
|
if (!interface) {
|
||||||
|
NSLog(@"failed to serialize get interface by nmae: %@", interfaceName);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +35,7 @@ const char *GetSupportedFrequencies(const char *iface) {
|
||||||
NSError *error = nil;
|
NSError *error = nil;
|
||||||
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:frequencies options:0 error:&error];
|
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:frequencies options:0 error:&error];
|
||||||
if (!jsonData) {
|
if (!jsonData) {
|
||||||
NSLog(@"Failed to serialize frequencies: %@", error);
|
NSLog(@"failed to serialize frequencies: %@", error);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,8 +47,9 @@ const char *GetSupportedFrequencies(const char *iface) {
|
||||||
bool SetInterfaceChannel(const char *iface, int channel) {
|
bool SetInterfaceChannel(const char *iface, int channel) {
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
NSString *interfaceName = [NSString stringWithUTF8String:iface];
|
NSString *interfaceName = [NSString stringWithUTF8String:iface];
|
||||||
CWInterface *interface = [CWInterface interfaceWithName:interfaceName];
|
CWInterface *interface = [[CWWiFiClient sharedWiFiClient] interfaceWithName: interfaceName];
|
||||||
if (!interface) {
|
if (!interface) {
|
||||||
|
NSLog(@"failed to serialize get interface by nmae: %@", interfaceName);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +60,7 @@ bool SetInterfaceChannel(const char *iface, int channel) {
|
||||||
if ([channelObj channelNumber] == channel) {
|
if ([channelObj channelNumber] == channel) {
|
||||||
[interface setWLANChannel:channelObj error:nil];
|
[interface setWLANChannel:channelObj error:nil];
|
||||||
if (error) {
|
if (error) {
|
||||||
NSLog(@"Failed to set channel: %@", error);
|
NSLog(@"failed to set channel: %@", error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue