Permalink
Browse files

Eliminate warnings about "'&&' within '||'"

  • Loading branch information...
1 parent 6d92415 commit 5b73b10c7b0005c4ad2e129e950f773bf1277e98 Ake Sandgren committed Dec 29, 2012
Showing with 43 additions and 43 deletions.
  1. +2 −2 include/rw/_meta_prop.h
  2. +1 −1 include/valarray
  3. +3 −3 src/facet.cpp
  4. +12 −12 src/locale_body.cpp
  5. +6 −6 src/num_get.cpp
  6. +1 −1 src/strstream.cpp
  7. +12 −12 src/time_put.cpp
  8. +1 −1 src/tmpbuf.cpp
  9. +2 −2 src/wcodecvt.cpp
  10. +3 −3 src/wctype.cpp
View
4 include/rw/_meta_prop.h
@@ -425,12 +425,12 @@ struct __rw_is_trivial_impl
typedef typename __rw_remove_cv<_TypeU>::type _NoCV_TypeU;
enum { _C_value = __rw_is_scalar<_NoCV_TypeU>::value
- || __rw_has_trivial_ctor<_NoCV_TypeU>::value
+ || (__rw_has_trivial_ctor<_NoCV_TypeU>::value
&& __rw_has_trivial_copy<_NoCV_TypeU>::value
&& __rw_has_trivial_dtor<_NoCV_TypeU>::value
&& __rw_has_trivial_assign<_NoCV_TypeU>::value
&& ( __rw_is_class<_NoCV_TypeU>::value
- || __rw_is_union<_NoCV_TypeU>::value) };
+ || __rw_is_union<_NoCV_TypeU>::value)) };
};
template <class _TypeT>
View
2 include/valarray
@@ -2322,7 +2322,7 @@ valarray<_TypeT>::operator= (const gslice_array<_TypeT>& sl_ar)
_RWSTD_SIZE_T __i = __sl.next_ind();
_RWSTD_SIZE_T __cpt = 0;
- while( !__sl.is_reseted() || !__cpt && __maxinx )
+ while( !__sl.is_reseted() || (!__cpt && __maxinx ))
{
__tmp[__cpt] = (*(sl_ar.get_ref_mem_array()))[__i];
__i= __sl.next_ind();
View
6 src/facet.cpp
@@ -218,8 +218,8 @@ const void* __rw_facet::_C_get_data ()
pdata = __rw_get_facet_data (cat, sz, strip_name.data ());
}
else if ( pstr && pstr [4] == '-' && !pstr [6]
- && ( '4' == pstr [5] && sizeof (wchar_t) == 4
- || '2' == pstr [5] && sizeof (wchar_t) == 2)) {
+ && ( ('4' == pstr [5] && sizeof (wchar_t) == 4)
+ || ('2' == pstr [5] && sizeof (wchar_t) == 2))) {
// @UCS-4 is only recognized where sizeof (wchar_t) == 4
// @UCS-2 is only recognized where sizeof (wchar_t) == 2
@@ -249,7 +249,7 @@ const void* __rw_facet::_C_get_data ()
return 0;
}
- if (!is_wcodecvt_byname || pstr && pdata) {
+ if (!is_wcodecvt_byname || (pstr && pdata)) {
_C_impdata = pdata;
_C_impsize = sz;
return _C_impdata;
View
24 src/locale_body.cpp
@@ -1072,18 +1072,18 @@ _C_is_managed (int cat) const
// detect categores of all byname facets not all of which
// belong to the same named locale)
if ( (_C_std_facet_bits & _C_all) != _C_all
- || (_C_byname_facet_bits & _C_collate)
- && (_C_byname_facet_bits & _C_collate) != _C_collate
- || (_C_byname_facet_bits & _C_ctype)
- && (_C_byname_facet_bits & _C_ctype) != _C_ctype
- || (_C_byname_facet_bits & _C_monetary)
- && (_C_byname_facet_bits & _C_monetary) != _C_monetary
- || (_C_byname_facet_bits & _C_numeric)
- && (_C_byname_facet_bits & _C_numeric) != _C_numeric
- || (_C_byname_facet_bits & _C_time)
- && (_C_byname_facet_bits & _C_time) != _C_time
- || (_C_byname_facet_bits & _C_messages)
- && (_C_byname_facet_bits & _C_messages) != _C_messages)
+ || ((_C_byname_facet_bits & _C_collate)
+ && (_C_byname_facet_bits & _C_collate) != _C_collate)
+ || ((_C_byname_facet_bits & _C_ctype)
+ && (_C_byname_facet_bits & _C_ctype) != _C_ctype)
+ || ((_C_byname_facet_bits & _C_monetary)
+ && (_C_byname_facet_bits & _C_monetary) != _C_monetary)
+ || ((_C_byname_facet_bits & _C_numeric)
+ && (_C_byname_facet_bits & _C_numeric) != _C_numeric)
+ || ((_C_byname_facet_bits & _C_time)
+ && (_C_byname_facet_bits & _C_time) != _C_time)
+ || ((_C_byname_facet_bits & _C_messages)
+ && (_C_byname_facet_bits & _C_messages) != _C_messages))
return false;
// check whether all _byname facets in each category belong
View
12 src/num_get.cpp
@@ -545,7 +545,7 @@ __rw_get_num (void *pval, const char *buf, int type, int flags,
_RWSTD_ASSERT (0 != end);
- if ('.' == *end || end == buf && '.' == buf [1]) {
+ if ('.' == *end || (end == buf && '.' == buf [1])) {
// on failure caused by an unrecognized decimal point
// set teporarily the global locale to "C" and reparse
__rw_setlocale loc ("C", _RWSTD_LC_NUMERIC);
@@ -649,7 +649,7 @@ __rw_get_num (void *pval, const char *buf, int type, int flags,
_RWSTD_ASSERT (0 != end);
- if ('.' == *end || end == buf && '.' == buf [1]) {
+ if ('.' == *end || (end == buf && '.' == buf [1])) {
// on failure caused by an unrecognized decimal point
// set teporarily the global locale to "C" and reparse
__rw_setlocale loc ("C", _RWSTD_LC_NUMERIC);
@@ -728,7 +728,7 @@ __rw_get_num (void *pval, const char *buf, int type, int flags,
_RWSTD_ASSERT (0 != end);
- if ('.' == *end || end == buf && '.' == buf [1]) {
+ if ('.' == *end || (end == buf && '.' == buf [1])) {
// on failure caused by an unrecognized decimal point
// set teporarily the global locale to "C" and reparse
__rw_setlocale loc ("C", _RWSTD_LC_NUMERIC);
@@ -794,9 +794,9 @@ __rw_get_num (void *pval, const char *buf, int type, int flags,
// note that grouping is optional and parsing fails due to bad format
// only if the positions thousands_sep's do not match those specified
// by grouping; in such cases, the value is still stored
- if ( *grouping && ngroups > 1
- && 0 > __rw_check_grouping (groups, ngroups, grouping, ngroupings)
- || !*grouping && ngroups > 1)
+ if ( (*grouping && ngroups > 1
+ && 0 > __rw_check_grouping (groups, ngroups, grouping, ngroupings))
+ || (!*grouping && ngroups > 1))
err |= _RWSTD_IOS_FAILBIT;
return err;
View
2 src/strstream.cpp
@@ -245,7 +245,7 @@ strstreambuf::setbuf (char_type* buf, streamsize bufsize)
_RWSTD_ASSERT (_C_is_valid ());
if ( !(_C_state & _C_dynamic) || (_C_state & _C_frozen)
- || !buf && !bufsize) {
+ || (!buf && !bufsize)) {
// lwg issue 66
return 0;
}
View
24 src/time_put.cpp
@@ -1845,10 +1845,10 @@ __rw_get_era (const __rw_time_t *ptime, const tm *tmb)
const int e = !b; // end index
// check to see if the specified date belongs to the era
- if ( year > pera->year [b] && year < pera->year [e]
+ if ( (year > pera->year [b] && year < pera->year [e])
|| ( (year == pera->year [b] || year == pera->year [e])
- && ( tmb->tm_mon > pera->month [b]
- && tmb->tm_mon < pera->month [e]
+ && ( (tmb->tm_mon > pera->month [b]
+ && tmb->tm_mon < pera->month [e])
|| ( ( tmb->tm_mon == pera->month [b]
|| tmb->tm_mon == pera->month [e])
&& tmb->tm_mday >= pera->day [b]
@@ -1889,7 +1889,7 @@ __rw_get_zone_off (const char *var, const char **var_end)
offset = *var++ - '0';
if (ISDIGIT (*var)) {
- if (offset < 2 || *var >= '0' && *var <= '4') {
+ if (offset < 2 || (*var >= '0' && *var <= '4')) {
// add offset in hours
offset = offset * 10 + *var++ - '0';
}
@@ -1985,7 +1985,7 @@ __rw_get_zone (__rw_time_put_data &tpd, const char *var, int isdst)
for (; ISALPHA (*var); ++var);
if ( var == stdbeg
- || *var && '+' != *var && '-' != *var && !ISDIGIT (*var))
+ || (*var && '+' != *var && '-' != *var && !ISDIGIT (*var)))
goto use_tzset;
}
@@ -2005,7 +2005,7 @@ __rw_get_zone (__rw_time_put_data &tpd, const char *var, int isdst)
}
if ( var == dstbeg
- || *var && '+' != *var && '-' != *var && !ISDIGIT (*var))
+ || (*var && '+' != *var && '-' != *var && !ISDIGIT (*var)))
goto use_tzset;
tpd.val = __rw_get_zone_off (var, &var);
@@ -2167,9 +2167,9 @@ __rw_get_time_put_data (__rw_time_put_data &tpd,
if ( !tpd.fmt
#ifndef _RWSTD_NO_WCHAR_T
- || wide && !*_RWSTD_STATIC_CAST (const wchar_t*, tpd.fmt)
+ || (wide && !*_RWSTD_STATIC_CAST (const wchar_t*, tpd.fmt))
#endif // _RWSTD_NO_WCHAR_T
- || !wide && !*_RWSTD_STATIC_CAST (const char*, tpd.fmt))
+ || (!wide && !*_RWSTD_STATIC_CAST (const char*, tpd.fmt)))
tpd.fmt = ptime->d_t_fmt (wide);
_RWSTD_ASSERT (0 != tpd.fmt);
@@ -2502,9 +2502,9 @@ __rw_get_time_put_data (__rw_time_put_data &tpd,
if ( !tpd.fmt
#ifndef _RWSTD_NO_WCHAR_T
- || wide && !*_RWSTD_STATIC_CAST (const wchar_t*, tpd.fmt)
+ || (wide && !*_RWSTD_STATIC_CAST (const wchar_t*, tpd.fmt))
#endif // _RWSTD_NO_WCHAR_T
- || !wide && !*_RWSTD_STATIC_CAST (const char*, tpd.fmt))
+ || (!wide && !*_RWSTD_STATIC_CAST (const char*, tpd.fmt)))
tpd.fmt = ptime->d_fmt (wide);
break;
@@ -2518,9 +2518,9 @@ __rw_get_time_put_data (__rw_time_put_data &tpd,
if ( !tpd.fmt
#ifndef _RWSTD_NO_WCHAR_T
- || wide && !*_RWSTD_STATIC_CAST (const wchar_t*, tpd.fmt)
+ || (wide && !*_RWSTD_STATIC_CAST (const wchar_t*, tpd.fmt))
#endif // _RWSTD_NO_WCHAR_T
- || !wide && !*_RWSTD_STATIC_CAST (const char*, tpd.fmt))
+ || (!wide && !*_RWSTD_STATIC_CAST (const char*, tpd.fmt)))
tpd.fmt = ptime->t_fmt (wide);
break;
View
2 src/tmpbuf.cpp
@@ -64,7 +64,7 @@ __rw_tmpbuf (void **pptr, _RWSTD_PTRDIFF_T nelems, _RWSTD_SIZE_T size)
if ( nelems < 0
|| nbytes / size != _RWSTD_STATIC_CAST (_RWSTD_SIZE_T, nelems)
- || nelems && nbytes / nelems != size) {
+ || (nelems && nbytes / nelems != size)) {
*pptr = 0;
return 0;
}
View
4 src/wcodecvt.cpp
@@ -769,8 +769,8 @@ __rw_libstd_do_out (const wchar_t *from,
// doesn't generate signed/unsigned compiler warnings
const WIntT wi = _RWSTD_STATIC_CAST (WIntT, *from_next);
- if ( WIntT (0xd800U) <= wi && wi <= WIntT (0xdfffU)
- || WIntT (0xfffeU) <= wi && wi <= WIntT (0xffffU)) {
+ if ( (WIntT (0xd800U) <= wi && wi <= WIntT (0xdfffU))
+ || (WIntT (0xfffeU) <= wi && wi <= WIntT (0xffffU))) {
res = _STD::codecvt_base::error;
break;
}
View
6 src/wctype.cpp
@@ -107,8 +107,8 @@ __rw_get_mask (__rw_ctype_t *impl,
// to the current character; otherwise continue
if (vec)
*vec = MaskT (next_elm.mask & mask);
- else if ( scan_is && next_elm.mask & mask
- || !scan_is && !(next_elm.mask & mask))
+ else if ( (scan_is && (next_elm.mask & mask))
+ || (!scan_is && !(next_elm.mask & mask)))
return beg;
break;
@@ -236,7 +236,7 @@ __rw_get_mask (__rw_ctype_t *impl,
if (vec)
*vec++ = MaskT (m);
- else if (scan_is && m & mask || !scan_is && !(m & mask))
+ else if ((scan_is && (m & mask)) || (!scan_is && !(m & mask)))
break;
}

0 comments on commit 5b73b10

Please sign in to comment.