| Index: third_party/sqlite/src/tool/restore_jrnl.tcl
|
| diff --git a/third_party/sqlite/src/tool/restore_jrnl.tcl b/third_party/sqlite/src/tool/restore_jrnl.tcl
|
| index 05af4f9a2a8b9ddc0d81041e6976546a9ca1735c..65dee80ca27393b925cdb3b61403ed65b26ec9ef 100644
|
| --- a/third_party/sqlite/src/tool/restore_jrnl.tcl
|
| +++ b/third_party/sqlite/src/tool/restore_jrnl.tcl
|
| @@ -114,40 +114,40 @@ proc dump_jrnl_page {jrnl_pgno} {
|
| set db_pgno [hexio_get_int [hexio_read $jrnl_name [expr $jrnl_pg_offset] 4]]
|
| set chksum [hexio_get_int [hexio_read $jrnl_name [expr $jrnl_pg_offset+4+$db_pgsz] 4]]
|
| set nonce [calc_nonce $jrnl_pgno]
|
| - puts [ format {jrnl_pg_offset: %08x (%d) jrnl_pgno: %d db_pgno: %d} \
|
| - $jrnl_pg_offset $jrnl_pg_offset \
|
| - $jrnl_pgno $db_pgno]
|
| - puts [ format {nonce: %08x chksum: %08x} \
|
| - $nonce $chksum]
|
| + puts [ format {jrnl_pg_offset: %08x (%d) jrnl_pgno: %d db_pgno: %d} \
|
| + $jrnl_pg_offset $jrnl_pg_offset \
|
| + $jrnl_pgno $db_pgno]
|
| + puts [ format {nonce: %08x chksum: %08x} \
|
| + $nonce $chksum]
|
|
|
| # now hex dump the data
|
| - # This is derived from the Tcler's WIKI
|
| - set fid [open $jrnl_name r]
|
| - fconfigure $fid -translation binary -encoding binary
|
| - seek $fid [expr $jrnl_pg_offset+4]
|
| - set data [read $fid $db_pgsz]
|
| - close $fid
|
| + # This is derived from the Tcler's WIKI
|
| + set fid [open $jrnl_name r]
|
| + fconfigure $fid -translation binary -encoding binary
|
| + seek $fid [expr $jrnl_pg_offset+4]
|
| + set data [read $fid $db_pgsz]
|
| + close $fid
|
| for {set addr 0} {$addr<$db_pgsz} {set addr [expr $addr+16]} {
|
| - # get 16 bytes of data
|
| - set s [string range $data $addr [expr $addr+16]]
|
| -
|
| - # Convert the data to hex and to characters.
|
| - binary scan $s H*@0a* hex ascii
|
| -
|
| - # Replace non-printing characters in the data.
|
| - regsub -all -- {[^[:graph:] ]} $ascii {.} ascii
|
| -
|
| - # Split the 16 bytes into two 8-byte chunks
|
| - regexp -- {(.{16})(.{0,16})} $hex -> hex1 hex2
|
| -
|
| - # Convert the hex to pairs of hex digits
|
| - regsub -all -- {..} $hex1 {& } hex1
|
| - regsub -all -- {..} $hex2 {& } hex2
|
| -
|
| - # Print the hex and ascii data
|
| - puts [ format {%08x %-24s %-24s %-16s} \
|
| - $addr $hex1 $hex2 $ascii ]
|
| - }
|
| + # get 16 bytes of data
|
| + set s [string range $data $addr [expr $addr+16]]
|
| +
|
| + # Convert the data to hex and to characters.
|
| + binary scan $s H*@0a* hex ascii
|
| +
|
| + # Replace non-printing characters in the data.
|
| + regsub -all -- {[^[:graph:] ]} $ascii {.} ascii
|
| +
|
| + # Split the 16 bytes into two 8-byte chunks
|
| + regexp -- {(.{16})(.{0,16})} $hex -> hex1 hex2
|
| +
|
| + # Convert the hex to pairs of hex digits
|
| + regsub -all -- {..} $hex1 {& } hex1
|
| + regsub -all -- {..} $hex2 {& } hex2
|
| +
|
| + # Print the hex and ascii data
|
| + puts [ format {%08x %-24s %-24s %-16s} \
|
| + $addr $hex1 $hex2 $ascii ]
|
| + }
|
| }
|
|
|
| # Setup for the tests. Make a backup copy of the files.
|
|
|