修复codec编码工具错误代码
This commit is contained in:
parent
00eec6c3c6
commit
3fcf0b4e09
@ -52,6 +52,7 @@ func ReadBigFloatForString(buf []byte) (ret *big.Float, n int, err error) {
|
||||
func ReadFloat32ForString(buf []byte) (ret float32, n int, err error) {
|
||||
if buf[0] == '-' {
|
||||
ret, n, err = readPositiveFloat32(buf[1:])
|
||||
n++
|
||||
ret = -ret
|
||||
return
|
||||
}
|
||||
@ -60,6 +61,7 @@ func ReadFloat32ForString(buf []byte) (ret float32, n int, err error) {
|
||||
func ReadFloat64ForString(buf []byte) (ret float64, n int, err error) {
|
||||
if buf[0] == '-' {
|
||||
ret, n, err = readPositiveFloat64(buf[1:])
|
||||
n++
|
||||
ret = -ret
|
||||
return
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ func ReadInt8ForString(buf []byte) (ret int8, n int, err error) {
|
||||
c := buf[0]
|
||||
if c == '-' {
|
||||
val, n, err = ReadUint32ForString(buf[1:])
|
||||
n++
|
||||
if val > math.MaxInt8+1 {
|
||||
err = errors.New("ReadInt8ForString overflow: " + strconv.FormatInt(int64(val), 10))
|
||||
return
|
||||
@ -64,6 +65,7 @@ func ReadInt16ForString(buf []byte) (ret int16, n int, err error) {
|
||||
c := buf[0]
|
||||
if c == '-' {
|
||||
val, n, err = ReadUint32ForString(buf[1:])
|
||||
n++
|
||||
if val > math.MaxInt16+1 {
|
||||
err = errors.New("ReadInt16ForString overflow: " + strconv.FormatInt(int64(val), 10))
|
||||
return
|
||||
@ -87,6 +89,7 @@ func ReadInt32ForString(buf []byte) (ret int32, n int, err error) {
|
||||
c := buf[0]
|
||||
if c == '-' {
|
||||
val, n, err = ReadUint32ForString(buf[1:])
|
||||
n++
|
||||
if val > math.MaxInt32+1 {
|
||||
err = errors.New("ReadInt32ForString overflow: " + strconv.FormatInt(int64(val), 10))
|
||||
return
|
||||
@ -110,6 +113,7 @@ func ReadInt64ForString(buf []byte) (ret int64, n int, err error) {
|
||||
c := buf[0]
|
||||
if c == '-' {
|
||||
val, n, err = ReadUint64ForString(buf[1:])
|
||||
n++
|
||||
if val > math.MaxInt64+1 {
|
||||
err = errors.New("ReadInt64ForString overflow: " + strconv.FormatInt(int64(val), 10))
|
||||
return
|
||||
@ -154,6 +158,7 @@ func ReadUint16ForString(buf []byte) (ret uint16, n int, err error) {
|
||||
|
||||
func ReadUint32ForString(buf []byte) (ret uint32, n int, err error) {
|
||||
ind := intDigits[buf[0]]
|
||||
n = 1
|
||||
if ind == 0 {
|
||||
err = assertInteger(buf[1:])
|
||||
return
|
||||
@ -163,7 +168,6 @@ func ReadUint32ForString(buf []byte) (ret uint32, n int, err error) {
|
||||
return
|
||||
}
|
||||
ret = uint32(ind)
|
||||
n = 1
|
||||
if len(buf) > 10 {
|
||||
i := 1
|
||||
ind2 := intDigits[buf[i]]
|
||||
@ -252,6 +256,7 @@ func ReadUint32ForString(buf []byte) (ret uint32, n int, err error) {
|
||||
|
||||
func ReadUint64ForString(buf []byte) (ret uint64, n int, err error) {
|
||||
ind := intDigits[buf[0]]
|
||||
n = 1
|
||||
if ind == 0 {
|
||||
err = assertInteger(buf[1:])
|
||||
return
|
||||
@ -261,7 +266,6 @@ func ReadUint64ForString(buf []byte) (ret uint64, n int, err error) {
|
||||
return
|
||||
}
|
||||
ret = uint64(ind)
|
||||
n = 1
|
||||
if len(buf) > 10 {
|
||||
i := 0
|
||||
ind2 := intDigits[buf[i]]
|
||||
|
@ -30,6 +30,8 @@ func (this *modelShopComp) Init(service core.IService, module core.IModule, comp
|
||||
//查询用户装备数据
|
||||
func (this *modelShopComp) QueryUserShopData(uId string) (data *pb.DBShop, err error) {
|
||||
data = &pb.DBShop{}
|
||||
err = this.Get(uId, data)
|
||||
if err = this.Get(uId, data); err != nil {
|
||||
this.module.Errorf("err:%v", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user