Ticket #3547: mc-3547-src-editor-edit.c-Cleanup-some-compiler-warnings.patch

File mc-3547-src-editor-edit.c-Cleanup-some-compiler-warnings.patch, 3.4 KB (added by and, 8 years ago)
  • src/editor/edit.c

    From e6f42527113a688e6d52bfc23e767beb01734fbe Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Sun, 28 Feb 2016 19:54:42 +0000
    Subject: [PATCH] src/editor/edit.c: Cleanup some compiler warnings
    
    edit.c:909:12: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion]
        return r;
        ~~~~~~ ^
    edit.c:1689:11: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        col = edit_get_col (edit);
            ~ ^~~~~~~~~~~~~~~~~~~
    edit.c:2361:17: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                d = edit->undo_stack[(sp - 2) & edit->undo_stack_size_mask];
                  ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    edit.c:2371:17: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                d = edit->undo_stack[spm1];
                  ~ ^~~~~~~~~~~~~~~~~~~~~~
    edit.c:2440:17: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                d = edit->redo_stack[(sp - 2) & edit->redo_stack_size_mask];
                  ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    edit.c:2450:17: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                d = edit->redo_stack[spm1];
                  ~ ^~~~~~~~~~~~~~~~~~~~~~
    edit.c:2970:27: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                    q = edit->curs_col;
                      ~ ~~~~~~^~~~~~~~
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     src/editor/edit.c | 10 +++++-----
     1 file changed, 5 insertions(+), 5 deletions(-)
    
    diff --git a/src/editor/edit.c b/src/editor/edit.c
    index 4b4d1db..ee9afec 100644
    a b edit_cursor_to_eol (WEdit * edit) 
    872872static unsigned long 
    873873my_type_of (int c) 
    874874{ 
    875     int x, r = 0; 
     875    unsigned long x, r = 0; 
    876876    const char *p, *q; 
    877877    const char option_chars_move_whole_word[] = 
    878878        "!=&|<>^~ !:;, !'!`!.?!\"!( !) !{ !} !Aa0 !+-*/= |<> ![ !] !\\#! "; 
    edit_insert_column_from_file (WEdit * edit, int file, off_t * start_pos, off_t * 
    16811681                              long *col1, long *col2) 
    16821682{ 
    16831683    off_t cursor; 
    1684     int col; 
     1684    long col; 
    16851685    off_t blocklen = -1, width = 0; 
    16861686    unsigned char *data; 
    16871687 
    edit_push_undo_action (WEdit * edit, long c) 
    23552355        && spm1 != edit->undo_stack_bottom 
    23562356        && ((sp - 2) & edit->undo_stack_size_mask) != edit->undo_stack_bottom) 
    23572357    { 
    2358         int d; 
     2358        long d; 
    23592359        if (edit->undo_stack[spm1] < 0) 
    23602360        { 
    23612361            d = edit->undo_stack[(sp - 2) & edit->undo_stack_size_mask]; 
    edit_push_redo_action (WEdit * edit, long c) 
    24342434        && spm1 != edit->redo_stack_bottom 
    24352435        && ((sp - 2) & edit->redo_stack_size_mask) != edit->redo_stack_bottom) 
    24362436    { 
    2437         int d; 
     2437        long d; 
    24382438        if (edit->redo_stack[spm1] < 0) 
    24392439        { 
    24402440            d = edit->redo_stack[(sp - 2) & edit->redo_stack_size_mask]; 
    edit_move_to_prev_col (WEdit * edit, off_t p) 
    29652965            fake_half_tabs = HALF_TAB_SIZE * space_width; 
    29662966            if (fake_half_tabs != 0 && edit->curs_col % fake_half_tabs != 0) 
    29672967            { 
    2968                 int q; 
     2968                long q; 
    29692969 
    29702970                q = edit->curs_col; 
    29712971                edit->curs_col -= (edit->curs_col % fake_half_tabs);