Ticket #1700: 0001-Ticket-1700-fixed-skin-color-parser.patch

File 0001-Ticket-1700-fixed-skin-color-parser.patch, 2.1 KB (added by andrew_b, 15 years ago)

Strip leading and trailing spaces in color names read from skin ini

file

  • src/skin/colors.c

    From 17e943401052e9db6ef32070b20c0416ce2cde4d Mon Sep 17 00:00:00 2001
    From: Andrew Borodin <aborodin@vmail.ru>
    Date: Sat, 10 Oct 2009 09:35:37 +0400
    Subject: [PATCH] Ticket #1700: fixed skin color parser.
    
    Strip leading and trailing spaces in color names read from skin ini
    file.
    
    Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
    ---
     src/skin/colors.c |   12 ++++++------
     1 files changed, 6 insertions(+), 6 deletions(-)
    
    diff --git a/src/skin/colors.c b/src/skin/colors.c
    index 638fb1f..95b7df8 100644
    a b mc_skin_color_get_from_ini_file (mc_skin_t * mc_skin, const gchar * group, const 
    144144    case 0: 
    145145        tmp = mc_skin_color_get_with_defaults (group, "_default_"); 
    146146        if (tmp) { 
    147             mc_skin_color->fgcolor = g_strdup (tmp->fgcolor); 
    148             mc_skin_color->bgcolor = g_strdup (tmp->bgcolor); 
     147            mc_skin_color->fgcolor = g_strstrip (g_strdup (tmp->fgcolor)); 
     148            mc_skin_color->bgcolor = g_strstrip (g_strdup (tmp->bgcolor)); 
    149149        } else { 
    150150            g_strfreev (values); 
    151151            g_free (mc_skin_color); 
    mc_skin_color_get_from_ini_file (mc_skin_t * mc_skin, const gchar * group, const 
    153153        } 
    154154        break; 
    155155    case 1: 
    156         mc_skin_color->fgcolor = (values[0]) ? g_strdup (values[0]) : NULL; 
     156        mc_skin_color->fgcolor = (values[0]) ? g_strstrip (g_strdup (values[0])) : NULL; 
    157157        tmp = mc_skin_color_get_with_defaults (group, "_default_"); 
    158         mc_skin_color->bgcolor = (tmp != NULL) ? g_strdup (tmp->bgcolor) : NULL; 
     158        mc_skin_color->bgcolor = (tmp != NULL) ? g_strstrip (g_strdup (tmp->bgcolor)) : NULL; 
    159159        break; 
    160160    case 2: 
    161         mc_skin_color->fgcolor = (values[0]) ? g_strdup (values[0]) : NULL; 
    162         mc_skin_color->bgcolor = (values[1]) ? g_strdup (values[1]) : NULL; 
     161        mc_skin_color->fgcolor = (values[0]) ? g_strstrip (g_strdup (values[0])) : NULL; 
     162        mc_skin_color->bgcolor = (values[1]) ? g_strstrip (g_strdup (values[1])) : NULL; 
    163163        break; 
    164164    } 
    165165    g_strfreev (values);