1
0
mirror of https://github.com/MidnightCommander/mc synced 2025-01-10 13:32:31 +03:00

fixup! WIP

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
This commit is contained in:
Yury V. Zaytsev 2024-10-05 12:19:19 +02:00
parent 45eda0c24d
commit 4dcc410e0e
42 changed files with 203 additions and 206 deletions

View File

@ -201,15 +201,15 @@ mc_skin_color_get_from_ini_file (mc_skin_t *mc_skin, const gchar *group, const g
}
tmp = mc_skin_color_get_with_defaults (group, "_default_");
mc_skin_color->fg = (items_count > 0 && values[0][0]) ?
mc_skin_color_look_up_alias (mc_skin, g_strstrip (g_strdup (values[0]))) :
((tmp != NULL) ? g_strdup (tmp->fg) : NULL);
mc_skin_color->bg = (items_count > 1 && values[1][0]) ?
mc_skin_color_look_up_alias (mc_skin, g_strstrip (g_strdup (values[1]))) :
((tmp != NULL) ? g_strdup (tmp->bg) : NULL);
mc_skin_color->attrs = (items_count > 2 && values[2][0]) ?
mc_skin_color_look_up_alias (mc_skin, g_strstrip (g_strdup (values[2]))) :
((tmp != NULL) ? g_strdup (tmp->attrs) : NULL);
mc_skin_color->fg = (items_count > 0 && values[0][0])
? mc_skin_color_look_up_alias (mc_skin, g_strstrip (g_strdup (values[0])))
: ((tmp != NULL) ? g_strdup (tmp->fg) : NULL);
mc_skin_color->bg = (items_count > 1 && values[1][0])
? mc_skin_color_look_up_alias (mc_skin, g_strstrip (g_strdup (values[1])))
: ((tmp != NULL) ? g_strdup (tmp->bg) : NULL);
mc_skin_color->attrs = (items_count > 2 && values[2][0])
? mc_skin_color_look_up_alias (mc_skin, g_strstrip (g_strdup (values[2])))
: ((tmp != NULL) ? g_strdup (tmp->attrs) : NULL);
g_strfreev (values);

View File

@ -123,8 +123,8 @@ mc_skin_init (const gchar *skin_override, GError **mcerror)
mc_skin__default.have_256_colors = FALSE;
mc_skin__default.have_true_colors = FALSE;
mc_skin__default.name = skin_override != NULL ? g_strdup (skin_override) :
mc_skin_get_default_name ();
mc_skin__default.name = skin_override != NULL ? g_strdup (skin_override)
: mc_skin_get_default_name ();
mc_skin__default.colors = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
mc_skin_hash_destroy_value);

View File

@ -71,9 +71,9 @@
anyone knows of a system for which this limit is too small, please
report it as a bug in this code. */
#define ST_BLKSIZE(statbuf) \
((0 < (statbuf).st_blksize && (size_t) ((statbuf).st_blksize) <= ((size_t) -1) / 8 + 1) ? \
(size_t) ((statbuf).st_blksize) : \
DEV_BSIZE)
((0 < (statbuf).st_blksize && (size_t) ((statbuf).st_blksize) <= ((size_t) -1) / 8 + 1) \
? (size_t) ((statbuf).st_blksize) \
: DEV_BSIZE)
#if defined hpux || defined __hpux__ || defined __hpux
/* HP-UX counts st_blocks in 1024-byte units.
This loses when mixing HP-UX and BSD file systems with NFS. */

View File

