Project now build with:

make CFLAGS="-ansi -pedantic -Wall -Wextra -Werror"

WARNING! Builds wuthout samba.
This commit is contained in:
Slava Zanko 2009-04-24 01:47:22 +03:00
parent 1d18f3227e
commit 10b7bdb361
42 changed files with 649 additions and 409 deletions

View File

@ -1080,6 +1080,7 @@ int edit_delete (WEdit * edit, const int byte_delete)
{
int p = 0;
int cw = 1;
int i;
if (!edit->curs2)
return 0;
@ -1095,7 +1096,7 @@ int edit_delete (WEdit * edit, const int byte_delete)
if ( cw < 1 )
cw = 1;
}
for ( int i = 1; i<= cw; i++ ) {
for ( i = 1; i<= cw; i++ ) {
p = edit->buffers2[(edit->curs2 - 1) >> S_EDIT_BUF_SIZE][EDIT_BUF_SIZE - ((edit->curs2 - 1) & M_EDIT_BUF_SIZE) - 1];
if (!(edit->curs2 & M_EDIT_BUF_SIZE)) {
@ -1129,6 +1130,7 @@ edit_backspace (WEdit * edit)
{
int p = 0;
int cw = 1;
int i;
if (!edit->curs1)
return 0;
@ -1143,7 +1145,7 @@ edit_backspace (WEdit * edit)
if ( cw < 1 )
cw = 1;
}
for ( int i = 1; i<= cw; i++ ) {
for ( i = 1; i<= cw; i++ ) {
p = *(edit->buffers1[(edit->curs1 - 1) >> S_EDIT_BUF_SIZE] + ((edit->curs1 - 1) & M_EDIT_BUF_SIZE));
if (!((edit->curs1 - 1) & M_EDIT_BUF_SIZE)) {
g_free (edit->buffers1[edit->curs1 >> S_EDIT_BUF_SIZE]);
@ -1286,6 +1288,7 @@ void edit_cursor_move (WEdit * edit, long increment)
long curs2 = edit->curs2;
int cw = 1;
int char_step = 0;
int i;
/* one char move*/
if ( increment == -1 || increment == 1)
@ -1312,7 +1315,7 @@ void edit_cursor_move (WEdit * edit, long increment)
if ( cw < 1 )
cw = 1;
}
for ( int i = 1; i<= cw; i++ ) {
for ( i = 1; i<= cw; i++ ) {
c = edit_get_byte (edit, curs1 - 1);
if (!((curs2 + 1) & M_EDIT_BUF_SIZE))
edit->buffers2[(curs2 + 1) >> S_EDIT_BUF_SIZE] = g_malloc (EDIT_BUF_SIZE);
@ -1346,7 +1349,7 @@ void edit_cursor_move (WEdit * edit, long increment)
if ( cw < 1 )
cw = 1;
}
for ( int i = 1; i<= cw; i++ ) {
for ( i = 1; i<= cw; i++ ) {
c = edit_get_byte (edit, curs1);
if (!(curs1 & M_EDIT_BUF_SIZE))
edit->buffers1[curs1 >> S_EDIT_BUF_SIZE] = g_malloc (EDIT_BUF_SIZE);
@ -2356,6 +2359,8 @@ static const char * const shell_cmd[] = SHELL_COMMANDS_i;
void
edit_execute_cmd (WEdit *edit, int command, int char_for_insertion)
{
int i = 0;
edit->force |= REDRAW_LINE;
/* The next key press will unhighlight the found string, so update
@ -2395,14 +2400,13 @@ edit_execute_cmd (WEdit *edit, int command, int char_for_insertion)
#ifdef HAVE_CHARSET
if ( char_for_insertion > 255 && utf8_display == 0 ) {
unsigned char str[6 + 1];
int res = g_unichar_to_utf8 (char_for_insertion, str);
int res = g_unichar_to_utf8 (char_for_insertion, (char *)str);
if ( res == 0 ) {
str[0] = '.';
str[1] = '\0';
} else {
str[res] = '\0';
}
int i = 0;
while ( str[i] != 0 && i<=6) {
char_for_insertion = str[i];
edit_insert (edit, char_for_insertion);

View File

@ -77,7 +77,7 @@ static int replace_whole = 0;
static int replace_case = 0;
static int replace_backwards = 0;
static int search_create_bookmark = 0;
static int search_in_all_charsets = 0;
/* static int search_in_all_charsets = 0; */
/* queries on a save */
int edit_confirm_save = 1;
@ -93,10 +93,12 @@ static int
editcmd_get_str_nlen(const char*str, int byte_len)
{
int ret;
char *tmp;
if (!str || byte_len < 1)
return 0;
char *tmp = g_malloc(sizeof(char)*byte_len+1);
tmp = g_malloc(sizeof(char)*byte_len+1);
memcpy(tmp,str,byte_len);
tmp[byte_len] = '\0';
ret = str_length(tmp);
@ -105,7 +107,7 @@ editcmd_get_str_nlen(const char*str, int byte_len)
}
static void
edit_search_cmd_search_create_bookmark(WEdit * edit, const char *search_string)
edit_search_cmd_search_create_bookmark(WEdit * edit)
{
int found = 0, books = 0;
int l = 0, l_last = -1;
@ -445,7 +447,7 @@ void menu_save_mode_cmd (void)
for (i = 0; i < 3; i++ ) {
str[i] = _(str[i]);
maxlen = max (maxlen, str_term_width1 (str[i]) + 7);
maxlen = max (maxlen, (size_t) str_term_width1 (str[i]) + 7);
}
i18n_flag = 1;
@ -1429,6 +1431,7 @@ static long sargs[NUM_REPL_ARGS][256 / sizeof (long)];
/* This function is a modification of mc-3.2.10/src/view.c:regexp_view_search() */
/* returns -3 on error in pattern, -1 on not found, found_len = 0 if either */
/*
static int
string_regexp_search (char *pattern, char *string, int match_type,
int match_bol, int icase, int *found_len, void *d)
@ -1469,7 +1472,7 @@ string_regexp_search (char *pattern, char *string, int match_type,
*found_len = pmatch[0].rm_eo - pmatch[0].rm_so;
return (pmatch[0].rm_so);
}
*/
/* thanks to Liviu Daia <daia@stoilow.imar.ro> for getting this
(and the above) routines to work properly - paul */
@ -1595,13 +1598,13 @@ err:
va_end (ap);
return -2;
}
/*
static void regexp_error (WEdit *edit)
{
(void) edit;
edit_error_dialog (_("Error"), _(" Invalid regular expression, or scanf expression with too many conversions "));
}
*/
static char *
edit_replace_cmd__conv_to_display(char *str)
{
@ -1999,7 +2002,7 @@ void edit_search_cmd (WEdit * edit, int again)
if (search_create_bookmark)
{
edit_search_cmd_search_create_bookmark(edit, (const char *) search_string);
edit_search_cmd_search_create_bookmark(edit);
}
else
{
@ -2658,12 +2661,15 @@ edit_collect_completions (WEdit *edit, long start, int word_len,
int len = 0, max_len = 0, i, skip;
unsigned char *bufpos;
(void) match_expr;
/* collect max MAX_WORD_COMPLETIONS completions */
while (*num < MAX_WORD_COMPLETIONS) {
/* get next match */
// start =
// edit_find (start - 1, (unsigned char *) match_expr, &len,
// edit->last_byte, edit_get_byte_ptr, (void *) edit, 0);
/*
start =
edit_find (start - 1, (unsigned char *) match_expr, &len,
edit->last_byte, edit_get_byte_ptr, (void *) edit, 0);
*/
start = -1;
/* not matched */
if (start < 0)
@ -2955,7 +2961,9 @@ edit_select_definition_dialog (WEdit * edit, char *match_expr, int max_len, int
WListbox *def_list;
int def_dlg_h; /* dialog height */
int def_dlg_w; /* dialog width */
char *label_def = NULL;
(void) word_len;
/* calculate the dialog metrics */
def_dlg_h = num_lines + 2;
def_dlg_w = max_len + 4;
@ -2987,7 +2995,6 @@ edit_select_definition_dialog (WEdit * edit, char *match_expr, int max_len, int
/* add the dialog */
add_widget (def_dlg, def_list);
char *label_def = NULL;
/* fill the listbox with the completions */
for (i = 0; i < num_lines; i++) {
@ -3001,9 +3008,10 @@ edit_select_definition_dialog (WEdit * edit, char *match_expr, int max_len, int
/* apply the choosen completion */
if ( def_dlg->ret_value == B_ENTER ) {
char *tmp_curr_def = (char *) curr_def;
int do_moveto = 0;
listbox_get_current (def_list, &curr, &tmp_curr_def);
curr_def = (etags_hash_t *) tmp_curr_def;
int do_moveto = 0;
if ( edit->modified ) {
if ( !edit_query_dialog2
(_("Warning"),
@ -3037,7 +3045,7 @@ edit_select_definition_dialog (WEdit * edit, char *match_expr, int max_len, int
}
/* clear definition hash */
for ( int i = 0; i < MAX_DEFINITIONS; i++) {
for ( i = 0; i < MAX_DEFINITIONS; i++) {
g_free(def_hash[i].filename);
}
@ -3052,6 +3060,7 @@ edit_get_match_keyword_cmd (WEdit *edit)
int word_len = 0;
int num_def = 0;
int max_len = 0;
int i;
long word_start = 0;
unsigned char *bufpos;
char *match_expr;
@ -3061,7 +3070,7 @@ edit_get_match_keyword_cmd (WEdit *edit)
etags_hash_t def_hash[MAX_DEFINITIONS];
for ( int i = 0; i < MAX_DEFINITIONS; i++) {
for ( i = 0; i < MAX_DEFINITIONS; i++) {
def_hash[i].filename = NULL;
}

View File

@ -301,14 +301,14 @@ print_to_widget (WEdit *edit, long row, int start_col, int start_col_real,
}
}
if ( textchar > 255 ) {
int res = g_unichar_to_utf8 (textchar, str);
int res = g_unichar_to_utf8 (textchar, (char *)str);
if ( res == 0 ) {
str[0] = '.';
str[1] = '\0';
} else {
str[res] = '\0';
}
addstr (str);
addstr ((char *)str);
} else {
addch(textchar);
}

View File

@ -116,6 +116,8 @@ int etags_set_definition_hash(const char *tagfile, const char *start_path,
const char *match_func,
etags_hash_t *def_hash)
{
enum {start, in_filename, in_define} state = start;
FILE *f;
static char buf[BUF_LARGE];
@ -126,16 +128,14 @@ int etags_set_definition_hash(const char *tagfile, const char *start_path,
char *chekedstr = NULL;
int num = 0; /* returned value */
int pos;
char *filename = NULL;
/* open file with positions */
f = fopen (tagfile, "r");
if (!f)
return 0;
int pos;
char *filename = NULL;
enum {start, in_filename, in_define} state = start;
while (fgets (buf, sizeof (buf), f)) {
switch ( state ) {
@ -162,7 +162,8 @@ int etags_set_definition_hash(const char *tagfile, const char *start_path,
parse_define (chekedstr, &longname, &shortname, &line);
if ( num < MAX_DEFINITIONS - 1 ) {
def_hash[num].filename_len = strlen (filename);
def_hash[num].fullpath = g_build_filename (start_path, filename, (char *) NULL);
def_hash[num].fullpath = g_build_filename ( start_path, filename, (char *) NULL);
canonicalize_pathname (def_hash[num].fullpath);
def_hash[num].filename = g_strdup (filename);
if ( shortname ) {

View File

@ -13,9 +13,9 @@
typedef struct etags_hash_struct {
size_t filename_len;
unsigned char *fullpath;
unsigned char *filename;
unsigned char *short_define;
char *fullpath;
char *filename;
char *short_define;
long line;
} etags_hash_t;

View File

@ -151,13 +151,13 @@ static mode_t get_perm (char *s, int base)
m = 0;
m |= (s[0] == '-') ? 0 :
((s[0] == '+') ? (1 << (base + 2)) : (1 << (base + 2)) & ch_cmode);
((s[0] == '+') ? (mode_t)(1 << (base + 2)) : (1 << (base + 2)) & ch_cmode);
m |= (s[1] == '-') ? 0 :
((s[1] == '+') ? (1 << (base + 1)) : (1 << (base + 1)) & ch_cmode);
((s[1] == '+') ? (mode_t)(1 << (base + 1)) : (1 << (base + 1)) & ch_cmode);
m |= (s[2] == '-') ? 0 :
((s[2] == '+') ? (1 << base) : (1 << base) & ch_cmode);
((s[2] == '+') ? (mode_t)(1 << base) : (1 << base) & ch_cmode);
return m;
}

View File

@ -197,7 +197,26 @@ background_attention (int fd, void *closure)
{
FileOpContext *ctx;
int have_ctx;
void *routine;
union
{
int (*have_ctx1)(int, char *);
int (*have_ctx2)(int, char *, char *);
int (*have_ctx3)(int, char *, char *, char *);
int (*have_ctx4)(int, char *, char *, char *, char *);
int (*non_have_ctx1)(FileOpContext *, int, char *);
int (*non_have_ctx2)(FileOpContext *, int, char *, char *);
int (*non_have_ctx3)(FileOpContext *, int, char *, char *, char *);
int (*non_have_ctx4)(FileOpContext *, int, char *, char *, char *, char *);
char * (*ret_str1)(char *);
char * (*ret_str2)(char *, char *);
char * (*ret_str3)(char *, char *, char *);
char * (*ret_str4)(char *, char *, char *, char *);
void *pointer;
} routine;
/* void *routine;*/
int argc, i, result, status;
char *data [MAXCALLARGS];
ssize_t bytes;
@ -205,7 +224,7 @@ background_attention (int fd, void *closure)
ctx = closure;
bytes = read (fd, &routine, sizeof (routine));
bytes = read (fd, &routine.pointer, sizeof (routine));
if (bytes == -1 || (size_t) bytes < (sizeof (routine))) {
const char *background_process_error = _(" Background process error ");
@ -252,38 +271,31 @@ background_attention (int fd, void *closure)
if (!have_ctx)
switch (argc){
case 1:
result = (*(int (*)(int, char *))routine)(Background, data [0]);
result = routine.have_ctx1 (Background, data [0]);
break;
case 2:
result = (*(int (*)(int, char *, char *))routine)
(Background, data [0], data [1]);
result = routine.have_ctx2 (Background, data [0], data [1]);
break;
case 3:
result = (*(int (*)(int, char *, char *, char *))routine)
(Background, data [0], data [1], data [2]);
result = routine.have_ctx3 (Background, data [0], data [1], data [2]);
break;
case 4:
result = (*(int (*)(int, char *, char *, char *, char *))routine)
(Background, data [0], data [1], data [2], data [3]);
result = routine.have_ctx4 (Background, data [0], data [1], data [2], data [3]);
break;
}
else
switch (argc){
case 1:
result = (*(int (*)(FileOpContext *, int, char *))routine)
(ctx, Background, data [0]);
result = routine.non_have_ctx1 (ctx, Background, data [0]);
break;
case 2:
result = (*(int (*)(FileOpContext *, int, char *, char *))routine)
(ctx, Background, data [0], data [1]);
result = routine.non_have_ctx2 (ctx, Background, data [0], data [1]);
break;
case 3:
result = (*(int (*)(FileOpContext *, int, char *, char *, char *))routine)
(ctx, Background, data [0], data [1], data [2]);
result = routine.non_have_ctx3 (ctx, Background, data [0], data [1], data [2]);
break;
case 4:
result = (*(int (*)(FileOpContext *, int, char *, char *, char *, char *))routine)
(ctx, Background, data [0], data [1], data [2], data [3]);
result = routine.non_have_ctx4 (ctx, Background, data [0], data [1], data [2], data [3]);
break;
}
@ -300,19 +312,16 @@ background_attention (int fd, void *closure)
*/
switch (argc){
case 1:
resstr = (*(char * (*)(char *))routine)(data [0]);
resstr = routine.ret_str1 (data [0]);
break;
case 2:
resstr = (*(char * (*)(char *, char *))routine)
(data [0], data [1]);
resstr = routine.ret_str2 (data [0], data [1]);
break;
case 3:
resstr = (*(char * (*)(char *, char *, char *))routine)
(data [0], data [1], data [2]);
resstr = routine.ret_str3 (data [0], data [1], data [2]);
break;
case 4:
resstr = (*(char * (*)(char *, char *, char *, char *))routine)
(data [0], data [1], data [2], data [3]);
resstr = routine.ret_str4 (data [0], data [1], data [2], data [3]);
break;
default: g_assert_not_reached();
}

View File

@ -565,6 +565,8 @@ sel_charset_button (int action)
{
const char *cpname;
char buf[64];
(void) action;
new_display_codepage = select_charset (0, 0, new_display_codepage, 1);
cpname = (new_display_codepage < 0)
? _("Other 8 bit")
@ -680,6 +682,7 @@ tree_box (const char *current_dir)
char *val;
WButtonBar *bar;
(void) current_dir;
/* Create the components */
dlg = create_dlg (0, 0, TREE_Y, TREE_X, dialog_colors,
tree_callback, "[Directory Tree]", NULL, DLG_CENTER | DLG_REVERSE);

View File

@ -311,19 +311,19 @@ str_nconvert_to_input (char *str, int len)
unsigned char
convert_from_utf_to_current (const char *str)
{
unsigned char buf_ch[6 + 1];
unsigned char ch = '.';
GIConv conv;
const char *cp_to;
if (!str)
return '.';
unsigned char buf_ch[6 + 1];
unsigned char ch = '.';
GIConv conv;
const char *cp_to = get_codepage_id ( source_codepage );
cp_to = get_codepage_id ( source_codepage );
conv = str_crt_conv_to ( cp_to );
if (conv != INVALID_CONV) {
switch (str_translate_char (conv, str, -1, buf_ch, sizeof(buf_ch))) {
switch (str_translate_char (conv, str, -1, (char *)buf_ch, sizeof(buf_ch))) {
case ESTR_SUCCESS:
ch = buf_ch[0];
break;
@ -345,21 +345,22 @@ convert_from_utf_to_current_c (const int input_char)
unsigned char str[6 + 1];
unsigned char buf_ch[6 + 1];
unsigned char ch = '.';
const char *cp_from;
GIConv conv;
int res = 0;
res = g_unichar_to_utf8 (input_char, str);
res = g_unichar_to_utf8 (input_char, (char *)str);
if ( res == 0 ) {
return ch;
}
str[res] = '\0';
const char *cp_from = get_codepage_id ( source_codepage );
cp_from = get_codepage_id ( source_codepage );
conv = str_crt_conv_from ( cp_from );
if (conv != INVALID_CONV) {
switch (str_translate_char (conv, str, -1, buf_ch, sizeof(buf_ch))) {
switch (str_translate_char (conv, (char *)str, -1, (char *)buf_ch, sizeof(buf_ch))) {
case ESTR_SUCCESS:
ch = buf_ch[0];
break;
@ -381,17 +382,18 @@ convert_from_8bit_to_utf_c (const char input_char)
int ch = '.';
int res = 0;
GIConv conv;
const char *cp_from;
str[0] = (unsigned char) input_char;
str[1] = '\0';
const char *cp_from = get_codepage_id ( source_codepage );
cp_from = get_codepage_id ( source_codepage );
conv = str_crt_conv_from (cp_from);
if (conv != INVALID_CONV) {
switch (str_translate_char (conv, str, -1, buf_ch, sizeof(buf_ch))) {
switch (str_translate_char (conv, (char *)str, -1, (char *)buf_ch, sizeof(buf_ch))) {
case ESTR_SUCCESS:
res = g_utf8_get_char_validated (buf_ch, -1);
res = g_utf8_get_char_validated ((char *)buf_ch, -1);
if ( res < 0 ) {
ch = buf_ch[0];
} else {
@ -417,17 +419,18 @@ convert_from_8bit_to_utf_c2 (const char input_char)
int ch = '.';
int res = 0;
GIConv conv;
const char *cp_from;
str[0] = (unsigned char) input_char;
str[1] = '\0';
const char *cp_from = get_codepage_id ( source_codepage );
cp_from = get_codepage_id ( source_codepage );
conv = str_crt_conv_to (cp_from);
if (conv != INVALID_CONV) {
switch (str_translate_char (conv, str, -1, buf_ch, sizeof(buf_ch))) {
switch (str_translate_char (conv, (char *) str, -1, (char *) buf_ch, sizeof(buf_ch))) {
case ESTR_SUCCESS:
res = g_utf8_get_char_validated (buf_ch, -1);
res = g_utf8_get_char_validated ((char *) buf_ch, -1);
if ( res < 0 ) {
ch = buf_ch[0];
} else {

View File

@ -133,43 +133,6 @@ static struct color_table_s const color_table [] = {
{ "default", 0 } /* default color of the terminal */
};
static const char *default_colors =
"normal=lightgray,blue:"
"selected=black,cyan:"
"marked=yellow,blue:"
"markselect=yellow,cyan:"
"errors=white,red:"
"menu=white,cyan:"
"reverse=black,lightgray:"
"dnormal=black,lightgray:"
"dfocus=black,cyan:"
"dhotnormal=blue,lightgray:"
"dhotfocus=blue,cyan:"
"viewunderline=brightred,blue:"
"menuhot=yellow,cyan:"
"menusel=white,black:"
"menuhotsel=yellow,black:"
"helpnormal=black,lightgray:"
"helpitalic=red,lightgray:"
"helpbold=blue,lightgray:"
"helplink=black,cyan:"
"helpslink=yellow,blue:"
"gauge=white,black:"
"input=black,cyan:"
"directory=white,blue:"
"executable=brightgreen,blue:"
"link=lightgray,blue:"
"stalelink=brightred,blue:"
"device=brightmagenta,blue:"
"core=red,blue:"
"special=black,blue:"
"editnormal=lightgray,blue:"
"editbold=yellow,blue:"
"editmarked=black,cyan:"
"editwhitespace=brightblue,blue:"
"errdhotnormal=yellow,red:"
"errdhotfocus=yellow,lightgray";
#ifdef HAVE_SLANG
# define color_value(i) color_table [i].name
# define color_name(i) color_table [i].name
@ -257,13 +220,52 @@ static void configure_colors_string (const char *the_color_string)
static void configure_colors (void)
{
gchar *default_colors = g_strconcat (
"normal=lightgray,blue:"
"selected=black,cyan:"
"marked=yellow,blue:"
"markselect=yellow,cyan:"
"errors=white,red:"
"menu=white,cyan:"
"reverse=black,lightgray:"
"dnormal=black,lightgray:"
"dfocus=black,cyan:"
"dhotnormal=blue,lightgray:"
"dhotfocus=blue,cyan:"
"viewunderline=brightred,blue:"
"menuhot=yellow,cyan:"
"menusel=white,black:"
"menuhotsel=yellow,black:"
"helpnormal=black,lightgray:"
"helpitalic=red,lightgray:"
"helpbold=blue,lightgray:"
"helplink=black,cyan:"
"helpslink=yellow,blue:"
"gauge=white,black:"
"input=black,cyan:"
"directory=white,blue:"
,
"executable=brightgreen,blue:"
"link=lightgray,blue:"
"stalelink=brightred,blue:"
"device=brightmagenta,blue:"
"core=red,blue:"
"special=black,blue:"
"editnormal=lightgray,blue:"
"editbold=yellow,blue:"
"editmarked=black,cyan:"
"editwhitespace=brightblue,blue:"
"errdhotnormal=yellow,red:"
"errdhotfocus=yellow,lightgray", NULL);
extern char *command_line_colors;
configure_colors_string (default_colors);
configure_colors_string (setup_color_string);
configure_colors_string (term_color_string);
configure_colors_string (getenv ("MC_COLOR_TABLE"));
configure_colors_string (command_line_colors);
g_free(default_colors);
}
#ifndef HAVE_SLANG

View File

@ -44,7 +44,7 @@
typedef char *CompletionFunction (char * text, int state, INPUT_COMPLETE_FLAGS flags);
//#define DO_COMPLETION_DEBUG
/* #define DO_COMPLETION_DEBUG */
#ifdef DO_COMPLETION_DEBUG
/*
* Useful to print/debug completion flags
@ -106,7 +106,7 @@ filename_completion_function (char *text, int state, INPUT_COMPLETE_FLAGS flags)
/* Save the version of the directory that the user typed. */
users_dirname = dirname;
{
// FIXME: memleak ?
/* FIXME: memleak ? */
dirname = tilde_expand (dirname);
canonicalize_pathname (dirname);
/* Here we should do something with variable expansion
@ -160,7 +160,7 @@ filename_completion_function (char *text, int state, INPUT_COMPLETE_FLAGS flags)
}
else
{
// stat failed, strange. not a dir in any case
/* stat failed, strange. not a dir in any case */
isdir = 0;
}
g_free (tmp);
@ -224,6 +224,7 @@ username_completion_function (char *text, int state, INPUT_COMPLETE_FLAGS flags)
static struct passwd *entry;
static int userlen;
(void) flags;
SHOW_C_CTX("username_completion_function");
if (text[0] == '\\' && text[1] == '~') text++;
@ -267,6 +268,7 @@ variable_completion_function (char *text, int state, INPUT_COMPLETE_FLAGS flags)
static int varlen, isbrace;
const char *p = NULL;
(void) flags;
SHOW_C_CTX("variable_completion_function");
if (!state){ /* Initialization stuff */
@ -390,6 +392,7 @@ hostname_completion_function (char *text, int state, INPUT_COMPLETE_FLAGS flags)
static char **host_p;
static int textstart, textlen;
(void) flags;
SHOW_C_CTX("hostname_completion_function");
if (!state){ /* Initialization stuff */

View File

@ -63,7 +63,7 @@
#include "widget.h"
#include "wtools.h"
#include "background.h" /* we_are_background */
//#include "util.h"
/* #include "util.h" */
#include "strutil.h"
/* Needed for current_panel, other_panel and WTree */
@ -2201,8 +2201,14 @@ real_query_recursive (FileOpContext *ctx, enum OperationMode mode, const char *s
static FileProgressStatus
do_file_error (const char *str)
{
union {
void *p;
FileProgressStatus (*f) (enum OperationMode, const char *);
} pntr;
pntr.f = real_do_file_error;
if (we_are_background)
return parent_call (real_do_file_error, NULL, 1, strlen (str),
return parent_call (pntr.p, NULL, 1, strlen (str),
str);
else
return real_do_file_error (Foreground, str);
@ -2211,8 +2217,14 @@ do_file_error (const char *str)
static FileProgressStatus
query_recursive (FileOpContext *ctx, const char *s)
{
union {
void *p;
FileProgressStatus (*f) (FileOpContext *, enum OperationMode, const char *);
} pntr;
pntr.f = real_query_recursive;
if (we_are_background)
return parent_call (real_query_recursive, ctx, 1, strlen (s), s);
return parent_call (pntr.p, ctx, 1, strlen (s), s);
else
return real_query_recursive (ctx, Foreground, s);
}
@ -2221,8 +2233,15 @@ static FileProgressStatus
query_replace (FileOpContext *ctx, const char *destname, struct stat *_s_stat,
struct stat *_d_stat)
{
union {
void *p;
FileProgressStatus (*f) (FileOpContext *, enum OperationMode, const char *,
struct stat *, struct stat *);
} pntr;
pntr.f = file_progress_real_query_replace;
if (we_are_background)
return parent_call ((void *) file_progress_real_query_replace,
return parent_call (pntr.p,
ctx,
3,
strlen (destname), destname,

View File

@ -563,7 +563,7 @@ search_content (Dlg_head *h, const char *directory, const char *filename)
found = 1;
}
} else {
// str_case_search_first do not accept invalid strings
/* str_case_search_first do not accept invalid strings */
if (str_is_valid_string (p) && str_search_first (p, content_pattern, case_sensitive) != NULL) {
char *match = g_strdup_printf("%d:%s", line, filename);
find_add_match (h, directory, match);

View File

@ -180,7 +180,7 @@ static struct {
#define SPLIT_OPTIONS_COUNT 1
#define OTHER_OPTIONS_COUNT 7
static int first_width, second_width;
static gsize first_width, second_width;
static const char *output_lines_label;
static WButton *bleft_widget, *bright_widget;
@ -369,7 +369,7 @@ init_layout (void)
static const char *title1, *title2, *title3;
if (!i18n_layt_flag) {
size_t l1;
gsize l1;
first_width = 19; /* length of line with '<' '>' buttons */

View File

@ -298,5 +298,12 @@ listmode_edit (char *oldlistformat)
listmode_done (listmode_dlg);
return newformat;
}
#else
void listmode__unused(void)
{
/*
CFLAGS="-ansi -pedantic -Wall -Wextra -Werror"
*/
}
#endif /* LISTMODE_EDITOR */

View File

@ -562,7 +562,7 @@ get_parent_dir_name (const char *cwd, const char *lwd)
const char *p;
if (strlen (lwd) > strlen (cwd))
if ((p = strrchr (lwd, PATH_SEP)) && !strncmp (cwd, lwd, p - lwd) &&
(strlen (cwd) == p - lwd || (p == lwd && cwd[0] == PATH_SEP &&
((gsize)strlen (cwd) == (gsize) p - (gsize) lwd || (p == lwd && cwd[0] == PATH_SEP &&
cwd[1] == '\0'))) {
return (p + 1);
}
@ -1898,7 +1898,9 @@ print_color_usage (void)
" Dialog boxes: dnormal, dfocus, dhotnormal, dhotfocus, errdhotnormal,\n"
" errdhotfocus\n"
" Menus: menu, menuhot, menusel, menuhotsel\n"
" Editor: editnormal, editbold, editmarked\n"
" Editor: editnormal, editbold, editmarked\n"), stdout);
fputs (_
(
" Help: helpnormal, helpitalic, helpbold, helplink, helpslink\n"
" File types: directory, executable, link, stalelink, device, special, core\n"
"\n" "Colors:\n"
@ -1966,70 +1968,70 @@ process_args (poptContext ctx, int c, const char *option_arg)
static const struct poptOption argument_table[] = {
/* generic options */
{"help", 'h', POPT_ARG_NONE, NULL, 'h',
{"help", 'h', POPT_ARG_NONE, {NULL}, 'h',
N_("Displays this help message"), NULL},
{"version", 'V', POPT_ARG_NONE, NULL, 'V',
{"version", 'V', POPT_ARG_NONE, {NULL}, 'V',
N_("Displays the current version"), NULL},
/* terminal options */
{"xterm", 'x', POPT_ARG_NONE, &force_xterm, 0,
{"xterm", 'x', POPT_ARG_NONE, {&force_xterm}, 0,
N_("Forces xterm features"), NULL},
{"nomouse", 'd', POPT_ARG_NONE, NULL, 'd',
{"nomouse", 'd', POPT_ARG_NONE, {NULL}, 'd',
N_("Disable mouse support in text version"), NULL},
#if defined(HAVE_SLANG)
{"termcap", 't', 0, &SLtt_Try_Termcap, 0,
{"termcap", 't', 0, {&SLtt_Try_Termcap}, 0,
N_("Tries to use termcap instead of terminfo"), NULL},
#endif
{"resetsoft", 'k', POPT_ARG_NONE, &reset_hp_softkeys, 0,
{"resetsoft", 'k', POPT_ARG_NONE, {&reset_hp_softkeys}, 0,
N_("Resets soft keys on HP terminals"), NULL},
{"slow", 's', POPT_ARG_NONE, &slow_terminal, 0,
{"slow", 's', POPT_ARG_NONE, {&slow_terminal}, 0,
N_("To run on slow terminals"), NULL},
{"stickchars", 'a', 0, &force_ugly_line_drawing, 0,
{"stickchars", 'a', 0, {&force_ugly_line_drawing}, 0,
N_("Use stickchars to draw"), NULL},
/* color options */
{"nocolor", 'b', POPT_ARG_NONE, &disable_colors, 0,
{"nocolor", 'b', POPT_ARG_NONE, {&disable_colors}, 0,
N_("Requests to run in black and white"), NULL},
{"color", 'c', POPT_ARG_NONE, NULL, 'c',
{"color", 'c', POPT_ARG_NONE, {NULL}, 'c',
N_("Request to run in color mode"), NULL},
{"colors", 'C', POPT_ARG_STRING, &command_line_colors, 0,
{"colors", 'C', POPT_ARG_STRING, {&command_line_colors}, 0,
N_("Specifies a color configuration"), NULL},
{"help-colors", 'H', POPT_ARG_NONE, NULL, 'H',
{"help-colors", 'H', POPT_ARG_NONE, {NULL}, 'H',
N_("Displays a help screen on how to change the color scheme"), NULL},
/* debug options */
#ifdef USE_NETCODE
{"ftplog", 'l', POPT_ARG_STRING, NULL, 'l',
{"ftplog", 'l', POPT_ARG_STRING, {NULL}, 'l',
N_("Log ftp dialog to specified file"), NULL},
#ifdef WITH_SMBFS
{"debuglevel", 'D', POPT_ARG_STRING, NULL, 'D',
{"debuglevel", 'D', POPT_ARG_STRING, {NULL}, 'D',
N_("Set debug level"), NULL},
#endif
#endif
/* options for wrappers */
{"datadir", 'f', POPT_ARG_NONE, NULL, 'f',
{"datadir", 'f', POPT_ARG_NONE, {NULL}, 'f',
N_("Print data directory"), NULL},
{"printwd", 'P', POPT_ARG_STRING, &last_wd_file, 0,
{"printwd", 'P', POPT_ARG_STRING, {&last_wd_file}, 0,
N_("Print last working directory to specified file"), NULL},
/* subshell options */
#ifdef HAVE_SUBSHELL_SUPPORT
{"subshell", 'U', POPT_ARG_NONE, &use_subshell, 0,
{"subshell", 'U', POPT_ARG_NONE, {&use_subshell}, 0,
N_("Enables subshell support (default)"), NULL},
{"nosubshell", 'u', POPT_ARG_NONE, NULL, 'u',
{"nosubshell", 'u', POPT_ARG_NONE, {NULL}, 'u',
N_("Disables subshell support"), NULL},
#endif
/* single file operations */
{"view", 'v', POPT_ARG_STRING, &view_one_file, 0,
{"view", 'v', POPT_ARG_STRING, {&view_one_file}, 0,
N_("Launches the file viewer on a file"), NULL},
#ifdef USE_INTERNAL_EDIT
{"edit", 'e', POPT_ARG_STRING, &edit_one_file, 0,
{"edit", 'e', POPT_ARG_STRING, {&edit_one_file}, 0,
N_("Edits one file"), NULL},
#endif
{NULL, '\0', 0, NULL, 0, NULL, NULL}
{NULL, '\0', 0, {NULL}, 0, NULL , NULL}
};
static void
@ -2130,6 +2132,8 @@ int
main (int argc, char *argv[])
{
/* We had LC_CTYPE before, LC_ALL includs LC_TYPE as well */
int i;
setlocale (LC_ALL, "");
bindtextdomain ("mc", LOCALEDIR);
textdomain ("mc");
@ -2151,7 +2155,7 @@ main (int argc, char *argv[])
vfs_init ();
#ifdef USE_INTERNAL_EDIT
for ( int i = 0; i < MAX_HISTORY_MOVETO; i++ ) {
for ( i = 0; i < MAX_HISTORY_MOVETO; i++ ) {
edit_history_moveto[i].filename = NULL;
edit_history_moveto[i].line = -1;
}
@ -2280,7 +2284,7 @@ main (int argc, char *argv[])
g_free (other_dir);
#ifdef USE_INTERNAL_EDIT
for ( int i = 0; i < MAX_HISTORY_MOVETO; i++ ) {
for ( i = 0; i < MAX_HISTORY_MOVETO; i++ ) {
g_free(edit_history_moveto[i].filename);
}
#endif

View File

@ -43,16 +43,14 @@ void poptSetExecPath(poptContext con, const char * path, int allowAbsolute) {
static void invokeCallbacks(poptContext con, const struct poptOption * table,
int post) {
const struct poptOption * opt = table;
poptCallbackType cb;
while (opt->longName || opt->shortName || opt->arg) {
while (opt->longName || opt->shortName || opt->arg.p) {
if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) {
invokeCallbacks(con, opt->arg, post);
invokeCallbacks(con, opt->arg.p, post);
} else if (((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_CALLBACK) &&
((!post && (opt->argInfo & POPT_CBFLAG_PRE)) ||
( post && (opt->argInfo & POPT_CBFLAG_POST)))) {
cb = (poptCallbackType)opt->arg;
cb(con, post ? POPT_CALLBACK_REASON_POST : POPT_CALLBACK_REASON_PRE,
opt->arg.f1(con, post ? POPT_CALLBACK_REASON_POST : POPT_CALLBACK_REASON_PRE,
NULL, NULL, opt->descrip);
}
opt++;
@ -247,9 +245,9 @@ static const struct poptOption * findOption(const struct poptOption * table,
if (singleDash && !shortName && !*longName)
shortName = '-';
while (opt->longName || opt->shortName || opt->arg) {
while (opt->longName || opt->shortName || opt->arg.p) {
if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) {
opt2 = findOption(opt->arg, longName, shortName, callback,
opt2 = findOption(opt->arg.p, longName, shortName, callback,
callbackData, singleDash);
if (opt2) {
if (*callback && !*callbackData)
@ -272,7 +270,7 @@ static const struct poptOption * findOption(const struct poptOption * table,
*callbackData = NULL;
*callback = NULL;
if (cb) {
*callback = (poptCallbackType)cb->arg;
*callback = cb->arg.f2;
if (!(cb->argInfo & POPT_CBFLAG_INC_DATA))
*callbackData = cb->descrip;
}
@ -376,10 +374,10 @@ int poptGetNextOpt(poptContext con) {
con->os->nextCharArg = origOptString;
}
if (opt->arg && (opt->argInfo & POPT_ARG_MASK) == POPT_ARG_NONE) {
*((int *)opt->arg) = 1;
if (opt->arg.p && (opt->argInfo & POPT_ARG_MASK) == POPT_ARG_NONE) {
*((int *)opt->arg.p) = 1;
} else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_VAL) {
if (opt->arg) *((int *) opt->arg) = opt->val;
if (opt->arg.p) *((int *) opt->arg.p) = opt->val;
} else if ((opt->argInfo & POPT_ARG_MASK) != POPT_ARG_NONE) {
if (longArg) {
con->os->nextArg = longArg;
@ -396,10 +394,10 @@ int poptGetNextOpt(poptContext con) {
con->os->nextArg = con->os->argv[con->os->next++];
}
if (opt->arg) {
if (opt->arg.p) {
switch (opt->argInfo & POPT_ARG_MASK) {
case POPT_ARG_STRING:
*((char **) opt->arg) = con->os->nextArg;
*((char **) opt->arg.p) = con->os->nextArg;
break;
case POPT_ARG_INT:
@ -411,11 +409,11 @@ int poptGetNextOpt(poptContext con) {
if (aLong == LONG_MIN || aLong == LONG_MAX)
return POPT_ERROR_OVERFLOW;
if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_LONG) {
*((long *) opt->arg) = aLong;
*((long *) opt->arg.p) = aLong;
} else {
if (aLong > INT_MAX || aLong < INT_MIN)
return POPT_ERROR_OVERFLOW;
*((int *) opt->arg) =aLong;
*((int *) opt->arg.p) =aLong;
}
break;
@ -446,7 +444,7 @@ int poptGetNextOpt(poptContext con) {
else
sprintf(con->finalArgv[i], "-%c", opt->shortName);
if (opt->arg && (opt->argInfo & POPT_ARG_MASK) != POPT_ARG_NONE
if (opt->arg.p && (opt->argInfo & POPT_ARG_MASK) != POPT_ARG_NONE
&& (opt->argInfo & POPT_ARG_MASK) != POPT_ARG_VAL)
con->finalArgv[con->finalArgvCount++] = strdup(con->os->nextArg);
}

View File

@ -51,11 +51,30 @@ extern "C" {
#define POPT_CONTEXT_KEEP_FIRST (1 << 1) /* pay attention to argv[0] */
#define POPT_CONTEXT_POSIXMEHARDER (1 << 2) /* options can't follow args */
struct poptOption;
enum poptCallbackReason { POPT_CALLBACK_REASON_PRE,
POPT_CALLBACK_REASON_POST,
POPT_CALLBACK_REASON_OPTION };
typedef struct poptContext_s * poptContext;
typedef void (*poptCallbackType)(poptContext con,
enum poptCallbackReason reason,
const struct poptOption * opt,
const char * arg, void * data);
typedef union {
void *p;
void (*f1)(poptContext , enum poptCallbackReason, struct poptOption *,
const char *, void *);
poptCallbackType f2;
} popt_arg_t;
struct poptOption {
const char * longName; /* may be NULL */
char shortName; /* may be '\0' */
int argInfo;
void * arg; /* depends on argInfo */
popt_arg_t arg; /* depends on argInfo */
int val; /* 0 means don't return, just update flag */
char * descrip; /* description for autohelp -- may be NULL */
const char * argDescrip; /* argument description for autohelp */
@ -68,22 +87,10 @@ struct poptAlias {
char ** argv; /* must be free()able */
};
extern struct poptOption const poptHelpOptions[];
#define POPT_AUTOHELP { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptHelpOptions, \
0, "Help options", NULL },
typedef struct poptContext_s * poptContext;
#ifndef __cplusplus
typedef struct poptOption * poptOption;
#endif
enum poptCallbackReason { POPT_CALLBACK_REASON_PRE,
POPT_CALLBACK_REASON_POST,
POPT_CALLBACK_REASON_OPTION };
typedef void (*poptCallbackType)(poptContext con,
enum poptCallbackReason reason,
const struct poptOption * opt,
const char * arg, void * data);
poptContext poptGetContext(const char * name, int argc, char ** argv,
const struct poptOption * options, int flags);

View File

@ -32,12 +32,6 @@ static void displayArgs(poptContext con, enum poptCallbackReason foo,
exit(0);
}
struct poptOption const poptHelpOptions[] = {
{ NULL, '\0', POPT_ARG_CALLBACK, (void *)&displayArgs, '\0', NULL, NULL },
{ "help", '?', 0, NULL, '?', N_("Show this help message"), NULL },
{ "usage", '\0', 0, NULL, 'u', N_("Display brief usage message"), NULL },
{ NULL, '\0', 0, NULL, 0, NULL, NULL }
} ;
static const char *
@ -46,10 +40,10 @@ getTableTranslationDomain(const struct poptOption *table)
const struct poptOption *opt;
for(opt = table;
opt->longName || opt->shortName || opt->arg;
opt->longName || opt->shortName || opt->arg.p;
opt++) {
if(opt->argInfo == POPT_ARG_INTL_DOMAIN)
return opt->arg;
return opt->arg.p;
}
return NULL;
@ -57,14 +51,62 @@ getTableTranslationDomain(const struct poptOption *table)
static const char * getArgDescrip(const struct poptOption * opt,
const char *translation_domain) {
struct poptOption *poptHelpOptions;
(void) translation_domain;
if (!(opt->argInfo & POPT_ARG_MASK)) return NULL;
poptHelpOptions = g_malloc(sizeof(struct poptOption)*4);
poptHelpOptions[0].longName = NULL;
poptHelpOptions[0].shortName = '\0';
poptHelpOptions[0].argInfo = POPT_ARG_CALLBACK;
poptHelpOptions[0].arg.f1 = &displayArgs;
poptHelpOptions[0].val = '\0';
poptHelpOptions[0].descrip = NULL;
poptHelpOptions[0].argDescrip = NULL;
poptHelpOptions[1].longName = "help";
poptHelpOptions[1].shortName = '?';
poptHelpOptions[1].argInfo = 0;
poptHelpOptions[1].arg.p = NULL;
poptHelpOptions[1].val = '?';
poptHelpOptions[1].descrip = _("Show this help message");
poptHelpOptions[1].argDescrip = NULL;
poptHelpOptions[2].longName = "usage";
poptHelpOptions[2].shortName = '\0';
poptHelpOptions[2].argInfo = 0;
poptHelpOptions[2].arg.p = NULL;
poptHelpOptions[2].val = 'u';
poptHelpOptions[2].descrip = _("Display brief usage message");
poptHelpOptions[2].argDescrip = NULL;
poptHelpOptions[3].longName = NULL;
poptHelpOptions[3].shortName = '\0';
poptHelpOptions[3].argInfo = 0;
poptHelpOptions[3].arg.p = NULL;
poptHelpOptions[3].val = 0;
poptHelpOptions[3].descrip = NULL;
poptHelpOptions[3].argDescrip = NULL;
if (!(opt->argInfo & POPT_ARG_MASK)){
g_free(poptHelpOptions);
return NULL;
}
if (opt == (poptHelpOptions + 1) || opt == (poptHelpOptions + 2))
if (opt->argDescrip) return POPT_(opt->argDescrip);
if (opt->argDescrip)
{
g_free(poptHelpOptions);
return POPT_(opt->argDescrip);
}
if (opt->argDescrip) return D_(translation_domain, opt->argDescrip);
if (opt->argDescrip)
{
g_free(poptHelpOptions);
return D_(translation_domain, opt->argDescrip);
}
g_free(poptHelpOptions);
return _("ARG");
}
@ -127,9 +169,9 @@ static int maxArgWidth(const struct poptOption * opt,
int this;
const char * s;
while (opt->longName || opt->shortName || opt->arg) {
while (opt->longName || opt->shortName || opt->arg.p) {
if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) {
this = maxArgWidth(opt->arg, translation_domain);
this = maxArgWidth(opt->arg.p, translation_domain);
if (this > max) max = this;
} else if (!(opt->argInfo & POPT_ARGFLAG_DOC_HIDDEN)) {
this = opt->shortName ? 2 : 0;
@ -157,7 +199,7 @@ static void singleTableHelp(FILE * f, const struct poptOption * table,
const char *sub_transdom;
opt = table;
while (opt->longName || opt->shortName || opt->arg) {
while (opt->longName || opt->shortName || opt->arg.p) {
if ((opt->longName || opt->shortName) &&
!(opt->argInfo & POPT_ARGFLAG_DOC_HIDDEN))
singleOptionHelp(f, left, opt, translation_domain);
@ -165,16 +207,16 @@ static void singleTableHelp(FILE * f, const struct poptOption * table,
}
opt = table;
while (opt->longName || opt->shortName || opt->arg) {
while (opt->longName || opt->shortName || opt->arg.p) {
if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) {
sub_transdom = getTableTranslationDomain(opt->arg);
sub_transdom = getTableTranslationDomain(opt->arg.p);
if(!sub_transdom)
sub_transdom = translation_domain;
if (opt->descrip)
fprintf(f, "\n%s\n", D_(sub_transdom, opt->descrip));
singleTableHelp(f, opt->arg, left, sub_transdom);
singleTableHelp(f, opt->arg.p, left, sub_transdom);
}
opt++;
}
@ -252,11 +294,11 @@ static int singleTableUsage(FILE * f, int cursor, const struct poptOption * tabl
const struct poptOption * opt;
opt = table;
while (opt->longName || opt->shortName || opt->arg) {
while (opt->longName || opt->shortName || opt->arg.p) {
if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INTL_DOMAIN)
translation_domain = (const char *)opt->arg;
translation_domain = (const char *)opt->arg.p;
else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE)
cursor = singleTableUsage(f, cursor, opt->arg,
cursor = singleTableUsage(f, cursor, opt->arg.p,
translation_domain);
else if ((opt->longName || opt->shortName) &&
!(opt->argInfo & POPT_ARGFLAG_DOC_HIDDEN))
@ -278,11 +320,11 @@ static int showShortOptions(const struct poptOption * opt, FILE * f,
memset(str, 0, sizeof(s));
}
while (opt->longName || opt->shortName || opt->arg) {
while (opt->longName || opt->shortName || opt->arg.p) {
if (opt->shortName && !(opt->argInfo & POPT_ARG_MASK))
str[strlen(str)] = opt->shortName;
else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE)
showShortOptions(opt->arg, f, str);
showShortOptions(opt->arg.p, f, str);
opt++;
}

View File

@ -8365,4 +8365,11 @@ weak_alias (__regfree, regfree)
# undef WCHAR
# define DEFINED_ONCE
#else
void mc_regex__unused(void)
{
/*
CFLAGS="-ansi -pedantic -Wall -Wextra -Werror"
*/
}
#endif /* USE_INCLUDED_REGEX */

View File

@ -110,6 +110,7 @@ static const char *mini_status_format (WPanel *panel);
static void
set_colors (WPanel *panel)
{
(void) panel;
standend ();
attrset (NORMAL_COLOR);
}
@ -164,6 +165,8 @@ static const char *
string_file_name (file_entry *fe, int len)
{
static char buffer [MC_MAXPATHLEN * MB_LEN_MAX + 1];
(void) len;
g_strlcpy (buffer, fe->fname, sizeof(buffer));
return buffer;
}
@ -237,6 +240,7 @@ string_file_type (file_entry *fe, int len)
{
static char buffer[2];
(void) len;
if (S_ISDIR (fe->st.st_mode))
buffer[0] = PATH_SEP;
else if (S_ISLNK (fe->st.st_mode)) {
@ -272,6 +276,7 @@ string_file_type (file_entry *fe, int len)
static const char *
string_file_mtime (file_entry *fe, int len)
{
(void) len;
if (!strcmp (fe->fname, "..")) {
return "";
}
@ -282,6 +287,7 @@ string_file_mtime (file_entry *fe, int len)
static const char *
string_file_atime (file_entry *fe, int len)
{
(void) len;
if (!strcmp (fe->fname, "..")) {
return "";
}
@ -292,6 +298,7 @@ string_file_atime (file_entry *fe, int len)
static const char *
string_file_ctime (file_entry *fe, int len)
{
(void) len;
if (!strcmp (fe->fname, "..")) {
return "";
}
@ -302,6 +309,7 @@ string_file_ctime (file_entry *fe, int len)
static const char *
string_file_permission (file_entry *fe, int len)
{
(void) len;
return string_perm (fe->st.st_mode);
}
@ -311,6 +319,7 @@ string_file_perm_octal (file_entry *fe, int len)
{
static char buffer [10];
(void) len;
g_snprintf (buffer, sizeof (buffer), "0%06lo", (unsigned long) fe->st.st_mode);
return buffer;
}
@ -321,6 +330,7 @@ string_file_nlinks (file_entry *fe, int len)
{
static char buffer[BUF_TINY];
(void) len;
g_snprintf (buffer, sizeof (buffer), "%16d", (int) fe->st.st_nlink);
return buffer;
}
@ -331,6 +341,7 @@ string_inode (file_entry *fe, int len)
{
static char buffer [10];
(void) len;
g_snprintf (buffer, sizeof (buffer), "%lu",
(unsigned long) fe->st.st_ino);
return buffer;
@ -342,6 +353,7 @@ string_file_nuid (file_entry *fe, int len)
{
static char buffer [10];
(void) len;
g_snprintf (buffer, sizeof (buffer), "%lu",
(unsigned long) fe->st.st_uid);
return buffer;
@ -353,6 +365,7 @@ string_file_ngid (file_entry *fe, int len)
{
static char buffer [10];
(void) len;
g_snprintf (buffer, sizeof (buffer), "%lu",
(unsigned long) fe->st.st_gid);
return buffer;
@ -362,6 +375,7 @@ string_file_ngid (file_entry *fe, int len)
static const char *
string_file_owner (file_entry *fe, int len)
{
(void) len;
return get_owner (fe->st.st_uid);
}
@ -369,6 +383,7 @@ string_file_owner (file_entry *fe, int len)
static const char *
string_file_group (file_entry *fe, int len)
{
(void) len;
return get_group (fe->st.st_gid);
}
@ -376,6 +391,7 @@ string_file_group (file_entry *fe, int len)
static const char *
string_marked (file_entry *fe, int len)
{
(void) len;
return fe->f.marked ? "*" : " ";
}
@ -383,6 +399,8 @@ string_marked (file_entry *fe, int len)
static const char *
string_space (file_entry *fe, int len)
{
(void) fe;
(void) len;
return " ";
}
@ -390,6 +408,8 @@ string_space (file_entry *fe, int len)
static const char *
string_dot (file_entry *fe, int len)
{
(void) fe;
(void) len;
return ".";
}
@ -486,6 +506,8 @@ format_file (char *dest, int limit, WPanel *panel, int file_index, int width, in
format_e *format, *home;
file_entry *fe;
(void) dest;
(void) limit;
length = 0;
empty_line = (file_index >= panel->count);
home = (isstatus) ? panel->status_format : panel->format;
@ -1729,6 +1751,7 @@ move_selection (WPanel *panel, int lines)
static cb_ret_t
move_left (WPanel *panel, int c_code)
{
(void) c_code;
if (panel->split) {
move_selection (panel, -llines (panel));
return MSG_HANDLED;
@ -1739,6 +1762,7 @@ move_left (WPanel *panel, int c_code)
static int
move_right (WPanel *panel, int c_code)
{
(void) c_code;
if (panel->split) {
move_selection (panel, llines (panel));
return MSG_HANDLED;
@ -1775,6 +1799,7 @@ prev_page (WPanel *panel)
static void
ctrl_prev_page (WPanel *panel)
{
(void) panel;
do_cd ("..", cd_exact);
}
@ -1980,7 +2005,7 @@ do_search (WPanel *panel, int c_code)
}
panel->search_chpoint = 0;
} else {
if (c_code && panel->search_chpoint < sizeof (panel->search_char)) {
if (c_code && (gsize) panel->search_chpoint < sizeof (panel->search_char)) {
panel->search_char[panel->search_chpoint] = c_code;
panel->search_chpoint++;
}
@ -2227,14 +2252,14 @@ typedef struct {
} panel_key_map;
static void cmd_do_enter(WPanel *wp) { (void) do_enter(wp); }
static void cmd_view_simple(WPanel *wp) { view_simple_cmd(); }
static void cmd_edit_new(WPanel *wp) { edit_cmd_new(); }
static void cmd_copy_local(WPanel *wp) { copy_cmd_local(); }
static void cmd_rename_local(WPanel *wp) { ren_cmd_local(); }
static void cmd_delete_local(WPanel *wp) { delete_cmd_local(); }
static void cmd_select(WPanel *wp) { select_cmd(); }
static void cmd_unselect(WPanel *wp) { unselect_cmd(); }
static void cmd_reverse_selection(WPanel *wp) { reverse_selection_cmd(); }
static void cmd_view_simple(WPanel *wp) { (void) wp; view_simple_cmd(); }
static void cmd_edit_new(WPanel *wp) { (void) wp; edit_cmd_new(); }
static void cmd_copy_local(WPanel *wp) { (void) wp;copy_cmd_local(); }
static void cmd_rename_local(WPanel *wp) { (void) wp;ren_cmd_local(); }
static void cmd_delete_local(WPanel *wp) { (void) wp;delete_cmd_local(); }
static void cmd_select(WPanel *wp) { (void) wp;select_cmd(); }
static void cmd_unselect(WPanel *wp) { (void) wp;unselect_cmd(); }
static void cmd_reverse_selection(WPanel *wp) { (void) wp;reverse_selection_cmd(); }
static const panel_key_map panel_keymap [] = {
{ KEY_DOWN, move_down },

View File

@ -52,7 +52,7 @@ typedef struct mc_search_cond_struct {
typedef enum {
COND__NOT_ALL_FOUND,
COND__FOUND_CHAR,
COND__FOUND_CHAR_LAST,
COND__FOUND_CHAR_LAST
} mc_search__found_cond_t;
/*** file scope variables ************************************************************************/
@ -175,7 +175,7 @@ mc_search__conditions_new (const char *str, gsize str_len, gboolean all_charsets
gchar *buffer;
for (loop1 = 0; loop1 < n_codepages; loop1++) {
for (loop1 = 0; loop1 < (gsize)n_codepages; loop1++) {
if (g_ascii_strcasecmp (codepages[loop1].id, cp_source)) {
g_ptr_array_add (ret,
mc_search__cond_struct_new (str, str_len, cp_source,
@ -344,14 +344,14 @@ mc_search__run_normal (mc_search_t * mc_search, const void *user_data,
}
/* --------------------------------------------------------------------------------------------- */
/*
static gboolean
mc_search__run_regex (mc_search_t * mc_search, const void *user_data,
gsize start_search, gsize end_search, gsize * found_len)
{
return FALSE;
}
*/
/*** public functions ****************************************************************************/
mc_search_t *
@ -361,7 +361,7 @@ mc_search_new (const gchar * original, gsize str_len)
if (!original)
return NULL;
if (str_len == -1) {
if ((gssize)str_len == -1) {
str_len = strlen (original);
if (str_len == 0)
return NULL;
@ -416,8 +416,9 @@ mc_search_run (mc_search_t * mc_search, const void *user_data, gsize start_searc
ret = mc_search__run_normal (mc_search, user_data, start_search, end_search, found_len);
break;
case MC_SEARCH_T_REGEX:
ret = mc_search__run_regex (mc_search, user_data, start_search, end_search, found_len);
// break;
/* ret = mc_search__run_regex (mc_search, user_data, start_search, end_search, found_len);*/
ret = FALSE;
/* break;*/
case MC_SEARCH_T_HEX:
case MC_SEARCH_T_SCANF:
case MC_SEARCH_T_GLOB:

View File

@ -18,7 +18,7 @@ typedef enum {
MC_SEARCH_E_OK,
MC_SEARCH_E_INPUT,
MC_SEARCH_E_REGEX,
MC_SEARCH_E_NOTFOUND,
MC_SEARCH_E_NOTFOUND
} mc_search_error_t;
typedef enum {
@ -26,7 +26,7 @@ typedef enum {
MC_SEARCH_T_REGEX,
MC_SEARCH_T_SCANF,
MC_SEARCH_T_HEX,
MC_SEARCH_T_GLOB,
MC_SEARCH_T_GLOB
} mc_search_type_t;

View File

@ -238,7 +238,7 @@ static const struct {
#ifdef USE_INTERNAL_EDIT
{ "editor_backup_extension", &option_backup_ext, "~" },
#endif
{ NULL, NULL }
{ NULL, NULL, NULL }
};
void

View File

@ -302,6 +302,7 @@ hline (int ch, int len)
void
vline (int character, int len)
{
(void) character;
if (!slow_terminal){
SLsmg_draw_vline (len);
} else {

View File

@ -35,14 +35,14 @@
#include "global.h"
#include "strutil.h"
//names, that are used for utf-8
/*names, that are used for utf-8 */
static const char *str_utf8_encodings[] = {
"utf-8",
"utf8",
NULL
};
// standard 8bit encodings, no wide or multibytes characters
/* standard 8bit encodings, no wide or multibytes characters*/
static const char *str_8bit_encodings[] = {
"cp-1251",
"cp1251",
@ -60,16 +60,16 @@ static const char *str_8bit_encodings[] = {
NULL
};
// terminal encoding
/* terminal encoding*/
static char *codeset;
// function for encoding specific operations
/* function for encoding specific operations*/
static struct str_class used_class;
GIConv str_cnv_to_term;
GIConv str_cnv_from_term;
GIConv str_cnv_not_convert;
// if enc is same encoding like on terminal
/* if enc is same encoding like on terminal*/
static int
str_test_not_convert (const char *enc)
{
@ -159,7 +159,7 @@ _str_convert (GIConv coder, const char *string, int size, GString * buffer)
g_string_append (buffer, tmp_buff);
g_free (tmp_buff);
}
if (bytes_read < left)
if ((int)bytes_read < left)
{
string += bytes_read + 1;
size -= (bytes_read + 1);
@ -181,7 +181,7 @@ _str_convert (GIConv coder, const char *string, int size, GString * buffer)
error = NULL;
g_string_append (buffer, tmp_buff);
g_free (tmp_buff);
if (bytes_read < left)
if ((int)bytes_read < left)
{
left = left - bytes_read;
tmp_buff = g_strnfill (left, '?');
@ -421,7 +421,7 @@ str_term_trim (const char *text, int width)
void
str_msg_term_size (const char *text, int *lines, int *columns)
{
return used_class.msg_term_size (text, lines, columns);
used_class.msg_term_size (text, lines, columns);
}
const char *

View File

@ -58,15 +58,17 @@ typedef enum {
#define J_LEFT 0x01
#define J_RIGHT 0x02
#define J_CENTER 0x03
// if there is enough space for string on terminal, string is centered
// otherwise is aligned to left
/*
if there is enough space for string on terminal, string is centered
otherwise is aligned to left
*/
#define J_CENTER_LEFT 0x04
#define IS_FIT(x) ((x) & 0x0010)
#define MAKE_FIT(x) ((x) | 0x0010)
#define HIDE_FIT(x) ((x) & 0x000f)
// fit alignment, if string is to long, is truncated with '~'
/* fit alignment, if string is to long, is truncated with '~' */
#define J_LEFT_FIT 0x11
#define J_RIGHT_FIT 0x12
#define J_CENTER_FIT 0x13
@ -74,62 +76,62 @@ typedef enum {
#define INVALID_CONV ((GIConv) (-1))
// standard convertors
/* standard convertors */
extern GIConv str_cnv_to_term;
extern GIConv str_cnv_from_term;
// from terminal encoding to terminal encoding
/* from terminal encoding to terminal encoding */
extern GIConv str_cnv_not_convert;
// all functions in str_class must be defined for every encoding
/* all functions in str_class must be defined for every encoding */
struct str_class {
estr_t (*vfs_convert_to) (GIConv coder, const char *string,
int size, GString *buffer); //I
int size, GString *buffer); /*I*/
void (*insert_replace_char) (GString *buffer);
int (*is_valid_string) (const char *); //I
int (*is_valid_char) (const char *, size_t); //I
int (*is_valid_string) (const char *); /*I*/
int (*is_valid_char) (const char *, size_t); /*I*/
void (*cnext_char) (const char **);
void (*cprev_char) (const char **);
void (*cnext_char_safe) (const char **); //I
void (*cprev_char_safe) (const char **); //I
int (*cnext_noncomb_char) (const char **text); //I
int (*cprev_noncomb_char) (const char **text, const char *begin); //I
int (*isspace) (const char *); //I
int (*ispunct) (const char *); //I
int (*isalnum) (const char *); //I
int (*isdigit) (const char *); //I
int (*isprint) (const char *); //I
int (*iscombiningmark) (const char *); //I
int (*length) (const char *); //I
int (*length2) (const char *, int); //I
int (*length_noncomb) (const char *); //I
void (*cnext_char_safe) (const char **); /*I*/
void (*cprev_char_safe) (const char **); /*I*/
int (*cnext_noncomb_char) (const char **text); /*I*/
int (*cprev_noncomb_char) (const char **text, const char *begin); /*I*/
int (*isspace) (const char *); /*I*/
int (*ispunct) (const char *); /*I*/
int (*isalnum) (const char *); /*I*/
int (*isdigit) (const char *); /*I*/
int (*isprint) (const char *); /*I*/
int (*iscombiningmark) (const char *); /*I*/
int (*length) (const char *); /*I*/
int (*length2) (const char *, int); /*I*/
int (*length_noncomb) (const char *); /*I*/
int (*toupper) (const char *, char **, size_t *);
int (*tolower) (const char *, char **, size_t *);
void (*fix_string) (char *); //I
const char *(*term_form) (const char *); //I
const char *(*fit_to_term) (const char *, int, int); //I
const char *(*term_trim) (const char *text, int width); //I
void (*msg_term_size) (const char *, int *, int *); //I
const char *(*term_substring) (const char *, int, int); //I
int (*term_width1) (const char *); //I
int (*term_width2) (const char *, size_t); //I
int (*term_char_width) (const char *); //I
const char *(*trunc) (const char *, int); //I
int (*offset_to_pos) (const char *, size_t); //I
int (*column_to_pos) (const char *, size_t); //I
void (*fix_string) (char *); /*I*/
const char *(*term_form) (const char *); /*I*/
const char *(*fit_to_term) (const char *, int, int); /*I*/
const char *(*term_trim) (const char *text, int width); /*I*/
void (*msg_term_size) (const char *, int *, int *); /*I*/
const char *(*term_substring) (const char *, int, int); /*I*/
int (*term_width1) (const char *); /*I*/
int (*term_width2) (const char *, size_t); /*I*/
int (*term_char_width) (const char *); /*I*/
const char *(*trunc) (const char *, int); /*I*/
int (*offset_to_pos) (const char *, size_t); /*I*/
int (*column_to_pos) (const char *, size_t); /*I*/
char *(*create_search_needle) (const char *, int);
void (*release_search_needle) (char *, int);
const char *(*search_first) (const char *, const char *, int);
const char *(*search_last) (const char *, const char *, int);
int (*compare) (const char *, const char *); //I
int (*ncompare) (const char *, const char *); //I
int (*casecmp) (const char *, const char *); //I
int (*ncasecmp) (const char *, const char *); //I
int (*prefix) (const char *, const char *); //I
int (*caseprefix) (const char *, const char *); //I
char *(*create_key) (const char *text, int case_sen); //I
char *(*create_key_for_filename) (const char *text, int case_sen); //I
int (*key_collate) (const char *t1, const char *t2, int case_sen); //I
void (*release_key) (char *key, int case_sen); //I
int (*compare) (const char *, const char *); /*I*/
int (*ncompare) (const char *, const char *); /*I*/
int (*casecmp) (const char *, const char *); /*I*/
int (*ncasecmp) (const char *, const char *); /*I*/
int (*prefix) (const char *, const char *); /*I*/
int (*caseprefix) (const char *, const char *); /*I*/
char *(*create_key) (const char *text, int case_sen); /*I*/
char *(*create_key_for_filename) (const char *text, int case_sen); /*I*/
int (*key_collate) (const char *t1, const char *t2, int case_sen); /*I*/
void (*release_key) (char *key, int case_sen); /*I*/
};
struct str_class str_utf8_init ();

View File

@ -48,12 +48,15 @@ str_8bit_insert_replace_char (GString * buffer)
static int
str_8bit_is_valid_string (const char *text)
{
(void) text;
return 1;
}
static int
str_8bit_is_valid_char (const char *ch, size_t size)
{
(void) ch;
(void) size;
return 1;
}
@ -126,6 +129,7 @@ str_8bit_isprint (const char *text)
static int
str_8bit_iscombiningmark (const char *text)
{
(void) text;
return 0;
}
@ -160,7 +164,7 @@ str_8bit_length (const char *text)
static int
str_8bit_length2 (const char *text, int size)
{
return (size >= 0) ? min (strlen (text), size) : strlen (text);
return (size >= 0) ? min (strlen (text), (gsize)size) : strlen (text);
}
static estr_t
@ -217,7 +221,7 @@ str_8bit_fit_to_term (const char *text, int width, int just_mode)
actual = result;
remain = sizeof (result);
if (length <= width)
if ((int)length <= width)
{
ident = 0;
switch (HIDE_FIT (just_mode))
@ -231,7 +235,7 @@ str_8bit_fit_to_term (const char *text, int width, int just_mode)
break;
}
if (remain <= ident)
if ((int)remain <= ident)
goto finally;
memset (actual, ' ', ident);
actual += ident;
@ -254,7 +258,7 @@ str_8bit_fit_to_term (const char *text, int width, int just_mode)
{
if (IS_FIT (just_mode))
{
for (; pos + 1 <= width / 2 && remain > 1;
for (; pos + 1 <= (gsize)width / 2 && remain > 1;
actual++, pos++, remain--)
{
@ -288,7 +292,7 @@ str_8bit_fit_to_term (const char *text, int width, int just_mode)
}
pos += ident;
for (; pos < ident + width && remain > 1;
for (; pos < (gsize)(ident + width) && remain > 1;
pos++, actual++, remain--)
{
@ -315,7 +319,7 @@ str_8bit_term_trim (const char *text, int width)
actual = result;
remain = sizeof (result);
if (width < length)
if (width < (int)length)
{
if (width <= 3)
{
@ -365,21 +369,23 @@ str_8bit_term_width1 (const char *text)
static int
str_8bit_term_char_width (const char *text)
{
(void) text;
return 1;
}
static void
str_8bit_msg_term_size (const char *text, int *lines, int *columns)
{
(*lines) = 1;
(*columns) = 0;
char *p, *tmp = g_strdup (text);
char *p, *tmp;
char *q;
char c = '\0';
int width;
p = tmp;
(*lines) = 1;
(*columns) = 0;
tmp = g_strdup ((char *)text);
for (;;)
{
q = strchr (p, '\n');
@ -415,7 +421,7 @@ str_8bit_term_substring (const char *text, int start, int width)
remain = sizeof (result);
length = strlen (text);
if (start < length)
if (start < (int)length)
{
pos += start;
for (; pos < length && width > 0 && remain > 1;
@ -448,9 +454,9 @@ str_8bit_trunc (const char *text, int width)
remain = sizeof (result);
length = strlen (text);
if (length > width)
if ((int)length > width)
{
for (; pos + 1 <= width / 2 && remain > 1; actual++, pos++, remain--)
for (; pos + 1 <= (gsize)width / 2 && remain > 1; actual++, pos++, remain--)
{
actual[0] = isprint (text[pos]) ? text[pos] : '.';
}
@ -484,24 +490,29 @@ str_8bit_trunc (const char *text, int width)
static int
str_8bit_offset_to_pos (const char *text, size_t length)
{
(void) text;
return (int) length;
}
static int
str_8bit_column_to_pos (const char *text, size_t pos)
{
(void) text;
return (int)pos;
}
static char *
str_8bit_create_search_needle (const char *needle, int case_sen)
{
(void) case_sen;
return (char *) needle;
}
static void
str_8bit_release_search_needle (char *needle, int case_sen)
{
(void) case_sen;
(void) needle;
}
static const char *
@ -605,6 +616,7 @@ str_8bit_caseprefix (const char *text, const char *prefix)
static void
str_8bit_fix_string (char *text)
{
(void) text;
}
static char *

View File

@ -21,6 +21,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <config.h>
#include <stdio.h>
#include <ctype.h>
@ -46,12 +47,15 @@ str_ascii_insert_replace_char (GString * buffer)
static int
str_ascii_is_valid_string (const char *text)
{
(void) text;
return 1;
}
static int
str_ascii_is_valid_char (const char *ch, size_t size)
{
(void) ch;
(void) size;
return 1;
}
@ -124,6 +128,7 @@ str_ascii_isprint (const char *text)
static int
str_ascii_iscombiningmark (const char *text)
{
(void) text;
return 0;
}
@ -158,13 +163,14 @@ str_ascii_length (const char *text)
static int
str_ascii_length2 (const char *text, int size)
{
return (size >= 0) ? min (strlen (text), size) : strlen (text);
return (size >= 0) ? min (strlen (text), (gsize) size) : strlen (text);
}
static estr_t
str_ascii_vfs_convert_to (GIConv coder, const char *string,
int size, GString * buffer)
{
(void) coder;
g_string_append_len (buffer, string, size);
return ESTR_SUCCESS;
}
@ -208,7 +214,7 @@ str_ascii_fit_to_term (const char *text, int width, int just_mode)
actual = result;
remain = sizeof (result);
if (length <= width)
if ((int)length <= width)
{
ident = 0;
switch (HIDE_FIT (just_mode))
@ -223,14 +229,14 @@ str_ascii_fit_to_term (const char *text, int width, int just_mode)
}
/* add space before text */
if (remain <= ident)
if ((int)remain <= ident)
goto finally;
memset (actual, ' ', ident);
actual += ident;
remain -= ident;
/* copy all characters */
for (; pos < length && remain > 1; pos++, actual++, remain--)
for (; pos < (gsize)length && remain > 1; pos++, actual++, remain--)
{
actual[0] = isascii ((unsigned char) text[pos]) ? text[pos] : '?';
actual[0] = g_ascii_isprint ((gchar) actual[0]) ? actual[0] : '.';
@ -251,7 +257,7 @@ str_ascii_fit_to_term (const char *text, int width, int just_mode)
if (IS_FIT (just_mode))
{
/* copy prefix of text, that is not wider than width / 2 */
for (; pos + 1 <= width / 2 && remain > 1;
for (; pos + 1 <= (gsize)width / 2 && remain > 1;
actual++, pos++, remain--)
{
actual[0] = isascii ((unsigned char) text[pos])
@ -293,7 +299,7 @@ str_ascii_fit_to_term (const char *text, int width, int just_mode)
/* copy substring text, substring start from ident and take width
* characters from text */
pos += ident;
for (; pos < ident + width && remain > 1;
for (; pos < (gsize)(ident + width) && remain > 1;
pos++, actual++, remain--)
{
actual[0] = isascii ((unsigned char) text[pos])
@ -322,7 +328,7 @@ str_ascii_term_trim (const char *text, int width)
actual = result;
remain = sizeof (result);
if (width < length)
if (width < (int)length)
{
if (width <= 3)
{
@ -378,19 +384,22 @@ str_ascii_term_width1 (const char *text)
static int
str_ascii_term_char_width (const char *text)
{
(void) text;
return 1;
}
static void
str_ascii_msg_term_size (const char *text, int *lines, int *columns)
{
(*lines) = 1;
(*columns) = 0;
char *p, *tmp = g_strdup (text);
char *p, *tmp;
char *q;
char c = '\0';
int width;
(*lines) = 1;
(*columns) = 0;
tmp = g_strdup (text);
p = tmp;
for (;;)
@ -428,7 +437,7 @@ str_ascii_term_substring (const char *text, int start, int width)
remain = sizeof (result);
length = strlen (text);
if (start < length)
if (start < (int)length)
{
pos += start;
/* copy at most width characters from text from start */
@ -464,10 +473,10 @@ str_ascii_trunc (const char *text, int width)
remain = sizeof (result);
length = strlen (text);
if (length > width)
if ((int)length > width)
{
/* copy prefix of text */
for (; pos + 1 <= width / 2 && remain > 1; actual++, pos++, remain--)
for (; pos + 1 <= (gsize)width / 2 && remain > 1; actual++, pos++, remain--)
{
actual[0] = isascii ((unsigned char) text[pos]) ? text[pos] : '?';
actual[0] = g_ascii_isprint ((gchar) actual[0]) ? actual[0] : '.';
@ -506,24 +515,30 @@ str_ascii_trunc (const char *text, int width)
static int
str_ascii_offset_to_pos (const char *text, size_t length)
{
(void) text;
return (int) length;
}
static int
str_ascii_column_to_pos (const char *text, size_t pos)
{
(void) text;
return (int)pos;
}
static char *
str_ascii_create_search_needle (const char *needle, int case_sen)
{
(void) case_sen;
return (char *) needle;
}
static void
str_ascii_release_search_needle (char *needle, int case_sen)
{
(void) case_sen;
(void) needle;
}
static const char *
@ -616,6 +631,7 @@ str_ascii_fix_string (char *text)
static char *
str_ascii_create_key (const char *text, int case_sen)
{
(void) case_sen;
return (char *) text;
}
@ -628,6 +644,8 @@ str_ascii_key_collate (const char *t1, const char *t2, int case_sen)
static void
str_ascii_release_key (char *key, int case_sen)
{
(void) key;
(void) case_sen;
}
static int

View File

@ -320,7 +320,7 @@ str_utf8_length_noncomb (const char *text)
return result;
}
/*
static void
str_utf8_questmark_sustb (char **string, size_t * left, GString * buffer)
{
@ -329,7 +329,7 @@ str_utf8_questmark_sustb (char **string, size_t * left, GString * buffer)
(*string) = next;
g_string_append_c (buffer, '?');
}
*/
static estr_t
str_utf8_vfs_convert_to (GIConv coder, const char *string,
int size, GString * buffer)
@ -404,7 +404,7 @@ str_utf8_make_make_term_form (const char *text, size_t length)
text = g_utf8_next_char (text);
} else {
text++;
//actual[0] = '?';
/*actual[0] = '?';*/
memcpy (actual, replch, strlen (replch));
actual+= strlen (replch);
result.width++;
@ -517,7 +517,7 @@ utf8_tool_insert_space (struct utf8_tool *tool, int count)
{
if (count <= 0)
return 1;
if (tool->remain <= count)
if (tool->remain <= (gsize) count)
return 0;
memset (tool->actual, ' ', count);
tool->actual += count;
@ -587,7 +587,7 @@ str_utf8_fit_to_term (const char *text, int width, int just_mode)
tool.remain = sizeof (result);
tool.compose = 0;
if (pre_form->width <= width)
if (pre_form->width <= (gsize)width)
{
tool.ident = 0;
switch (HIDE_FIT (just_mode))
@ -660,7 +660,7 @@ str_utf8_term_trim (const char *text, int width)
tool.remain = sizeof (result);
tool.compose = 0;
if (width < pre_form->width)
if ((gsize)width < pre_form->width)
{
if (width <= 3)
{
@ -716,14 +716,15 @@ str_utf8_term_char_width (const char *text)
static void
str_utf8_msg_term_size (const char *text, int *lines, int *columns)
{
(*lines) = 1;
(*columns) = 0;
char *p, *tmp = g_strdup (text);
char *p, *tmp;
char *q;
char c = '\0';
int width;
(*lines) = 1;
(*columns) = 0;
tmp = g_strdup (text);
p = tmp;
for (;;)
{
@ -790,7 +791,7 @@ str_utf8_trunc (const char *text, int width)
tool.remain = sizeof (result);
tool.compose = 0;
if (pre_form->width > width)
if (pre_form->width > (gsize)width)
{
tool.ident = 0;
utf8_tool_copy_chars_to (&tool, width / 2);
@ -863,7 +864,7 @@ str_utf8_column_to_pos (const char *text, size_t pos)
text++;
width++;
}
if (width > pos)
if ((gsize)width > pos)
return result;
result++;
@ -896,6 +897,7 @@ str_utf8_create_search_needle (const char *needle, int case_sen)
static void
str_utf8_release_search_needle (char *needle, int case_sen)
{
(void) case_sen;
if (needle != NULL)
g_free (needle);
}
@ -1274,12 +1276,14 @@ str_utf8_create_key_for_filename (const char *text, int case_sen)
static int
str_utf8_key_collate (const char *t1, const char *t2, int case_sen)
{
(void) case_sen;
return strcmp (t1, t2);
}
static void
str_utf8_release_key (char *key, int case_sen)
{
(void) case_sen;
g_free (key);
}

View File

@ -191,6 +191,7 @@ init_subshell_child (const char *pty_name)
pid_t mc_sid;
#endif /* HAVE_GETSID */
(void) pty_name;
setsid (); /* Get a fresh terminal session */
/* Make sure that it has become our controlling terminal */

View File

@ -715,13 +715,13 @@ i18n_checktimelength (void)
char buf [MB_LEN_MAX * MAX_I18NTIMELENGTH + 1];
size_t a, b;
strftime (buf, sizeof(buf) - 1, _("%b %e %H:%M"), lt);
strftime (buf, sizeof(buf) - 1, _("%b %d %H:%M"), lt);
a = str_term_width1 (buf);
strftime (buf, sizeof(buf) - 1, _("%b %e %Y"), lt);
strftime (buf, sizeof(buf) - 1, _("%b %d %Y"), lt);
b = str_term_width1 (buf);
length = max (a, b);
length = max (str_term_width1 (_(INVALID_TIME_TEXT)), length);
length = max ((size_t)str_term_width1 (_(INVALID_TIME_TEXT)), length);
}
/* Don't handle big differences. Use standard value (email bug, please) */
@ -1601,13 +1601,15 @@ shell_unescape(const char* text)
{
GString *str;
char *result = NULL;
const char* readptr;
char c;
if (!text)
return NULL;
/* look for the first \ - that's quick skipover if there's nothing to escape */
const char* readptr = text;
readptr = text;
while ((*readptr) && ((*readptr)!='\\')) readptr++;
if (!(*readptr)) {
result = g_strdup(text);
@ -1616,7 +1618,6 @@ shell_unescape(const char* text)
str = g_string_new_len(text, readptr - text);
/* if we're here, we're standing on the first '\' */
char c;
while ((c = *readptr))
{
if (c=='\\')

View File

@ -415,13 +415,13 @@ static int
view_read_test_new_line (WView *view, struct read_info *info)
{
#define cmp(t1,t2) (strcmp((t1),(t2)) == 0)
(void) view;
if (cmp (info->cact, "\n")) return VRT_NW_YES;
if (cmp (info->cact, "\r")) {
if (info->result != -1 && (cmp (info->cnxt, "\r") || cmp (info->cnxt, "\n")))
return VRT_NW_CONTINUE;
return VRT_NW_YES;
}
return VRT_NW_NO;
@ -433,6 +433,7 @@ static int
view_read_test_tabulator (WView *view, struct read_info *info)
{
#define cmp(t1,t2) (strcmp((t1),(t2)) == 0)
(void) view;
return cmp (info->cact, "\t");
}
@ -510,7 +511,7 @@ view_load_cache_line (WView *view, struct cache_line *line)
struct read_info info;
offset_type nroff_start = 0;
int nroff_seq = 0;
int w;
gsize w;
line->width = 0;
@ -593,17 +594,17 @@ view_map_offset_and_column (WView *view, struct cache_line *line,
{
const screen_dimen width = view->data_area.width;
struct read_info info;
offset_type nroff_start = 0;
int nroff_seq = 0;
gsize w;
screen_dimen col;
/* HACK: valgrind screams here.
* TODO: to figure out WHY valgrind detects uninitialized
* variables. Maybe, info isn't fully initialized?
*/
memset (&info, 0, sizeof info);
offset_type nroff_start = 0;
int nroff_seq = 0;
int w;
screen_dimen col;
col = 0;
view_read_start (view, &info, line->start);
while (info.result != -1) {
@ -804,6 +805,7 @@ view_get_last_line (WView *view)
static struct cache_line *
view_get_previous_line (WView *view, struct cache_line *line)
{
(void) view;
return line->prev;
}
@ -913,10 +915,10 @@ view_column_to_offset (WView *view, struct cache_line **line, offset_type column
if ((next == NULL) || (next->number != (*line)->number)) break;
(*line) = next;
}
// if (column < (*line)->left + (*line)->width) {
/* if (column < (*line)->left + (*line)->width) { */
result = INVALID_OFFSET,
view_map_offset_and_column (view, *line, &column, &result);
// }
/* } */
return result;
}
@ -1564,9 +1566,9 @@ view_moveto_eol (WView *view)
if (w > width) {
view->dpy_text_column = w - width;
} else {
// if (w + width <= view->dpy_text_column) {
/* if (w + width <= view->dpy_text_column) {*/
view->dpy_text_column = 0;
// }
/* }*/
}
view_set_first_showed (view, line);
}
@ -1598,7 +1600,7 @@ view_moveto (WView *view, offset_type row, offset_type col)
struct cache_line *t;
act = view_get_first_line (view);
view_move_to_stop (act, t, act->number != row, view_get_next_line)
view_move_to_stop (act, t, (off_t)act->number != row, view_get_next_line)
view->dpy_text_column = (view->text_wrap_mode) ? 0 : col;
view->dpy_start = view_column_to_offset (view, &act, col);
@ -1618,7 +1620,7 @@ static void
view_move_up (WView *view, offset_type lines)
{
struct cache_line *line, *t;
int li;
off_t li;
if (view->hex_mode) {
offset_type bytes = lines * view->bytes_per_line;
@ -1642,33 +1644,36 @@ view_move_up (WView *view, offset_type lines)
}
view_movement_fixups (view, (lines != 1));
}
/*
static void
return_up (struct cache_line * (*ne) (WView *, struct cache_line *),
struct cache_line * (*pr) (WView *, struct cache_line *),
off_t *li, struct cache_line **t, struct cache_line **line,
WView *view)
{
*li = 0;
*t = *line;
while ((*t != NULL) && (*li < view->data_area.height)) {
(*li)++;
*t = ne (view, *t);
}
*li = view->data_area.height - *li;
*t = pr (view, *line);
while ((*t != NULL) && (*li > 0)) {
*line = *t;
*t = pr (view, *line);
(*li)--;
}
}
*/
static void
view_move_down (WView *view, offset_type lines)
{
struct cache_line *line;
struct cache_line *t;
int li;
void
return_up (struct cache_line * (*ne) (WView *, struct cache_line *),
struct cache_line * (*pr) (WView *, struct cache_line *))
{
li = 0;
t = line;
while ((t != NULL) && (li < view->data_area.height)) {
li++;
t = ne (view, t);
}
li = view->data_area.height - li;
t = pr (view, line);
while ((t != NULL) && (li > 0)) {
line = t;
t = pr (view, line);
li--;
}
}
off_t li;
if (view->hex_mode) {
offset_type i, limit, last_byte;
@ -1686,16 +1691,16 @@ view_move_down (WView *view, offset_type lines)
} else if (view->text_wrap_mode) {
line = view_get_first_showed_line (view);
li = 0;
view_count_to_stop (line, t, li, li < lines, view_get_next_line)
view_count_to_stop (line, t, li, (off_t)li < lines, view_get_next_line)
// return_up (view_get_next_line, view_get_previous_line);
/* return_up (view_get_next_line, view_get_previous_line); */
view_set_first_showed (view, line);
} else {
line = view_get_first_showed_line (view);
li = 0;
view_count_to_stop (line, t, li, li < lines, view_get_next_whole_line)
// return_up (view_get_next_whole_line, view_get_previous_whole_line);
/* return_up (view_get_next_whole_line, view_get_previous_whole_line); */
view_set_first_showed (view, line);
}
view_movement_fixups (view, (lines != 1));
@ -2422,13 +2427,14 @@ view_display_text (WView * view)
view_read_continue (view, &info);
if (view_read_test_nroff_back (view, &info)) {
int c;
w = str_term_width1 (info.chi1);
col-= w;
if (col >= view->dpy_text_column
&& col + w - view->dpy_text_column <= width) {
widget_move (view, top + row, left + (col - view->dpy_text_column));
int c;
for (c = 0; c < w; c++) addch (' ');
}
if (cmp (info.chi1, "_") && (!cmp (info.cnxt, "_") || !cmp (info.chi2, "\b")))
@ -2861,10 +2867,12 @@ view_moveto_match (WView *view)
if (line->start <= view->search_end && line->end >= view->search_end)
end_off = off;
}
line = view_get_first_showed_line (view);
off = (start_off - end_off < height - height3) ? start_off + height3: end_off;
off = ((off_t)(start_off - end_off) < (off_t)(height - height3))
? (int)(start_off + height3)
: (int)end_off;
for (;off >= 0 && line->start > 0; off--)
line = view_get_previous_line (view, line);
} else {
@ -2884,12 +2892,14 @@ view_moveto_match (WView *view)
if (line->start <= view->search_end && line->end >= view->search_end)
end_off = off;
}
line = view_get_first_showed_line (view);
// if view->search_end is farther then screen heigth */
if (end_off >= height) {
off = (end_off - start_off < height - height3) ? end_off - height + height3: start_off;
/* if view->search_end is farther then screen heigth */
if ((off_t)end_off >= height) {
off = ((off_t)(end_off - start_off) < (off_t)(height - height3))
? (int) (end_off - height + height3)
: (int) start_off;
for (;off >= 0; off--)
line = view_get_next_line (view, line);
}
@ -2918,7 +2928,9 @@ view_moveto_match (WView *view)
line = view_get_first_showed_line (view);
line = view_get_start_of_whole_line (view, line);
off = (start_off - end_off < height - height3) ? start_off + height3: end_off;
off = ((off_t)(start_off - end_off) < (off_t)(height - height3))
? (int)(start_off + height3)
: (int)end_off;
for (;off >= 0 && line->start > 0; off--) {
line = view_get_previous_whole_line (view, line);
line = view_get_start_of_whole_line (view, line);
@ -2940,12 +2952,14 @@ view_moveto_match (WView *view)
if (line->start <= view->search_end && line_end->end >= view->search_end)
end_off = off;
}
line = view_get_first_showed_line (view);
line = view_get_start_of_whole_line (view, line);
if (end_off >= height) {
off = (end_off - start_off < height - height3) ? end_off - height + height3: start_off;
if ((off_t)end_off >= height) {
off = ((off_t)(end_off - start_off) < (off_t)(height - height3))
? (int)(end_off - height + height3)
: (int)start_off;
for (;off >= 0; off--)
line = view_get_next_whole_line (view, line);
}
@ -2957,11 +2971,11 @@ view_moveto_match (WView *view)
t = view_offset_to_line_from (view, view->search_end, line);
end_off = view_offset_to_column (view, t, view->search_end);
if (end_off - start_off > width) end_off = start_off + width;
if (view->dpy_text_column > start_off) {
if ((off_t)(end_off - start_off) > width) end_off = start_off + width;
if (view->dpy_text_column > (off_t)start_off) {
view->dpy_text_column = start_off;
} else {
if (view->dpy_text_column + width < end_off) {
if (view->dpy_text_column + width < (off_t)end_off) {
view->dpy_text_column = end_off - width;
}
}
@ -3250,6 +3264,7 @@ regexp_view_search (WView *view, char *pattern, char *string,
regmatch_t pmatch[1];
int i, flags = REG_ICASE;
(void) view;
if (old_pattern == NULL || strcmp (old_pattern, pattern) != 0
|| old_type != match_type) {
if (old_pattern != NULL) {

View File

@ -275,6 +275,10 @@ message (int flags, const char *title, const char *text, ...)
{
char *p;
va_list ap;
union {
void *p;
void (*f) (int, int *, char *, const char *);
} func;
va_start (ap, text);
p = g_strdup_vprintf (text, ap);
@ -285,7 +289,8 @@ message (int flags, const char *title, const char *text, ...)
#ifdef WITH_BACKGROUND
if (we_are_background) {
parent_call ((void *) bg_message, NULL, 3, sizeof (flags), &flags,
func.f = bg_message;
parent_call (func.p, NULL, 3, sizeof (flags), &flags,
strlen (title), title, strlen (p), p);
} else
#endif /* WITH_BACKGROUND */
@ -537,13 +542,21 @@ char *
input_dialog_help (const char *header, const char *text, const char *help,
const char *history_name, const char *def_text)
{
union {
void *p;
char * (*f) (const char *, const char *, const char *,
const char *, const char *);
} func;
#ifdef WITH_BACKGROUND
if (we_are_background)
return parent_call_string ((void *) fg_input_dialog_help, 5,
{
func.f = fg_input_dialog_help;
return parent_call_string (func.p, 5,
strlen (header), header, strlen (text),
text, strlen (help), help,
strlen (history_name), history_name,
strlen (def_text), def_text);
}
else
#endif /* WITH_BACKGROUND */
return fg_input_dialog_help (header, text, help, history_name, def_text);

View File

@ -334,8 +334,8 @@ static ssize_t cpio_read_oldc_head(struct vfs_class *me, struct vfs_s_super *sup
u.buf[HEAD_LENGTH] = 0;
if (sscanf (u.buf, "070707%6lo%6lo%6lo%6lo%6lo%6lo%6lo%11lo%6lo%11lo",
&hd.c_dev, &hd.c_ino, &hd.c_mode, &hd.c_uid, &hd.c_gid,
&hd.c_nlink, &hd.c_rdev, &hd.c_mtime,
(unsigned long *)&hd.c_dev, &hd.c_ino, &hd.c_mode, &hd.c_uid, &hd.c_gid,
&hd.c_nlink, (unsigned long *)&hd.c_rdev, &hd.c_mtime,
&hd.c_namesize, &hd.c_filesize) < 10) {
message (D_ERROR, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"),
super->name);
@ -395,7 +395,7 @@ static ssize_t cpio_read_crc_head(struct vfs_class *me, struct vfs_s_super *supe
if (sscanf (u.buf, "%6ho%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx",
&hd.c_magic, &hd.c_ino, &hd.c_mode, &hd.c_uid, &hd.c_gid,
&hd.c_nlink, &hd.c_mtime, &hd.c_filesize,
&hd.c_dev, &hd.c_devmin, &hd.c_rdev, &hd.c_rdevmin,
(unsigned long *)&hd.c_dev, (unsigned long *)&hd.c_devmin, (unsigned long *)&hd.c_rdev, (unsigned long *)&hd.c_rdevmin,
&hd.c_namesize, &hd.c_chksum) < 14) {
message (D_ERROR, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"),
super->name);

View File

@ -367,6 +367,7 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
FILE *logfile;
char *quoted_path;
int reply_code;
gchar *shell_commands;
#if 0
/*
@ -376,7 +377,7 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
{
MEDATA->logfile = fopen("/tmp/mc-FISH.sh", "w");
}
#endif // 0
#endif /* 0 */
logfile = MEDATA->logfile;
@ -385,7 +386,7 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
gettimeofday(&dir->timestamp, NULL);
dir->timestamp.tv_sec += fish_directory_timeout;
quoted_path = shell_escape (remote_path);
fish_command (me, super, NONE,
shell_commands = g_strconcat(
"#LIST /%s\n"
"if `perl -v > /dev/null 2>&1` ; then\n"
"perl -e '\n"
@ -399,6 +400,7 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
"while( (my $filename = readdir(DIR))){\n"
"my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = lstat(\"$dirname/$filename\");\n"
"my $mloctime= scalar localtime $mtime;\n"
,
"my $shell_escape_regex= s/([;<>\\*\\|`&\\$!#\\(\\)\\[\\]\\{\\}:'\\''\"\\ \\\\])/\\\\$1/g;\n"
"my $e_filename = $filename;\n"
"$e_filename =~ $shell_escape_regex;\n"
@ -418,6 +420,7 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
":\\\"$e_filename\\\"\\n"
"\\n\", S_IMODE($mode), S_IFMT($mode));\n"
"}}\n"
,
"printf(\"### 200\\n\");\n"
"closedir(DIR);\n"
"} else {\n"
@ -440,6 +443,7 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
"echo \"P$p $u.$g\nS$s\nd$m $d $y\n:$n\n\"\n"
"elif `sed --version >/dev/null 2>&1` ; then\n"
"file=`echo $n | sed -e 's#^\\(.*\\) -> \\(.*\\)#\\1\" -> \"\\2#'`\n"
,
"echo \"P$p $u $g\nS$s\nd$m $d $y\n:\"$file\"\n\"\n"
"else\n"
"echo \"P$p $u $g\nS$s\nd$m $d $y\n:\"$n\"\n\"\n"
@ -459,8 +463,15 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
"echo '### 200'\n"
"else\n"
"echo '### 500'\n"
"fi\n",
"fi\n"
,
NULL
);
fish_command (me, super, NONE, shell_commands,
quoted_path, quoted_path, quoted_path, quoted_path, quoted_path, quoted_path);
g_free(shell_commands);
g_free (quoted_path);
ent = vfs_s_generate_entry(me, NULL, dir, 0);
while (1) {
@ -498,9 +509,9 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
break; /* We'll do "." and ".." ourselves */
if (S_ISLNK(ST.st_mode)) {
// we expect: "escaped-name" -> "escaped-name"
/* we expect: "escaped-name" -> "escaped-name"
// -> cannot occur in filenames,
// because it will be escaped to -\>
// because it will be escaped to -\> */
if (*filename == '"')
++filename;
@ -512,14 +523,14 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
linkname = filename_bound;
if (filename_bound > filename
&& *(filename_bound - 1) == '"')
--filename_bound; // skip trailing "
--filename_bound; /* skip trailing " */
}
else
{
filename_bound = linkname;
linkname += 6; // strlen ("\" -> \"")
linkname += 6; /* strlen ("\" -> \"") */
if (*(linkname_bound - 1) == '"')
--linkname_bound; // skip trailing "
--linkname_bound; /* skip trailing " */
}
ent->name = str_dup_range(filename, filename_bound);
@ -528,11 +539,13 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
ent->ino->linkname = str_dup_range(linkname, linkname_bound);
shell_unescape(ent->ino->linkname);
} else {
// we expect: "escaped-name"
/* we expect: "escaped-name" */
if (filename_bound - filename > 2)
{
// there is at least 2 "
// and we skip them
/*
there is at least 2 "
and we skip them
*/
if (*filename == '"')
++filename;
if (*(filename_bound - 1) == '"')
@ -557,8 +570,10 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
break;
}
case 'R': {
// raw filemode:
// we expect: Roctal-filemode octal-filetype uid.gid
/*
raw filemode:
we expect: Roctal-filemode octal-filetype uid.gid
*/
size_t skipped;
vfs_parse_raw_filemode (buffer + 1, &skipped, &ST.st_mode);
break;
@ -848,6 +863,8 @@ static int
fish_ctl (void *fh, int ctlop, void *arg)
{
(void) arg;
(void) fh;
(void) ctlop;
return 0;
#if 0
switch (ctlop) {

View File

@ -1246,5 +1246,11 @@ tcp_invalidate_socket (int sock)
{
mcfs_invalidate_socket (sock);
}
#else
void mcfs__unused(void)
{
/*
CFLAGS="-ansi -pedantic -Wall -Wextra -Werror"
*/
}
#endif /* WITH_MCFS */

View File

@ -204,4 +204,11 @@ rpc_get (int sock, ...)
}
}
}
#else
void mcfsutil__unused(void)
{
/*
CFLAGS="-ansi -pedantic -Wall -Wextra -Werror"
*/
}
#endif /* WITH_MCFS */

View File

@ -157,7 +157,7 @@ static int
undelfs_lsdel_proc(ext2_filsys fs, blk_t *block_nr, int blockcnt, void *private)
{
struct lsdel_struct *lsd = (struct lsdel_struct *) private;
(void) blockcnt;
lsd->num_blocks++;
if (*block_nr < fs->super->s_first_data_block ||

View File

@ -549,7 +549,7 @@ vfs_parse_raw_filemode (const char *s, size_t *ret_skipped,
p = s;
// isoctal
/* isoctal */
while(*p >= '0' && *p <= '7')
{
perms *= 010;
@ -589,7 +589,7 @@ vfs_parse_raw_filemode (const char *s, size_t *ret_skipped,
case 0120000:
local_type = S_IFLNK; break;
case 0100000:
default:// don't know what is it
default: /* don't know what is it */
local_type = S_IFREG; break;
}

View File

@ -382,7 +382,7 @@ vfs_supported_enconding (const char *encoding) {
* buffer - used to store result of translation
*/
static estr_t
_vfs_translate_path (const char *path, int size,
_vfs_translate_path (const char *path, int size,
GIConv defcnv, GString *buffer)
{
const char *semi;
@ -393,8 +393,8 @@ _vfs_translate_path (const char *path, int size,
GIConv coder;
int ms;
if (size == 0) return 0;
size = (size > 0) ? size : strlen (path);
if (size == 0) return 0;
size = ( size > 0) ? size : (signed int)strlen (path);
/* try found #end: */
semi = g_strrstr_len (path, size, "#enc:");
@ -414,12 +414,12 @@ _vfs_translate_path (const char *path, int size,
semi+= 5;
slash = strchr (semi, PATH_SEP);
// ignore slashes after size;
/* ignore slashes after size; */
if (slash - path >= size) slash = NULL;
ms = (slash != NULL) ? slash - semi : strlen (semi);
ms = min (ms, sizeof (encoding) - 1);
// limit encoding size (ms) to path size (size)
ms = (slash != NULL) ? slash - semi : (int) strlen (semi);
ms = min ((unsigned int) ms, sizeof (encoding) - 1);
/* limit encoding size (ms) to path size (size) */
if (semi + ms > path + size) ms = path + size - semi;
memcpy (encoding, semi, ms);
encoding[ms] = '\0';
@ -462,8 +462,10 @@ vfs_translate_path (const char *path)
g_string_set_size(vfs_str_buffer,0);
state = _vfs_translate_path (path, -1, str_cnv_from_term, vfs_str_buffer);
// strict version
//return (state == 0) ? vfs_str_buffer->data : NULL;
/*
strict version
return (state == 0) ? vfs_str_buffer->data : NULL;
*/
return (state != ESTR_FAILURE) ? vfs_str_buffer->str : NULL;
}
@ -766,14 +768,11 @@ mc_readdir (DIR *dirp)
vfs = vfs_op (handle);
dirinfo = vfs_info (handle);
if (vfs->readdir) {
// do {
entry = (*vfs->readdir) (dirinfo->info);
if (entry == NULL) return NULL;
g_string_set_size(vfs_str_buffer,0);
state = str_vfs_convert_from (dirinfo->converter,
entry = (*vfs->readdir) (dirinfo->info);
if (entry == NULL) return NULL;
g_string_set_size(vfs_str_buffer,0);
state = str_vfs_convert_from (dirinfo->converter,
entry->d_name, vfs_str_buffer);
// } while (state != ESTR_SUCCESS);
mc_readdir_result->d_ino = entry->d_ino;
g_strlcpy (mc_readdir_result->d_name, vfs_str_buffer->str, NAME_MAX + 1);
}
@ -863,7 +862,7 @@ _vfs_get_cwd (void)
estr_t state;
struct stat my_stat, my_stat2;
trans = vfs_translate_path_n (current_dir); //add check if NULL
trans = vfs_translate_path_n (current_dir); /* add check if NULL */
if (!_vfs_get_class (trans)) {
encoding = vfs_get_encoding (current_dir);

View File

@ -19,7 +19,7 @@ char *vfs_translate_path_n (const char *path);
/* return encoding after last #enc: or NULL, if part does not contain #enc:
* return static buffer */
const char *vfs_get_encoding (const char *path);
// canonize and translate path, return new string */
/* canonize and translate path, return new string */
char *vfs_canon_and_translate (const char *path);
/* Only the routines outside of the VFS module need the emulation macros */