Skip to content

Commit

Permalink
Make sure account and key fields displayed with proper ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
vgrichina committed Feb 15, 2024
1 parent 19e0b08 commit 44b66c7
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions scripts/HexFiend/ChangeIndex.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,35 @@ proc varint {name {delta 0}} {
}
}

proc account_id {} {
proc account_id {name} {
set length [varint ""]
if {$length == 0} {
return ""
}
return [str $length "utf8"]
if {$name ne ""} {
return [str $length "utf8" $name]
} else {
return [str $length "utf8"]
}
}

proc buffer {} {
proc buffer {name} {
set length [varint ""]
if {$length == 0} {
return ""
}
set value [hex $length]
return $value
if {$name ne ""} {
return [hex $length $name]
} else {
return [hex $length]
}
}

set PAGE_SIZE [expr {64 * 1024}]

while {![end]} {
set account [account_id]
set saved_pos [pos]
set account [account_id ""]
if {$account eq ""} {
# if pos not at the end of the page, round it up
if {[pos] % $PAGE_SIZE != 0} {
Expand All @@ -49,16 +57,22 @@ while {![end]} {

continue
}
goto $saved_pos

section -collapsed "Account" {
sectionvalue $account
account_id "account_id"

while {![end]} {
set key [buffer]
set saved_pos [pos]
set key [buffer ""]
if {[string length $key] == 0} {
break
}
goto $saved_pos
section "Key" {
sectionvalue $key
buffer "key"
section -collapsed "Changes" {
set changes_count [varint "count"]
sectionvalue $changes_count
Expand Down

0 comments on commit 44b66c7

Please sign in to comment.