Merge pull request #3959 from opentx/schwabe/fix_clang_warnings2

Schwabe/fix clang warnings2
This commit is contained in:
Damjan Adamic
2016-10-27 20:21:03 +02:00
committed by GitHub
4 changed files with 12 additions and 13 deletions
+3 -3
View File
@@ -75,7 +75,7 @@ bool MixersList::dropMimeData( int index, const QMimeData * data, Qt::DropAction
*/ */
void MixersDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const void MixersDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{ {
QStyleOptionViewItemV4 options = option; QStyleOptionViewItem options = option;
initStyleOption(&options, index); initStyleOption(&options, index);
painter->save(); painter->save();
@@ -107,7 +107,7 @@ void MixersDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option
*/ */
QSize MixersDelegate::sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const QSize MixersDelegate::sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const
{ {
QStyleOptionViewItemV4 options = option; QStyleOptionViewItem options = option;
initStyleOption(&options, index); initStyleOption(&options, index);
//setup html document //setup html document
@@ -125,7 +125,7 @@ QSize MixersDelegate::sizeHint ( const QStyleOptionViewItem & option, const QMod
return QSize(doc.idealWidth(), height); return QSize(doc.idealWidth(), height);
} }
void MixersDelegate::SetupDocument(QTextDocument & doc, const QStyleOptionViewItemV4 & options) const void MixersDelegate::SetupDocument(QTextDocument & doc, const QStyleOptionViewItem & options) const
{ {
//setup html document //setup html document
doc.setHtml(options.text); doc.setHtml(options.text);
+1 -1
View File
@@ -46,7 +46,7 @@ class MixersDelegate : public QStyledItemDelegate
QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const; QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const;
private: private:
void SetupDocument(QTextDocument & doc, const QStyleOptionViewItemV4 & options) const; void SetupDocument(QTextDocument & doc, const QStyleOptionViewItem & options) const;
}; };
+2 -2
View File
@@ -210,7 +210,7 @@
#ifdef MOUNTED_GETMNTINFO #ifdef MOUNTED_GETMNTINFO
# if ! HAVE_STRUCT_STATFS_F_FSTYPENAME # if ! HAVE_STRUCT_STATFS_F_FSTYPENAME
static char * static const char *
fstype_to_string (short int t) fstype_to_string (short int t)
{ {
switch (t) switch (t)
@@ -305,7 +305,7 @@ fstype_to_string (short int t)
} }
# endif # endif
static char * static const char *
fsp_to_string (const struct statfs *fsp) fsp_to_string (const struct statfs *fsp)
{ {
# if HAVE_STRUCT_STATFS_F_FSTYPENAME # if HAVE_STRUCT_STATFS_F_FSTYPENAME
+6 -7
View File
@@ -78,18 +78,17 @@ extern void rtcdriver_settime(struct gtm * t);
#endif #endif
#define TIME_T_MIDPOINT (SHR (TIME_T_MIN + TIME_T_MAX, 1) + 1) #define TIME_T_MIDPOINT (SHR (TIME_T_MIN + TIME_T_MAX, 1) + 1)
/* Verify a requirement at compile-time (unlike assert, which is runtime). */
#define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]; }
verify(gtime_t_is_integer, TYPE_IS_INTEGER(gtime_t));
verify(twos_complement_arithmetic, TYPE_TWOS_COMPLEMENT(int)); static_assert(TYPE_IS_INTEGER(gtime_t), "gtime_t is not integer");
static_assert(TYPE_TWOS_COMPLEMENT(int), "twos complement arithmetic");
/* The code also assumes that signed integer overflow silently wraps /* The code also assumes that signed integer overflow silently wraps
around, but this assumption can't be stated without causing a around, but this assumption can't be stated without causing a
diagnostic on some hosts. */ diagnostic on some hosts. */
#define EPOCH_YEAR 1970 #define EPOCH_YEAR 1970
#define TM_YEAR_BASE 1900 #define TM_YEAR_BASE 1900
verify(base_year_is_a_multiple_of_100, TM_YEAR_BASE % 100 == 0); static_assert(TM_YEAR_BASE % 100 == 0, "base year is not a multiple of 100");
/* Return 1 if YEAR + TM_YEAR_BASE is a leap year. */ /* Return 1 if YEAR + TM_YEAR_BASE is a leap year. */
static inline int leapyear(long int year) static inline int leapyear(long int year)
@@ -188,8 +187,8 @@ struct gtm * __localtime_r(const gtime_t * t, struct gtm * tp)
static inline gtime_t ydhms_diff(long int year1, long int yday1, int hour1, int min1, int sec1, static inline gtime_t ydhms_diff(long int year1, long int yday1, int hour1, int min1, int sec1,
int year0, int yday0, int hour0, int min0, int sec0) int year0, int yday0, int hour0, int min0, int sec0)
{ {
verify(C99_integer_division, -1 / 2 == 0); static_assert(-1 / 2 == 0, "no C99 integer division");
verify(long_int_year_and_yday_are_wide_enough, INT_MAX <= LONG_MAX / 2 || TIME_T_MAX <= UINT_MAX); static_assert(INT_MAX <= LONG_MAX / 2 || TIME_T_MAX <= UINT_MAX, "long int year and yday are not wide enough");
/* Compute intervening leap days correctly even if year is negative. /* Compute intervening leap days correctly even if year is negative.
Take care to avoid integer overflow here. */ Take care to avoid integer overflow here. */