r20881 by jghali -
scribus-commit
scribus-commit at lists.scribus.net
Tue Feb 2 21:23:52 UTC 2016
Author: jghali
Date: Tue Feb 2 21:23:52 2016
New Revision: 20881
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20881
Log:
coverity #1350013/42: pointer comparison with string literal
Modified:
trunk/Scribus/scribus/plugins/scriptplugin/cmdmisc.cpp
trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp
trunk/Scribus/scribus/plugins/scriptplugin/cmdstyle.cpp
Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdmisc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20881&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdmisc.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdmisc.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdmisc.cpp Tue Feb 2 21:23:52 2016
@@ -201,7 +201,7 @@
return NULL;
if(!checkHaveDocument())
return NULL;
- if (Layer == EMPTY_STRING)
+ if (strlen(Layer) == 0)
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error").toLocal8Bit().constData());
return NULL;
@@ -219,7 +219,7 @@
}
// If no name have been specified in args, process whole selection
currentView->SelectItem(item);
- if (Name == EMPTY_STRING)
+ if (strlen(Name) == 0)
{
for (int i = 0; i < currentDoc->m_Selection->count(); ++i)
{
@@ -245,7 +245,7 @@
return NULL;
if(!checkHaveDocument())
return NULL;
- if (Name == EMPTY_STRING)
+ if (strlen(Name) == 0)
{
PyErr_SetString(PyExc_ValueError, QString("Cannot have an empty layer name").toLocal8Bit().constData());
return NULL;
@@ -278,7 +278,7 @@
return NULL;
if(!checkHaveDocument())
return NULL;
- if (Name == EMPTY_STRING)
+ if (strlen(Name) == 0)
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error").toLocal8Bit().constData());
return NULL;
@@ -311,7 +311,7 @@
return NULL;
if(!checkHaveDocument())
return NULL;
- if (Name == EMPTY_STRING)
+ if (strlen(Name) == 0)
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error").toLocal8Bit().constData());
return NULL;
@@ -344,7 +344,7 @@
return NULL;
if(!checkHaveDocument())
return NULL;
- if (Name == EMPTY_STRING)
+ if (strlen(Name) == 0)
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error").toLocal8Bit().constData());
return NULL;
@@ -377,7 +377,7 @@
return NULL;
if(!checkHaveDocument())
return NULL;
- if (Name == EMPTY_STRING)
+ if (strlen(Name) == 0)
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error").toLocal8Bit().constData());
return NULL;
@@ -410,7 +410,7 @@
return NULL;
if(!checkHaveDocument())
return NULL;
- if (Name == EMPTY_STRING)
+ if (strlen(Name) == 0)
{
PyErr_SetString(PyExc_ValueError, QString("Cannot have an empty layer name").toLocal8Bit().constData());
return NULL;
@@ -443,7 +443,7 @@
return NULL;
if(!checkHaveDocument())
return NULL;
- if (Name == EMPTY_STRING)
+ if (strlen(Name) == 0)
{
PyErr_SetString(PyExc_ValueError, QString("Cannot have an empty layer name").toLocal8Bit().constData());
return NULL;
@@ -475,7 +475,7 @@
return NULL;
if(!checkHaveDocument())
return NULL;
- if (Name == EMPTY_STRING)
+ if (strlen(Name) == 0)
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error").toLocal8Bit().constData());
return NULL;
@@ -506,7 +506,7 @@
return NULL;
if(!checkHaveDocument())
return NULL;
- if (Name == EMPTY_STRING)
+ if (strlen(Name) == 0)
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error").toLocal8Bit().constData());
return NULL;
@@ -537,7 +537,7 @@
return NULL;
if(!checkHaveDocument())
return NULL;
- if (Name == EMPTY_STRING)
+ if (strlen(Name) == 0)
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error").toLocal8Bit().constData());
return NULL;
@@ -568,7 +568,7 @@
return NULL;
if(!checkHaveDocument())
return NULL;
- if (Name == EMPTY_STRING)
+ if (strlen(Name) == 0)
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error").toLocal8Bit().constData());
return NULL;
@@ -599,7 +599,7 @@
return NULL;
if(!checkHaveDocument())
return NULL;
- if (Name == EMPTY_STRING)
+ if (strlen(Name) == 0)
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error").toLocal8Bit().constData());
return NULL;
@@ -630,7 +630,7 @@
return NULL;
if(!checkHaveDocument())
return NULL;
- if (Name == EMPTY_STRING)
+ if (strlen(Name) == 0)
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error").toLocal8Bit().constData());
return NULL;
@@ -661,7 +661,7 @@
return NULL;
if(!checkHaveDocument())
return NULL;
- if (Name == EMPTY_STRING)
+ if (strlen(Name) == 0)
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error").toLocal8Bit().constData());
return NULL;
@@ -693,7 +693,7 @@
return NULL;
if(!checkHaveDocument())
return NULL;
- if (Name == EMPTY_STRING)
+ if (strlen(Name) == 0)
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error").toLocal8Bit().constData());
return NULL;
@@ -741,7 +741,7 @@
return NULL;
if (!checkHaveDocument())
return NULL;
- if (Name == EMPTY_STRING)
+ if (strlen(Name) == 0)
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot create layer without a name.","python error").toLocal8Bit().constData());
return NULL;
Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20881&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp Tue Feb 2 21:23:52 2016
@@ -37,7 +37,7 @@
ScCore->primaryMainWindow()->doc->itemToolPrefs().shapeLineWidth,
ScCore->primaryMainWindow()->doc->itemToolPrefs().shapeFillColor, ScCore->primaryMainWindow()->doc->itemToolPrefs().shapeLineColor);
// ScCore->primaryMainWindow()->doc->setRedrawBounding(ScCore->primaryMainWindow()->doc->Items->at(i));
- if (Name != EMPTY_STRING)
+ if (strlen(Name) >= 0)
{
QString objName = QString::fromUtf8(Name);
if (!ItemExists(objName))
@@ -63,7 +63,7 @@
ScCore->primaryMainWindow()->doc->itemToolPrefs().shapeLineWidth,
ScCore->primaryMainWindow()->doc->itemToolPrefs().shapeFillColor,
ScCore->primaryMainWindow()->doc->itemToolPrefs().shapeLineColor);
- if (Name != EMPTY_STRING)
+ if (strlen(Name) >= 0)
{
QString objName = QString::fromUtf8(Name);
if (!ItemExists(objName))
@@ -88,7 +88,7 @@
ValueToPoint(h),
1, ScCore->primaryMainWindow()->doc->itemToolPrefs().imageFillColor,
ScCore->primaryMainWindow()->doc->itemToolPrefs().imageStrokeColor);
- if (Name != EMPTY_STRING)
+ if (strlen(Name) >= 0)
{
QString objName = QString::fromUtf8(Name);
if (!ItemExists(objName))
@@ -113,7 +113,7 @@
ValueToPoint(h),
ScCore->primaryMainWindow()->doc->itemToolPrefs().shapeLineWidth, CommonStrings::None,
ScCore->primaryMainWindow()->doc->itemToolPrefs().textColor);
- if (Name != EMPTY_STRING)
+ if (strlen(Name) >= 0)
{
QString objName = QString::fromUtf8(Name);
if (!ItemExists(objName))
@@ -149,7 +149,7 @@
table->insertColumns(0, numColumns - 1);
table->adjustTableToFrame();
table->adjustFrameToTable();
- if (Name != EMPTY_STRING)
+ if (strlen(Name) >= 0)
{
QString objName = QString::fromUtf8(Name);
if (!ItemExists(objName))
@@ -209,7 +209,7 @@
ScCore->primaryMainWindow()->view->SizeItem(it->PoLine.WidthHeight().x(),
it->PoLine.WidthHeight().y(), i, false, false, false);
ScCore->primaryMainWindow()->view->AdjustItemSize(it);*/
- if (Name != EMPTY_STRING)
+ if (strlen(Name) >= 0)
{
QString objName = QString::fromUtf8(Name);
if (!ItemExists(objName))
@@ -286,7 +286,7 @@
}
ScCore->primaryMainWindow()->doc->sizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), it, false, false, false);
ScCore->primaryMainWindow()->doc->adjustItemSize(it);
- if (Name != EMPTY_STRING)
+ if (strlen(Name) >= 0)
{
QString objName = QString::fromUtf8(Name);
if (!ItemExists(objName))
@@ -368,7 +368,7 @@
}
ScCore->primaryMainWindow()->doc->sizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), it, false, false, false);
ScCore->primaryMainWindow()->doc->adjustItemSize(it);
- if (Name != EMPTY_STRING)
+ if (strlen(Name) >= 0)
{
QString objName = QString::fromUtf8(Name);
if (!ItemExists(objName))
@@ -459,7 +459,7 @@
}
ScCore->primaryMainWindow()->doc->sizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), it, false, false, false);
ScCore->primaryMainWindow()->doc->adjustItemSize(it);
- if (Name != EMPTY_STRING)
+ if (strlen(Name) >= 0)
{
QString objName = QString::fromUtf8(Name);
if (!ItemExists(objName))
@@ -500,7 +500,7 @@
ScCore->primaryMainWindow()->doc->m_Selection->addItem(ii);
ScCore->primaryMainWindow()->view->ToPathText();
ScCore->primaryMainWindow()->doc->moveItem(pageUnitXToDocX(x) - i->xPos(), pageUnitYToDocY(y) - i->yPos(), i);
- if (Name != EMPTY_STRING)
+ if (strlen(Name) >= 0)
{
QString objName = QString::fromUtf8(Name);
if (!ItemExists(objName))
@@ -620,7 +620,7 @@
return NULL;
}
// for current item only
- if (ScCore->primaryMainWindow()->doc->m_Selection->count() == 0 || name != EMPTY_STRING)
+ if (ScCore->primaryMainWindow()->doc->m_Selection->count() == 0 || (strlen(name) > 0))
{
// quick hack to always apply on the right frame - pv
ScCore->primaryMainWindow()->view->Deselect(true);
Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdstyle.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20881&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdstyle.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdstyle.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdstyle.cpp Tue Feb 2 21:23:52 2016
@@ -49,7 +49,7 @@
return NULL;
if(!checkHaveDocument())
return NULL;
- if (Name == EMPTY_STRING)
+ if (strlen(Name) == 0)
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty paragraph style name.","python error").toLocal8Bit().constData());
return NULL;
@@ -126,7 +126,7 @@
return NULL;
if(!checkHaveDocument())
return NULL;
- if(Name == EMPTY_STRING)
+ if (strlen(Name) == 0)
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty char style name.","python error").toLocal8Bit().constData());
return NULL;
More information about the scribus-commit
mailing list