@ -247,8 +247,8 @@ str_crt_conv_to (const char *to_enc)
GIConv
str_crt_conv_from (const char *from_enc)
{
return (!str_test_not_convert (from_enc)) ? g_iconv_open (codeset, from_enc) :
str_cnv_not_convert;
return (!str_test_not_convert (from_enc)) ? g_iconv_open (codeset, from_enc)
: str_cnv_not_convert;
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -635,8 +635,8 @@ void
tty_print_alt_char (int c, gboolean single)
{
#define DRAW(x, y) \
(x == y) ? SLsmg_draw_object (SLsmg_get_row (), SLsmg_get_column (), x) : \
SLsmg_write_char ((unsigned int) y)
(x == y) ? SLsmg_draw_object (SLsmg_get_row (), SLsmg_get_column (), x) \
: SLsmg_write_char ((unsigned int) y)
switch (c)
{
case ACS_VLINE:

View File

@ -1191,8 +1191,8 @@ vfs_s_get_path (const vfs_path_t *vpath, struct vfs_s_super **archive, int flags
subclass = VFS_SUBCLASS (path_element->class);
super = subclass->new_archive != NULL ? subclass->new_archive (path_element->class) :
vfs_s_new_super (path_element->class);
super = subclass->new_archive != NULL ? subclass->new_archive (path_element->class)
: vfs_s_new_super (path_element->class);
if (subclass->open_archive != NULL)
{

View File

@ -434,9 +434,9 @@ mc_opendir (const vfs_path_t *vpath)
path_element->dir.info = info;
#ifdef HAVE_CHARSET
path_element->dir.converter = (path_element->encoding != NULL) ?
str_crt_conv_from (path_element->encoding) :
str_cnv_from_term;
path_element->dir.converter = (path_element->encoding != NULL)
? str_crt_conv_from (path_element->encoding)
: str_cnv_from_term;
if (path_element->dir.converter == INVALID_CONV)
path_element->dir.converter = str_cnv_from_term;
#endif
@ -569,8 +569,8 @@ mc_getlocalcopy (const vfs_path_t *pathname_vpath)
me = VFS_CLASS (vfs_path_get_last_path_vfs (pathname_vpath));
if (me != NULL)
{
result = me->getlocalcopy != NULL ? me->getlocalcopy (pathname_vpath) :
mc_def_getlocalcopy (pathname_vpath);
result = me->getlocalcopy != NULL ? me->getlocalcopy (pathname_vpath)
: mc_def_getlocalcopy (pathname_vpath);
if (result == NULL)
errno = vfs_ferrno (me);
}
@ -591,9 +591,9 @@ mc_ungetlocalcopy (const vfs_path_t *pathname_vpath, const vfs_path_t *local_vpa
me = vfs_path_get_last_path_vfs (pathname_vpath);
if (me != NULL)
result = me->ungetlocalcopy != NULL ?
me->ungetlocalcopy (pathname_vpath, local_vpath, has_changed) :
mc_def_ungetlocalcopy (pathname_vpath, local_vpath, has_changed);
result = me->ungetlocalcopy != NULL
? me->ungetlocalcopy (pathname_vpath, local_vpath, has_changed)
: mc_def_ungetlocalcopy (pathname_vpath, local_vpath, has_changed);
return result;
}

View File

@ -394,9 +394,8 @@ vfs_path_from_str_deprecated_parser (char *path)
#ifdef HAVE_CHARSET
element->encoding = vfs_get_encoding (local, -1);
element->dir.converter = (element->encoding != NULL) ?
str_crt_conv_from (element->encoding) :
INVALID_CONV;
element->dir.converter = (element->encoding != NULL) ? str_crt_conv_from (element->encoding)
: INVALID_CONV;
#endif
url_params = strchr (op, ':'); /* skip VFS prefix */
@ -420,9 +419,8 @@ vfs_path_from_str_deprecated_parser (char *path)
#ifdef HAVE_CHARSET
element->encoding = vfs_get_encoding (path, -1);
element->dir.converter = (element->encoding != NULL) ?
str_crt_conv_from (element->encoding) :
INVALID_CONV;
element->dir.converter = (element->encoding != NULL) ? str_crt_conv_from (element->encoding)
: INVALID_CONV;
#endif
g_array_prepend_val (vpath->path, element);
}
@ -502,9 +500,8 @@ vfs_path_from_str_uri_parser (char *path)
#endif
}
#ifdef HAVE_CHARSET
element->dir.converter = (element->encoding != NULL) ?
str_crt_conv_from (element->encoding) :
INVALID_CONV;
element->dir.converter = (element->encoding != NULL) ? str_crt_conv_from (element->encoding)
: INVALID_CONV;
#endif
g_array_prepend_val (vpath->path, element);
@ -522,9 +519,8 @@ vfs_path_from_str_uri_parser (char *path)
element->path = vfs_translate_path_n (path);
#ifdef HAVE_CHARSET
element->encoding = vfs_get_encoding (path, -1);
element->dir.converter = (element->encoding != NULL) ?
str_crt_conv_from (element->encoding) :
INVALID_CONV;
element->dir.converter = (element->encoding != NULL) ? str_crt_conv_from (element->encoding)
: INVALID_CONV;
#endif
g_array_prepend_val (vpath->path, element);
}
@ -1233,9 +1229,8 @@ vfs_path_deserialize (const char *data, GError **mcerror)
#ifdef HAVE_CHARSET
element->encoding = mc_config_get_string_raw (cpath, groupname, "encoding", NULL);
element->dir.converter = (element->encoding != NULL) ?
str_crt_conv_from (element->encoding) :
INVALID_CONV;
element->dir.converter = (element->encoding != NULL) ? str_crt_conv_from (element->encoding)
: INVALID_CONV;
#endif
element->vfs_prefix = mc_config_get_string_raw (cpath, groupname, "vfs_prefix", NULL);

View File

@ -223,8 +223,8 @@ menubar_draw (const WMenuBar *menubar)
GList *i;
/* First draw the complete menubar */
tty_setcolor (widget_get_state (WIDGET (menubar), WST_FOCUSED) ? MENU_ENTRY_COLOR :
MENU_INACTIVE_COLOR);
tty_setcolor (widget_get_state (WIDGET (menubar), WST_FOCUSED) ? MENU_ENTRY_COLOR
: MENU_INACTIVE_COLOR);
tty_draw_hline (w->y, w->x, ' ', w->cols);
/* Now each one of the entries */

View File

@ -726,8 +726,8 @@ widget_default_make_local (Widget *w, const WRect *delta)
GList *
widget_default_find (const Widget *w, const Widget *what)
{
return (w != what || w->owner == NULL) ? NULL :
g_list_find (CONST_GROUP (w->owner)->widgets, what);
return (w != what || w->owner == NULL) ? NULL
: g_list_find (CONST_GROUP (w->owner)->widgets, what);
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -284,8 +284,8 @@ query_dialog (const char *header, const char *text, int flags, int count, ...)
int result = -1;
int cols, lines;
const int *query_colors = (flags & D_ERROR) != 0 ? alarm_colors : dialog_colors;
widget_pos_flags_t pos_flags = (flags & D_CENTER) != 0 ? (WPOS_CENTER | WPOS_TRYUP) :
WPOS_KEEP_DEFAULT;
widget_pos_flags_t pos_flags = (flags & D_CENTER) != 0 ? (WPOS_CENTER | WPOS_TRYUP)
: WPOS_KEEP_DEFAULT;
if (header == MSG_ERROR)
header = _ ("Error");

View File

@ -2243,8 +2243,8 @@ dview_set_codeset (WDiff *dview)
const char *encoding_id = NULL;
dview->utf8 = TRUE;
encoding_id = get_codepage_id (mc_global.source_codepage >= 0 ? mc_global.source_codepage :
mc_global.display_codepage);
encoding_id = get_codepage_id (mc_global.source_codepage >= 0 ? mc_global.source_codepage
: mc_global.display_codepage);
if (encoding_id != NULL)
{
GIConv conv;
@ -2985,9 +2985,9 @@ dview_ok_to_exit (WDiff *dview)
return res;
act = query_dialog (_ ("Quit"),
!mc_global.midnight_shutdown ?
_ ("File(s) was modified. Save with exit?") :
_ ("Midnight Commander is being shut down.\nSave modified file(s)?"),
!mc_global.midnight_shutdown
? _ ("File(s) was modified. Save with exit?")
: _ ("Midnight Commander is being shut down.\nSave modified file(s)?"),
D_NORMAL, 2, _ ("&Yes"), _ ("&No"));
/* Esc is No */

View File

@ -1096,8 +1096,8 @@ edit_move_updown (WEdit *edit, long lines, gboolean do_scroll, gboolean directio
edit_scroll_downward (edit, lines);
}
p = edit_buffer_get_current_bol (&edit->buffer);
p = direction ? edit_buffer_get_backward_offset (&edit->buffer, p, lines) :
edit_buffer_get_forward_offset (&edit->buffer, p, lines, 0);
p = direction ? edit_buffer_get_backward_offset (&edit->buffer, p, lines)
: edit_buffer_get_forward_offset (&edit->buffer, p, lines, 0);
edit_cursor_move (edit, p - edit->buffer.curs1);
edit_move_to_prev_col (edit, p);
@ -2300,8 +2300,8 @@ edit_set_codeset (WEdit *edit)
{
const char *cp_id;
cp_id = get_codepage_id (mc_global.source_codepage >= 0 ? mc_global.source_codepage :
mc_global.display_codepage);
cp_id = get_codepage_id (mc_global.source_codepage >= 0 ? mc_global.source_codepage
: mc_global.display_codepage);
if (cp_id != NULL)
{

View File

@ -146,7 +146,7 @@ status_string (WEdit *edit, char *s, int w)
#ifdef HAVE_CHARSET
mc_global.source_codepage >= 0 ? get_codepage_id (mc_global.source_codepage) :
#endif
"");
"");
else
g_snprintf (s, w, "[%c%c%c%c] %2ld L:[%3ld+%2ld %3ld/%3ld] *(%-4ld/%4ldb) %s %s",
edit->mark1 != edit->mark2 ? (edit->column_highlight ? 'C' : 'B') : '-',
@ -158,7 +158,7 @@ status_string (WEdit *edit, char *s, int w)
#ifdef HAVE_CHARSET
mc_global.source_codepage >= 0 ? get_codepage_id (mc_global.source_codepage) :
#endif
"");
"");
}
/* --------------------------------------------------------------------------------------------- */
@ -1017,9 +1017,9 @@ edit_status (WEdit *edit, gboolean active)
}
else
{
color = edit->drag_state != MCEDIT_DRAG_NONE ? EDITOR_FRAME_DRAG :
active ? EDITOR_FRAME_ACTIVE :
EDITOR_FRAME;
color = edit->drag_state != MCEDIT_DRAG_NONE ? EDITOR_FRAME_DRAG
: active ? EDITOR_FRAME_ACTIVE
: EDITOR_FRAME;
edit_draw_frame (edit, color, active);
edit_status_window (edit);
}

View File

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

View File

@ -377,9 +377,9 @@ sel_charset_button (WButton *button, int action)
const char *cpname;
new_display_codepage = new_dcp;
cpname = (new_display_codepage == SELECT_CHARSET_OTHER_8BIT) ?
_ ("Other 8 bit") :
((codepage_desc *) g_ptr_array_index (codepages, new_display_codepage))->name;
cpname = (new_display_codepage == SELECT_CHARSET_OTHER_8BIT)
? _ ("Other 8 bit")
: ((codepage_desc *) g_ptr_array_index (codepages, new_display_codepage))->name;
if (cpname != NULL)
mc_global.utf8_display = str_isutf8 (cpname);
else
@ -980,9 +980,9 @@ display_bits_box (void)
new_display_codepage = mc_global.display_codepage;
cpname = (new_display_codepage < 0) ?
_ ("Other 8 bit") :
((codepage_desc *) g_ptr_array_index (codepages, new_display_codepage))->name;
cpname = (new_display_codepage < 0)
? _ ("Other 8 bit")
: ((codepage_desc *) g_ptr_array_index (codepages, new_display_codepage))->name;
{
gboolean new_meta;

View File

@ -54,9 +54,9 @@
/*** file scope macro definitions ****************************************************************/
#define MY_ISDIR(x) \
((is_exe (x->st.st_mode) && !(S_ISDIR (x->st.st_mode) || link_isdir (x)) && exec_first) ? \
1 : \
((S_ISDIR (x->st.st_mode) || link_isdir (x)) ? 2 : 0))
((is_exe (x->st.st_mode) && !(S_ISDIR (x->st.st_mode) || link_isdir (x)) && exec_first) \
? 1 \
: ((S_ISDIR (x->st.st_mode) || link_isdir (x)) ? 2 : 0))
/*** file scope type declarations ****************************************************************/
@ -805,9 +805,9 @@ dir_list_reload (dir_list *list, const vfs_path_t *vpath, GCompareFunc sort,
* we copied one.
*/
fentry->f.marked = (marked_cnt > 0
&& g_hash_table_lookup (marked_files, dp->d_name) != NULL) ?
1 :
0;
&& g_hash_table_lookup (marked_files, dp->d_name) != NULL)
? 1
: 0;
if (fentry->f.marked != 0)
marked_cnt--;
}

View File

@ -684,9 +684,9 @@ regex_check_type (const vfs_path_t *filename_vpath, const char *ptr, gboolean ca
}
#ifdef HAVE_CHARSET
got_encoding_data = is_autodetect_codeset_enabled ?
get_file_encoding_local (localfile_vpath, encoding_id, sizeof (encoding_id)) :
0;
got_encoding_data = is_autodetect_codeset_enabled
? get_file_encoding_local (localfile_vpath, encoding_id, sizeof (encoding_id))
: 0;
if (got_encoding_data > 0)
{
@ -975,9 +975,9 @@ regex_command_for (void *target, const vfs_path_t *filename_vpath, const char *a
ignore_case = mc_config_get_bool (ext_ini, g, "TypeIgnoreCase", FALSE);
type_state = regex_check_type (filename_vpath, pattern, ignore_case, &have_type,
&mcerror) ?
TYPE_FOUND :
TYPE_NOT_FOUND;
&mcerror)
? TYPE_FOUND
: TYPE_NOT_FOUND;
g_free (pattern);
if (mc_error_message (&mcerror, NULL))

View File

@ -965,9 +965,9 @@ real_query_recursive (file_op_context_t *ctx, enum OperationMode mode, const cha
const char *msg;
char *text;
msg = mode == Foreground ?
_ ("Directory \"%s\" not empty.\nDelete it recursively?") :
_ ("Background process:\nDirectory \"%s\" not empty.\nDelete it recursively?");
msg = mode == Foreground
? _ ("Directory \"%s\" not empty.\nDelete it recursively?")
: _ ("Background process:\nDirectory \"%s\" not empty.\nDelete it recursively?");
text = g_strdup_printf (msg, path_trunc (s, 30));
if (safe_delete)

View File

@ -113,12 +113,12 @@ statfs (char const *filename, struct fs_info *buf)
if (device < 0)
{
errno = (device == B_ENTRY_NOT_FOUND ? ENOENT :
device == B_BAD_VALUE ? EINVAL :
device == B_NAME_TOO_LONG ? ENAMETOOLONG :
device == B_NO_MEMORY ? ENOMEM :
device == B_FILE_ERROR ? EIO :
0);
errno = (device == B_ENTRY_NOT_FOUND ? ENOENT
: device == B_BAD_VALUE ? EINVAL
: device == B_NAME_TOO_LONG ? ENAMETOOLONG
: device == B_NO_MEMORY ? ENOMEM
: device == B_FILE_ERROR ? EIO
: 0);
return -1;
}
/* If successful, buf->dev will be == device. */
@ -1229,8 +1229,8 @@ file_progress_real_query_replace (file_op_context_t *ctx, enum OperationMode mod
ui->replace_result = overwrite_query_dialog (ctx, mode);
}
replace_with_zero = (src_stat->st_size == 0 && ui->dont_overwrite_with_zero) ? FILE_SKIP :
FILE_CONT;
replace_with_zero = (src_stat->st_size == 0 && ui->dont_overwrite_with_zero) ? FILE_SKIP
: FILE_CONT;
switch (ui->replace_result)
{

View File

@ -1733,8 +1733,8 @@ run_process (void)
search_content_handle = mc_search_new (content_pattern, NULL);
if (search_content_handle)
{
search_content_handle->search_type = options.content_regexp ? MC_SEARCH_T_REGEX :
MC_SEARCH_T_NORMAL;
search_content_handle->search_type = options.content_regexp ? MC_SEARCH_T_REGEX
: MC_SEARCH_T_NORMAL;
search_content_handle->is_case_sensitive = options.content_case_sens;
search_content_handle->whole_words = options.content_whole_words;
#ifdef HAVE_CHARSET

View File

@ -172,9 +172,9 @@ info_show_info (WInfo *info)
else
tty_printf ("%s %" PRIuMAX " / %" PRIuMAX " (%d%%)", _ ("Free nodes:"),
myfs_stats.nfree, myfs_stats.nodes,
myfs_stats.nodes == 0 ?
0 :
(int) (100 * (long double) myfs_stats.nfree / myfs_stats.nodes));
myfs_stats.nodes == 0
? 0
: (int) (100 * (long double) myfs_stats.nfree / myfs_stats.nodes));
MC_FALLTHROUGH;
case 16:
widget_gotoyx (w, 16, 3);
@ -187,9 +187,9 @@ info_show_info (WInfo *info)
size_trunc_len (buffer1, 5, myfs_stats.avail, 1, panels_options.kilobyte_si);
size_trunc_len (buffer2, 5, myfs_stats.total, 1, panels_options.kilobyte_si);
tty_printf (_ ("Free space: %s / %s (%d%%)"), buffer1, buffer2,
myfs_stats.total == 0 ?
0 :
(int) (100 * (long double) myfs_stats.avail / myfs_stats.total));
myfs_stats.total == 0
? 0
: (int) (100 * (long double) myfs_stats.avail / myfs_stats.total));
}
MC_FALLTHROUGH;
case 15:

View File

@ -570,8 +570,8 @@ layout_dlg_create (void)
check_options[0].widget = check_new (5, 5, XTRACT (0));
group_add_widget (g, check_options[0].widget);
equal_split = panels_layout.horizontal_split ? panels_layout.horizontal_equal :
panels_layout.vertical_equal;
equal_split = panels_layout.horizontal_split ? panels_layout.horizontal_equal
: panels_layout.vertical_equal;
bleft_widget = button_new (6, 8, B_2LEFT, NARROW_BUTTON, "&<", b_left_right_cback);
widget_disable (WIDGET (bleft_widget), equal_split);

View File

@ -269,9 +269,9 @@ me_remote (char const *fs_name, char const *fs_type)
is unsigned and narrower than uintmax_t. */
#define PROPAGATE_ALL_ONES(x) \
((sizeof (x) < sizeof (uintmax_t) \
&& (~(x) == (sizeof (x) < sizeof (int) ? -(1 << (sizeof (x) * CHAR_BIT)) : 0))) ? \
UINTMAX_MAX : \
(uintmax_t) (x))
&& (~(x) == (sizeof (x) < sizeof (int) ? -(1 << (sizeof (x) * CHAR_BIT)) : 0))) \
? UINTMAX_MAX \
: (uintmax_t) (x))
/* Extract the top bit of X as an uintmax_t value. */
#define EXTRACT_TOP_BIT(x) ((x) & ((uintmax_t) 1 << (sizeof (x) * CHAR_BIT - 1)))
@ -857,8 +857,8 @@ read_file_system_list (void)
break;
me = g_malloc (sizeof (*me));
me->me_devname = g_strdup (fi.device_name[0] != '\0' ? fi.device_name :
fi.fsh_name);
me->me_devname = g_strdup (fi.device_name[0] != '\0' ? fi.device_name
: fi.fsh_name);
me->me_mountdir = g_strdup (re != NULL ? re->name : fi.fsh_name);
me->me_mntroot = NULL;
me->me_type = g_strdup (fi.fsh_name);
@ -1332,8 +1332,8 @@ get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp)
return -1;
/* f_frsize isn't guaranteed to be supported. */
fsp->fsu_blocksize = (vfsd.f_frsize ? PROPAGATE_ALL_ONES (vfsd.f_frsize) :
PROPAGATE_ALL_ONES (vfsd.f_bsize));
fsp->fsu_blocksize = (vfsd.f_frsize ? PROPAGATE_ALL_ONES (vfsd.f_frsize)
: PROPAGATE_ALL_ONES (vfsd.f_bsize));
fsp->fsu_blocks = PROPAGATE_ALL_ONES (vfsd.f_blocks);
fsp->fsu_bfree = PROPAGATE_ALL_ONES (vfsd.f_bfree);
@ -1355,8 +1355,8 @@ get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp)
/* f_frsize isn't guaranteed to be supported. */
/* *INDENT-OFF* */
fsp->fsu_blocksize = fsd.f_frsize ? PROPAGATE_ALL_ONES (fsd.f_frsize) :
PROPAGATE_ALL_ONES (fsd.f_bsize);
fsp->fsu_blocksize = fsd.f_frsize ? PROPAGATE_ALL_ONES (fsd.f_frsize)
: PROPAGATE_ALL_ONES (fsd.f_bsize);
/* *INDENT-ON* */
#elif defined STAT_STATFS3_OSF1 /* OSF/1 */

