mirror of
https://gitee.com/willfree/min-dev-java.git
synced 2026-10-04 19:42:01 +08:00
fixed some error: Block
This commit is contained in:
1 parent
3daf0156e0
commit
99d7f94fec
1 file changed
+8
-8
@@ -343,16 +343,16 @@ public class Block {
|
||||
if(this.hasValue()){
|
||||
// 如果设置了 value ,则直接使用
|
||||
int tmplen=encoder.appendByteArray(this.value,new SizeT(this.value.length));
|
||||
if(tmplen==0){
|
||||
return 0;
|
||||
if(tmplen<=0){
|
||||
return -1;
|
||||
}
|
||||
len+=tmplen;
|
||||
}else{
|
||||
// 如果 value 为空,则看 elements 中有没有子TLV Block,有则编码后插入
|
||||
for(Block subBlock:this.elements.getElements()){
|
||||
int tmplen=subBlock.encode(encoder);
|
||||
if(tmplen==0){
|
||||
return 0;
|
||||
if(tmplen<=0){
|
||||
return -1;
|
||||
}
|
||||
len+=tmplen;
|
||||
}
|
||||
@@ -360,15 +360,15 @@ public class Block {
|
||||
|
||||
// 编码 TLV-LENGTH
|
||||
int tmplen=encoder.prependVarNumber(new VlInt(len));
|
||||
if(tmplen==0){
|
||||
return 0;
|
||||
if(tmplen<=0){
|
||||
return -1;
|
||||
}
|
||||
len+=tmplen;
|
||||
|
||||
// 编码 TLV-TYPE
|
||||
tmplen=encoder.prependVarNumber(this.tlvType);
|
||||
if(tmplen==0){
|
||||
return 0;
|
||||
if(tmplen<=0){
|
||||
return -1;
|
||||
}
|
||||
len+=tmplen;
|
||||
|
||||
|
||||
Reference in new issue
Block a user