aboutsummaryrefslogtreecommitdiff
path: root/objectheader
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-04 08:26:56 +0800
committerGravatar Runxi Yu2026-03-04 08:59:53 +0800
commitab7501be34032fb9e5c48726a68ae90a917af9eb (patch)
tree20d005647569befea8133e953c3270e8fd2a2a5b /objectheader
parent*: gofumpt (diff)
signatureNo signature
*: Lint
Diffstat (limited to 'objectheader')
-rw-r--r--objectheader/append.go2
-rw-r--r--objectheader/parse.go2
2 files changed, 4 insertions, 0 deletions
diff --git a/objectheader/append.go b/objectheader/append.go
index 3965dc21..bfccf388 100644
--- a/objectheader/append.go
+++ b/objectheader/append.go
@@ -11,6 +11,7 @@ func Append(dst []byte, ty objecttype.Type, size int64) ([]byte, bool) {
if size < 0 {
return nil, false
}
+
tyName, ok := objecttype.Name(ty)
if !ok {
return nil, false
@@ -23,5 +24,6 @@ func Append(dst []byte, ty objecttype.Type, size int64) ([]byte, bool) {
out = append(out, ' ')
out = append(out, sizeStr...)
out = append(out, 0)
+
return out, true
}
diff --git a/objectheader/parse.go b/objectheader/parse.go
index 72d91d3e..677dffdb 100644
--- a/objectheader/parse.go
+++ b/objectheader/parse.go
@@ -21,6 +21,7 @@ func Parse(data []byte) (objecttype.Type, int64, int, bool) {
if nulRel < 0 {
return objecttype.TypeInvalid, 0, 0, false
}
+
nul := space + 1 + nulRel
ty, ok := objecttype.ParseName(string(data[:space]))
@@ -32,6 +33,7 @@ func Parse(data []byte) (objecttype.Type, int64, int, bool) {
if len(sizeBytes) == 0 {
return objecttype.TypeInvalid, 0, 0, false
}
+
size, err := strconv.ParseInt(string(sizeBytes), 10, 64)
if err != nil || size < 0 {
return objecttype.TypeInvalid, 0, 0, false