From 08894025bc08be9629a1c2af6e8e7270f5be91c6 Mon Sep 17 00:00:00 2001 From: morpingsss Date: Fri, 12 Jul 2024 14:48:17 +0800 Subject: [PATCH] fix(cpp/inih) : Use unsafe.Point to replace stirringHead --- cpp/inih/inihReader.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/cpp/inih/inihReader.go b/cpp/inih/inihReader.go index 23163eb9..b1b682d1 100644 --- a/cpp/inih/inihReader.go +++ b/cpp/inih/inihReader.go @@ -15,11 +15,6 @@ type StdString struct { buf [24]byte } -type stringHead struct { - data unsafe.Pointer - size int -} - type __long struct { __cap_ int __size_ int @@ -37,7 +32,7 @@ func (r *StdString) String() string { return c.GoString((*c.Char)(unsafe.Pointer(&r.buf[1]))) } else { v := *(*__long)(unsafe.Pointer(&r.buf[0])) - return *(*string)(unsafe.Pointer(&stringHead{data: v.__data_, size: v.__size_})) + return unsafe.String((*byte)(v.__data_), v.__size_) } }