Cleanup of code. Indentation.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Slava Zanko 2009-08-25 01:41:31 +03:00
parent d41e57a673
commit ac11bedf24
14 changed files with 47 additions and 46 deletions

View File

@ -60,7 +60,7 @@
#include "../src/cmd.h"
#include "../src/execute.h"
#include "../src/help.h"
#include "../src/viewer/internal.h"
#include "internal.h"
#include "../src/viewer/mcviewer.h"
/*** global variables ****************************************************************************/
@ -517,9 +517,9 @@ mcview_moveto_line_cmd (mcview_t * view)
mcview_offset_to_coord (view, &line, &col, view->dpy_start);
g_snprintf (prompt_format, sizeof (prompt_format),
g_snprintf (prompt_format, sizeof (prompt_format),
_(" The current address is %s.\n"
" Enter the new address:"), "0x%08"OFFSETTYPE_PRIX"");
" Enter the new address:"), "0x%08" OFFSETTYPE_PRIX "");
g_snprintf (prompt, sizeof (prompt), prompt_format, view->hex_cursor);
answer = input_dialog (_(" Goto line "), prompt, MC_HISTORY_VIEW_GOTO_LINE, "");
if (answer != NULL && answer[0] != '\0') {
@ -542,7 +542,8 @@ mcview_moveto_addr_cmd (mcview_t * view)
off_t addr;
g_snprintf (prompt, sizeof (prompt),
_(" The current address is 0x%lx.\n" " Enter the new address:"), view->hex_cursor);
_(" The current address is 0x%lx.\n" " Enter the new address:"),
(long unsigned int) view->hex_cursor);
line = input_dialog (_(" Goto Address "), prompt, MC_HISTORY_VIEW_GOTO_ADDR, "");
if (line != NULL) {
if (*line != '\0') {

View File

@ -52,7 +52,7 @@
#include <config.h>
#include "../src/global.h"
#include "../src/viewer/internal.h"
#include "internal.h"
#define VIEW_COORD_CACHE_GRANUL 1024

View File

@ -58,7 +58,7 @@
#include "../src/global.h"
#include "../src/wtools.h"
#include "../src/viewer/internal.h"
#include "internal.h"
/*** global variables ****************************************************************************/

View File

@ -39,7 +39,7 @@
#include "../src/global.h"
#include "../src/wtools.h"
#include "../src/viewer/internal.h"
#include "internal.h"
#include "../src/charsets.h"
/*** global variables ****************************************************************************/

View File

@ -42,7 +42,7 @@
#include "../src/tty/tty.h"
#include "../src/tty/key.h"
#include "../src/strutil.h"
#include "../src/viewer/internal.h"
#include "internal.h"
#include "../src/viewer/mcviewer.h"
/*** global variables ****************************************************************************/

View File

@ -40,7 +40,7 @@
#include "../src/global.h"
#include "../src/wtools.h"
#include "../src/viewer/internal.h"
#include "internal.h"
/* Block size for reading files in parts */
#define VIEW_PAGE_SIZE ((size_t) 8192)

View File

@ -46,7 +46,7 @@
#include "../src/main.h"
#include "../src/wtools.h"
#include "../src/charsets.h"
#include "../src/viewer/internal.h"
#include "internal.h"
/*** global variables ****************************************************************************/

View File

@ -11,12 +11,12 @@ typedef unsigned char byte;
/* A width or height on the screen */
typedef unsigned int screen_dimen;
/* Offset in bytes into a file */
typedef unsigned long offset_type;
#define OFFSETTYPE_PRIX "lX"
#define OFFSETTYPE_PRId "lu"
extern const off_t INVALID_OFFSET;
extern const off_t OFFSETTYPE_MAX;
/*** enums *************************************************************/
/* data sources of the view */
@ -29,13 +29,6 @@ enum view_ds {
};
/* Offset in bytes into a file */
typedef enum {
INVALID_OFFSET = ((off_t) - 1),
OFFSETTYPE_MAX = ((off_t) 1 << (sizeof (off_t) * 8 - 1) - 1)
}
mcview_offset_t;
enum ccache_type {
CCACHE_OFFSET,
CCACHE_LINECOL
@ -125,11 +118,11 @@ typedef struct mcview_struct {
/* Display information */
screen_dimen dpy_frame_size; /* Size of the frame surrounding the real viewer */
offset_type dpy_start; /* Offset of the displayed data */
offset_type dpy_end; /* Offset after the displayed data */
offset_type dpy_text_column; /* Number of skipped columns in non-wrap
* text mode */
offset_type hex_cursor; /* Hexview cursor position in file */
off_t dpy_start; /* Offset of the displayed data */
off_t dpy_end; /* Offset after the displayed data */
off_t dpy_text_column; /* Number of skipped columns in non-wrap
* text mode */
off_t hex_cursor; /* Hexview cursor position in file */
screen_dimen cursor_col; /* Cursor column */
screen_dimen cursor_row; /* Cursor row */
struct hexedit_change_node *change_list; /* Linked list of changes */
@ -144,15 +137,15 @@ typedef struct mcview_struct {
int bytes_per_line; /* Number of bytes per line in hex mode */
/* Search variables */
offset_type search_start; /* First character to start searching from */
offset_type search_end; /* Length of found string or 0 if none was found */
off_t search_start; /* First character to start searching from */
off_t search_end; /* Length of found string or 0 if none was found */
/* Pointer to the last search command */
gboolean want_to_quit; /* Prepare for cleanup ... */
/* Markers */
int marker; /* mark to use */
offset_type marks[10]; /* 10 marks: 0..9 */
off_t marks[10]; /* 10 marks: 0..9 */
int move_dir; /* return value from widget:
* 0 do nothing
@ -160,9 +153,9 @@ typedef struct mcview_struct {
* 1 view next file
*/
offset_type update_steps; /* The number of bytes between percent
off_t update_steps; /* The number of bytes between percent
* increments */
offset_type update_activate; /* Last point where we updated the status */
off_t update_activate; /* Last point where we updated the status */
/* converter for translation of text */
GIConv converter;
@ -180,7 +173,7 @@ typedef struct mcview_struct {
int search_numNeedSkipChar;
} mcview_t;
typedef struct mcview_nroff_struct{
typedef struct mcview_nroff_struct {
mcview_t *view;
off_t index;
int char_width;
@ -218,6 +211,9 @@ gboolean mcview_coord_cache_entry_less (const struct coord_cache_entry *,
void mcview_ccache_dump (mcview_t *);
#endif
void
mcview_ccache_lookup (mcview_t *, struct coord_cache_entry *, enum ccache_type);
/* datasource.c: */
void mcview_set_datasource_none (mcview_t *);

View File

@ -41,12 +41,17 @@
#include "../src/wtools.h"
#include "../src/strutil.h"
#include "../src/main.h"
#include "../src/charsets.h"
#include "../src/selcodepage.h"
#include "../src/viewer/internal.h"
#include "internal.h"
#include "../src/viewer/mcviewer.h"
/*** global variables ****************************************************************************/
#define OFF_T_BITWIDTH (int) (sizeof (off_t) * 8 - 1)
const off_t INVALID_OFFSET = ((off_t) - 1);
const off_t OFFSETTYPE_MAX = ((off_t) 1 << (OFF_T_BITWIDTH - 1)) - 1;
/*** file scope macro definitions ****************************************************************/
/*** file scope type declarations ****************************************************************/

View File

@ -42,8 +42,10 @@
#include "../src/global.h"
#include "../src/strutil.h"
#include "../src/main.h"
#include "../src/charsets.h"
#include "../src/tty/tty.h"
#include "../src/viewer/internal.h"
#include "internal.h"
#include "../src/viewer/mcviewer.h"
/*** global variables ****************************************************************************/

View File

@ -55,7 +55,7 @@
#include "../src/global.h"
#include "../src/tty/tty.h"
#include "../src/viewer/internal.h"
#include "internal.h"
/*** global variables ****************************************************************************/

View File

@ -42,7 +42,7 @@
#include "../src/charsets.h"
#include "../src/tty/tty.h"
#include "../src/tty/color.h"
#include "../src/viewer/internal.h"
#include "internal.h"
/*** global variables ****************************************************************************/
@ -199,11 +199,9 @@ mcview__get_nroff_real_len (mcview_t * view, off_t start, off_t length)
if (nroff == NULL)
return 0;
while (i<length)
{
if (nroff->type != NROFF_TYPE_NONE)
{
ret+=2;
while (i < length) {
if (nroff->type != NROFF_TYPE_NONE) {
ret += 2;
}
i++;
mcview_nroff_seq_next (nroff);

View File

@ -42,7 +42,7 @@
#include "../src/charsets.h"
#include "../src/tty/tty.h"
#include "../src/tty/color.h"
#include "../src/viewer/internal.h"
#include "internal.h"
/*** global variables ****************************************************************************/

View File

@ -41,7 +41,7 @@
#include "../src/setup.h"
#include "../src/wtools.h"
#include "../src/tty/tty.h"
#include "../src/viewer/internal.h"
#include "internal.h"
/*** global variables ****************************************************************************/
@ -117,8 +117,7 @@ mcview_search_cmd_callback (const void *user_data, gsize char_offset)
mcview_t *view = (mcview_t *) user_data;
/* view_read_continue (view, &view->search_onechar_info); *//* AB:FIXME */
if (!view->text_nroff_mode)
{
if (!view->text_nroff_mode) {
byte = mcview_get_byte (view, char_offset);
if (byte == -1)
return MC_SEARCH_CB_ABORT;
@ -211,10 +210,10 @@ mcview_do_search (mcview_t * view)
view->search->start_buffer);
if (!view->hex_mode)
view->search_start ++;
view->search_start++;
view->search_end = view->search_start + match_len +
mcview__get_nroff_real_len (view, view->search_start-1, match_len);
mcview__get_nroff_real_len (view, view->search_start - 1, match_len);
if (view->hex_mode) {
view->hex_cursor = view->search_start;