Add option editor_persistent_block to Options/General dialog;
Make persistent/nonpersistent blocks if mcedit;
Enlarged height of Options/General dialog from 17 to 19 lines;
* mc-4.6:
src/file.c: move_dir_dir():
fileopctx.h: set definitely values for FileProgressStatus enum type.
src/file.c: modified error messages fro warn_same_file() function.
non-relevant comment removed
little fix for show message
Denis Vlasenko posted a patch which would fix issue when no dialog for break operation. Trouble: recently i accidentally entered '.' instead of '..' in the file copy dialog on a relatively big tree ... for every file in the tree i got the <foo> and <bar> are the same file message box, without any way to escape except killing mc from the outside. Rework warn_same_file for more usage glib. ... msg = g_strdup_printf() ...
po/sk.po: translation update by Ivan Masár <helix84@centrum.sk>
mountlist: use fsblkcnt_t when available (fixes#179)
Fixed menu painting for NCurses screen library.
Backport: syntax/spec.syntax: .spec syntax update by adamw (#189)
lib/mc.ext.in: command line options fix by adamw (#183)
Conflicts:
ChangeLog
po/az.po
po/be.po
po/bg.po
po/ca.po
po/cs.po
po/da.po
po/de.po
po/el.po
po/es.po
po/eu.po
po/fi.po
po/fr.po
po/hu.po
po/it.po
po/ja.po
po/ko.po
po/lt.po
po/lv.po
po/mn.po
po/nl.po
po/no.po
po/pl.po
po/pt.po
po/pt_BR.po
po/ro.po
po/ru.po
po/sk.po
po/sl.po
po/sr.po
po/sv.po
po/ta.po
po/tr.po
po/uk.po
po/vi.po
po/wa.po
po/zh_CN.po
po/zh_TW.po
src/file.c
* changed type of move_over variable from int to gboolean;
* fixed memory leak: destdir is not free'd when the same directory is copied;
* don't use the non-valid dbuf variable if mc_stat(d, &dbuf) returns non-zero.
* changed type of move_over variable from int to gboolean;
* fixed memory leak: destdir is not free'd when the same directory is copied;
* don't use the non-valid dbuf variable if mc_stat(d, &dbuf) returns non-zero.
screen.o: In function `show_free_space':
/home/dsterba/_dev/mc-build/src/screen.c:783: undefined reference to
`mhl_mem_free'
/home/dsterba/_dev/mc-build/src/screen.c:784: undefined reference to
`mhl_str_dup'
Signed-off-by: David Sterba <dave@jikos.cz>
and add shell_(un)escape again
This patch reintroduces fix firstly appeared in (and recently broken by mhl revert)
> commit e48cb7c89f
> Author: Sergei Trofimovich <st@anti-virus.by>
> Date: Fri Jan 30 09:31:28 2009 +0200
>
> mhl: added mhl_strmove() function (memmove semantics)
...
> Snippet of man strcpy:
> DESCRIPTION
> The strcpy() function copies the string pointed to by src, including the terminating
> null byte ('\0'), to the buffer pointed to by dest. ___The strings may not overlap___,
> and the destination string dest must be large enough to receive the copy.
> We used strcpy to move data chunk in memory: "./foo" -> "foo", etc.
>
> This patch introduces mhl_strmove and fixed canonicalize_pathname.
Conflicts:
src/util.h
Signed-off-by: Patrick Winnertz <winnie@debian.org>
g_strconcat expects 0 as last argument, but mhl_strmove is not.
When reverting this detail was overlooked. Returning 0 as last argument.
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
This pach fixes two issues (both appear only in escapy strings):
* tail cut of escapy string when '\\' is met
* head cut of escapy string when '\\' is met :]
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
This patch reintroduces fix firstly appeared in (and recently broken by mhl revert)
> commit e48cb7c89f
> Author: Sergei Trofimovich <st@anti-virus.by>
> Date: Fri Jan 30 09:31:28 2009 +0200
>
> mhl: added mhl_strmove() function (memmove semantics)
...
> Snippet of man strcpy:
> DESCRIPTION
> The strcpy() function copies the string pointed to by src, including the terminating
> null byte ('\0'), to the buffer pointed to by dest. ___The strings may not overlap___,
> and the destination string dest must be large enough to receive the copy.
> We used strcpy to move data chunk in memory: "./foo" -> "foo", etc.
>
> This patch introduces mhl_strmove and fixed canonicalize_pathname.
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
When we try to complete something what can't be stat()'ed,
we treated it like dir. Now we do not consider such candidates
for completion.
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
This commit will replace some *ptr = c; stuff with g_string_append_c(str,c);
in order to use glib here.
Signed-off-by: Patrick Winnertz <winnie@debian.org>
As we decided to fully switch back to glb we needed to rewrite this function in order to use
glib functions. This means in this case mostly that *ptr = c; ptr++; is replaced by something
like this: g_string_append(str,c); with str a GString*.
Signed-off-by: Patrick Winnertz <winnie@debian.org>
This commit moves the mhl_str_concat_dir_and_file back into src/util.c whitout changing atm the functionality.
Please note that this is an incomplete fix and needs to be partially enhanced in order to keep the full functionality with glib.
Signed-off-by: Patrick Winnertz <winnie@debian.org>
This removes the usage of stdbool.h in favour of mhl/tyes.h as we have to revert everything one by one
Signed-off-by: Patrick Winnertz <winnie@debian.org>
Enrico has accidentially removed the slang1.x support in mc-4.6 branch as
this is a structural change which clearly doesn't belong into mc-4.6.
Signed-off-by: Patrick Winnertz <winnie@debian.org>
./configure --enable-charset && make
charsets.c: In function 'load_codepages_list':
charsets.c:51: warning: implicit declaration of function 'mhl_str_dir_plus_file'
charsets.c:51: warning: assignment makes pointer from integer without a cast
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
* mc-4.6: (38 commits)
mhl: mhl_shell_unescape_buf(): fixed memory array OOB.
completion: fixed complete already escaped secuences.
completion: added changelog entry for solved #147
completion: fixed completion of escaped commands in commandline
Removed unused char*.
mhl: added mhl_strmove() function (memmove semantics)
completion: added escapes in command line on completion
complete: cleanup: #define to enum INPUT_COMPLETION_FLAGS
added a new parameter for completion flags to input_new
fish: cleanup: unboxed quoted strings when generate shell commands
introduced new type SHELL_ESCAPED_STR for more type safety
added mhl/types.h which defines bool enum, escape.h now using this type
Removed unused variable
Changes for use MHL.
Fixed bug with renamig/copying files with backshashes in names
Remove some testing stuff
Temporarry commit. Fixed completion in browse by directoryes.
Fixed some memory leaks.
Add $ and ` for escaping and reorder it according to the ascii values
Rewrite it to use g_string_append_c instead of some homebrew stuff
...
<winnie> ls -lQ /tmp/test
-rw-r--r-- 1 winnie winnie 0 30. Jan 13:05 "a"
-rw-r--r-- 1 winnie winnie 0 30. Jan 13:04 " test\"hallo"
-rw-r--r-- 1 winnie winnie 0 30. Jan 13:04 " test$hallo"
<winnie> and then cat /tmp/test/\ and ESC-tab in subshell...
unescape/escape sequences in command completion (it also solves
completiont of weirdweird escapy commands like ./<escapy-cmd><complete>, like:
$ ls -lQ
-rwxr-xr-x 1 slyfox slyfox 2037 Jan 15 21:18 " 'asd&&\"->build-glib1.sh"
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
* mc-4.6:
replaced buggy concat_dir_and_file() by mhl_str_dir_plus_file()
fixed out-of-tree-builds
Updated the NEWS file for 4.6.2 and added the bugnumbers behind the items in the list.
Update for OpenOffice and StarOffice viewer.
changelog: added entry for python syntax
syntax: python: keywords update (patch by NNemec) fixes#216
AC_USE_SYSTEM_EXTENSIONS macro requires autoconf >= 2.60
po/ru.po: In russian translation, there are some hotkey conficts in menu.
ChangeLog/NEWS: added entry for #181 ticket (copy to deleted dir)
Now a trailing slash will only be added in copy & move dialogs if the path itselfs
copy/move dialog: add trailing '/' to default destination path (fix#181)
fixed comments to /* ... */
Not only comment it out but removing it
Removed unneeded var to make build process a bit cleaner
Add code snipplet by il.smind which should fix issues with putty and
Conflicts:
ChangeLog
mhl/string.h
src/command.c
src/complete.c
src/file.c
src/util.c
valgrind detected an error in completion path:
==2962== Source and destination overlap in strcpy(0x459F068, 0x459F06A)
==2962== at 0x4026056: strcpy (mc_replace_strmem.c:268)
==2962== by 0x808F70B: canonicalize_pathname (string3.h:106)
==2962== by 0x805ECBA: filename_completion_function (complete.c:125)
==2962== by 0x805FB35: command_completion_function (complete.c:448)
==2962== by 0x805EA34: completion_matches (complete.c:552)
==2962== by 0x8060454: complete (complete.c:735)
==2962== by 0x809AAC4: handle_char (widget.c:1545)
==2962== by 0x807867E: midnight_callback (dialog.h:201)
==2962== by 0x8061B27: dlg_process_event (dialog.c:664)
==2962== by 0x8061ECE: run_dlg (dialog.c:786)
==2962== by 0x807996C: main (main.c:1674)
Snippet of man strcpy:
DESCRIPTION
The strcpy() function copies the string pointed to by src, including the terminating
null byte ('\0'), to the buffer pointed to by dest. ___The strings may not overlap___,
and the destination string dest must be large enough to receive the copy.
We used strcpy to move data chunk in memory: "./foo" -> "foo", etc.
This patch introduces mhl_strmove and fixed canonicalize_pathname.
Signed-off-by: Sergei Trofimovich <st@anti-virus.by>
* mc-4.6:
Now a trailing slash will only be added in copy & move dialogs if the path itselfs
copy/move dialog: add trailing '/' to default destination path (fix#181)
Problem:
When user tried to copy/move file (F5/F6) - he could run into trouble if
destination directory is removed (it can be removed by user from another mc session).
Operation is performed and(!) file is renamed.
So when when user issues 'cp /tmp/a.file /tmp/b' - he gets not expected /tmp/b/a.file,
but /tmp.b !
Solution:
Add trailing space for destination directory for non-local copy/move(F5/F6) operations.
So operation, given above will take form: 'cp /tmp/a.file /tmp/b/' disambiguating b
meaning.
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
mhl/escape.h:
add new function mhl_shell_is_char_escaped()
src/command.c; src/complete.c; src/file.c; src/util.c:
Changes for use MHL-functions.
src/util.h:
remove old escape-related declarations of functions
mc (mc over ssh on a putty console)
- to reproduce try this:
1) run 'putty'; login to remote host
2) run mc
3) press key '/' on keypad. You will see menu that is called when you press the F2
4) Go to 'Learn keys' (simple call dialog)
5) just exit from 'learn keys' dialog (without any changes)
6) 3) press key '/' on keypad again. You will see '/' symbol in command line.
experimental patch, completely different reading file, new cache structure,
shall view text in every encodings (remaped ctrl + t, new dialog need
localization).
1. to avoid backward reading, viewer keeps four following characters from
file: next, actual and two previous. This is enough to handle new lines
and nroff fortmatin correctly.
2. cache_line structure, that presents one line in file. cache_line stores,
where line starts and ends in file,number of line and width of line. Width
is at most equal to screen width, so longer lines are cached in more
cache_lines. This makes wrapping text very easy. Cache_lines are stored
in a linked list. file is loaded into cache_lines sequential, not whole at once.
It only provides navigation in file.
I found two problems in this solution:
1. slow first move to end in large files, because can not read files
backward. (loading in background may help)
2. it is slow with multibyte characters. I tried to eliminate calling iconv
to two, but it did not help (iconv is called on every byte). I think
caching some parts of file will be needed.
add support for filesystem, that use others encodings than mc (vfs). Now can be
encoding set only manually, but automatic detection is possible. Filename is
converted in mc_readdir and other function translate it back by vfs_translate
added menu etries encodnig in left and rigth menu (localization will be neede)
modified subshell.c to put subshell correct working directoy,
modified ext.c and execute.c to translate filename before running command
there could be one problem, vfs_translate_path does not use something like
path_magic function
rest of fixes in files cmc.c, main.c (xterm title), panelize.c, subshell.c,
tree.c, tty.c, user.c, util.c, win.c
now, basic mc's function should work well, editor and view are still broken.
like buttons use menu entries hotkey_t. But menus are staticly defined, so this
change is much bigger. All menu declaration must be edited. follow standard
changes in drawing and handling hotkeys.
now basic mc's functions works in utf-8, remain correct calculation of controls
width in dialogs, replace functions like tolower, toupper,isspace, ... width
functions from strutil or g_ascii variant.
like in input, added multibytes characters buffer for search in panel (ctrl+s)
drawing is simplier, because alignment do directly str_fit_to_term function
from strutil, changed time functions in util to work correctly in utf-8
experimental patch, completely different reading file, new cache structure,
shall view text in every encodings (remaped ctrl + t, new dialog need
localization).
1. to avoid backward reading, viewer keeps four following characters from
file: next, actual and two previous. This is enough to handle new lines
and nroff fortmatin correctly.
2. cache_line structure, that presents one line in file. cache_line stores,
where line starts and ends in file,number of line and width of line. Width
is at most equal to screen width, so longer lines are cached in more
cache_lines. This makes wrapping text very easy. Cache_lines are stored
in a linked list. file is loaded into cache_lines sequential, not whole at once.
It only provides navigation in file.
I found two problems in this solution:
1. slow first move to end in large files, because can not read files
backward. (loading in background may help)
2. it is slow with multibyte characters. I tried to eliminate calling iconv
to two, but it did not help (iconv is called on every byte). I think
caching some parts of file will be needed.
add support for filesystem, that use others encodings than mc (vfs). Now can be
encoding set only manually, but automatic detection is possible. Filename is
converted in mc_readdir and other function translate it back by vfs_translate
added menu etries encodnig in left and rigth menu (localization will be neede)
modified subshell.c to put subshell correct working directoy,
modified ext.c and execute.c to translate filename before running command
there could be one problem, vfs_translate_path does not use something like
path_magic function
rest of fixes in files cmc.c, main.c (xterm title), panelize.c, subshell.c,
tree.c, tty.c, user.c, util.c, win.c
now, basic mc's function should work well, editor and view are still broken.
changes in sorting strings (name, extension), for comparing are created keys
from strings and than their are compared instead of primary strings. (in
reality, keys are created only for case insensitive comparing, case
sensitive compare original strings). In utf-8 shall by keys faster than
compare strings directly. But this need ediding declaration of all sorts
functions.
changes in handlig keys,
if key is ascii characters, is clear what to do. But when key is between 0x80 and
0xff, it is impossible say, if is valid, alpha, number, ...
I think, that will be better support multibytes characters directly in message
handler, but is not necessary and my patch do not do that.
like buttons use menu entries hotkey_t. But menus are staticly defined, so this
change is much bigger. All menu declaration must be edited. follow standard
changes in drawing and handling hotkeys.
now basic mc's functions works in utf-8, remain correct calculation of controls
width in dialogs, replace functions like tolower, toupper,isspace, ... width
functions from strutil or g_ascii variant.
like in input, added multibytes characters buffer for search in panel (ctrl+s)
drawing is simplier, because alignment do directly str_fit_to_term function
from strutil, changed time functions in util to work correctly in utf-8
in input widget I made a lot of changes:
1. rename some members in WInput to reflect more their functions
(field_len -> field_width, ...)
2. buffer for reading multibytes characters - charbuf, (taken from UTF-8
patch)
3. modified insert_char to accept mulstibytes characters, drawing changed
4. works only with valid strings, str_fix_string used to assure that
input->buffer is valid
changes in complete.c:
- some iteration strings with ++/-- replaced with str_next_char,
str_prev_char, where was needed. ++ was offset oriented, but str_next_char
use directly referecne (char *), so result is not extra beatiful in every
cases
- other buffer for multibytes characters
- complete only valid filenames
all options of radio box are stored in an array of hotkey_t, so radio box has own
copy of options now (in original mc has only a reference to options), changed
drawing and handling hotkey
text of button stored in hotkey_t instead of char*, modified achown.c, because
access directly button text, change in drawing button adn handling hotkey
add new structure hotkey_t for storings caption with hotkey in buttons, menus,...
contains three strings - start, hotkey, end. So hotkey could be any characters,
but mc's message handles works correct only with ascii characters.
for me is working with hotkey_t easier than how are stored hotkeys in original
mc.
add functions for working with strings
some functions are implemented directlu in strutil.c, others have ascii, 8bit
or utf-8 variant. (8bit means singlebyte encodings, where all characters have
width one). Mc autodetects terminal encoding at start and chooses right
variant. If does not know terminal encoding, chooses ascii variant.
contains functions:
1. for translation strings and growing strings
2. for working with characters (next char, prev char, length in
characters, isspace, isalnum, ...)
3. prepeare for display, replace invalid characters with questionmark,
unprintable with dot, left / right / center align
4. comparing strings
in future all string function from util should be moved into strutil, some
function from util have new variant in strutil.
* src/widget.c (listbox_append_item): Implement LISTBOX_APPEND_SORTED
by insertsort.
* src/chown.c (init_chown): Use LISTBOX_APPEND_SORTED for user and
group list.
* src/achown.c (do_enter_key): Likewise.
(init_subshell): Do not close the pseudo-terminal slave -
store it in `subshell_pty_slave' for later use.
(init_subshell_child): Do not open the pseudo-terminal slave
in the child. It is inherited from the parent now.
Use `subshell_pty_slave' as the file descriptor of the
opened pseudo-terminal slave.
Rearrange the code a bit.
(synchronize): Discard all data from the pseudo-terminal
slave input queue.
Teach all code dealing with nodes that the actual node data
starts right after the first newline following the node
header. Thanks to Grigory Trenin <gtrenin@gmail.com> .
to it.
(select_prev_link): Remove the first argument.
Keep searching until a link is found or end of node delimiter is
reached.
(help_handle_key): Reflect the changes above.
Remove an unneeded check.
variable so that it can be reused when viewing another file.
Do not use the same variable to hold the search string for
both the "Search" and "Regexp Search" functions.
(view_normal_search_cmd): Likewise.
for getmntinfo() returning its result in struct statvfs.
* m4/fstypename.m4: Update to serial#6, which replaces
HAVE_F_FSTYPENAME_IN_STATFS with HAVE_STRUCT_STATFS_F_FSTYPENAME.
* src/mountlist.c: Sync with gnulib.
All uses of HAVE_F_FSTYPENAME replaced by HAVE_STRUCT_STATFS_F_FSTYPENAME.
[MOUNTED_GETMNTINFO2] Include sys/statvfs.h.
(read_file_system_list) [MOUNTED_GETMNTINFO2]: Implement.
getmntinfo() returning its result in struct statvfs.
* src/mountlist.c: Revert a failed attempt to properly detect and use
getmntinfo() returning its result in struct statvfs.
* acinclude.m4 (AC_GET_FS_INFO): Add a check to determine whether
getmntinfo() takes struct statvfs instead of struct statfs as its
first argument. Define MOUNTED_GETMNTINFO_STATVFS if it does.
Add a check to determine whether struct statvfs has a field named
f_fstypename.
Use gl_FSTYPENAME tp determine whether struct statfs has a field
named f_fstypename.
* src/mountlist.c (HAVE_F_FSTYPENAME): Define when getmntinfo() is
used and the struct which it fills has a field named f_fstypename.
(read_filesystem_list) [MOUNTED_GETMNTINFO]: Use
MOUNTED_GETMNTINFO_STATVFS to determine the type of the first
argument to getmntinfo().
(tty_tgetstr): Declare new function.
* src/tty.c [USE_NCURSES]: Request the inclusion of term.h.
(tty_tgetstr): Define new function
* src/main.c (init_xterm_support): Use tty_tgetstr().
the xterm mouse reporting modes offered by various xterm-like
terminals.
* src/mouse.c: Adjust the code to reflect the changes above.
Send the proper terminal control codes when xterm normal mouse
tracking is requested.
* src/main.c (init_xterm_support): Try to fine-tune the mouse tracking
mode based on the terminal type.
`upper_letter_is_hotkey'.
(radio_new): Remove the last argument from the function
declaration - it is unused.
* src/widget.c (radio_new): Remove the last argument from the
function declaration - it is unused.
* src/boxes.c: Adjust all callers to reflect the changes above.
* src/layout.c: Likewise.
* src/listmode.c: Likewise.
* src/option.c: Likewise.
* src/wtools.c: Likewise.
* vfs/fish.c (fish_directory_timeout): Define new global variable.
(FISH_DIRECTORY_TIMEOUT): Eliminate - this macro is not used
anywhere.
(fish_dir_load): Use `fish_directory_timeout' to calculate the
expiration time of a newly created directory entries.
* src/setup.c [USE_NETCODE]: Include fish.h .
(int_options) [USE_NETCODE]: Add support for user configurable
expiration timeout of FISH directory cache entries.
* doc/mc.1.in: Document `fish_directory_timeout'.
(add_dotdot_to_list): Define new function.
(HotListType): Add HL_TYPE_DOTDOT.
(update_path_name): Handle HL_TYPE_DOTDOT entries the same way as
HL_TYPE_ENTRY entries.
(fill_listbox): Likewise.
(hotlist_button_callback): Go up one level when enter is pressed on
an entry of type HL_TYPE_DOTDOT.
(add2hotlist): Always attach a HL_TYPE_DOTDOT to each new HL_TYPE_GROUP
entry.
Make sure that the HL_TYPE_DOTDOT entry is the first one in the list.
(remove_from_hotlist): Do not remove HL_TYPE_DOTDOT entries.
(hot_save_group): Do nothing for HL_TYPE_DOTDOT entries.
confirmation may be requested when deleting directory hotlist entries
based on a user configurable setting.
* src/file.h (safe_delete): Move declaration of `safe_delete'
* src/main.h: ... here.
(confirm_directory_hotlist_delete): Declare new global variable.
* src/file.c (safe_delete): Move definition of `safe_delete'
* src/main.c: ... here.
(confirm_directory_hotlist_delete): Define new global variable.
* src/hotlist.c (remove_from_hotlist): Based on a user configurable
setting, request confirmation when removing directory hotlist
entries. The confirmation dialog honours the `Safe delete'
setting.
Reorder the buttons in the hotlist group removal confirmation
dialog so that it becomes consistent with other confirmation
boxes.
* src/setup.c (int_options): Add support for user configurable
confirmation of directory hotlist entries removal.
* src/boxes.c (conf_widgets): Likewise.
(confirm_box): Likewise.
(my_directory_hotlist_delete): New module variable.
variable first, then PAGER, then fall back to "view".
* lib/mc.hint: Mention VIEWER environment variable.
* doc/mc.1.in: Document support for VIEWER environment variable.
* util.c: ... here. Q_ is not defined by just including glib.h.
The glib implementation doesn't strip prefix from translations,
so it's not suitable for us. Finally, it makes man2hlp depend
on libintl.
Reported by Leonard den Ottolander <leonard@den.ottolander.nl>
the currently selected panel entry and moves down. Suggested by
ForestCreature on mc-devel.
* cmd.h: Likewise.
* main.c (midnight_callback): When the space key is pressed and
the command line is empty, single_dirsize_cmd() is called.
* tty.c: ... this newly created file, which contains a simple,
not yet complete interface to the terminal library. It should be
used instead of depending directly on ncurses or SLang features.
* tty.h: Added the new function prototypes from tty.c and some
legacy definitions.
view->filename be not NULL.
* view.c (view_toggle_magic_mode): Check if filename != NULL
before dereferencing the pointer.
* view.c (view_change_nroff_mode_cmd): Renamed to
view_toggle_nroff_mode_cmd.
* view.c (view_new): Don't initialize the various view->mode
variables by now. This needs to be done correctly.
not search progress), calculate the percentage based on dpy_end
instead of dpy_start. This avoids a sudden break to 100 % when
approaching the end of file.
does not always represent the top-left corner of the screen.
Replaced dpy_complete with dpy_end, the offset of the first byte
after the displayed region.
This fixes an inconsistency noted by Andrej Zebrowski on
mc-devel.
* view.c (view_move_down): Do nothing if we're already at the
end of the file. This makes the cursor movement more consistent
with the behavior of the <End> key.
* view.c (regexp_search_cmd): Moved the code to save the changes
of the hex editor out of this function. Whoever wrote that
should be blamed for it, but the code has been there since the
beginning.