fix some compiler warnings

the list of upstream commits is incomplete, the Qt(5) devs have taken care
of many warnings and I have not scoped trough all of the repos and commits
to find them out and list them. I've made some changes on my own too

upstream commits:
fece2474fe
e6799c6e33
64a7ac344e

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2016-01-13 18:27:10 +02:00
parent b2b09ad769
commit 9c7c7d8531
18 changed files with 8 additions and 217 deletions

View file

@ -755,15 +755,6 @@ static inline void SLL_PushRange(void **head, void *start, void *end) {
*head = start;
}
static inline size_t SLL_Size(void *head) {
int count = 0;
while (head) {
count++;
head = SLL_Next(head);
}
return count;
}
// Setup helper functions.
static ALWAYS_INLINE size_t SizeClass(size_t size) {
@ -3433,12 +3424,14 @@ static Span* DoSampledAllocation(size_t size) {
}
#endif
#if !ASSERT_DISABLED
static inline bool CheckCachedSizeClass(void *ptr) {
PageID p = reinterpret_cast<uintptr_t>(ptr) >> kPageShift;
size_t cached_value = pageheap->GetSizeClassIfCached(p);
return cached_value == 0 ||
cached_value == pageheap->GetDescriptor(p)->sizeclass;
}
#endif
static inline void* CheckedMallocResult(void *result)
{

View file

@ -167,7 +167,7 @@ static inline bool is_space(char s)
#endif
// This code is shared with moc.cpp
static QByteArray normalizeTypeInternal(const char *t, const char *e, bool fixScope = false, bool adjustConst = true)
static inline QByteArray normalizeTypeInternal(const char *t, const char *e, bool fixScope = false, bool adjustConst = true)
{
int len = e - t;
/*

View file

@ -468,11 +468,6 @@ void ActionEditor::slotNewAction()
}
}
static inline bool isSameIcon(const QIcon &i1, const QIcon &i2)
{
return i1.cacheKey() == i2.cacheKey();
}
// return a FormWindow command to apply an icon or a reset command in case it
// is empty.

View file

@ -1109,11 +1109,6 @@ void addWidgetToGrid(QGridLayout *lt, QWidget * widget, int row, int column, int
lt->addWidget(widget, row, column, rowSpan, columnSpan, alignment);
}
inline void getGridItemPosition(QFormLayout *formLayout, int index, int *row, int *column, int *rowspan, int *colspan)
{
getFormLayoutItemPosition(formLayout, index, row, column, rowspan, colspan);
}
inline void addWidgetToGrid(QFormLayout *lt, QWidget * widget, int row, int column, int, int columnSpan, Qt::Alignment)
{
formLayoutAddWidget(lt, widget, QRect(column, row, columnSpan, 1), false);

View file

@ -63,11 +63,6 @@ enum { debugZoomWidget = 0 };
static const int menuZoomList[] = { 100, 25, 50, 75, 125, 150 , 175, 200 };
static inline QSize qCeiling(const QSizeF &s)
{
return QSize(qCeil(s.width()), qCeil(s.height()));
}
namespace qdesigner_internal {
// ---------- ZoomMenu

View file

@ -660,20 +660,6 @@ Qt::AnchorPoint QGraphicsAnchorLayoutPrivate::oppositeEdge(Qt::AnchorPoint edge)
}
/*!
* \internal
*
* helper function in order to avoid overflowing anchor sizes
* the returned size will never be larger than FLT_MAX
*
*/
inline static qreal checkAdd(qreal a, qreal b)
{
if (FLT_MAX - b < a)
return FLT_MAX;
return a + b;
}
/*!
\internal

View file

@ -130,64 +130,6 @@ QBezier QBezier::getSubRange(qreal t0, qreal t1) const
return result;
}
static inline int quadraticRoots(qreal a, qreal b, qreal c,
qreal *x1, qreal *x2)
{
if (qFuzzyIsNull(a)) {
if (qFuzzyIsNull(b))
return 0;
*x1 = *x2 = (-c / b);
return 1;
} else {
const qreal det = b * b - 4 * a * c;
if (qFuzzyIsNull(det)) {
*x1 = *x2 = -b / (2 * a);
return 1;
}
if (det > 0) {
if (qFuzzyIsNull(b)) {
*x2 = qSqrt(-c / a);
*x1 = -(*x2);
return 2;
}
const qreal stableA = b / (2 * a);
const qreal stableB = c / (a * stableA * stableA);
const qreal stableC = -1 - qSqrt(1 - stableB);
*x2 = stableA * stableC;
*x1 = (stableA * stableB) / stableC;
return 2;
} else
return 0;
}
}
static inline bool findInflections(qreal a, qreal b, qreal c,
qreal *t1 , qreal *t2, qreal *tCups)
{
qreal r1 = 0, r2 = 0;
short rootsCount = quadraticRoots(a, b, c, &r1, &r2);
if (rootsCount >= 1) {
if (r1 < r2) {
*t1 = r1;
*t2 = r2;
} else {
*t1 = r2;
*t2 = r1;
}
if (!qFuzzyIsNull(a))
*tCups = qreal(0.5) * (-b / a);
else
*tCups = 2;
return true;
}
return false;
}
void QBezier::addToPolygon(QPolygonF *polygon, qreal bezier_flattening_threshold) const
{
QBezier beziers[32];
@ -498,34 +440,6 @@ static QDebug operator<<(QDebug dbg, const QBezier &bz)
}
#endif
static inline void splitBezierAt(const QBezier &bez, qreal t,
QBezier *left, QBezier *right)
{
left->x1 = bez.x1;
left->y1 = bez.y1;
left->x2 = bez.x1 + t * ( bez.x2 - bez.x1 );
left->y2 = bez.y1 + t * ( bez.y2 - bez.y1 );
left->x3 = bez.x2 + t * ( bez.x3 - bez.x2 ); // temporary holding spot
left->y3 = bez.y2 + t * ( bez.y3 - bez.y2 ); // temporary holding spot
right->x3 = bez.x3 + t * ( bez.x4 - bez.x3 );
right->y3 = bez.y3 + t * ( bez.y4 - bez.y3 );
right->x2 = left->x3 + t * ( right->x3 - left->x3);
right->y2 = left->y3 + t * ( right->y3 - left->y3);
left->x3 = left->x2 + t * ( left->x3 - left->x2 );
left->y3 = left->y2 + t * ( left->y3 - left->y2 );
left->x4 = right->x1 = left->x3 + t * (right->x2 - left->x3);
left->y4 = right->y1 = left->y3 + t * (right->y2 - left->y3);
right->x4 = bez.x4;
right->y4 = bez.y4;
}
qreal QBezier::length(qreal error) const
{
qreal length = qreal(0.0);

View file

@ -183,7 +183,7 @@ public:
void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
void drawImage(const QPointF &p, const QImage &img);
void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
Qt::ImageConversionFlags falgs = Qt::AutoColor);
Qt::ImageConversionFlags flags = Qt::AutoColor);
void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr);
void drawTextItem(const QPointF &p, const QTextItem &textItem);

View file

@ -116,12 +116,6 @@ static inline QGradient::CoordinateMode coordinateMode(const QBrush &brush)
return QGradient::LogicalMode;
}
/* Returns true if the gradient requires stretch to device...*/
static inline bool check_gradient(const QBrush &brush)
{
return coordinateMode(brush) == QGradient::StretchToDeviceMode;
}
extern bool qHasPixmapTexture(const QBrush &);
static inline bool is_brush_transparent(const QBrush &brush) {

View file

@ -1038,16 +1038,6 @@ qreal QWingedEdge::delta(int vertex, int a, int b) const
return result;
}
static inline QPointF midPoint(const QWingedEdge &list, int ei)
{
const QPathEdge *ep = list.edge(ei);
Q_ASSERT(ep);
const QPointF a = *list.vertex(ep->first);
const QPointF b = *list.vertex(ep->second);
return a + 0.5 * (b - a);
}
QWingedEdge::TraversalStatus QWingedEdge::findInsertStatus(int vi, int ei) const
{
const QPathVertex *vp = vertex(vi);

View file

@ -111,15 +111,6 @@ static inline QPrinter::PaperSize string2PaperSize(const char *name)
return r->size;
return QPrinter::Custom;
}
static inline const char *paperSize2String(QPrinter::PaperSize size)
{
for (int i = 0; i < QPrinter::NPageSize; ++i) {
if (size == named_sizes_map[i].size)
return named_sizes_map[i].name;
}
return 0;
}
#endif
void qt_perhapsAddPrinter(QList<QPrinterDescription> *printers, const QString &name,

View file

@ -2577,7 +2577,6 @@ void QDockAreaLayout::remove(const QList<int> &path)
docks[index].remove(path.mid(1));
}
static inline int qMin(int i1, int i2, int i3) { return qMin(i1, qMin(i2, i3)); }
static inline int qMax(int i1, int i2, int i3) { return qMax(i1, qMax(i2, i3)); }
void QDockAreaLayout::getGrid(QVector<QLayoutStruct> *_ver_struct_list,

View file

@ -1020,20 +1020,6 @@ void QMainWindowLayout::toggleToolBarsVisible()
*/
#ifndef QT_NO_DOCKWIDGET
static inline void validateDockWidgetArea(Qt::DockWidgetArea &area)
{
switch (area) {
case Qt::LeftDockWidgetArea:
case Qt::RightDockWidgetArea:
case Qt::TopDockWidgetArea:
case Qt::BottomDockWidgetArea:
break;
default:
area = Qt::LeftDockWidgetArea;
}
}
static QInternal::DockPosition toDockPos(Qt::DockWidgetArea area)
{
switch (area) {

View file

@ -184,14 +184,6 @@ static const QStyle::SubControl SubControls[] =
};
static const int NumSubControls = sizeof(SubControls) / sizeof(SubControls[0]);
static const QStyle::StandardPixmap ButtonPixmaps[] =
{
QStyle::SP_TitleBarMinButton,
QStyle::SP_TitleBarNormalButton,
QStyle::SP_TitleBarCloseButton
};
static const int NumButtonPixmaps = sizeof(ButtonPixmaps) / sizeof(ButtonPixmaps[0]);
static const Qt::WindowFlags CustomizeWindowFlags =
Qt::FramelessWindowHint
| Qt::CustomizeWindowHint

View file

@ -90,10 +90,12 @@
QT_BEGIN_NAMESPACE
#ifdef QT_OPENGL_ES_2
inline static bool isPowerOfTwo(uint x)
{
return x && !(x & (x - 1));
}
#endif
#if defined(Q_WS_WIN)
extern Q_GUI_EXPORT bool qt_cleartype_enabled;

View file

@ -324,11 +324,6 @@ static inline qint64 qCross(const QPodPoint &u, const QPodPoint &v)
return qint64(u.x) * qint64(v.y) - qint64(u.y) * qint64(v.x);
}
static inline qint64 qDot(const QPodPoint &u, const QPodPoint &v)
{
return qint64(u.x) * qint64(v.x) + qint64(u.y) * qint64(v.y);
}
// Return positive value if 'p' is to the right of the line 'v1'->'v2', negative if left of the
// line and zero if exactly on the line.
// The returned value is the z-component of the qCross product between 'v2-v1' and 'p-v1',
@ -343,23 +338,6 @@ static inline bool qPointIsLeftOfLine(const QPodPoint &p, const QPodPoint &v1, c
return QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(p, v1, v2) < 0;
}
// Return:
// -1 if u < v
// 0 if u == v
// 1 if u > v
static int comparePoints(const QPodPoint &u, const QPodPoint &v)
{
if (u.y < v.y)
return -1;
if (u.y > v.y)
return 1;
if (u.x < v.x)
return -1;
if (u.x > v.x)
return 1;
return 0;
}
//============================================================================//
// QIntersectionPoint //
//============================================================================//
@ -389,13 +367,6 @@ static inline QIntersectionPoint qIntersectionPoint(const QPodPoint &point)
return p;
}
static inline QIntersectionPoint qIntersectionPoint(int x, int y)
{
// upperLeft = (x, y), xOffset = 0/1, yOffset = 0/1.
QIntersectionPoint p = {{x, y}, {0, 1}, {0, 1}};
return p;
}
static QIntersectionPoint qIntersectionPoint(const QPodPoint &u1, const QPodPoint &u2, const QPodPoint &v1, const QPodPoint &v2)
{
QIntersectionPoint result = {{0, 0}, {0, 0}, {0, 0}};

View file

@ -1917,18 +1917,6 @@ QString QAccessibleComboBox::actionText(int action, Text t, int child) const
}
#endif // QT_NO_COMBOBOX
static inline void removeInvisibleWidgetsFromList(QWidgetList *list)
{
if (!list || list->isEmpty())
return;
for (int i = 0; i < list->count(); ++i) {
QWidget *widget = list->at(i);
if (!widget->isVisible())
list->removeAt(i);
}
}
#ifndef QT_NO_SCROLLAREA
// ======================= QAccessibleAbstractScrollArea =======================
QAccessibleAbstractScrollArea::QAccessibleAbstractScrollArea(QWidget *widget)

View file

@ -175,7 +175,7 @@ public:
void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
void drawTextItem(const QPointF &pt, const QTextItem &item);
void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
Qt::ImageConversionFlag = Qt::AutoColor);
Qt::ImageConversionFlags flags = Qt::AutoColor);
QPaintEngine::Type type() const { return QPaintEngine::SVG; }
@ -903,7 +903,7 @@ void QSvgPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm,
void QSvgPaintEngine::drawImage(const QRectF &r, const QImage &image,
const QRectF &sr,
Qt::ImageConversionFlag flags)
Qt::ImageConversionFlags flags)
{
//Q_D(QSvgPaintEngine);