mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
remove usage of gconv.Unsafe* functions internally to avoid unexpected errors
This commit is contained in:
@ -12,7 +12,6 @@ import (
|
||||
"github.com/gogf/gf/encoding/gxml"
|
||||
"github.com/gogf/gf/encoding/gyaml"
|
||||
"github.com/gogf/gf/internal/json"
|
||||
"github.com/gogf/gf/util/gconv"
|
||||
)
|
||||
|
||||
// ========================================================================
|
||||
@ -50,7 +49,7 @@ func (j *Json) MustToJson() []byte {
|
||||
}
|
||||
|
||||
func (j *Json) MustToJsonString() string {
|
||||
return gconv.UnsafeBytesToStr(j.MustToJson())
|
||||
return string(j.MustToJson())
|
||||
}
|
||||
|
||||
func (j *Json) MustToJsonIndent() []byte {
|
||||
@ -62,7 +61,7 @@ func (j *Json) MustToJsonIndent() []byte {
|
||||
}
|
||||
|
||||
func (j *Json) MustToJsonIndentString() string {
|
||||
return gconv.UnsafeBytesToStr(j.MustToJsonIndent())
|
||||
return string(j.MustToJsonIndent())
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
@ -96,7 +95,7 @@ func (j *Json) MustToXml(rootTag ...string) []byte {
|
||||
}
|
||||
|
||||
func (j *Json) MustToXmlString(rootTag ...string) string {
|
||||
return gconv.UnsafeBytesToStr(j.MustToXml(rootTag...))
|
||||
return string(j.MustToXml(rootTag...))
|
||||
}
|
||||
|
||||
func (j *Json) MustToXmlIndent(rootTag ...string) []byte {
|
||||
@ -108,7 +107,7 @@ func (j *Json) MustToXmlIndent(rootTag ...string) []byte {
|
||||
}
|
||||
|
||||
func (j *Json) MustToXmlIndentString(rootTag ...string) string {
|
||||
return gconv.UnsafeBytesToStr(j.MustToXmlIndent(rootTag...))
|
||||
return string(j.MustToXmlIndent(rootTag...))
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
@ -135,7 +134,7 @@ func (j *Json) MustToYaml() []byte {
|
||||
}
|
||||
|
||||
func (j *Json) MustToYamlString() string {
|
||||
return gconv.UnsafeBytesToStr(j.MustToYaml())
|
||||
return string(j.MustToYaml())
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
@ -162,7 +161,7 @@ func (j *Json) MustToToml() []byte {
|
||||
}
|
||||
|
||||
func (j *Json) MustToTomlString() string {
|
||||
return gconv.UnsafeBytesToStr(j.MustToToml())
|
||||
return string(j.MustToToml())
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
@ -192,5 +191,5 @@ func (j *Json) MustToIni() []byte {
|
||||
|
||||
// MustToIniString .
|
||||
func (j *Json) MustToIniString() string {
|
||||
return gconv.UnsafeBytesToStr(j.MustToIni())
|
||||
return string(j.MustToIni())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user