Ticket #1977: 1977-unifying-some-declarations-in-edit-dir.patch

File 1977-unifying-some-declarations-in-edit-dir.patch, 13.5 KB (added by vit_r, 14 years ago)

some trivial corrections in edit dir

  • edit/bookmark.c

    From 462219fd0f21a29e8caa6b18dcbc46b997b0ef3a Mon Sep 17 00:00:00 2001
    From: Vit Rosin <vit_r@list.ru>
    Date: Mon, 25 Jan 2010 18:55:30 +0000
    Subject: [PATCH]  unifying some declarations in edit dir
    
    ---
     edit/bookmark.c    |   12 ++++++------
     edit/edit-impl.h   |   20 ++++++++++----------
     edit/edit-widget.h |    2 +-
     edit/edit.c        |   36 +++++++++++++++++-------------------
     edit/edit.h        |    2 +-
     edit/editcmd.c     |    4 ++--
     edit/editdraw.c    |   22 +++++++++++-----------
     edit/editwidget.c  |    2 +-
     edit/wordproc.c    |    4 +++-
     9 files changed, 52 insertions(+), 52 deletions(-)
    
    diff --git a/edit/bookmark.c b/edit/bookmark.c
    index 00dfe8e..e64e03e 100644
    a b static struct _book_mark *double_marks (WEdit * edit, struct _book_mark *p) 
    6060} 
    6161 
    6262/* returns the first bookmark on or before this line */ 
    63 struct _book_mark *book_mark_find (WEdit * edit, int line) 
     63struct _book_mark *book_mark_find (WEdit * edit, long line) 
    6464{ 
    6565    struct _book_mark *p; 
    6666    if (!edit->book_mark) { 
    struct _book_mark *book_mark_find (WEdit * edit, int line) 
    104104} 
    105105 
    106106/* returns true if a bookmark exists at this line of color c */ 
    107 int book_mark_query_color (WEdit * edit, int line, int c) 
     107int book_mark_query_color (WEdit * edit, long line, int c) 
    108108{ 
    109109    struct _book_mark *p; 
    110110    if (!edit->book_mark) 
    int book_mark_query_color (WEdit * edit, int line, int c) 
    120120 
    121121/* insert a bookmark at this line */ 
    122122void 
    123 book_mark_insert (WEdit *edit, int line, int c) 
     123book_mark_insert (WEdit *edit, long line, int c) 
    124124{ 
    125125    struct _book_mark *p, *q; 
    126126    p = book_mark_find (edit, line); 
    book_mark_insert (WEdit *edit, int line, int c) 
    149149 
    150150/* remove a bookmark if there is one at this line matching this color - c of -1 clear all */ 
    151151/* returns non-zero on not-found */ 
    152 int book_mark_clear (WEdit * edit, int line, int c) 
     152int book_mark_clear (WEdit * edit, long line, int c) 
    153153{ 
    154154    struct _book_mark *p, *q; 
    155155    int r = 1; 
    void book_mark_flush (WEdit * edit, int c) 
    201201} 
    202202 
    203203/* shift down bookmarks after this line */ 
    204 void book_mark_inc (WEdit * edit, int line) 
     204void book_mark_inc (WEdit * edit, long line) 
    205205{ 
    206206    if (edit->book_mark) { 
    207207        struct _book_mark *p; 
    void book_mark_inc (WEdit * edit, int line) 
    213213} 
    214214 
    215215/* shift up bookmarks after this line */ 
    216 void book_mark_dec (WEdit * edit, int line) 
     216void book_mark_dec (WEdit * edit, long line) 
    217217{ 
    218218    if (edit->book_mark) { 
    219219        struct _book_mark *p; 
  • edit/edit-impl.h

    diff --git a/edit/edit-impl.h b/edit/edit-impl.h
    index a66f1a4..7e7d91a 100644
    a b long edit_move_backward (WEdit * edit, long current, long lines); 
    166166void edit_scroll_screen_over_cursor (WEdit * edit); 
    167167void edit_render_keypress (WEdit * edit); 
    168168void edit_scroll_upward (WEdit * edit, unsigned long i); 
    169 void edit_scroll_downward (WEdit * edit, int i); 
    170 void edit_scroll_right (WEdit * edit, int i); 
    171 void edit_scroll_left (WEdit * edit, int i); 
     169void edit_scroll_downward (WEdit * edit, long i); 
     170void edit_scroll_right (WEdit * edit, long i); 
     171void edit_scroll_left (WEdit * edit, long i); 
    172172void edit_move_up (WEdit * edit, unsigned long i, int scroll); 
    173173void edit_move_down (WEdit * edit, unsigned long i, int scroll); 
    174174void edit_move_to_prev_col (WEdit *edit, long p); 
    void edit_free_syntax_rules (WEdit * edit); 
    260260void edit_get_syntax_color (WEdit * edit, long byte_index, int *color); 
    261261 
    262262 
    263 void book_mark_insert (WEdit * edit, int line, int c); 
    264 int book_mark_query_color (WEdit * edit, int line, int c); 
    265 int book_mark_query_all (WEdit * edit, int line, int *c); 
    266 struct _book_mark *book_mark_find (WEdit * edit, int line); 
    267 int book_mark_clear (WEdit * edit, int line, int c); 
     263struct _book_mark *book_mark_find (WEdit * edit, long line); 
     264int book_mark_clear (WEdit * edit, long line, int c); 
     265int book_mark_query_color (WEdit * edit, long line, int c); 
     266int book_mark_query_all (WEdit * edit, long line, int *c); 
     267void book_mark_inc (WEdit * edit, long line); 
     268void book_mark_dec (WEdit * edit, long line); 
     269void book_mark_insert (WEdit * edit, long line, int c); 
    268270void book_mark_flush (WEdit * edit, int c); 
    269 void book_mark_inc (WEdit * edit, int line); 
    270 void book_mark_dec (WEdit * edit, int line); 
    271271 
    272272int line_is_blank (WEdit *edit, long line); 
    273273int edit_indent_width (WEdit *edit, long p); 
  • edit/edit-widget.h

    diff --git a/edit/edit-widget.h b/edit/edit-widget.h
    index 0e90882..de2d5c7 100644
    a b  
    1616#define N_LINE_CACHES 32 
    1717 
    1818struct _book_mark { 
    19     int line;                   /* line number */ 
     19    long line;                  /* line number */ 
    2020    int c;                      /* color */ 
    2121    struct _book_mark *next; 
    2222    struct _book_mark *prev; 
  • edit/edit.c

    diff --git a/edit/edit.c b/edit/edit.c
    index b48e108..0c84d98 100644
    a b edit_load_position (WEdit *edit) 
    706706        line = edit->curs_line; 
    707707    } 
    708708    edit_move_to_prev_col (edit, edit_bol (edit, edit->curs1)); 
    709     edit_move_display (edit, line - (edit->num_widget_lines / 2)); 
     709    edit_move_display (edit, line - (long) (edit->num_widget_lines / 2)); 
    710710} 
    711711 
    712712/* Save cursor position in the file */ 
    edit_insert (WEdit *edit, int c) 
    12041204static void 
    12051205edit_insert_over (WEdit * edit) 
    12061206{ 
    1207     int i; 
     1207    long i; 
    12081208 
    12091209    for ( i = 0; i < edit->over_col; i++ ) { 
    12101210        edit_insert (edit, ' '); 
    static void memqcpy (WEdit * edit, unsigned char *dest, unsigned char *src, int 
    13581358int 
    13591359edit_move_backward_lots (WEdit *edit, long increment) 
    13601360{ 
    1361     int r, s, t; 
     1361    long r, s, t; 
    13621362    unsigned char *p = NULL; 
    13631363 
    13641364    if (increment > edit->curs1) 
    void edit_scroll_upward (WEdit * edit, unsigned long i) 
    16821682 
    16831683 
    16841684/* returns 1 if could scroll, 0 otherwise */ 
    1685 void edit_scroll_downward (WEdit * edit, int i) 
     1685void edit_scroll_downward (WEdit * edit, long i) 
    16861686{ 
    1687     int lines_below; 
    1688     lines_below = edit->total_lines - edit->start_line - (edit->num_widget_lines - 1); 
     1687    long lines_below; 
     1688    lines_below = edit->total_lines - edit->start_line - ((long) edit->num_widget_lines) - 1; 
    16891689    if (lines_below > 0) { 
    16901690        if (i > lines_below) 
    16911691            i = lines_below; 
    void edit_scroll_downward (WEdit * edit, int i) 
    16971697    edit_update_curs_row (edit); 
    16981698} 
    16991699 
    1700 void edit_scroll_right (WEdit * edit, int i) 
     1700void edit_scroll_right (WEdit * edit, long i) 
    17011701{ 
    17021702    edit->force |= REDRAW_PAGE; 
    17031703    edit->force &= (0xfff - REDRAW_CHAR_ONLY); 
    17041704    edit->start_col -= i; 
    17051705} 
    17061706 
    1707 void edit_scroll_left (WEdit * edit, int i) 
     1707void edit_scroll_left (WEdit * edit, long i) 
    17081708{ 
    17091709    if (edit->start_col) { 
    17101710        edit->start_col += i; 
    static int left_of_four_spaces (WEdit *edit); 
    17311731void 
    17321732edit_move_to_prev_col (WEdit * edit, long p) 
    17331733{ 
    1734     int prev = edit->prev_col; 
    1735     int over = edit->over_col; 
     1734    long prev = edit->prev_col; 
     1735    long over = edit->over_col; 
    17361736    edit_cursor_move (edit, edit_move_forward3 (edit, p, prev + edit->over_col, 0) - edit->curs1); 
    17371737 
    17381738    if (option_cursor_beyond_eol) { 
    is_blank (WEdit *edit, long offset) 
    17821782 
    17831783/* returns the offset of line i */ 
    17841784static long 
    1785 edit_find_line (WEdit *edit, int line) 
     1785edit_find_line (WEdit *edit, long line) 
    17861786{ 
    17871787    int i, j = 0; 
    17881788    int m = 2000000000; 
    static void edit_move_up_paragraph (WEdit * edit, int scroll) 
    18591859   before a non-blank line is reached */ 
    18601860static void edit_move_down_paragraph (WEdit * edit, int scroll) 
    18611861{ 
    1862     int i; 
     1862    long i; 
    18631863    if (edit->curs_line >= edit->total_lines - 1) { 
    18641864        i = edit->total_lines; 
    18651865    } else { 
    edit_execute_cmd (WEdit *edit, unsigned long command, int char_for_insertion) 
    25972597        edit->highlight = 1; 
    25982598    } else {                    /* any other command */ 
    25992599        if (edit->highlight) 
    2600             edit_mark_cmd (edit, 0);    /* clear */ 
     2600            edit_mark_cmd (edit, 0);    /* marking on */ 
    26012601        edit->highlight = 0; 
    26022602    } 
    26032603 
    edit_execute_cmd (WEdit *edit, unsigned long command, int char_for_insertion) 
    29702970                                                      edit->curs_line); 
    29712971            if (p->next) { 
    29722972                p = p->next; 
    2973                 if (p->line >= edit->start_line + edit->num_widget_lines 
     2973                if (p->line >= (edit->start_line + (long) edit->num_widget_lines) 
    29742974                    || p->line < edit->start_line) 
    29752975                    edit_move_display (edit, 
    2976                                        p->line - 
    2977                                        edit->num_widget_lines / 2); 
     2976                                       p->line - ((long) (edit->num_widget_lines / 2))); 
    29782977                edit_move_to_line (edit, p->line); 
    29792978            } 
    29802979        } 
    edit_execute_cmd (WEdit *edit, unsigned long command, int char_for_insertion) 
    29882987                if (p->prev) 
    29892988                    p = p->prev; 
    29902989            if (p->line >= 0) { 
    2991                 if (p->line >= edit->start_line + edit->num_widget_lines 
     2990                if (p->line >= (edit->start_line + (long) edit->num_widget_lines) 
    29922991                    || p->line < edit->start_line) 
    29932992                    edit_move_display (edit, 
    2994                                        p->line - 
    2995                                        edit->num_widget_lines / 2); 
     2993                                       p->line - ((long) (edit->num_widget_lines / 2))); 
    29962994                edit_move_to_line (edit, p->line); 
    29972995            } 
    29982996        } 
  • edit/edit.h

    diff --git a/edit/edit.h b/edit/edit.h
    index 2b46607..e4de807 100644
    a b extern int show_right_margin; 
    6767void edit_stack_init (void); 
    6868void edit_stack_free (void); 
    6969 
    70 int edit_file (const char *_file, int line); 
     70int edit_file (const char *_file, long line); 
    7171 
    7272const char *edit_get_file_name (const WEdit *edit); 
    7373int edit_get_curs_col (const WEdit *edit); 
  • edit/editcmd.c

    diff --git a/edit/editcmd.c b/edit/editcmd.c
    index 3d60d90..668227c 100644
    a b edit_search_cmd_search_create_bookmark(WEdit * edit) 
    124124static int 
    125125edit_search_cmd_callback(const void *user_data, gsize char_offset) 
    126126{ 
    127     return edit_get_byte ((WEdit * )user_data, (long) char_offset); 
     127    return edit_get_byte ((WEdit * ) user_data, (long) char_offset); 
    128128} 
    129129 
    130130void edit_help_cmd (WEdit * edit) 
    edit_goto_cmd (WEdit *edit) 
    20152015    line = l; 
    20162016    if (l < 0) 
    20172017        l = edit->total_lines + l + 2; 
    2018     edit_move_display (edit, l - edit->num_widget_lines / 2 - 1); 
     2018    edit_move_display (edit, l - ((long) (edit->num_widget_lines / 2 - 1))); 
    20192019    edit_move_to_line (edit, l - 1); 
    20202020    edit->force |= REDRAW_COMPLETELY; 
    20212021    g_free (f); 
  • edit/editdraw.c

    diff --git a/edit/editdraw.c b/edit/editdraw.c
    index 9913c5d..9a0eb93 100644
    a b edit_status (WEdit *edit) 
    219219/* this scrolls the text so that cursor is on the screen */ 
    220220void edit_scroll_screen_over_cursor (WEdit * edit) 
    221221{ 
    222     int p; 
    223     int outby; 
     222    long p, outby; 
    224223    int b_extreme, t_extreme, l_extreme, r_extreme; 
    225224 
    226225    if (edit->num_widget_lines <= 0 || edit->num_widget_columns <= 0) 
    void edit_scroll_screen_over_cursor (WEdit * edit) 
    251250    } 
    252251    p = edit_get_col (edit) + edit->over_col; 
    253252    edit_update_curs_row (edit); 
    254     outby = p + edit->start_col - edit->num_widget_columns + 1 + (r_extreme + edit->found_len); 
     253    p = p + edit->start_col + 1; 
     254    outby = p - ((long) (edit->num_widget_columns + r_extreme + edit->found_len)); 
    255255    if (outby > 0) 
    256256        edit_scroll_right (edit, outby); 
    257     outby = l_extreme - p - edit->start_col; 
     257    outby = ((long) l_extreme) - p - edit->start_col; 
    258258    if (outby > 0) 
    259259        edit_scroll_left (edit, outby); 
    260260    p = edit->curs_row; 
    261     outby = p - edit->num_widget_lines + 1 + b_extreme; 
     261    outby = p + 1 - ((long) (edit->num_widget_lines + b_extreme)); 
    262262    if (outby > 0) 
    263263        edit_scroll_downward (edit, outby); 
    264     outby = t_extreme - p; 
     264    outby = ((long) t_extreme) - p; 
    265265    if (outby > 0) 
    266266        edit_scroll_upward (edit, outby); 
    267267    edit_update_curs_row (edit); 
    print_to_widget (WEdit *edit, long row, int start_col, int start_col_real, 
    287287    int x1 = start_col + EDIT_TEXT_HORIZONTAL_OFFSET + option_line_state_width; 
    288288    int y = row + EDIT_TEXT_VERTICAL_OFFSET; 
    289289    int cols_to_skip = abs (x); 
     290    int i = 1; 
    290291 
    291292    tty_setcolor (EDITOR_NORMAL_COLOR); 
    292293 
    print_to_widget (WEdit *edit, long row, int start_col, int start_col_real, 
    307308    } 
    308309 
    309310    if (option_line_state) { 
    310         int i; 
    311         for (i = 0; i < LINE_STATE_WIDTH; i++) 
    312             if (status[i] == '\0') 
    313                 status[i] = ' '; 
     311        int n; 
     312        for (n = 0; n < LINE_STATE_WIDTH; n++) 
     313            if (status[n] == '\0') 
     314                status[n] = ' '; 
    314315 
    315316        tty_setcolor (LINE_STATE_COLOR); 
    316317        edit_move (x1 + FONT_OFFSET_X - option_line_state_width, y + FONT_OFFSET_Y); 
    print_to_widget (WEdit *edit, long row, int start_col, int start_col_real, 
    319320 
    320321    edit_move (x1 + FONT_OFFSET_X, y + FONT_OFFSET_Y); 
    321322    p = line; 
    322     int i = 1; 
    323323    while (p->ch) { 
    324324        int style; 
    325325        unsigned int textchar; 
  • edit/editwidget.c

    diff --git a/edit/editwidget.c b/edit/editwidget.c
    index 33175d4..69d97a9 100644
    a b edit_dialog_callback (Dlg_head *h, Widget *sender, 
    227227} 
    228228 
    229229int 
    230 edit_file (const char *_file, int line) 
     230edit_file (const char *_file, long line) 
    231231{ 
    232232    static gboolean made_directory = FALSE; 
    233233    Dlg_head *edit_dlg; 
  • edit/wordproc.c

    diff --git a/edit/wordproc.c b/edit/wordproc.c
    index b340544..b42787a 100644
    a b begin_paragraph (WEdit *edit, int force) 
    119119static long 
    120120end_paragraph (WEdit *edit, int force) 
    121121{ 
    122     int i; 
     122    long i; 
    123123    for (i = edit->curs_line + 1; i <= edit->total_lines; i++) { 
    124124        if (line_is_blank (edit, i)) { 
    125125            i--; 
    format_paragraph (WEdit *edit, int force) 
    352352        return; 
    353353    p = begin_paragraph (edit, force); 
    354354    q = end_paragraph (edit, force); 
     355    if (q <= p) 
     356        return; 
    355357    indent = test_indent (edit, p, q); 
    356358    t = get_paragraph (edit, p, q, indent, &size); 
    357359    if (!t)