Sun, 06 Sep 2015 03:17:29 +0300
Remove "!= nullptr" expressions
--- a/src/addObjectDialog.cpp Sun Sep 06 03:10:03 2015 +0300 +++ b/src/addObjectDialog.cpp Sun Sep 06 03:17:29 2015 +0300 @@ -95,7 +95,7 @@ coordCount = 3; tw_subfileList = new QTreeWidget(); tw_subfileList->setHeaderLabel (tr ("Primitives")); - PopulatePrimitives (tw_subfileList, (obj != nullptr ? static_cast<LDSubfile*> (obj)->fileInfo()->name() : "")); + PopulatePrimitives (tw_subfileList, (obj ? static_cast<LDSubfile*> (obj)->fileInfo()->name() : "")); connect (tw_subfileList, SIGNAL (itemSelectionChanged()), this, SLOT (slot_subfileTypeChanged())); lb_subfileName = new QLabel ("File:"); @@ -124,7 +124,7 @@ // Show a color edit dialog for the types that actually use the color if (defaults->isColored()) { - if (obj != nullptr) + if (obj) m_color = obj->color(); else m_color = (type == OBJ_CondLine or type == OBJ_Line) ? EdgeColor : MainColor; @@ -152,7 +152,7 @@ case OBJ_Triangle: case OBJ_Quad: // Apply coordinates - if (obj != nullptr) + if (obj) { for (int i = 0; i < coordCount / 3; ++i) { @@ -190,7 +190,7 @@ // le_matrix->setValidator (new QDoubleValidator); Matrix defaultMatrix = IdentityMatrix; - if (mo != nullptr) + if (mo) { mo->position().apply ([&](Axis ax, double value) {
--- a/src/dialogs.cpp Sun Sep 06 03:10:03 2015 +0300 +++ b/src/dialogs.cpp Sun Sep 06 03:17:29 2015 +0300 @@ -88,7 +88,7 @@ LDGLOverlay& info = g_win->renderer()->getOverlay (newcam); RadioDefault<int> (newcam, m_cameraArgs); - if (info.img != nullptr) + if (info.img) { ui->filename->setText (info.fname); ui->originX->setValue (info.ox);
--- a/src/dialogs/configdialog.cpp Sun Sep 06 03:10:03 2015 +0300 +++ b/src/dialogs/configdialog.cpp Sun Sep 06 03:17:29 2015 +0300 @@ -66,27 +66,27 @@ QCheckBox* checkbox; QPushButton* button; - if ((le = qobject_cast<QLineEdit*> (widget)) != nullptr) + if ((le = qobject_cast<QLineEdit*> (widget))) { le->setText (value.toString()); } - else if ((spinbox = qobject_cast<QSpinBox*> (widget)) != nullptr) + else if ((spinbox = qobject_cast<QSpinBox*> (widget))) { spinbox->setValue (value.toInt()); } - else if ((doublespinbox = qobject_cast<QDoubleSpinBox*> (widget)) != nullptr) + else if ((doublespinbox = qobject_cast<QDoubleSpinBox*> (widget))) { doublespinbox->setValue (value.toDouble()); } - else if ((slider = qobject_cast<QSlider*> (widget)) != nullptr) + else if ((slider = qobject_cast<QSlider*> (widget))) { slider->setValue (value.toInt()); } - else if ((checkbox = qobject_cast<QCheckBox*> (widget)) != nullptr) + else if ((checkbox = qobject_cast<QCheckBox*> (widget))) { checkbox->setChecked (value.toBool()); } - else if ((button = qobject_cast<QPushButton*> (widget)) != nullptr) + else if ((button = qobject_cast<QPushButton*> (widget))) { setButtonBackground (button, value.toString()); connect (button, SIGNAL (clicked()), this, SLOT (setButtonColor())); @@ -230,17 +230,17 @@ QCheckBox* checkbox; QPushButton* button; - if ((le = qobject_cast<QLineEdit*> (widget)) != nullptr) + if ((le = qobject_cast<QLineEdit*> (widget))) value = le->text(); - else if ((spinbox = qobject_cast<QSpinBox*> (widget)) != nullptr) + else if ((spinbox = qobject_cast<QSpinBox*> (widget))) value = spinbox->value(); - else if ((doublespinbox = qobject_cast<QDoubleSpinBox*> (widget)) != nullptr) + else if ((doublespinbox = qobject_cast<QDoubleSpinBox*> (widget))) value = doublespinbox->value(); - else if ((slider = qobject_cast<QSlider*> (widget)) != nullptr) + else if ((slider = qobject_cast<QSlider*> (widget))) value = slider->value(); - else if ((checkbox = qobject_cast<QCheckBox*> (widget)) != nullptr) + else if ((checkbox = qobject_cast<QCheckBox*> (widget))) value = checkbox->isChecked(); - else if ((button = qobject_cast<QPushButton*> (widget)) != nullptr) + else if ((button = qobject_cast<QPushButton*> (widget))) value = m_buttonColors[button]; else { @@ -380,7 +380,7 @@ if (not ColorSelector::selectColor (this, value, defaultValue)) return; - if (entry != nullptr) + if (entry) { entry->setColor (value); }
--- a/src/editmodes/abstractEditMode.cpp Sun Sep 06 03:10:03 2015 +0300 +++ b/src/editmodes/abstractEditMode.cpp Sun Sep 06 03:17:29 2015 +0300 @@ -137,7 +137,7 @@ } } - if (closest != nullptr) + if (closest) addDrawnVertex (*closest); return true;
--- a/src/editmodes/circleMode.cpp Sun Sep 06 03:10:03 2015 +0300 +++ b/src/editmodes/circleMode.cpp Sun Sep 06 03:17:29 2015 +0300 @@ -159,7 +159,7 @@ } } - if (circleOrDisc and refFile != nullptr) + if (circleOrDisc and refFile) { LDSubfile* ref = LDSpawn<LDSubfile>(); ref->setFileInfo (refFile);
--- a/src/editmodes/selectMode.cpp Sun Sep 06 03:10:03 2015 +0300 +++ b/src/editmodes/selectMode.cpp Sun Sep 06 03:17:29 2015 +0300 @@ -120,7 +120,7 @@ renderer()->document()->clearSelection(); LDObject* obj = renderer()->pickOneObject (ev->x(), ev->y()); - if (obj != nullptr) + if (obj) { AddObjectDialog::staticDialog (obj->type(), obj); m_window->endAction();
--- a/src/glCompiler.cpp Sun Sep 06 03:10:03 2015 +0300 +++ b/src/glCompiler.cpp Sun Sep 06 03:17:29 2015 +0300 @@ -101,7 +101,7 @@ glDeleteBuffers (g_numVBOs, &m_vbo[0]); CHECK_GL_ERROR(); - if (m_renderer != nullptr) + if (m_renderer) m_renderer->setCompiler (nullptr); } @@ -248,7 +248,7 @@ // void GLCompiler::compileDocument (LDDocument* doc) { - if (doc != nullptr) + if (doc) { for (LDObject* obj : doc->objects()) compileObject (obj);
--- a/src/glRenderer.cpp Sun Sep 06 03:10:03 2015 +0300 +++ b/src/glRenderer.cpp Sun Sep 06 03:17:29 2015 +0300 @@ -212,7 +212,7 @@ // void GLRenderer::needZoomToFit() { - if (document() != nullptr) + if (document()) currentDocumentData().needZoomToFit = true; } @@ -625,7 +625,7 @@ // Paint the overlay image if we have one const LDGLOverlay& overlay = currentDocumentData().overlays[camera()]; - if (overlay.img != nullptr) + if (overlay.img) { QPoint v0 = coordconv3_2 (currentDocumentData().overlays[camera()].v0), v1 = coordconv3_2 (currentDocumentData().overlays[camera()].v1); @@ -1023,7 +1023,7 @@ // void GLRenderer::setEditMode (EditModeType a) { - if (m_editmode != nullptr and m_editmode->type() == a) + if (m_editmode and m_editmode->type() == a) return; delete m_editmode; @@ -1050,7 +1050,7 @@ { m_document = a; - if (a != nullptr) + if (a) { initOverlaysFromObjects(); @@ -1433,12 +1433,12 @@ LDGLOverlay& meta = currentDocumentData().overlays[cam]; LDOverlay* ovlobj = findOverlayObject (cam); - if (ovlobj == nullptr and meta.img != nullptr) + if (ovlobj == nullptr and meta.img) { delete meta.img; meta.img = nullptr; } - else if (ovlobj != nullptr and + else if (ovlobj and (meta.img == nullptr or meta.fname != ovlobj->fileName()) and not meta.invalid) { @@ -1460,7 +1460,7 @@ LDGLOverlay& meta = currentDocumentData().overlays[cam]; LDOverlay* ovlobj = findOverlayObject (cam); - if (meta.img == nullptr and ovlobj != nullptr) + if (meta.img == nullptr and ovlobj) { // If this is the last overlay image, we need to remove the empty space after it as well. LDObject* nextobj = ovlobj->next(); @@ -1472,7 +1472,7 @@ // not, remove the object. ovlobj->destroy(); } - else if (meta.img != nullptr and ovlobj == nullptr) + else if (meta.img and ovlobj == nullptr) { // Inverse case: image is there but the overlay object is // not, thus create the object. @@ -1512,7 +1512,7 @@ } } - if (meta.img != nullptr and ovlobj != nullptr) + if (meta.img and ovlobj) { ovlobj->setCamera (cam); ovlobj->setFileName (meta.fname); @@ -1553,17 +1553,17 @@ newIndex = pixel[0] * 0x10000 | pixel[1] * 0x100 | pixel[2]; } - if (newIndex != (oldObject != nullptr ? oldObject->id() : 0)) + if (newIndex != (oldObject ? oldObject->id() : 0)) { if (newIndex != 0) newObject = LDObject::fromID (newIndex); setObjectAtCursor (newObject); - if (oldObject != nullptr) + if (oldObject) compileObject (oldObject); - if (newObject != nullptr) + if (newObject) compileObject (newObject); } @@ -1572,13 +1572,13 @@ void GLRenderer::dragEnterEvent (QDragEnterEvent* ev) { - if (m_window != nullptr and ev->source() == m_window->getPrimitivesTree() and m_window->getPrimitivesTree()->currentItem() != nullptr) + if (m_window and ev->source() == m_window->getPrimitivesTree() and m_window->getPrimitivesTree()->currentItem()) ev->acceptProposedAction(); } void GLRenderer::dropEvent (QDropEvent* ev) { - if (m_window != nullptr and ev->source() == m_window->getPrimitivesTree()) + if (m_window and ev->source() == m_window->getPrimitivesTree()) { QString primName = static_cast<SubfileListItem*> (m_window->getPrimitivesTree()->currentItem())->primitive()->name; LDSubfile* ref = LDSpawn<LDSubfile>();
--- a/src/hierarchyelement.cpp Sun Sep 06 03:10:03 2015 +0300 +++ b/src/hierarchyelement.cpp Sun Sep 06 03:17:29 2015 +0300 @@ -10,7 +10,7 @@ { if (parent) { - while (parent->parent() != nullptr) + while (parent->parent()) parent = parent->parent(); m_window = qobject_cast<MainWindow*> (parent);
--- a/src/ldDocument.cpp Sun Sep 06 03:10:03 2015 +0300 +++ b/src/ldDocument.cpp Sun Sep 06 03:17:29 2015 +0300 @@ -311,7 +311,7 @@ print ("Opening %1...\n", relpath); QString path = FindDocumentPath (relpath, subdirs); - if (pathpointer != nullptr) + if (pathpointer) *pathpointer = path; if (path.isEmpty()) @@ -384,7 +384,7 @@ if (not fp) return nullptr; - LDDocument* load = (fileToOverride != nullptr ? fileToOverride : g_win->newDocument (implicit)); + LDDocument* load = (fileToOverride ? fileToOverride : g_win->newDocument (implicit)); load->setFullPath (fullpath); load->setName (LDDocument::shortenName (load->fullPath())); @@ -533,14 +533,14 @@ // We cannot open this file if the document this would replace is not // safe to close. - if (documentToReplace != nullptr and not documentToReplace->isSafeToClose()) + if (documentToReplace and not documentToReplace->isSafeToClose()) return; g_loadingMainFile = true; // If we're replacing an existing document, clear the document and // make it ready for being loaded to. - if (documentToReplace != nullptr) + if (documentToReplace) { file = documentToReplace; file->clear(); @@ -613,7 +613,7 @@ // If the second object in the list holds the file name, update that now. LDObject* nameObject = getObject (1); - if (nameObject != nullptr and nameObject->type() == OBJ_Comment) + if (nameObject and nameObject->type() == OBJ_Comment) { LDComment* nameComment = static_cast<LDComment*> (nameObject); @@ -627,7 +627,7 @@ QByteArray data; - if (sizeptr != nullptr) + if (sizeptr) *sizeptr = 0; // File is open, now save the model to it. Note that LDraw requires files to have DOS line endings. @@ -636,7 +636,7 @@ QByteArray subdata ((obj->asText() + "\r\n").toUtf8()); data.append (subdata); - if (sizeptr != nullptr) + if (sizeptr) *sizeptr += subdata.size(); } @@ -933,7 +933,7 @@ LDSubfile* ref = static_cast<LDSubfile*> (obj); LDDocument* fileInfo = GetDocument (ref->fileInfo()->name()); - if (fileInfo != nullptr) + if (fileInfo) { ref->setFileInfo (fileInfo); } @@ -974,7 +974,7 @@ { for (LDObject* obj : objs) { - if (obj != nullptr) + if (obj) addObject (obj); } } @@ -1126,7 +1126,7 @@ LDPolygon* data = obj->getPolygon(); - if (data != nullptr) + if (data) { m_polygonData << *data; delete data; @@ -1184,9 +1184,9 @@ // Ensure logoed studs are loaded first LoadLogoStuds(); - if (name() == "stud.dat" and g_logoedStud != nullptr) + if (name() == "stud.dat" and g_logoedStud) return g_logoedStud->inlineContents (deep, renderinline); - else if (name() == "stud2.dat" and g_logoedStud2 != nullptr) + else if (name() == "stud2.dat" and g_logoedStud2) return g_logoedStud2->inlineContents (deep, renderinline); }
--- a/src/ldObject.cpp Sun Sep 06 03:10:03 2015 +0300 +++ b/src/ldObject.cpp Sun Sep 06 03:17:29 2015 +0300 @@ -299,11 +299,11 @@ deselect(); // If this object was associated to a file, remove it off it now - if (document() != nullptr) + if (document()) document()->forgetObject (this); // Delete the GL lists - if (g_win != nullptr) + if (g_win) g_win->renderer()->forgetObject (this); // Remove this object from the list of LDObjects @@ -423,7 +423,7 @@ // ----------------------------------------------------------------------------- long LDObject::lineNumber() const { - if (document() != nullptr) + if (document()) { for (int i = 0; i < document()->getObjectCount(); ++i) { @@ -835,7 +835,7 @@ // void LDObject::select() { - if (document() != nullptr) + if (document()) document()->addToSelection (this); } @@ -843,7 +843,7 @@ // void LDObject::deselect() { - if (isSelected() and document() != nullptr) + if (isSelected() and document()) { document()->removeFromSelection (this); @@ -879,7 +879,7 @@ // If it's an immediate subfile reference (i.e. this subfile belongs in an // explicit file), we need to pre-compile the GL polygons for the document // if they don't exist already. - if (a != nullptr and + if (a and a->isCache() == false and a->polygonData().isEmpty()) {
--- a/src/mainwindow.cpp Sun Sep 06 03:10:03 2015 +0300 +++ b/src/mainwindow.cpp Sun Sep 06 03:17:29 2015 +0300 @@ -91,7 +91,7 @@ connect (m_tabs, SIGNAL (currentChanged(int)), this, SLOT (tabSelected())); connect (m_tabs, SIGNAL (tabCloseRequested (int)), this, SLOT (closeTab (int))); - if (ActivePrimitiveScanner() != nullptr) + if (ActivePrimitiveScanner()) connect (ActivePrimitiveScanner(), SIGNAL (workDone()), this, SLOT (updatePrimitives())); else updatePrimitives(); @@ -164,7 +164,7 @@ { QToolBar* toolbar = findChild<QToolBar*> (toolbarname.toString()); - if (toolbar != nullptr) + if (toolbar) toolbar->hide(); } @@ -1031,7 +1031,7 @@ // void MainWindow::updateActions() { - if (m_currentDocument != nullptr and m_currentDocument->history() != nullptr) + if (m_currentDocument and m_currentDocument->history()) { EditHistory* his = m_currentDocument->history(); int pos = his->position(); @@ -1258,7 +1258,7 @@ void MainWindow::changeDocument (LDDocument* document) { // Implicit files were loaded for caching purposes and may never be switched to. - if (document != nullptr and document->isCache()) + if (document and document->isCache()) return; m_currentDocument = document;
--- a/src/messageLog.cpp Sun Sep 06 03:10:03 2015 +0300 +++ b/src/messageLog.cpp Sun Sep 06 03:17:29 2015 +0300 @@ -127,7 +127,7 @@ { for (QString& a : msg.split ("\n", QString::SkipEmptyParts)) { - if (g_win != nullptr) + if (g_win) g_win->addMessage (a); // Also print it to stdout
--- a/src/partDownloader.cpp Sun Sep 06 03:10:03 2015 +0300 +++ b/src/partDownloader.cpp Sun Sep 06 03:17:29 2015 +0300 @@ -322,7 +322,7 @@ m_requests.clear(); // Update everything now - if (primaryFile() != nullptr) + if (primaryFile()) { g_win->changeDocument (primaryFile()); g_win->doFullRefresh();
--- a/src/primitives.cpp Sun Sep 06 03:10:03 2015 +0300 +++ b/src/primitives.cpp Sun Sep 06 03:17:29 2015 +0300 @@ -255,13 +255,13 @@ } // Drop out if a category was decided on. - if (prim.category != nullptr) + if (prim.category) break; } // If there was a match, add the primitive to the category. // Otherwise, add it to the list of unmatched primitives. - if (prim.category != nullptr) + if (prim.category) prim.category->prims << prim; else g_unmatched->prims << prim; @@ -313,7 +313,7 @@ cat = new PrimitiveCategory (line); } - else if (cat != nullptr) + else if (cat) { QString cmd = line.left (colon); RegexType type = EFilenameRegex; @@ -365,7 +365,7 @@ // bool IsPrimitiveLoaderBusy() { - return g_activeScanner != nullptr; + return g_activeScanner; } // ============================================================================= @@ -652,7 +652,7 @@ QString name = MakeRadialFileName (type, segs, divs, num); LDDocument* f = GetDocument (name); - if (f != nullptr) + if (f) return f; return GeneratePrimitive (type, segs, divs, num);
--- a/src/ringFinder.cpp Sun Sep 06 03:10:03 2015 +0300 +++ b/src/ringFinder.cpp Sun Sep 06 03:17:29 2015 +0300 @@ -172,7 +172,7 @@ m_bestSolution = / } - return (m_bestSolution != nullptr); + return (m_bestSolution); } //
--- a/src/toolsets/algorithmtoolset.cpp Sun Sep 06 03:10:03 2015 +0300 +++ b/src/toolsets/algorithmtoolset.cpp Sun Sep 06 03:17:29 2015 +0300 @@ -153,7 +153,7 @@ { LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (obj); - if (mo != nullptr) + if (mo) { Vertex v = mo->position(); Matrix t = mo->transform(); @@ -460,7 +460,7 @@ int refidx (selectedObjects()[0]->lineNumber()); // Determine title of subfile - if (titleobj != nullptr) + if (titleobj) subtitle = "~" + titleobj->text(); else subtitle = "~subfile"; @@ -516,7 +516,7 @@ digits.prepend ("0"); fullsubname = subdirname + "/" + Basename (parentpath) + "s" + digits + ".dat"; - } while (FindDocument ("s\\" + Basename (fullsubname)) != nullptr or QFile (fullsubname).exists()); + } while (FindDocument ("s\\" + Basename (fullsubname)) or QFile (fullsubname).exists()); } // Determine the BFC winding type used in the main document - it is to