Skip to content

Commit

Permalink
Fix static error when converting uintptr in gl.Ptr (#111)
Browse files Browse the repository at this point in the history
reflect will always panic on this conversion.  As uintptr is an integer type, it is not interpreted as a pointer in itself.  Also, this call is redundant per se as it returns a uintptr.  Just converting data to a uintptr and passing to unsafe.Pointer should get the expected result.
  • Loading branch information
HymnsForDisco authored Dec 24, 2020
1 parent b0ec079 commit f340092
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tmpl/conversions.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func Ptr(data interface{}) unsafe.Pointer {
panic(fmt.Errorf("unsupported pointer to type %s; must be a slice or pointer to a singular scalar value or the first element of an array or slice", e.Kind()))
}
case reflect.Uintptr:
addr = unsafe.Pointer(v.Pointer())
addr = unsafe.Pointer(data.(uintptr))
case reflect.Slice:
addr = unsafe.Pointer(v.Index(0).UnsafeAddr())
default:
Expand Down

0 comments on commit f340092

Please sign in to comment.