plugeth/vendor/github.com/mattn/go-ieproxy/utils.go
Alexander van der Meij 57d9c93dcd vendor, internal/build: fix OpenBSD by bumping Azure libs (#17966)
* bump azure-storage-blob-go dependency to 0.3.0 release

* update azure-storage-blob-go module import path

* fix multiple return values on azblob.NewSharedKeyCredential

* vendor: bump Azure libs to latest from upstream
2019-07-23 15:06:44 +03:00

24 lines
350 B
Go

package ieproxy
import (
"unicode/utf16"
"unsafe"
)
// StringFromUTF16Ptr converts a *uint16 C string to a Go String
func StringFromUTF16Ptr(s *uint16) string {
if s == nil {
return ""
}
p := (*[1<<30 - 1]uint16)(unsafe.Pointer(s))
// find the string length
sz := 0
for p[sz] != 0 {
sz++
}
return string(utf16.Decode(p[:sz:sz]))
}