View File

@ -1081,9 +1081,9 @@ show_free_space (const WPanel *panel)
size_trunc_len (buffer2, sizeof (buffer2) - 1, myfs_stats.total, 1,
panels_options.kilobyte_si);
g_snprintf (tmp, sizeof (tmp), " %s / %s (%d%%) ", buffer1, buffer2,
myfs_stats.total == 0 ?
0 :
(int) (100 * (long double) myfs_stats.avail / myfs_stats.total));
myfs_stats.total == 0
? 0
: (int) (100 * (long double) myfs_stats.avail / myfs_stats.total));
widget_gotoyx (w, w->rect.lines - 1, w->rect.cols - 2 - (int) strlen (tmp));
tty_setcolor (NORMAL_COLOR);
tty_print_string (tmp);
@ -1439,8 +1439,8 @@ panel_paint_sort_info (const WPanel *panel)
{
if (*panel->sort_field->hotkey != '\0')
{
const char *sort_sign = panel->sort_info.reverse ? panel_sort_up_char :
panel_sort_down_char;
const char *sort_sign = panel->sort_info.reverse ? panel_sort_up_char
: panel_sort_down_char;
char *str;
str = g_strdup_printf ("%s%s", sort_sign, Q_ (panel->sort_field->hotkey));
@ -1505,8 +1505,8 @@ panel_print_header (const WPanel *panel)
if (panel->list_format == list_long && strcmp (fi->id, panel->sort_field->id) == 0)
g_string_append (format_txt,
panel->sort_info.reverse ? panel_sort_up_char :
panel_sort_down_char);
panel->sort_info.reverse ? panel_sort_up_char
: panel_sort_down_char);
g_string_append (format_txt, fi->title);

View File

@ -84,8 +84,8 @@ gboolean xtree_mode = FALSE;
/*** file scope macro definitions ****************************************************************/
#define tlines(t) \
(t->is_panel ? WIDGET (t)->rect.lines - 2 - (panels_options.show_mini_info ? 2 : 0) : \
WIDGET (t)->rect.lines)
(t->is_panel ? WIDGET (t)->rect.lines - 2 - (panels_options.show_mini_info ? 2 : 0) \
: WIDGET (t)->rect.lines)
/*** file scope type declarations ****************************************************************/

View File

@ -200,7 +200,7 @@ init_sigchld (void)
#ifdef ENABLE_SUBSHELL
mc_global.tty.use_subshell ? sigchld_handler :
#endif /* ENABLE_SUBSHELL */
sigchld_handler_no_subshell;
sigchld_handler_no_subshell;
sigemptyset (&sigchld_action.sa_mask);

View File

@ -109,8 +109,8 @@ select_charset (int center_y, int center_x, int current_charset, gboolean seldis
}
/* Select the default entry */
i = seldisplay ? ((current_charset < 0) ? codepages->len : (size_t) current_charset) :
((size_t) current_charset + 1);
i = seldisplay ? ((current_charset < 0) ? codepages->len : (size_t) current_charset)
: ((size_t) current_charset + 1);
listbox_set_current (listbox->list, i);
@ -123,8 +123,8 @@ select_charset (int center_y, int center_x, int current_charset, gboolean seldis
/* some charset has been selected */
if (seldisplay)
/* charset list is finished with "Other 8 bit" item */
return (listbox_result >= (int) codepages->len) ? SELECT_CHARSET_OTHER_8BIT :
listbox_result;
return (listbox_result >= (int) codepages->len) ? SELECT_CHARSET_OTHER_8BIT
: listbox_result;
/* charset list is began with "- < No translation >" item */
return (listbox_result - 1);
@ -140,9 +140,9 @@ do_set_codepage (int codepage)
gboolean ret;
mc_global.source_codepage = codepage;
errmsg = init_translation_table (codepage == SELECT_CHARSET_NO_TRANSLATE ?
mc_global.display_codepage :
mc_global.source_codepage,
errmsg = init_translation_table (codepage == SELECT_CHARSET_NO_TRANSLATE
? mc_global.display_codepage
: mc_global.source_codepage,
mc_global.display_codepage);
ret = errmsg == NULL;

View File

@ -435,9 +435,9 @@ setup__is_cfg_group_must_panel_config (const char *grp)
{
return (!strcasecmp ("Dirs", grp) || !strcasecmp ("Temporal:New Right Panel", grp)
|| !strcasecmp ("Temporal:New Left Panel", grp) || !strcasecmp ("New Left Panel", grp)
|| !strcasecmp ("New Right Panel", grp)) ?
grp :
NULL;
|| !strcasecmp ("New Right Panel", grp))
? grp
: NULL;
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -733,8 +733,8 @@ check_format_var (const char *p, char **v)
if (dots == NULL || dots == q + 5)
{
message (D_ERROR, _ ("Format error on file Extensions File"),
!dots ? _ ("The %%var macro has no default") :
_ ("The %%var macro has no variable"));
!dots ? _ ("The %%var macro has no default")
: _ ("The %%var macro has no variable"));
return 0;
}

View File

@ -552,9 +552,9 @@ extfs_open_archive (int fstype, const char *name, struct extfs_super_t **pparc,
}
cmd = g_strconcat (info->path, info->prefix, " list ",
vfs_path_get_last_path_str (local_name_vpath) != NULL ?
vfs_path_get_last_path_str (local_name_vpath) :
tmp,
vfs_path_get_last_path_str (local_name_vpath) != NULL
? vfs_path_get_last_path_str (local_name_vpath)
: tmp,
(char *) NULL);
g_free (tmp);

View File

@ -654,8 +654,8 @@ ftpfs_login_server (struct vfs_class *me, struct vfs_s_super *super, const char
/* Proxy server accepts: username@host-we-want-to-connect */
if (ftp_super->proxy != NULL)
name = g_strconcat (super->path_element->user, "@",
super->path_element->host[0] == '!' ? super->path_element->host + 1 :
super->path_element->host,
super->path_element->host[0] == '!' ? super->path_element->host + 1
: super->path_element->host,
(char *) NULL);
else
name = g_strdup (super->path_element->user);
@ -1045,9 +1045,9 @@ ftpfs_archive_same (const vfs_path_element_t *vpath_element, struct vfs_s_super
result = ((strcmp (path_element->host, super->path_element->host) == 0)
&& (strcmp (path_element->user, super->path_element->user) == 0)
&& (path_element->port == super->path_element->port)) ?
1 :
0;
&& (path_element->port == super->path_element->port))
? 1
: 0;
vfs_path_element_free (path_element);
return result;
@ -1281,9 +1281,9 @@ ftpfs_setup_active (struct vfs_class *me, struct vfs_s_super *super,
port = ntohs (port);
/* We are talking to an IPV6 server or PORT failed, so we can try EPRT anyway */
res = (ftpfs_command (me, super, WAIT_REPLY, "EPRT |%u|%s|%hu|", af, addr, port) == COMPLETE) ?
1 :
0;
res = (ftpfs_command (me, super, WAIT_REPLY, "EPRT |%u|%s|%hu|", af, addr, port) == COMPLETE)
? 1
: 0;
g_free (addr);
return res;
}
@ -1431,9 +1431,9 @@ ftpfs_initconn (struct vfs_class *me, struct vfs_s_super *super)
}
/* Restore the initial value of use_passive_connection (for subsequent retries) */
ftp_super->use_passive_connection = ftp_super->proxy != NULL ?
ftpfs_use_passive_connections_over_proxy :
ftpfs_use_passive_connections;
ftp_super->use_passive_connection = ftp_super->proxy != NULL
? ftpfs_use_passive_connections_over_proxy
: ftpfs_use_passive_connections;
me->verrno = EIO;
return (-1);

View File

@ -722,9 +722,9 @@ shell_archive_same (const vfs_path_element_t *vpath_element, struct vfs_s_super
result = ((strcmp (path_element->host, super->path_element->host) == 0)
&& (strcmp (path_element->user, super->path_element->user) == 0)
&& (path_element->port == super->path_element->port)) ?
1 :
0;
&& (path_element->port == super->path_element->port))
? 1
: 0;
vfs_path_element_free (path_element);

View File

@ -152,10 +152,10 @@
#define _GL_ADD_OVERFLOW(a, b, min, max) __builtin_add_overflow_p (a, b, (__typeof__ ((a) + (b))) 0)
#else
#define _GL_ADD_OVERFLOW(a, b, min, max) \
((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) : \
(a) < 0 ? (b) <= (a) + (b) : \
(b) < 0 ? (a) <= (a) + (b) : \
(a) + (b) < (b))
((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \
: (a) < 0 ? (b) <= (a) + (b) \
: (b) < 0 ? (a) <= (a) + (b) \
: (a) + (b) < (b))
#endif
/* Bound on length of the string representing an integer type or expression T.

View File

@ -448,12 +448,12 @@ tar_fill_stat (struct vfs_s_super *archive, union block *header)
case TAR_GNU:
case TAR_OLDGNU:
/* *INDENT-OFF* */
current_stat_info.stat.st_uid = *header->header.uname != '\0' ?
(uid_t) vfs_finduid (header->header.uname) :
UID_FROM_HEADER (header->header.uid);
current_stat_info.stat.st_gid = *header->header.gname != '\0' ?
(gid_t) vfs_findgid (header->header.gname) :
GID_FROM_HEADER (header->header.gid);
current_stat_info.stat.st_uid = *header->header.uname != '\0'
? (uid_t) vfs_finduid (header->header.uname)
: UID_FROM_HEADER (header->header.uid);
current_stat_info.stat.st_gid = *header->header.gname != '\0'
? (gid_t) vfs_findgid (header->header.gname)
: GID_FROM_HEADER (header->header.gid);
/* *INDENT-ON* */
switch (header->header.typeflag)

View File

@ -423,8 +423,8 @@ mcview_get_next_maybe_nroff_char (WView *view, mcview_state_machine_t *state, in
{
*state = state_after_nroff;
if (color != NULL)
*color = state->nroff_underscore_is_underlined ? VIEW_UNDERLINED_COLOR :
VIEW_BOLD_COLOR;
*color = state->nroff_underscore_is_underlined ? VIEW_UNDERLINED_COLOR
: VIEW_BOLD_COLOR;
}
else if (*c == c3)
{

View File

@ -351,8 +351,8 @@ retry:
{
case NROFF_START:
case NROFF_CONTINUATION:
nroff_state = mcview_is_nroff_sequence (view, current.cc_offset) ? NROFF_BACKSPACE :
NROFF_START;
nroff_state = mcview_is_nroff_sequence (view, current.cc_offset) ? NROFF_BACKSPACE
: NROFF_START;
break;
case NROFF_BACKSPACE:
nroff_state = NROFF_CONTINUATION;

View File

@ -156,9 +156,9 @@ mcview_display_status (WView *view)
tty_setcolor (STATUSBAR_COLOR);
tty_draw_hline (WIDGET (view)->rect.y + r->y, WIDGET (view)->rect.x + r->x, ' ', r->cols);
file_label = view->filename_vpath != NULL ? vfs_path_get_last_path_str (view->filename_vpath) :
view->command != NULL ? view->command :
"";
file_label = view->filename_vpath != NULL ? vfs_path_get_last_path_str (view->filename_vpath)
: view->command != NULL ? view->command
: "";
if (r->cols > 40)
{
@ -174,10 +174,10 @@ mcview_display_status (WView *view)
tty_printf ("%9" PRIuMAX "/%s%s %s", (uintmax_t) view->dpy_end, buffer,
mcview_may_still_grow (view) ? "+" : " ",
#ifdef HAVE_CHARSET
mc_global.source_codepage >= 0 ?
get_codepage_id (mc_global.source_codepage) :
mc_global.source_codepage >= 0 ? get_codepage_id (mc_global.source_codepage)
:
#endif
"");
"");
}
}
widget_gotoyx (view, r->y, r->x);

View File

@ -85,10 +85,10 @@ static mark_t
mcview_hex_calculate_boldflag (WView *view, off_t from, struct hexedit_change_node *curr,
gboolean force_changed)
{
return (from == view->hex_cursor) ? MARK_CURSOR :
((curr != NULL && from == curr->offset) || force_changed) ? MARK_CHANGED :
(view->search_start <= from && from < view->search_end) ? MARK_SELECTED :
MARK_NORMAL;
return (from == view->hex_cursor) ? MARK_CURSOR
: ((curr != NULL && from == curr->offset) || force_changed) ? MARK_CHANGED
: (view->search_start <= from && from < view->search_end) ? MARK_SELECTED
: MARK_NORMAL;
}
/* --------------------------------------------------------------------------------------------- */
@ -122,9 +122,9 @@ mcview_display_hex (WView *view)
char hex_buff[10]; /* A temporary buffer for sprintf and mvwaddstr */
text_start = 8 + 13 * ngroups
+ ((r->cols < 80) ? 0 :
(r->cols == 80) ? (ngroups - 1) :
(ngroups - 1 + 1));
+ ((r->cols < 80) ? 0
: (r->cols == 80) ? (ngroups - 1)
: (ngroups - 1 + 1));
mcview_display_clean (view);
@ -272,12 +272,13 @@ mcview_display_hex (WView *view)
}
/* Select the color for the hex number */
tty_setcolor (boldflag_byte == MARK_NORMAL ? VIEW_NORMAL_COLOR :
boldflag_byte == MARK_SELECTED ? VIEW_BOLD_COLOR :
boldflag_byte == MARK_CHANGED ? VIEW_UNDERLINED_COLOR :
/* boldflag_byte == MARK_CURSOR */
view->hexview_in_text ? VIEW_SELECTED_COLOR :
VIEW_UNDERLINED_COLOR);
tty_setcolor (boldflag_byte == MARK_NORMAL ? VIEW_NORMAL_COLOR
: boldflag_byte == MARK_SELECTED ? VIEW_BOLD_COLOR
: boldflag_byte == MARK_CHANGED ? VIEW_UNDERLINED_COLOR
:
/* boldflag_byte == MARK_CURSOR */
view->hexview_in_text ? VIEW_SELECTED_COLOR
: VIEW_UNDERLINED_COLOR);
/* Print the hex number */
widget_gotoyx (view, r->y + row, r->x + col);
@ -320,12 +321,13 @@ mcview_display_hex (WView *view)
/* Select the color for the character; this differs from the
* hex color when boldflag == MARK_CURSOR */
tty_setcolor (boldflag_char == MARK_NORMAL ? VIEW_NORMAL_COLOR :
boldflag_char == MARK_SELECTED ? VIEW_BOLD_COLOR :
boldflag_char == MARK_CHANGED ? VIEW_UNDERLINED_COLOR :
/* boldflag_char == MARK_CURSOR */
view->hexview_in_text ? VIEW_SELECTED_COLOR :
MARKED_SELECTED_COLOR);
tty_setcolor (boldflag_char == MARK_NORMAL ? VIEW_NORMAL_COLOR
: boldflag_char == MARK_SELECTED ? VIEW_BOLD_COLOR
: boldflag_char == MARK_CHANGED ? VIEW_UNDERLINED_COLOR
:
/* boldflag_char == MARK_CURSOR */
view->hexview_in_text ? VIEW_SELECTED_COLOR
: MARKED_SELECTED_COLOR);
#ifdef HAVE_CHARSET
if (mc_global.utf8_display)

View File

@ -266,8 +266,8 @@ mcview_set_codeset (WView *view)
const char *cp_id = NULL;
view->utf8 = TRUE;
cp_id = get_codepage_id (mc_global.source_codepage >= 0 ? mc_global.source_codepage :
mc_global.display_codepage);
cp_id = get_codepage_id (mc_global.source_codepage >= 0 ? mc_global.source_codepage
: mc_global.display_codepage);
if (cp_id != NULL)
{
GIConv conv;

View File

@ -182,8 +182,8 @@ mcview_nroff_seq_info (mcview_nroff_t *nroff)
if (nroff->current_char == '_' && next2 == '_')
{
nroff->type = (nroff->prev_type == NROFF_TYPE_BOLD) ? NROFF_TYPE_BOLD :
NROFF_TYPE_UNDERLINE;
nroff->type = (nroff->prev_type == NROFF_TYPE_BOLD) ? NROFF_TYPE_BOLD
: NROFF_TYPE_UNDERLINE;
}
else if (nroff->current_char == next2)
{

View File

@ -191,18 +191,18 @@ mcview_search_show_result (WView *view, size_t match_len)
{
int nroff_len;
nroff_len = view->mode_flags.nroff ?
mcview__get_nroff_real_len (view, view->search->start_buffer,
view->search->normal_offset - view->search->start_buffer) :
0;
nroff_len = view->mode_flags.nroff
? mcview__get_nroff_real_len (view, view->search->start_buffer,
view->search->normal_offset - view->search->start_buffer)
: 0;
view->search_start = view->search->normal_offset + nroff_len;
if (!view->mode_flags.hex)
view->search_start++;
nroff_len = view->mode_flags.nroff ?
mcview__get_nroff_real_len (view, view->search_start - 1, match_len) :
0;
nroff_len = view->mode_flags.nroff
? mcview__get_nroff_real_len (view, view->search_start - 1, match_len)
: 0;
view->search_end = view->search_start + match_len + nroff_len;
mcview_moveto_match (view);