Ticket #2119: 2119-some-trivial-corrections.patch

File 2119-some-trivial-corrections.patch, 4.7 KB (added by vit_r, 15 years ago)

some-trivial-corrections

  • lib/util.h

    From acc5b501679d20c456cd275ed3f9c5ee2010aff2 Mon Sep 17 00:00:00 2001
    From: Vit Rosin <vit_r@list.ru>
    Date: Mon, 22 Mar 2010 22:08:37 +0000
    Subject: [PATCH]  some trivial corrections
    
    ---
     lib/util.h         |    2 +-
     src/charsets.h     |    3 ++-
     src/complete.c     |   12 ++++++++----
     src/cons.handler.c |    6 ++++--
     src/dialog.h       |    6 +++---
     src/editor/etags.c |    1 -
     src/main.c         |    8 +++++---
     src/viewer/nroff.c |    2 ++
     8 files changed, 25 insertions(+), 15 deletions(-)
    
    diff --git a/lib/util.h b/lib/util.h
    index 606449c..c588434 100644
    a b static inline char * str_move(char * dest, const char * src) 
    288288 
    289289    n = strlen (src) + 1; /* + '\0' */ 
    290290 
    291     return memmove (dest, src, n); 
     291    return ((char *) memmove (dest, src, n)); 
    292292} 
    293293 
    294294gboolean mc_util_make_backup_if_possible (const char *, const char *); 
  • src/charsets.h

    diff --git a/src/charsets.h b/src/charsets.h
    index 98186b8..cb9c7ef 100644
    a b convert_to_display_c (int c) 
    6969{ 
    7070    if (c < 0 || c >= 256) 
    7171        return c; 
    72     return conv_displ[c]; 
     72 
     73    return ((int) conv_displ[c]); 
    7374} 
    7475 
    7576static inline int 
  • src/complete.c

    diff --git a/src/complete.c b/src/complete.c
    index abe0668..2cd098f 100644
    a b command_completion_function (const char *_text, int state, INPUT_COMPLETE_FLAGS 
    520520    switch (phase) { 
    521521    case 0:                     /* Reserved words */ 
    522522        while (*words) { 
    523             if (!strncmp (*words, text, text_len)) 
    524                 return g_strdup (*(words++)); 
     523            if (!strncmp (*words, text, text_len)) { 
     524                g_free (text); 
     525                return g_strdup (*(words++)); 
     526            } 
    525527            words++; 
    526528        } 
    527529        phase++; 
    528530        words = bash_builtins; 
    529531    case 1:                     /* Builtin commands */ 
    530532        while (*words) { 
    531             if (!strncmp (*words, text, text_len)) 
    532                 return g_strdup (*(words++)); 
     533            if (!strncmp (*words, text, text_len)) { 
     534                g_free (text); 
     535                return g_strdup (*(words++)); 
     536            } 
    533537            words++; 
    534538        } 
    535539        phase++; 
  • src/cons.handler.c

    diff --git a/src/cons.handler.c b/src/cons.handler.c
    index bb4674b..a65b1a5 100644
    a b handle_console_linux (unsigned char action) 
    107107    switch (action) { 
    108108    case CONSOLE_INIT: 
    109109        /* Close old pipe ends in case it is the 2nd time we run cons.saver */ 
    110         close (pipefd1[1]); 
    111         close (pipefd2[0]); 
     110        if (pipefd1[1] > 2) { 
     111            close (pipefd1[1]); 
     112            close (pipefd2[0]); 
     113        } 
    112114        /* Create two pipes for communication */ 
    113115        pipe (pipefd1); 
    114116        pipe (pipefd2); 
  • src/dialog.h

    diff --git a/src/dialog.h b/src/dialog.h
    index c40dd5f..514b6a7 100644
    a b send_message (Widget *w, widget_msg_t msg, int parm) 
    235235    return (*(w->callback)) (w, msg, parm); 
    236236} 
    237237 
    238 /* Return 1 if the widget is active, 0 otherwise */ 
    239 static inline int 
     238/* Return TRUE if the widget is active, FALSE otherwise */ 
     239static inline gboolean 
    240240dlg_widget_active (void *w) 
    241241{ 
    242242    Widget *w1 = (Widget *) w; 
    243     return (w1->parent->current == w1); 
     243    return ((gboolean) (w1->parent->current == w1)); 
    244244} 
    245245 
    246246void dlg_replace_widget   (Widget *old, Widget *new); 
  • src/editor/etags.c

    diff --git a/src/editor/etags.c b/src/editor/etags.c
    index e5d0a81..945f597 100644
    a b static gboolean parse_define(char *buf, char **long_name, char **short_name, lon 
    110110            *short_name = g_strdup (shortdef); 
    111111            *line = atol (linedef); 
    112112            return TRUE; 
    113             break; 
    114113        } 
    115114        buf++; 
    116115        c = *buf; 
  • src/main.c

    diff --git a/src/main.c b/src/main.c
    index 27e34b7..c01d453 100644
    a b init_xterm_support (void) 
    13881388    const char *termvalue; 
    13891389 
    13901390    termvalue = getenv ("TERM"); 
    1391     if (!termvalue || !(*termvalue)) { 
     1391    if (termvalue == NULL || *termvalue == '\0') { 
    13921392        fputs (_("The TERM environment variable is unset!\n"), stderr); 
    1393         exit (1); 
     1393        exit (EXIT_FAILURE); 
    13941394    } 
    13951395 
    13961396    /* Check mouse capabilities */ 
    mc_main__setup_by_args (int argc, char *argv[]) 
    20402040             * in error messages and warnings. It is supported so that 
    20412041             * users can quickly copy and paste file locations. 
    20422042             */ 
    2043             char *end = tmp + strlen (tmp), *p = end; 
     2043            char *end = tmp + strlen (tmp); 
     2044            char *p = end; 
     2045 
    20442046            if (p > tmp && p[-1] == ':') 
    20452047                p--; 
    20462048            while (p > tmp && g_ascii_isdigit ((gchar) p[-1])) 
  • src/viewer/nroff.c

    diff --git a/src/viewer/nroff.c b/src/viewer/nroff.c
    index 95d743f..4411a1d 100644
    a b mcview_nroff_seq_free (mcview_nroff_t ** nroff) 
    277277{ 
    278278    if (nroff == NULL || *nroff == NULL) 
    279279        return; 
     280 
     281    g_free ((*nroff)->view); 
    280282    g_free (*nroff); 
    281283    nroff = NULL; 
    282284}