Ticket #1838: 0001-REBASE-CLEANUP-for-merge-with-730ab3937cc3d8d978b5.patch

File 0001-REBASE-CLEANUP-for-merge-with-730ab3937cc3d8d978b5.patch, 3.8 KB (added by slavazanko, 14 years ago)
  • src/ext.c

    From d15379c31d9437ecf3bf390379663b17bd4ea28b Mon Sep 17 00:00:00 2001
    From: Slava Zanko <slavazanko@gmail.com>
    Date: Fri, 27 Nov 2009 12:54:25 +0200
    Subject: [PATCH] REBASE: CLEANUP: for merge with 730ab3937cc3d8d978b51829bfa6ced71d2bd660
    
    run command:
    
    git rebase -i 730ab3937cc3d8d978b51829bfa6ced71d2bd660^
    
    and split this commit with 730ab3937cc3d
    
    Signed-off-by: Slava Zanko <slavazanko@gmail.com>
    ---
     src/ext.c |   63 +++++++++++++++++++++++++++++-------------------------------
     1 files changed, 30 insertions(+), 33 deletions(-)
    
    diff --git a/src/ext.c b/src/ext.c
    index b9ed2d7..771f85a 100644
    a b exec_extension (const char *filename, const char *lc_data, int *move_dir, 
    300300#   define FILE_CMD "file " 
    301301#endif 
    302302 
    303 /*   
     303/* 
    304304 * Run cmd_file with args, put in buf[buflen] result. 
    305305 * If error, put in buf[0] = '\0'; 
    306306 * 
    get_popen_information(const char *cmd_file, const char *args, char *buf, int bu 
    326326        read_bytes = (fgets (buf, buflen, f) 
    327327                      != NULL); 
    328328        if (read_bytes == 0) 
    329   /* if(buflen > 0) // ;-) */ 
    330             buf[0] = 0; 
     329/* if(buflen > 0) // ;-) */ 
     330        buf[0] = 0; 
    331331        pclose (f); 
    332     } else {                               
    333   /* if(buflen > 0) // ;-) */ 
     332    } else { 
     333/* if(buflen > 0) // ;-) */ 
    334334        buf[0] = 0; /* Paranoid termination */ 
    335335        return -1; 
    336336    } 
    337            
     337 
    338338    /* Paranoid termination */ 
    339           buf[buflen - 1] = 0; 
     339    buf[buflen - 1] = 0; 
    340340 
    341341    return (read_bytes > 0); 
    342342} 
    get_file_type_local (const char *filename, char *buf, int buflen) 
    361361static int 
    362362get_file_encoding_local (const char *filename, char *buf, int buflen) 
    363363{ 
    364     if(autodetect_codeset[0] != '\0') 
    365     { 
    366       int read_bytes = 0; 
    367       char *tmp = name_quote (filename, 0); 
    368       char *lang = name_quote (autodetect_codeset, 0); 
    369       char *args= g_strconcat (" -L", lang, " -i ", tmp, (char *) 0); 
    370       int ret = get_popen_information("enca", args, buf, buflen); 
    371       g_free (args); 
    372       g_free (lang); 
    373       g_free (tmp); 
    374       return ret; 
     364    if(autodetect_codeset[0] != '\0') { 
     365        int read_bytes = 0; 
     366        char *tmp = name_quote (filename, 0); 
     367        char *lang = name_quote (autodetect_codeset, 0); 
     368        char *args= g_strconcat (" -L", lang, " -i ", tmp, (char *) 0); 
     369        int ret = get_popen_information("enca", args, buf, buflen); 
     370        g_free (args); 
     371        g_free (lang); 
     372        g_free (tmp); 
     373        return ret; 
    375374    } 
    376   return 0; 
     375    return 0; 
    377376} 
    378377 
    379378 
    regex_check_type (const char *filename, const char *ptr, int *have_type) 
    390389 
    391390    /* Following variables are valid if *have_type is 1 */ 
    392391    static char content_string[2048]; 
    393     static char encoding_id[21]; // CSISO51INISCYRILLIC -- 20 
     392    static char encoding_id[21]; /* CSISO51INISCYRILLIC -- 20 */ 
    394393    static int got_encoding_data = 0; 
    395394    static int content_shift = 0; 
    396395    static int got_data = 0; 
    regex_check_type (const char *filename, const char *ptr, int *have_type) 
    411410 
    412411        realname = localfile; 
    413412 
    414   got_encoding_data = 
    415     get_file_encoding_local (localfile, encoding_id, 
     413        got_encoding_data = 
     414            get_file_encoding_local (localfile, encoding_id, 
    416415                                 sizeof (encoding_id)); 
    417416        mc_ungetlocalcopy (filename, localfile, 0); 
    418417 
    419   if( got_encoding_data > 0 ) 
    420   { 
    421           char *pp; 
    422           if ((pp = strchr (encoding_id, '\n')) != 0) 
    423                   *pp = 0; 
     418        if( got_encoding_data > 0 ) { 
     419            char *pp; 
     420            if ((pp = strchr (encoding_id, '\n')) != 0) 
     421                *pp = 0; 
    424422 
    425     source_codepage = get_codepage_index( encoding_id ); 
    426     if(source_codepage == -1)   
    427        source_codepage = default_source_codepage; 
    428   } 
     423            source_codepage = get_codepage_index( encoding_id ); 
     424            if(source_codepage == -1) 
     425                source_codepage = default_source_codepage; 
     426        } 
    429427 
    430    
    431   got_data = 
     428        got_data = 
    432429            get_file_type_local (localfile, content_string, 
    433430                                 sizeof (content_string)); 
    434431