Commit Graph

13 Commits

Author SHA1 Message Date
Denys Vlasenko
ca2f831ead hexedit: fixes for redraw and down movement causing SEGV on attempt to access
"Go to:" command was not updating row position, making next "down" movements
for one screenful print empty lines instead of showing the contents.

If the file is whole pages long, "down" movement at EOF was advancing position
+16 bytes, mapping the next portion (entirely past the end of the file),
then finding out that the new position is beyond the EOF, rolling it back
-16 bytes... ending up with this postion pointing *before* the mapped portion.
Any next access (e.g. "move right" key) SEGVs.

function                                             old     new   delta
hexedit_main                                        1170    1184     +14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-07-23 14:26:55 +02:00
Denys Vlasenko
38da4c4420 config: add size estimations for a few applets
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-14 12:03:33 +01:00
Denys Vlasenko
e58b44755d hexedit: code shrink
function                                             old     new   delta
hexedit_main                                        1171    1170      -1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-09-15 15:23:47 +02:00
Denys Vlasenko
f3fa865258 hexedit: fixes to "goto address" code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-09-15 14:00:41 +02:00
Denys Vlasenko
9a4100cf53 hexedit: position in correct column on "goto" command
function                                             old     new   delta
hexedit_main                                        1169    1202     +33

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-09-14 13:57:07 +02:00
Denys Vlasenko
44cb1666ef hexedit: code shrink
function                                             old     new   delta
hexedit_main                                        1176    1169      -7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-09-14 11:20:36 +02:00
Denys Vlasenko
8838c6d53e hexdump: code shrink
function                                             old     new   delta
remap                                                173     178      +5
move_mapping_lower                                   107     109      +2
move_mapping_further                                 141     143      +2
hexedit_main                                        1191    1176     -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 9/-15)              Total: -6 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-09-14 11:01:37 +02:00
Denys Vlasenko
d54f58d487 hexedit: implement "[enter] goto offset" key
This is a must if you need to edit sector 123456789999 on your /dev/disk.

   text	   data	    bss	    dec	    hex	filename
 922745	    481	   6832	 930058	  e310a	busybox_old
 923023	    481	   6832	 930336	  e3220	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-09-14 10:51:12 +02:00
Denys Vlasenko
363fb5ec40 hexedit: restore screen on exit
function                                             old     new   delta
hexedit_main                                         998    1082     +84
restore_term                                           -      29     +29
remap                                                168     173      +5
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/0 up/down: 118/0)             Total: 118 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-09-14 09:42:40 +02:00
Denys Vlasenko
d72e804e6d hexedit: optimize output buffering
function                                             old     new   delta
hexedit_main                                         970     998     +28

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-09-14 00:04:16 +02:00
Denys Vlasenko
62643017c3 hexedit: implement page up/down
function                                             old     new   delta
hexedit_main                                         924     970     +46

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-09-13 23:02:51 +02:00
Denys Vlasenko
136946c3ea hexedit: smarter redraw
function                                             old     new   delta
format_line                                          197     209     +12
hexedit_main                                         930     924      -6
redraw_cur_line                                      104      94     -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 12/-16)             Total: -4 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-09-13 21:38:55 +02:00
Denys Vlasenko
73af705628 hexedit: new applet
function                                             old     new   delta
hexedit_main                                           -     930    +930
format_line                                            -     197    +197
remap                                                  -     168    +168
move_mapping_further                                   -     141    +141
move_mapping_lower                                     -     107    +107
redraw_cur_line                                        -     104    +104
packed_usage                                       31802   31812     +10
applet_names                                        2688    2696      +8
applet_main                                         1552    1556      +4
applet_suid                                           97      98      +1
applet_install_loc                                   194     195      +1
------------------------------------------------------------------------------
(add/remove: 7/0 grow/shrink: 5/0 up/down: 1671/0)           Total: 1671 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-09-13 19:20:27 +02:00