diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2023-03-21 14:03:15 +0100 |
|---|---|---|
| committer | Jeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com> | 2023-09-25 09:43:37 +0200 |
| commit | 01edc951094822b1bee98ae6ddd3930d16b1bfe2 (patch) | |
| tree | 36229d2f200c9b60504ef01a923c720d1999627f | |
| parent | 6017b58600910e83e6177044e4e69b9ff556a70c (diff) | |
Exports + Python: Compare booleans with != 0 instead of == 1
Reported by: Simon Rozman <simon@rozman.si>
| -rw-r--r-- | exports/exports.go | 8 | ||||
| -rw-r--r-- | wrappers/python/eduvpn_common/types.py | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/exports/exports.go b/exports/exports.go index 724185a..be53079 100644 --- a/exports/exports.go +++ b/exports/exports.go @@ -78,7 +78,7 @@ func StateCallback( dataC := C.CString(d) handled := C.call_callback(PStateCallback, oldStateC, newStateC, unsafe.Pointer(dataC)) FreeString(dataC) - return handled == C.int(1) + return handled != C.int(0) } func getVPNState() (*client.Client, error) { @@ -108,7 +108,7 @@ func Register( C.GoString(version), C.GoString(configDirectory), StateCallback, - debug == 1, + debug != 0, ) return getCError(registerErr) @@ -257,7 +257,7 @@ func GetConfig(_type C.int, id *C.char, pTCP C.int, tokens *C.char) (*C.char, *C if stateErr != nil { return nil, getCError(stateErr) } - preferTCPBool := pTCP == 1 + preferTCPBool := pTCP != 0 tok, err := getTokens(tokens) if err != nil { return nil, getCError(err) @@ -367,7 +367,7 @@ func SetSupportWireguard(support C.int) *C.char { if stateErr != nil { return getCError(stateErr) } - state.SupportsWireguard = support == 1 + state.SupportsWireguard = support != 0 return nil } diff --git a/wrappers/python/eduvpn_common/types.py b/wrappers/python/eduvpn_common/types.py index ea5bbd2..4e54ad3 100644 --- a/wrappers/python/eduvpn_common/types.py +++ b/wrappers/python/eduvpn_common/types.py @@ -107,4 +107,4 @@ def get_bool(lib: CDLL, boolInt: c_int) -> bool: :return: The boolean converted to Python :rtype: bool """ - return boolInt == 1 + return boolInt != 0 |
