From 6f9d17e6541df19caa115e398b15b454eb3bf4cf Mon Sep 17 00:00:00 2001
From: Vit Rosin <vit_r@list.ru>
Date: Sun, 24 Jan 2010 21:00:39 +0000
Subject: [PATCH] unifying some declarations in src dir
---
src/args.c | 2 +-
src/cmd.c | 6 +++---
src/cmd.h | 4 ++--
src/ext.c | 6 +++---
src/file.c | 2 +-
src/filehighlight/internal.h | 2 +-
src/find.c | 18 +++++++++---------
src/main.c | 6 +++---
src/panel.h | 4 ++--
src/screen.c | 2 +-
src/tty/mouse.c | 3 +++
src/viewer/display.c | 6 +++++-
src/viewer/internal.h | 4 ++--
src/viewer/mcviewer.c | 4 ++--
src/viewer/mcviewer.h | 4 ++--
src/viewer/nroff.c | 2 +-
src/viewer/search.c | 6 +++---
17 files changed, 44 insertions(+), 37 deletions(-)
diff --git a/src/args.c b/src/args.c
index f845aed..4e560a0 100644
a
|
b
|
static const GOptionEntry argument_terminal_table[] = { |
235 | 235 | |
236 | 236 | GOptionGroup *color_group; |
237 | 237 | #define ARGS_COLOR_OPTIONS 0 |
238 | | // #define ARGS_COLOR_OPTIONS G_OPTION_FLAG_IN_MAIN |
| 238 | /* #define ARGS_COLOR_OPTIONS G_OPTION_FLAG_IN_MAIN */ |
239 | 239 | static const GOptionEntry argument_color_table[] = { |
240 | 240 | /* color options */ |
241 | 241 | { |
diff --git a/src/cmd.c b/src/cmd.c
index 182a896..ad912cf 100644
a
|
b
|
int select_flags = SELECT_MATCH_CASE | SELECT_SHELL_PATTERNS; |
113 | 113 | |
114 | 114 | int |
115 | 115 | view_file_at_line (const char *filename, int plain_view, int internal, |
116 | | int start_line) |
| 116 | long start_line) |
117 | 117 | { |
118 | 118 | static const char *viewer = NULL; |
119 | 119 | int move_dir = 0; |
… |
… |
view_file_at_line (const char *filename, int plain_view, int internal, |
150 | 150 | char view_entry[BUF_TINY]; |
151 | 151 | |
152 | 152 | if (start_line != 0) |
153 | | g_snprintf (view_entry, sizeof (view_entry), "View:%d", |
| 153 | g_snprintf (view_entry, sizeof (view_entry), "View:%ld", |
154 | 154 | start_line); |
155 | 155 | else |
156 | 156 | strcpy (view_entry, "View"); |
… |
… |
filtered_view_cmd (void) |
295 | 295 | } |
296 | 296 | |
297 | 297 | void |
298 | | do_edit_at_line (const char *what, int start_line) |
| 298 | do_edit_at_line (const char *what, long start_line) |
299 | 299 | { |
300 | 300 | static const char *editor = NULL; |
301 | 301 | |
diff --git a/src/cmd.h b/src/cmd.h
index cca7473..23069d3 100644
a
|
b
|
void smart_dirsize_cmd (void); |
18 | 18 | void single_dirsize_cmd (void); |
19 | 19 | void dirsizes_cmd (void); |
20 | 20 | int view_file_at_line (const char *filename, int plain_view, int internal, |
21 | | int start_line); |
| 21 | long start_line); |
22 | 22 | int view_file (const char *filename, int normal, int internal); |
23 | 23 | void view_cmd (void); |
24 | 24 | void view_file_cmd (void); |
25 | 25 | void view_simple_cmd (void); |
26 | 26 | void filtered_view_cmd (void); |
27 | | void do_edit_at_line (const char *what, int start_line); |
| 27 | void do_edit_at_line (const char *what, long start_line); |
28 | 28 | void edit_cmd (void); |
29 | 29 | void edit_cmd_new (void); |
30 | 30 | void copy_cmd (void); |
diff --git a/src/ext.c b/src/ext.c
index 7e368e8..6e26931 100644
a
|
b
|
typedef char *(*quote_func_t) (const char *name, int quote_percent); |
67 | 67 | |
68 | 68 | static void |
69 | 69 | exec_extension (const char *filename, const char *lc_data, int *move_dir, |
70 | | int start_line) |
| 70 | long start_line) |
71 | 71 | { |
72 | 72 | char *fn; |
73 | 73 | char *file_name; |
… |
… |
regex_command (const char *filename, const char *action, int *move_dir) |
433 | 433 | int error_flag = 0; |
434 | 434 | int ret = 0; |
435 | 435 | struct stat mystat; |
436 | | int view_at_line_number; |
| 436 | long view_at_line_number; |
437 | 437 | char *include_target; |
438 | 438 | int include_target_len; |
439 | 439 | int have_type = 0; /* Flag used by regex_check_type() */ |
440 | 440 | |
441 | 441 | /* Check for the special View:%d parameter */ |
442 | 442 | if (strncmp (action, "View:", 5) == 0) { |
443 | | view_at_line_number = atoi (action + 5); |
| 443 | view_at_line_number = atol (action + 5); |
444 | 444 | action = "View"; |
445 | 445 | } else { |
446 | 446 | view_at_line_number = 0; |
diff --git a/src/file.c b/src/file.c
index f0b0c02..3041d72 100644
a
|
b
|
end_bg_process (FileOpContext *ctx, enum OperationMode mode) { |
1800 | 1800 | ctx->pid = 0; |
1801 | 1801 | |
1802 | 1802 | unregister_task_with_pid(pid); |
1803 | | // file_op_context_destroy(ctx); |
| 1803 | /* file_op_context_destroy(ctx); */ |
1804 | 1804 | return 1; |
1805 | 1805 | } |
1806 | 1806 | #endif |
diff --git a/src/filehighlight/internal.h b/src/filehighlight/internal.h
index 4b66254..3856af6 100644
a
|
b
|
typedef enum { |
26 | 26 | MC_FLHGH_FTYPE_T_SPECIAL, |
27 | 27 | MC_FLHGH_FTYPE_T_SPECIAL_SOCKET, |
28 | 28 | MC_FLHGH_FTYPE_T_SPECIAL_FIFO, |
29 | | MC_FLHGH_FTYPE_T_SPECIAL_DOOR, |
| 29 | MC_FLHGH_FTYPE_T_SPECIAL_DOOR |
30 | 30 | } mc_flhgh_ftype_type; |
31 | 31 | |
32 | 32 | /*** structures declarations (and typedefs of structures)*****************************************/ |
diff --git a/src/find.c b/src/find.c
index 1d0a3e0..bfac3eb 100644
a
|
b
|
static char *old_dir = NULL; |
117 | 117 | |
118 | 118 | /* Where did we stop */ |
119 | 119 | static int resuming; |
120 | | static int last_line; |
121 | | static int last_pos; |
| 120 | static long last_line; |
| 121 | static long last_pos; |
122 | 122 | |
123 | 123 | static Dlg_head *find_dlg; /* The dialog */ |
124 | 124 | static WButton *stop_button; /* pointer to the stop button */ |
… |
… |
find_add_match (const char *dir, const char *file) |
644 | 644 | * has_newline - is there newline ? |
645 | 645 | */ |
646 | 646 | static char * |
647 | | get_line_at (int file_fd, char *buf, int buf_size, int *pos, int *n_read, |
| 647 | get_line_at (int file_fd, char *buf, int buf_size, long *pos, long *n_read, |
648 | 648 | gboolean *has_newline) |
649 | 649 | { |
650 | 650 | char *buffer = NULL; |
… |
… |
search_content (Dlg_head *h, const char *directory, const char *filename) |
753 | 753 | tty_got_interrupt (); |
754 | 754 | |
755 | 755 | { |
756 | | int line = 1; |
757 | | int pos = 0; |
758 | | int n_read = 0; |
| 756 | long line = 1; |
| 757 | long pos = 0; |
| 758 | long n_read = 0; |
759 | 759 | gboolean has_newline; |
760 | 760 | char *p = NULL; |
761 | 761 | gboolean found = FALSE; |
… |
… |
search_content (Dlg_head *h, const char *directory, const char *filename) |
774 | 774 | if (!found /* Search in binary line once */ |
775 | 775 | && mc_search_run (search_content_handle, |
776 | 776 | (const void *) p, 0, strlen (p), &found_len)) { |
777 | | g_snprintf (result, sizeof (result), "%d:%s", line, filename); |
| 777 | g_snprintf (result, sizeof (result), "%ld:%s", line, filename); |
778 | 778 | find_add_match (directory, result); |
779 | 779 | found = TRUE; |
780 | 780 | } |
… |
… |
find_do_view_edit (int unparsed_view, int edit, char *dir, char *file) |
1018 | 1018 | { |
1019 | 1019 | char *fullname = NULL; |
1020 | 1020 | const char *filename = NULL; |
1021 | | int line; |
| 1021 | long line; |
1022 | 1022 | |
1023 | 1023 | if (content_pattern != NULL) { |
1024 | 1024 | filename = strchr (file + 4, ':') + 1; |
1025 | | line = atoi (file + 4); |
| 1025 | line = atol (file + 4); |
1026 | 1026 | } else { |
1027 | 1027 | filename = file + 4; |
1028 | 1028 | line = 0; |
diff --git a/src/main.c b/src/main.c
index a12fb12..82b39f7 100644
a
|
b
|
const char *view_one_file = NULL; |
280 | 280 | const char *edit_one_file = NULL; |
281 | 281 | |
282 | 282 | /* Line to start the editor on */ |
283 | | static int edit_one_file_start_line = 0; |
| 283 | static long edit_one_file_start_line = 0; |
284 | 284 | |
285 | 285 | /* Used so that widgets know if they are being destroyed or |
286 | 286 | shut down */ |
… |
… |
mc_main__setup_by_args (int argc, char *argv[]) |
2052 | 2052 | */ |
2053 | 2053 | if (mc_stat (tmp, &st) == -1 && mc_stat (fname, &st) != -1) { |
2054 | 2054 | edit_one_file = fname; |
2055 | | edit_one_file_start_line = atoi (p); |
| 2055 | edit_one_file_start_line = atol (p); |
2056 | 2056 | } else { |
2057 | 2057 | g_free (fname); |
2058 | 2058 | goto try_plus_filename; |
… |
… |
mc_main__setup_by_args (int argc, char *argv[]) |
2060 | 2060 | } else { |
2061 | 2061 | try_plus_filename: |
2062 | 2062 | if (*tmp == '+' && g_ascii_isdigit ((gchar) tmp[1])) { |
2063 | | int start_line = atoi (tmp); |
| 2063 | long start_line = atol (tmp); |
2064 | 2064 | if (start_line > 0) { |
2065 | 2065 | char *file = (argc > 1) ? argv[2] : NULL; |
2066 | 2066 | if (file) { |
diff --git a/src/panel.h b/src/panel.h
index b32dabc..0415abd 100644
a
|
b
|
typedef enum { |
27 | 27 | view_listing = 0, /* Directory listing */ |
28 | 28 | view_info = 1, /* Information panel */ |
29 | 29 | view_tree = 2, /* Tree view */ |
30 | | view_quick = 3, /* Quick view */ |
31 | | view_nothing = 4, /* Undefined */ |
| 30 | view_quick = 3 /* Quick view */ |
| 31 | /* view_nothing = 4 Undefined */ |
32 | 32 | } panel_view_mode_t; |
33 | 33 | |
34 | 34 | enum panel_display_enum { |
diff --git a/src/screen.c b/src/screen.c
index 6abfac6..ade7af9 100644
a
|
b
|
panel_get_title_without_hotkey(const char *title) |
1381 | 1381 | |
1382 | 1382 | hkey = strchr(translated_title, '&'); |
1383 | 1383 | if ((hkey != NULL) && (hkey[1] != '\0')) |
1384 | | memmove((void *) hkey, (void *) hkey+1,strlen(hkey)); |
| 1384 | memmove((void *) hkey, (void *) (hkey + 1), strlen (hkey)); |
1385 | 1385 | |
1386 | 1386 | return translated_title; |
1387 | 1387 | } |
diff --git a/src/tty/mouse.c b/src/tty/mouse.c
index a811c05..841d377 100644
a
|
b
|
show_mouse_pointer (int x, int y) |
47 | 47 | #ifdef HAVE_LIBGPM |
48 | 48 | if (use_mouse_p == MOUSE_GPM) |
49 | 49 | Gpm_DrawPointer (x, y, gpm_consolefd); |
| 50 | #else |
| 51 | (void) x; |
| 52 | (void) y; |
50 | 53 | #endif /* HAVE_LIBGPM */ |
51 | 54 | } |
52 | 55 | |
diff --git a/src/viewer/display.c b/src/viewer/display.c
index 87a94a2..f67afba 100644
a
|
b
|
|
49 | 49 | #include "internal.h" |
50 | 50 | #include "mcviewer.h" |
51 | 51 | |
| 52 | #ifdef HAVE_CHARSET |
| 53 | #include "charsets.h" /* get_codepage_id () */ |
| 54 | #endif |
| 55 | |
52 | 56 | /*** global variables ****************************************************************************/ |
53 | 57 | |
54 | 58 | /*** file scope macro definitions ****************************************************************/ |
… |
… |
mcview_display_status (mcview_t * view) |
127 | 131 | const screen_dimen width = view->status_area.width; |
128 | 132 | const screen_dimen height = view->status_area.height; |
129 | 133 | const char *file_label; |
130 | | screen_dimen file_label_width, i = 0; |
| 134 | screen_dimen file_label_width; |
131 | 135 | |
132 | 136 | if (height < 1) |
133 | 137 | return; |
diff --git a/src/viewer/internal.h b/src/viewer/internal.h
index 22391c6..348385f 100644
a
|
b
|
gboolean mcview_get_byte_none (mcview_t *, off_t, int *); |
231 | 231 | void mcview_set_byte (mcview_t *, off_t, byte); |
232 | 232 | void mcview_file_load_data (mcview_t *, off_t); |
233 | 233 | void mcview_close_datasource (mcview_t *); |
234 | | void mcview_set_datasource_file (mcview_t *, int, const struct stat *); |
| 234 | void mcview_set_datasource_file (mcview_t * view, int fd, const struct stat *st); |
235 | 235 | gboolean mcview_load_command_output (mcview_t *, const char *); |
236 | 236 | void mcview_set_datasource_vfs_pipe (mcview_t *, int); |
237 | 237 | void mcview_set_datasource_string (mcview_t *, const char *); |
… |
… |
void mcview_moveto_match (mcview_t *); |
297 | 297 | |
298 | 298 | /* nroff.c: */ |
299 | 299 | void mcview_display_nroff (mcview_t *view); |
300 | | int mcview__get_nroff_real_len (mcview_t *view, off_t, off_t p); |
| 300 | int mcview_get_nroff_real_len (mcview_t *view, off_t, off_t p); |
301 | 301 | |
302 | 302 | mcview_nroff_t *mcview_nroff_seq_new_num (mcview_t *view, off_t p); |
303 | 303 | mcview_nroff_t *mcview_nroff_seq_new (mcview_t * view); |
diff --git a/src/viewer/mcviewer.c b/src/viewer/mcviewer.c
index a2aecf4..d9f2020 100644
a
|
b
|
mcview_new (int y, int x, int lines, int cols, int is_panel) |
261 | 261 | |
262 | 262 | /* Real view only */ |
263 | 263 | int |
264 | | mcview_viewer (const char *command, const char *file, int *move_dir_p, int start_line) |
| 264 | mcview_viewer (const char *command, const char *file, int *move_dir_p, long start_line) |
265 | 265 | { |
266 | 266 | gboolean succeeded; |
267 | 267 | mcview_t *lc_mcview; |
… |
… |
mcview_viewer (const char *command, const char *file, int *move_dir_p, int start |
295 | 295 | /* --------------------------------------------------------------------------------------------- */ |
296 | 296 | |
297 | 297 | gboolean |
298 | | mcview_load (mcview_t * view, const char *command, const char *file, int start_line) |
| 298 | mcview_load (mcview_t * view, const char *command, const char *file, long start_line) |
299 | 299 | { |
300 | 300 | int i, type; |
301 | 301 | int fd = -1; |
diff --git a/src/viewer/mcviewer.h b/src/viewer/mcviewer.h
index 89ba277..6bea829 100644
a
|
b
|
extern struct mcview_struct *mcview_new (int y, int x, int lines, int cols, int |
44 | 44 | * wants to move (-1 = previous file, 1 = next file, 0 = do nothing). |
45 | 45 | */ |
46 | 46 | extern int mcview_viewer (const char *command, const char *file, |
47 | | int *move_dir_p, int start_line); |
| 47 | int *move_dir_p, long start_line); |
48 | 48 | |
49 | | extern gboolean mcview_load (struct mcview_struct *, const char *, const char *, int); |
| 49 | extern gboolean mcview_load (struct mcview_struct *, const char *, const char *, long start_line); |
50 | 50 | |
51 | 51 | #endif |
diff --git a/src/viewer/nroff.c b/src/viewer/nroff.c
index 8602572..045f577 100644
a
|
b
|
mcview_display_nroff (mcview_t * view) |
197 | 197 | /* --------------------------------------------------------------------------------------------- */ |
198 | 198 | |
199 | 199 | int |
200 | | mcview__get_nroff_real_len (mcview_t * view, off_t start, off_t length) |
| 200 | mcview_get_nroff_real_len (mcview_t * view, off_t start, off_t length) |
201 | 201 | { |
202 | 202 | mcview_nroff_t *nroff; |
203 | 203 | int ret = 0; |
diff --git a/src/viewer/search.c b/src/viewer/search.c
index 63d639e..b5df1b2 100644
a
|
b
|
mcview_search_show_result(mcview_t * view, Dlg_head **d, size_t match_len) |
111 | 111 | { |
112 | 112 | |
113 | 113 | view->search_start = view->search->normal_offset + |
114 | | mcview__get_nroff_real_len (view, |
| 114 | mcview_get_nroff_real_len (view, |
115 | 115 | view->search->start_buffer, |
116 | 116 | view->search->normal_offset - |
117 | 117 | view->search->start_buffer); |
… |
… |
mcview_search_show_result(mcview_t * view, Dlg_head **d, size_t match_len) |
120 | 120 | view->search_start++; |
121 | 121 | |
122 | 122 | view->search_end = view->search_start + match_len + |
123 | | mcview__get_nroff_real_len (view, view->search_start - 1, match_len); |
| 123 | mcview_get_nroff_real_len (view, view->search_start - 1, match_len); |
124 | 124 | |
125 | 125 | if (view->hex_mode) { |
126 | 126 | view->hex_cursor = view->search_start; |
… |
… |
mcview_do_search (mcview_t * view) |
221 | 221 | if (view->search_start) { |
222 | 222 | search_start = (view->search_backwards) ? -2 : 2; |
223 | 223 | search_start = view->search_start + search_start + |
224 | | mcview__get_nroff_real_len (view, view->search_start, 2) * search_start; |
| 224 | mcview_get_nroff_real_len (view, view->search_start, 2) * search_start; |
225 | 225 | } else { |
226 | 226 | search_start = view->search_start; |
227 | 227 | } |