1
1

* view.c (view_hexedit_save_changes): Use the VFS file functions

instead of the native ones. This makes it possible to edit
	remote files using the hex editor.
Этот коммит содержится в:
Roland Illig 2005-07-12 07:22:49 +00:00
родитель c61ea2f1c4
Коммит fae0cabfc6
2 изменённых файлов: 8 добавлений и 6 удалений

Просмотреть файл

@ -2,6 +2,9 @@
* view.c: Added some paragraph comments. Changed some literal
expressions (e.g. 0 => '\0', 0 => NULL). Fixed indentation.
* view.c (view_hexedit_save_changes): Use the VFS file functions
instead of the native ones. This makes it possible to edit
remote files using the hex editor.
2005-07-11 Roland Illig <roland.illig@gmx.de>

Просмотреть файл

@ -1981,16 +1981,15 @@ view_hexedit_save_changes (WView *view)
char *text, *error;
retry_save:
/* FIXME: why not use mc_open()? */
fp = open (view->filename, O_WRONLY);
fp = mc_open (view->filename, O_WRONLY);
if (fp == -1)
goto save_error;
for (curr = view->change_list; curr != NULL; curr = next) {
next = curr->next;
if (lseek (fp, curr->offset, SEEK_SET) == -1
|| write (fp, &(curr->value), 1) != 1)
if (mc_lseek (fp, curr->offset, SEEK_SET) == -1
|| mc_write (fp, &(curr->value), 1) != 1)
goto save_error;
/* delete the saved item from the change list */
@ -2000,7 +1999,7 @@ view_hexedit_save_changes (WView *view)
g_free (curr);
}
if (close (fp) == -1) {
if (mc_close (fp) == -1) {
error = g_strdup (strerror (errno));
message (D_ERROR, _(" Save file "),
_(" Error while closing the file: \n %s \n"
@ -2014,7 +2013,7 @@ view_hexedit_save_changes (WView *view)
error = g_strdup (strerror (errno));
text = g_strdup_printf (_(" Cannot save file: \n %s "), error);
g_free (error);
(void) close (fp);
(void) mc_close (fp);
answer = query_dialog (_(" Save file "), text, D_ERROR,
2, _("&Retry"), _("&Cancel"));