1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-21 03:12:48 +02:00

od,test: address warnings from gcc's -Wjump-misses-init

* src/test.c (unary_operator): gcc reported that initializations
in two case statements were skipped.  Enclose in braces.
* src/od.c (decode_one_format): Likewise.
This commit is contained in:
Jim Meyering
2011-12-03 17:49:57 +01:00
parent bea7b10489
commit 63098ee582
2 changed files with 41 additions and 35 deletions

View File

@@ -771,32 +771,34 @@ this system doesn't provide a %lu-byte floating point type"),
}
size_spec = fp_type_size[size];
struct lconv const *locale = localeconv ();
size_t decimal_point_len =
(locale->decimal_point[0] ? strlen (locale->decimal_point) : 1);
{
struct lconv const *locale = localeconv ();
size_t decimal_point_len =
(locale->decimal_point[0] ? strlen (locale->decimal_point) : 1);
switch (size_spec)
{
case FLOAT_SINGLE:
print_function = print_float;
field_width = FLT_STRLEN_BOUND_L (decimal_point_len);
break;
switch (size_spec)
{
case FLOAT_SINGLE:
print_function = print_float;
field_width = FLT_STRLEN_BOUND_L (decimal_point_len);
break;
case FLOAT_DOUBLE:
print_function = print_double;
field_width = DBL_STRLEN_BOUND_L (decimal_point_len);
break;
case FLOAT_DOUBLE:
print_function = print_double;
field_width = DBL_STRLEN_BOUND_L (decimal_point_len);
break;
case FLOAT_LONG_DOUBLE:
print_function = print_long_double;
field_width = LDBL_STRLEN_BOUND_L (decimal_point_len);
break;
case FLOAT_LONG_DOUBLE:
print_function = print_long_double;
field_width = LDBL_STRLEN_BOUND_L (decimal_point_len);
break;
default:
abort ();
}
default:
abort ();
}
break;
break;
}
case 'a':
++s;

View File

@@ -413,22 +413,26 @@ unary_operator (void)
return euidaccess (argv[pos - 1], X_OK) == 0;
case 'O': /* File is owned by you? */
unary_advance ();
if (stat (argv[pos - 1], &stat_buf) != 0)
return false;
errno = 0;
uid_t euid = geteuid ();
uid_t NO_UID = -1;
return ! (euid == NO_UID && errno) && euid == stat_buf.st_uid;
{
unary_advance ();
if (stat (argv[pos - 1], &stat_buf) != 0)
return false;
errno = 0;
uid_t euid = geteuid ();
uid_t NO_UID = -1;
return ! (euid == NO_UID && errno) && euid == stat_buf.st_uid;
}
case 'G': /* File is owned by your group? */
unary_advance ();
if (stat (argv[pos - 1], &stat_buf) != 0)
return false;
errno = 0;
gid_t egid = getegid ();
gid_t NO_GID = -1;
return ! (egid == NO_GID && errno) && egid == stat_buf.st_gid;
{
unary_advance ();
if (stat (argv[pos - 1], &stat_buf) != 0)
return false;
errno = 0;
gid_t egid = getegid ();
gid_t NO_GID = -1;
return ! (egid == NO_GID && errno) && egid == stat_buf.st_gid;
}
case 'f': /* File is a file? */
unary_advance ();