mirror of
https://github.com/mbilker/kbinxml-rs.git
synced 2026-09-09 19:15:27 -05:00
lib: support writing attribute key names uncompressed
This commit is contained in:
11
src/lib.rs
11
src/lib.rs
@@ -196,7 +196,6 @@ impl KbinXml {
|
||||
count);
|
||||
|
||||
node_buf.write_u8(node_type.id | array_mask).context(KbinErrorKind::DataWrite(node_type.name))?;
|
||||
|
||||
match self.options.compression {
|
||||
Compression::Compressed => Sixbit::pack(&mut **node_buf, input.name())?,
|
||||
Compression::Uncompressed => {
|
||||
@@ -252,7 +251,15 @@ impl KbinXml {
|
||||
|
||||
let node_type = StandardType::Attribute;
|
||||
node_buf.write_u8(node_type.id).context(KbinErrorKind::DataWrite(node_type.name))?;
|
||||
Sixbit::pack(&mut **node_buf, key)?;
|
||||
match self.options.compression {
|
||||
Compression::Compressed => Sixbit::pack(&mut **node_buf, key)?,
|
||||
Compression::Uncompressed => {
|
||||
let data = self.options.encoding.encode_bytes(key)?;
|
||||
let len = (data.len() - 1) as u8;
|
||||
node_buf.write_u8(len | ARRAY_MASK).context(KbinErrorKind::DataWrite("attribute name length"))?;
|
||||
node_buf.write_all(&data).context(KbinErrorKind::DataWrite("node name bytes"))?;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
for child in input.children() {
|
||||
|
||||
Reference in New Issue
Block a user