Ticket #3547: mc-3547-src-editor-editbuffer.c-Cleanup-some-Warnings.patch

File mc-3547-src-editor-editbuffer.c-Cleanup-some-Warnings.patch, 1.9 KB (added by and, 6 years ago)
  • src/editor/editbuffer.c

    From 7be779ee069338d5dff30e73a9b5b19bde9dd0e7 Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Sun, 28 Feb 2016 20:27:39 +0000
    Subject: [PATCH] src/editor/editbuffer.c: Cleanup some compiler warning
    
    editbuffer.c:428:12: warning: implicit conversion changes signedness: 'long' to 'gsize' (aka 'unsigned long') [-Wsign-conversion]
        *cut = cut_len;
             ~ ^~~~~~~
    editbuffer.c:518:44: warning: implicit conversion loses integer precision: 'off_t' (aka 'long') to 'guint' (aka 'unsigned int') [-Wshorten-64-to-32]
            g_ptr_array_remove_index (buf->b2, i);
            ~~~~~~~~~~~~~~~~~~~~~~~~           ^
    editbuffer.c:554:44: warning: implicit conversion loses integer precision: 'off_t' (aka 'long') to 'guint' (aka 'unsigned int') [-Wshorten-64-to-32]
            g_ptr_array_remove_index (buf->b1, i);
            ~~~~~~~~~~~~~~~~~~~~~~~~           ^
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     src/editor/editbuffer.c | 12 ++++++------
     1 file changed, 6 insertions(+), 6 deletions(-)
    
    diff --git a/src/editor/editbuffer.c b/src/editor/editbuffer.c
    index a62bc00..6b45c10 100644
    a b edit_buffer_get_word_from_pos (const edit_buffer_t * buf, off_t start_pos, off_t 
    401401                               gsize * cut) 
    402402{ 
    403403    off_t word_start; 
    404     long cut_len = 0; 
     404    gsize cut_len = 0; 
    405405    GString *match_expr; 
    406406    int c1, c2; 
    407407 
    edit_buffer_delete (edit_buffer_t * buf) 
    502502{ 
    503503    void *b; 
    504504    unsigned char c; 
    505     off_t prev; 
    506     off_t i; 
     505    off_t prev, i; 
     506    guint j; 
    507507 
    508508    prev = buf->curs2 - 1; 
    509509 
    edit_buffer_delete (edit_buffer_t * buf) 
    513513 
    514514    if (i == 0) 
    515515    { 
    516         i = buf->b2->len - 1; 
    517         b = g_ptr_array_index (buf->b2, i); 
    518         g_ptr_array_remove_index (buf->b2, i); 
     516        j = buf->b2->len - 1; 
     517        b = g_ptr_array_index (buf->b2, j); 
     518        g_ptr_array_remove_index (buf->b2, j); 
    519519        g_free (b); 
    520520    } 
    521521