Skip to content

Commit

Permalink
chore: rename boolToCInt to CUchar
Browse files Browse the repository at this point in the history
  • Loading branch information
YOU54F committed Jul 3, 2024
1 parent ebcaa29 commit a272944
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions internal/native/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,19 @@ func (v *Verifier) SetFilterInfo(description string, state string, noState bool)
cFilterState := C.CString(state)
defer free(cFilterState)

C.pactffi_verifier_set_filter_info(v.handle, cFilterDescription, cFilterState, boolToCInt(noState))
C.pactffi_verifier_set_filter_info(v.handle, cFilterDescription, cFilterState, boolToCUchar(noState))
}

func (v *Verifier) SetProviderState(url string, teardown bool, body bool) {
cURL := C.CString(url)
defer free(cURL)

C.pactffi_verifier_set_provider_state(v.handle, cURL, boolToCInt(teardown), boolToCInt(body))
C.pactffi_verifier_set_provider_state(v.handle, cURL, boolToCUchar(teardown), boolToCUchar(body))
}

func (v *Verifier) SetVerificationOptions(disableSSLVerification bool, requestTimeout int64) {
// TODO: this returns an int and therefore can error. We should have all of these functions return values??
C.pactffi_verifier_set_verification_options(v.handle, boolToCInt(disableSSLVerification), C.ulong(requestTimeout))
C.pactffi_verifier_set_verification_options(v.handle, boolToCUchar(disableSSLVerification), C.ulong(requestTimeout))
}

func (v *Verifier) SetConsumerFilters(consumers []string) {
Expand Down Expand Up @@ -181,7 +181,7 @@ func (v *Verifier) BrokerSourceWithSelectors(url string, username string, passwo
cProviderBranch := C.CString(providerBranch)
defer free(cProviderBranch)

C.pactffi_verifier_broker_source_with_selectors(v.handle, cUrl, cUsername, cPassword, cToken, boolToCInt(enablePending), cIncludeWipPactsSince, stringArrayToCStringArray(providerTags), C.ushort(len(providerTags)), cProviderBranch, stringArrayToCStringArray(selectors), C.ushort(len(selectors)), stringArrayToCStringArray(consumerVersionTags), C.ushort(len(consumerVersionTags)))
C.pactffi_verifier_broker_source_with_selectors(v.handle, cUrl, cUsername, cPassword, cToken, boolToCUchar(enablePending), cIncludeWipPactsSince, stringArrayToCStringArray(providerTags), C.ushort(len(providerTags)), cProviderBranch, stringArrayToCStringArray(selectors), C.ushort(len(selectors)), stringArrayToCStringArray(consumerVersionTags), C.ushort(len(consumerVersionTags)))
}

func (v *Verifier) SetPublishOptions(providerVersion string, buildUrl string, providerTags []string, providerBranch string) {
Expand Down Expand Up @@ -216,11 +216,11 @@ func (v *Verifier) Execute() error {
}

func (v *Verifier) SetNoPactsIsError(isError bool) {
C.pactffi_verifier_set_no_pacts_is_error(v.handle, boolToCInt(isError))
C.pactffi_verifier_set_no_pacts_is_error(v.handle, boolToCUchar(isError))
}

func (v *Verifier) SetColoredOutput(isColoredOutput bool) {
C.pactffi_verifier_set_coloured_output(v.handle, boolToCInt(isColoredOutput))
C.pactffi_verifier_set_coloured_output(v.handle, boolToCUchar(isColoredOutput))
}

func stringArrayToCStringArray(inputs []string) **C.char {
Expand All @@ -237,7 +237,7 @@ func stringArrayToCStringArray(inputs []string) **C.char {
return (**C.char)(unsafe.Pointer(&output[0]))
}

func boolToCInt(val bool) C.uchar {
func boolToCUchar(val bool) C.uchar {
if val {
return C.uchar(1)
}
Expand Down

0 comments on commit a272944

Please sign in to comment.