diff --git a/src/ChangeLog b/src/ChangeLog index e018b8cd7..8e0eca1bc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 2003-09-09 Andrew V. Samoilov + * view.c (view_init): Constify "_command" argument. + (view): Likewise. + (do_view_init): Likewise. + (init_growing_view): Constify "name" and "filename" args. + * view.h: Fix declarations and comment. + * user.c (execute_menu_command: Fix rare segmentation violation if last line in menu file contain space(s) only and no trailing newline. diff --git a/src/view.c b/src/view.c index a33b73b5d..e85433a3a 100644 --- a/src/view.c +++ b/src/view.c @@ -516,7 +516,7 @@ set_view_init_error (WView *view, const char *msg) /* return values: NULL for success, else points to error message */ static char * -init_growing_view (WView *view, char *name, char *filename) +init_growing_view (WView *view, const char *name, const char *filename) { char *err_msg = NULL; @@ -605,7 +605,7 @@ load_view_file (WView *view, int fd) /* Return zero on success, -1 on failure */ static int -do_view_init (WView *view, char *_command, const char *_file, +do_view_init (WView *view, const char *_command, const char *_file, int start_line) { char *error = 0; @@ -758,7 +758,7 @@ view_update_bytes_per_line (WView *view) /* Both views */ /* Return zero on success, -1 on failure */ int -view_init (WView *view, char *_command, const char *_file, int start_line) +view_init (WView *view, const char *_command, const char *_file, int start_line) { if (!view->view_active || strcmp (_file, view->filename) || altered_magic_flag) @@ -2623,7 +2623,7 @@ view_dialog_callback (Dlg_head *h, dlg_msg_t msg, int parm) /* Real view only */ int -view (char *_command, const char *_file, int *move_dir_p, int start_line) +view (const char *_command, const char *_file, int *move_dir_p, int start_line) { int error; WView *wview; diff --git a/src/view.h b/src/view.h index 15c97e65f..9821f1fde 100644 --- a/src/view.h +++ b/src/view.h @@ -6,15 +6,15 @@ typedef struct WView WView; /* Creation/initialization of a new view widget */ WView *view_new (int y, int x, int cols, int lines, int is_panel); -int view_init (WView *view, char *_command, const char *_file, +int view_init (WView *view, const char *_command, const char *_file, int start_line); void view_update_bytes_per_line (WView *view); -/* Command: view a file, if _command != NULL we use popen on _command */ -/* move direction should be apointer that will hold the direction in which the user */ -/* wants to move (-1 previous file, 1 next file, 0 do nothing) */ -int view (char *_command, const char *_file, int *move_direction, +/* Command: view a _file, if _command != NULL we use popen on _command */ +/* move direction should be a pointer that will hold the direction in which */ +/* the user wants to move (-1 previous file, 1 next file, 0 do nothing) */ +int view (const char *_command, const char *_file, int *move_direction, int start_line); extern int mouse_move_pages_viewer;