mirror of
https://github.com/json-iterator/go.git
synced 2025-02-01 19:14:29 +02:00
try to fix #194 with larger array
This commit is contained in:
parent
b1b003864e
commit
9fddff05f0
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
.idea
|
||||
/coverage.txt
|
||||
/profile.out
|
||||
/bug_test.go
|
||||
|
@ -168,7 +168,7 @@ func (iter *Iterator) isObjectEnd() bool {
|
||||
if c == '}' {
|
||||
return true
|
||||
}
|
||||
iter.ReportError("isObjectEnd", "object ended prematurely")
|
||||
iter.ReportError("isObjectEnd", "object ended prematurely, unexpected char " + string([]byte{c}))
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -128,11 +128,9 @@ func growOne(slice *sliceHeader, sliceType reflect.Type, elementType reflect.Typ
|
||||
dst := unsafe.Pointer(newVal.Pointer())
|
||||
// copy old array into new array
|
||||
originalBytesCount := uintptr(slice.Len) * elementType.Size()
|
||||
srcPtr := (*[1 << 30]byte)(slice.Data)
|
||||
dstPtr := (*[1 << 30]byte)(dst)
|
||||
for i := uintptr(0); i < originalBytesCount; i++ {
|
||||
dstPtr[i] = srcPtr[i]
|
||||
}
|
||||
srcPtr := (*[1 << 49]byte)(slice.Data)
|
||||
dstPtr := (*[1 << 49]byte)(dst)
|
||||
copy(dstPtr[:originalBytesCount], srcPtr[:originalBytesCount])
|
||||
slice.Data = dst
|
||||
slice.Len = newLen
|
||||
slice.Cap = newCap
|
||||
|
Loading…
x
Reference in New Issue
Block a user