mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-30 09:37:26 +08:00
This commit is contained in:
1 parent
13dbacad15
commit
f71000befd
45 files changed
+4383
-422
No files matched your search
@@ -46,6 +46,27 @@ type u3dHistogram struct {
|
||||
total uint32
|
||||
}
|
||||
|
||||
// finish 校验压缩块的冲刷字段及结束位置
|
||||
// 返回: error 截断、冲刷或多余数据错误
|
||||
func (r *u3dBits) finish() error {
|
||||
if r.err != nil {
|
||||
return r.err
|
||||
}
|
||||
if r.pos > uint64(len(r.data))*8 {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if r.u32() != 0 {
|
||||
return fmt.Errorf("invalid U3D compression flush")
|
||||
}
|
||||
if r.err != nil {
|
||||
return r.err
|
||||
}
|
||||
if (r.pos-16+7)/8 != uint64(len(r.data)) {
|
||||
return fmt.Errorf("unexpected U3D compressed block data")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// take 读取定长字段,失败后不继续推进位置
|
||||
// 入参: size 字节数
|
||||
// 返回: []byte 字段数据,失败时为空
|
||||
|
||||
Reference in new issue
Block a user