Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/handlers/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"flag"
"log"
"path/filepath"

"github.com/sciter-sdk/go-sciter"
"github.com/sciter-sdk/go-sciter/rice"
"github.com/sciter-sdk/go-sciter/window"
Expand All @@ -25,7 +25,7 @@ func setEventHandler(w *window.Window) {
return rval
})
w.DefineFunction("sumall", func(args ...*sciter.Value) *sciter.Value {
sum := 0
sum := int32(0)
for i := 0; i < len(args); i++ {
sum += args[i].Int()
}
Expand Down
6 changes: 3 additions & 3 deletions sciter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2051,9 +2051,9 @@ func NewSymbol(sym string) *Value {
}

// UINT ValueIntData ( const VALUE* pval, INT* pData ) ;//{ return SAPI()->ValueIntData ( pval, pData ); }
func (pdst *Value) Int() int {
func (pdst *Value) Int() int32 {
cpdst := (*C.VALUE)(unsafe.Pointer(pdst))
var data int = 0
var data int32 = 0
pData := (*C.INT)(unsafe.Pointer(&data))
ret := VALUE_RESULT(C.ValueIntData(cpdst, pData))
if ret == HV_OK {
Expand All @@ -2063,7 +2063,7 @@ func (pdst *Value) Int() int {
}

// UINT ValueIntDataSet ( VALUE* pval, INT data, UINT type, UINT units ) ;//{ return SAPI()->ValueIntDataSet ( pval, data,type,units ); }
func (pdst *Value) SetInt(data int) error {
func (pdst *Value) SetInt(data int32) error {
cpdst := (*C.VALUE)(unsafe.Pointer(pdst))
// args
return wrapValueResult(VALUE_RESULT(C.ValueIntDataSet(cpdst, C.INT(data), T_INT, 0)), "ValueIntDataSet")
Expand Down
22 changes: 12 additions & 10 deletions value.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ func (v *Value) Assign(val interface{}) {
case string:
s := val.(string)
v.SetString(s)
case int:
i := val.(int)
case int32:
i := val.(int32)
v.SetInt(i)
case float64:
f := val.(float64)
Expand All @@ -83,19 +83,21 @@ func (v *Value) Assign(val interface{}) {
if val.(bool) {
i = 1
}
v.SetInt(i)
v.SetInt(int32(i))
case float32:
v.Assign(float64(val.(float32)))
case int:
// TODO: should we check if it's too big?
v.Assign(int32(val.(int)))
case uint:
v.Assign(int(val.(uint)))
v.Assign(uint32(val.(uint)))
case uint32:
v.Assign(int(val.(uint32)))
case uint64:
v.Assign(int(val.(uint64)))
case int32:
v.Assign(int(val.(int32)))
v.Assign(int32(val.(uint32)))
case int64:
v.Assign(int(val.(int64)))
// TODO: should we check if it's too big?
v.Assign(int32(val.(int64)))
case uint64:
v.Assign(int64(val.(uint64)))
case Value:
vf := val.(Value)
v.Copy(&vf)
Expand Down