mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 18:32:55 +00:00
fix some static analyzer warnings
upstream commit:
8936918a65
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
13b48ebdb1
commit
14ec74239b
19 changed files with 33 additions and 59 deletions
|
@ -36,10 +36,6 @@
|
|||
#include "qset.h"
|
||||
#include "qabstractfileengine_p.h"
|
||||
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
# include "qresource_p.h"
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
//these unix functions are in this file, because they were shared by symbian port
|
||||
|
|
|
@ -791,15 +791,12 @@ public:
|
|||
virtual ResourceRootType type() const { return Resource_Buffer; }
|
||||
|
||||
bool registerSelf(const uchar *b) {
|
||||
//setup the data now
|
||||
int offset = 0;
|
||||
|
||||
//magic number
|
||||
if(b[offset+0] != 'q' || b[offset+1] != 'r' ||
|
||||
b[offset+2] != 'e' || b[offset+3] != 's') {
|
||||
if(b[0] != 'q' || b[1] != 'r' || b[2] != 'e' || b[3] != 's') {
|
||||
return false;
|
||||
}
|
||||
offset += 4;
|
||||
//setup the data now
|
||||
int offset = 4;
|
||||
|
||||
const int version = (b[offset+0] << 24) + (b[offset+1] << 16) +
|
||||
(b[offset+2] << 8) + (b[offset+3] << 0);
|
||||
|
@ -815,7 +812,6 @@ public:
|
|||
|
||||
const int name_offset = (b[offset+0] << 24) + (b[offset+1] << 16) +
|
||||
(b[offset+2] << 8) + (b[offset+3] << 0);
|
||||
offset += 4;
|
||||
|
||||
if(version == Q_RCC_OUTPUT_REVISION) {
|
||||
buffer = b;
|
||||
|
@ -842,11 +838,10 @@ public:
|
|||
bool registerSelf(const QString &f) {
|
||||
QFile file(f);
|
||||
if (file.open(QIODevice::ReadOnly)) {
|
||||
unsigned int data_len = file.size();
|
||||
qint64 data_len = file.size();
|
||||
uchar *data = new uchar[data_len];
|
||||
if (data_len != (uint)file.read((char*)data, data_len)) {
|
||||
if (data_len != file.read((char*)data, data_len)) {
|
||||
delete [] data;
|
||||
data_len = 0;
|
||||
return false;
|
||||
} else if (QDynamicBufferResourceRoot::registerSelf(data)) {
|
||||
fileName = f;
|
||||
|
|
|
@ -681,11 +681,9 @@ static bool QT_FASTCALL _IPv6Address(const char **ptr)
|
|||
int canBeCase = -1;
|
||||
bool ls32WasRead = false;
|
||||
|
||||
const char *tmpBackup = *ptr;
|
||||
|
||||
// count the number of (h16 ":") on the right of ::
|
||||
for (;;) {
|
||||
tmpBackup = *ptr;
|
||||
const char *tmpBackup = *ptr;
|
||||
if (!_h16(ptr)) {
|
||||
if (!_ls32(ptr)) {
|
||||
if (rightHexColons != 0) {
|
||||
|
|
|
@ -1787,10 +1787,6 @@ void QCoreApplication::setLibraryPaths(const QStringList &paths)
|
|||
is \c INSTALL/plugins, where \c INSTALL is the directory where Qt was
|
||||
installed.
|
||||
|
||||
In Symbian this function is only useful for adding paths for
|
||||
finding Qt extension plugin stubs, since the OS can only
|
||||
load libraries from the \c{/sys/bin} directory.
|
||||
|
||||
\sa removeLibraryPath(), libraryPaths(), setLibraryPaths()
|
||||
*/
|
||||
void QCoreApplication::addLibraryPath(const QString &path)
|
||||
|
|
|
@ -472,15 +472,19 @@ QDataStream &operator>>(QDataStream &ds, QLocale &l)
|
|||
|
||||
static quint16 localePrivateIndex(const QLocalePrivate *p)
|
||||
{
|
||||
if (Q_LIKELY(p)) {
|
||||
#ifndef QT_NO_SYSTEMLOCALE
|
||||
if (p && p == system_lp)
|
||||
return systemLocaleIndex;
|
||||
if (p == system_lp) {
|
||||
return systemLocaleIndex;
|
||||
}
|
||||
#endif
|
||||
for (qint16 i = 0; i < localeTblSize; i++) {
|
||||
if (p->m_language == localeTbl[i].m_language
|
||||
&& p->m_country == localeTbl[i].m_country
|
||||
&& p->m_script == localeTbl[i].m_script)
|
||||
return i;
|
||||
for (qint16 i = 0; i < localeTblSize; i++) {
|
||||
if (p->m_language == localeTbl[i].m_language
|
||||
&& p->m_country == localeTbl[i].m_country
|
||||
&& p->m_script == localeTbl[i].m_script) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1249,11 +1249,11 @@ QString& QString::insert(int i, const QChar *unicode, int size)
|
|||
const ushort *s = (const ushort *)unicode;
|
||||
if (s >= d->data && s < d->data + d->alloc) {
|
||||
// Part of me - take a copy
|
||||
ushort *tmp = static_cast<ushort *>(malloc(size * sizeof(QChar)));
|
||||
QChar *tmp = static_cast<QChar *>(::malloc(size * sizeof(QChar)));
|
||||
Q_CHECK_PTR(tmp);
|
||||
memcpy(tmp, s, size * sizeof(QChar));
|
||||
insert(i, reinterpret_cast<const QChar *>(tmp), size);
|
||||
free(tmp);
|
||||
::memcpy(tmp, s, size * sizeof(QChar));
|
||||
insert(i, tmp, size);
|
||||
::free(tmp);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ QSize QWellArray::sizeHint() const
|
|||
|
||||
void QWellArray::paintCell(QPainter* p, int row, int col, const QRect &rect)
|
||||
{
|
||||
int b = 3; //margin
|
||||
static const int b = 3; //margin
|
||||
|
||||
const QPalette & g = palette();
|
||||
QStyleOptionFrame opt;
|
||||
|
@ -238,7 +238,6 @@ void QWellArray::paintCell(QPainter* p, int row, int col, const QRect &rect)
|
|||
opt.palette = g;
|
||||
opt.state = QStyle::State_Enabled | QStyle::State_Sunken;
|
||||
style()->drawPrimitive(QStyle::PE_Frame, &opt, p, this);
|
||||
b += dfw;
|
||||
|
||||
if ((row == curRow) && (col == curCol)) {
|
||||
if (hasFocus()) {
|
||||
|
|
|
@ -380,7 +380,7 @@ bool QShortcut::event(QEvent *e)
|
|||
if (QWhatsThis::inWhatsThisMode()) {
|
||||
QWhatsThis::showText(QCursor::pos(), d->sc_whatsthis);
|
||||
handled = true;
|
||||
} else
|
||||
}
|
||||
#endif
|
||||
if (se->isAmbiguous())
|
||||
emit activatedAmbiguously();
|
||||
|
|
|
@ -477,10 +477,8 @@ qreal QBezier::tForY(qreal t0, qreal t1, qreal y) const
|
|||
|
||||
if (yt < y) {
|
||||
t0 = t;
|
||||
py0 = yt;
|
||||
} else {
|
||||
t1 = t;
|
||||
py1 = yt;
|
||||
}
|
||||
dt = lt - t;
|
||||
lt = t;
|
||||
|
|
|
@ -788,8 +788,8 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin
|
|||
yTarget[rows - 1] = targetCenterBottom;
|
||||
yTarget[rows] = targetRect.top() + targetRect.height();
|
||||
|
||||
qreal dx = targetCenterWidth;
|
||||
qreal dy = targetCenterHeight;
|
||||
qreal dx = 0;
|
||||
qreal dy = 0;
|
||||
|
||||
switch (rules.horizontal) {
|
||||
case Qt::StretchTile:
|
||||
|
|
|
@ -2640,7 +2640,6 @@ void QRasterPaintEngine::drawBitmap(const QPointF &pos, const QImage &image, QSp
|
|||
}
|
||||
if (n) {
|
||||
fg->blend(n, spans, fg);
|
||||
n = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -132,7 +132,6 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
|
|||
}
|
||||
|
||||
QHash<GlyphAndSubPixelPosition, Coord> listItemCoordinates;
|
||||
int rowHeight = 0;
|
||||
|
||||
QFontEngine::GlyphFormat format;
|
||||
switch (m_type) {
|
||||
|
@ -189,13 +188,10 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
|
|||
-metrics.y.truncate() }; // baseline for horizontal scripts
|
||||
|
||||
listItemCoordinates.insert(key, c);
|
||||
rowHeight = qMax(rowHeight, glyph_height);
|
||||
}
|
||||
if (listItemCoordinates.isEmpty())
|
||||
return true;
|
||||
|
||||
rowHeight += margin * 2;
|
||||
|
||||
if (m_w == 0) {
|
||||
if (fontEngine->maxCharWidth() <= QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH)
|
||||
m_w = QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH;
|
||||
|
|
|
@ -4539,7 +4539,7 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
|
|||
if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
|
||||
bool checkable = mi->menuHasCheckableItems;
|
||||
int maxpmw = mi->maxIconWidth;
|
||||
int w = sz.width(), h = sz.height();
|
||||
int w = sz.width(), h = 0;
|
||||
if (mi->menuItemType == QStyleOptionMenuItem::Separator) {
|
||||
w = 10;
|
||||
h = 2;
|
||||
|
@ -4714,7 +4714,6 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
|
|||
case SH_LineEdit_PasswordCharacter: {
|
||||
const QFontMetrics &fm = opt ? opt->fontMetrics
|
||||
: (widget ? widget->fontMetrics() : QFontMetrics(QFont()));
|
||||
ret = 0;
|
||||
if (fm.inFont(QChar(0x25CF))) {
|
||||
ret = 0x25CF;
|
||||
} else if (fm.inFont(QChar(0x2022))) {
|
||||
|
|
|
@ -973,7 +973,7 @@ static void convertPath(const QPainterPath &path, QList<TTF_POINT> *points, QLis
|
|||
// see if we can optimize out the last onCurve point
|
||||
int mx = (points->at(points->size() - 2).x + base[2].x) >> 1;
|
||||
int my = (points->at(points->size() - 2).y + base[2].y) >> 1;
|
||||
if (qAbs(mx - base[3].x) <= split_limit && qAbs(my = base[3].y) <= split_limit)
|
||||
if (qAbs(mx - base[3].x) <= split_limit && qAbs(my - base[3].y) <= split_limit)
|
||||
points->takeLast();
|
||||
try_reduce = false;
|
||||
}
|
||||
|
|
|
@ -434,8 +434,6 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon
|
|||
status.last = control.direction();
|
||||
if (control.override)
|
||||
dir = control.direction();
|
||||
else
|
||||
dir = QChar::DirON;
|
||||
status.lastStrong = control.direction();
|
||||
}
|
||||
break;
|
||||
|
@ -593,8 +591,7 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon
|
|||
// neutrals go to R
|
||||
eor = current - 1;
|
||||
appendItems(analysis, sor, eor, control, dir);
|
||||
dir = QChar::DirON; status.eor = QChar::DirEN;
|
||||
dir = QChar::DirAN;
|
||||
dir = QChar::DirAN; status.eor = QChar::DirEN;
|
||||
}
|
||||
else if(status.eor == QChar::DirL ||
|
||||
(status.eor == QChar::DirEN && status.lastStrong == QChar::DirL)) {
|
||||
|
@ -607,8 +604,7 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon
|
|||
eor = current - 1;
|
||||
dir = QChar::DirR;
|
||||
appendItems(analysis, sor, eor, control, dir);
|
||||
dir = QChar::DirON; status.eor = QChar::DirON;
|
||||
dir = QChar::DirAN;
|
||||
dir = QChar::DirAN; status.eor = QChar::DirON;
|
||||
} else {
|
||||
eor = current; status.eor = dirCurrent;
|
||||
}
|
||||
|
|
|
@ -491,7 +491,6 @@ QHash<QByteArray, QByteArray> QAuthenticatorPrivate::parseDigestAuthenticationCh
|
|||
++d;
|
||||
if (d >= end)
|
||||
break;
|
||||
start = d;
|
||||
QByteArray value;
|
||||
while (d < end) {
|
||||
bool backslash = false;
|
||||
|
|
|
@ -90,7 +90,7 @@ namespace QTest {
|
|||
IgnoreResultList *last = 0;
|
||||
IgnoreResultList *list = ignoreResultList;
|
||||
while (list) {
|
||||
if (list->type == type && strcmp(msg, list->msg) == 0) {
|
||||
if (list->type == type && qstrcmp(msg, list->msg) == 0) {
|
||||
// remove the item from the list
|
||||
if (last)
|
||||
last->next = list->next;
|
||||
|
|
|
@ -601,7 +601,8 @@ void Moc::parse()
|
|||
if (inNamespace(&namespaceList.at(i)))
|
||||
def.qualified.prepend(namespaceList.at(i).name + "::");
|
||||
while (inClass(&def) && hasNext()) {
|
||||
switch ((t = next())) {
|
||||
t = next();
|
||||
switch (t) {
|
||||
case PRIVATE:
|
||||
access = FunctionDef::Private;
|
||||
if (test(Q_SIGNALS_TOKEN))
|
||||
|
|
|
@ -80,12 +80,10 @@ void WriteIconData::writeImage(QTextStream &output, const QString &indent, const
|
|||
{
|
||||
QString img = image->attributeName() + QLatin1String("_data");
|
||||
QString data = image->elementData()->text();
|
||||
QString fmt = image->elementData()->attributeFormat();
|
||||
int size = image->elementData()->attributeLength();
|
||||
|
||||
output << indent << "static const unsigned char " << img << "[] = { \n";
|
||||
output << indent;
|
||||
int a ;
|
||||
int a;
|
||||
for (a = 0; a < (int) (data.length()/2)-1; a++) {
|
||||
output << "0x" << QString(data[2*a]) << QString(data[2*a+1]) << ',';
|
||||
if (a % 12 == 11)
|
||||
|
|
Loading…
Add table
Reference in a new issue