From 9aef3ce9fcc050874d870d131a6bbcd635055c10 Mon Sep 17 00:00:00 2001
From: Jeremy Drake <github@jdrake.com>
Date: Wed, 2 Dec 2020 11:54:32 -0800
Subject: [PATCH 1/3] Fix casts from pointer to long to size_t instead.

These caused an error on mingw64.
---
 src/autoroute/cmrouter/cmrouter.cpp | 14 +++++++-------
 src/connectors/connectoritem.cpp    |  4 ++--
 src/items/itembase.cpp              |  2 +-
 src/items/paletteitem.cpp           |  2 +-
 src/sketch/sketchwidget.cpp         |  4 ++--
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/autoroute/cmrouter/cmrouter.cpp b/src/autoroute/cmrouter/cmrouter.cpp
index 68414a2b..5c828147 100644
--- a/src/autoroute/cmrouter/cmrouter.cpp
+++ b/src/autoroute/cmrouter/cmrouter.cpp
@@ -154,21 +154,21 @@ static inline void infoTile(const QString & message, Tile * tile)
 	}
 
 	DebugDialog::debug(QString("tile:%1 lb:%2 bl:%3 tr:%4 rt%5")
-	                   .arg((long) tile, 0, 16)
-	                   .arg((long) tile->ti_lb, 0, 16)
-	                   .arg((long) tile->ti_bl, 0, 16)
-	                   .arg((long) tile->ti_tr, 0, 16)
-	                   .arg((long) tile->ti_rt, 0, 16));
+	                   .arg((size_t) tile, 0, 16)
+	                   .arg((size_t) tile->ti_lb, 0, 16)
+	                   .arg((size_t) tile->ti_bl, 0, 16)
+	                   .arg((size_t) tile->ti_tr, 0, 16)
+	                   .arg((size_t) tile->ti_rt, 0, 16));
 
 	DebugDialog::debug(QString("%1 tile:%2 l:%3 t:%4 w:%5 h:%6 type:%7 body:%8")
 	                   .arg(message)
-	                   .arg((long) tile, 0, 16)
+	                   .arg((size_t) tile, 0, 16)
 	                   .arg(LEFT(tile))
 	                   .arg(YMIN(tile))
 	                   .arg(WIDTH(tile))
 	                   .arg(HEIGHT(tile))
 	                   .arg(TiGetType(tile))
-	                   .arg((long) TiGetBody(tile), 0, 16)
+	                   .arg((size_t) TiGetBody(tile), 0, 16)
 	                  );
 }
 
diff --git a/src/connectors/connectoritem.cpp b/src/connectors/connectoritem.cpp
index 7494ebb5..51c98bf1 100644
--- a/src/connectors/connectoritem.cpp
+++ b/src/connectors/connectoritem.cpp
@@ -475,7 +475,7 @@ ConnectorItem * ConnectorItem::removeConnection(ItemBase * itemBase) {
 			}
 			restoreColor(visited);
 			DebugDialog::debug(QString("remove from:%1 to:%2 count%3")
-			                   .arg((long) this, 0, 16)
+			                   .arg((size_t) this, 0, 16)
 			                   .arg(itemBase->modelPartShared()->title())
 			                   .arg(m_connectedTo.count()) );
 			return removed;
@@ -1944,7 +1944,7 @@ void ConnectorItem::debugInfo(const QString & msg)
 	            .arg(this->attachedToViewLayerPlacement())
 	            .arg(this->attachedTo()->wireFlags())
 	            .arg(this->m_hybrid)
-	            .arg((long) this->bus(), 0, 16)
+	            .arg((size_t) this->bus(), 0, 16)
 	            .arg(this->m_radius)
 	            .arg(this->m_strokeWidth)
 	            .arg(p.x())
diff --git a/src/items/itembase.cpp b/src/items/itembase.cpp
index 9d13ca9b..761b0aaa 100644
--- a/src/items/itembase.cpp
+++ b/src/items/itembase.cpp
@@ -1859,7 +1859,7 @@ void ItemBase::debugInfo2(const QString & msg) const
 	                   .arg(this->viewLayerID())
 	                   .arg(this->viewLayerPlacement())
 	                   .arg(this->wireFlags())
-	                   .arg((long) dynamic_cast<const QGraphicsItem *const>(this), 0, 16)
+	                   .arg((size_t) dynamic_cast<const QGraphicsItem *const>(this), 0, 16)
 	                   .arg(m_viewID)
 	                   .arg(this->zValue())
 	                   .arg(this->pos().x())
diff --git a/src/items/paletteitem.cpp b/src/items/paletteitem.cpp
index 3c6c14ba..382326df 100644
--- a/src/items/paletteitem.cpp
+++ b/src/items/paletteitem.cpp
@@ -200,7 +200,7 @@ void PaletteItem::makeOneKin(qint64 & id, ViewLayer::ViewLayerID viewLayerID, Vi
 	if (lkpi->ok()) {
 		DebugDialog::debug(QString("adding layer kin %1 %2 %3 %4")
 		                   .arg(id).arg(m_viewID).arg(viewLayerID)
-		                   .arg((long) lkpi, 0, 16)
+		                   .arg((size_t) lkpi, 0, 16)
 		                  );
 		addLayerKin(lkpi);
 		id++;
diff --git a/src/sketch/sketchwidget.cpp b/src/sketch/sketchwidget.cpp
index a7486b8f..34137460 100644
--- a/src/sketch/sketchwidget.cpp
+++ b/src/sketch/sketchwidget.cpp
@@ -958,7 +958,7 @@ ItemBase * SketchWidget::findItem(long id) {
 
 void SketchWidget::deleteItem(long id, bool deleteModelPart, bool doEmit, bool later) {
 	ItemBase * pitem = findItem(id);
-	DebugDialog::debug(QString("delete item (1) %1 %2 %3 %4").arg(id).arg(doEmit).arg(m_viewID).arg((long) pitem, 0, 16) );
+	DebugDialog::debug(QString("delete item (1) %1 %2 %3 %4").arg(id).arg(doEmit).arg(m_viewID).arg((size_t) pitem, 0, 16) );
 	if (pitem) {
 		deleteItem(pitem, deleteModelPart, doEmit, later);
 	}
@@ -972,7 +972,7 @@ void SketchWidget::deleteItem(long id, bool deleteModelPart, bool doEmit, bool l
 void SketchWidget::deleteItem(ItemBase * itemBase, bool deleteModelPart, bool doEmit, bool later)
 {
 	long id = itemBase->id();
-	DebugDialog::debug(QString("delete item (2) %1 %2 %3 %4").arg(id).arg(itemBase->title()).arg(m_viewID).arg((long) itemBase, 0, 16) );
+	DebugDialog::debug(QString("delete item (2) %1 %2 %3 %4").arg(id).arg(itemBase->title()).arg(m_viewID).arg((size_t) itemBase, 0, 16) );
 
 	// this is a hack to try to workaround a Qt 4.7 crash in QGraphicsSceneFindItemBspTreeVisitor::visit
 	// when using a custom boundingRect, after deleting an item, it still appears on the visit list.
-- 
2.31.1.windows.1

