mirror of
https://gitee.com/energye/energy.git
synced 2024-11-30 10:47:57 +08:00
优化&修复 tag -> v17
This commit is contained in:
parent
4d237dbc1a
commit
6b2c675a74
@ -12,6 +12,7 @@
|
||||
package cef
|
||||
|
||||
import (
|
||||
"github.com/energye/energy/common"
|
||||
"github.com/energye/energy/common/imports"
|
||||
"github.com/energye/golcl/lcl/api"
|
||||
"unsafe"
|
||||
@ -73,8 +74,7 @@ func (m *ICefStringMultiMap) GetKey(index uint32) string {
|
||||
func (m *ICefStringMultiMap) GetValue(index uint32) string {
|
||||
var result uintptr
|
||||
imports.Proc(internale_StringMultimap_GetValue).Call(m.Instance(), uintptr(index), uintptr(unsafe.Pointer(&result)))
|
||||
resultString := (*StringHeader)(unsafe.Pointer(result))
|
||||
return resultString.GoStr()
|
||||
return common.GoStr(result)
|
||||
}
|
||||
|
||||
// Append 给key追加值
|
||||
|
@ -330,18 +330,6 @@ type Exception struct {
|
||||
message string
|
||||
}
|
||||
|
||||
type StringHeader struct {
|
||||
value uintptr
|
||||
length uintptr
|
||||
}
|
||||
|
||||
func (m *StringHeader) GoStr() string {
|
||||
if m == nil || m.length <= 0 {
|
||||
return ""
|
||||
}
|
||||
return *(*string)(unsafe.Pointer(m))
|
||||
}
|
||||
|
||||
func (m *Exception) SetMessage(message string) {
|
||||
m.message = message
|
||||
}
|
||||
|
@ -638,3 +638,14 @@ func GoroutineID() (id uint64) {
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
func GoStr(ptr uintptr) string {
|
||||
if ptr == 0 {
|
||||
return ""
|
||||
}
|
||||
resultString := (*reflect.StringHeader)(unsafe.Pointer(ptr))
|
||||
if resultString == nil || resultString.Len <= 0 {
|
||||
return ""
|
||||
}
|
||||
return *(*string)(unsafe.Pointer(resultString))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user