tags 385520 + patch
thanks

Hi,

Attached is the diff for my kxstitch 0.7-2.1 NMU.

Mike, nice work fixing the lintian warnings, I hope this stuff will be
addressed by the package maintainer. NMUs are supposed to fix only the
critical bug.

Ana
diff -u kxstitch-0.7/debian/changelog kxstitch-0.7/debian/changelog
--- kxstitch-0.7/debian/changelog
+++ kxstitch-0.7/debian/changelog
@@ -1,3 +1,12 @@
+kxstitch (0.7-2.1) unstable; urgency=low
+
+  * Non-maintainer upload to fix RC bug.
+  * Fix to allow build with GCC 4.2. (Closes: #385520)
+    Patch by Mike O'Connor <[EMAIL PROTECTED]>
+  * Add build-dep on quilt and modified debian/rules to apply patch.
+
+ -- Ana Beatriz Guerrero Lopez <[EMAIL PROTECTED]>  Mon, 22 Oct 2007 05:23:03 +0200
+
 kxstitch (0.7-2) unstable; urgency=low
 
   * Fixed Build-Depends to depend on libmagick++9-dev (Closes: #332459)
diff -u kxstitch-0.7/debian/control kxstitch-0.7/debian/control
--- kxstitch-0.7/debian/control
+++ kxstitch-0.7/debian/control
@@ -2,7 +2,7 @@
 Section: kde
 Priority: optional
 Maintainer: eric pareja <[EMAIL PROTECTED]>
-Build-Depends: debhelper (>= 4.0.0), kdelibs4-dev, libmagick++9-dev, libqt3-mt-dev, libltdl3-dev
+Build-Depends: debhelper (>= 4.0.0), kdelibs4-dev, libmagick++9-dev, libqt3-mt-dev, libltdl3-dev, quilt
 Standards-Version: 3.6.2
 
 Package: kxstitch
diff -u kxstitch-0.7/debian/rules kxstitch-0.7/debian/rules
--- kxstitch-0.7/debian/rules
+++ kxstitch-0.7/debian/rules
@@ -32,12 +32,14 @@
 
 build-stamp:  config.status
 	dh_testdir
+	$(MAKE) -f /usr/share/quilt/quilt.make patch
 	$(MAKE)
 	touch build-stamp
 
 clean:
 	dh_testdir
 	dh_testroot
+	$(MAKE) -f /usr/share/quilt/quilt.make unpatch
 	rm -f build-stamp 
 
 	-$(MAKE) distclean
only in patch2:
unchanged:
--- kxstitch-0.7.orig/debian/patches/series
+++ kxstitch-0.7/debian/patches/series
@@ -0,0 +1 @@
+kxstitch.gcc-4.2.diff
only in patch2:
unchanged:
--- kxstitch-0.7.orig/debian/patches/kxstitch.gcc-4.2.diff
+++ kxstitch-0.7/debian/patches/kxstitch.gcc-4.2.diff
@@ -0,0 +1,238 @@
+diff -ru kxstitch-0.7.orig/kxstitch/editview.cpp kxstitch-0.7/kxstitch/editview.cpp
+--- kxstitch-0.7.orig/kxstitch/editview.cpp	2005-07-03 06:54:14.000000000 -0400
++++ kxstitch-0.7/kxstitch/editview.cpp	2007-09-27 21:37:25.000000000 -0400
+@@ -47,6 +47,9 @@
+ 
+ extern "C" double round(double x);
+ 
++#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
++#define MAX(X,Y) ((X) < (Y) ? (Y) : (X))
++
+ #define TIMERSPEED 50
+ 
+ EditView::EditView(KXStitchDoc* doc,QWidget* parent)
+@@ -800,13 +803,13 @@
+ QRect EditView::selectionArea()
+ {
+   int left = m_selectedArea.left();
+-  left = left>?0;
++  left = MAX(left,0);
+   int top = m_selectedArea.top();
+-  top = top>?0;
++  top = MAX(top,0);
+   int right = m_selectedArea.right();
+-  right = right<?contentsWidth();
++  right = MIN(right,contentsWidth());
+   int bottom = m_selectedArea.bottom();
+-  bottom = bottom <? contentsHeight();
++  bottom = MIN(bottom,contentsHeight());
+   int width = (right-left+1)/m_cellSize;
+   int height = (bottom-top+1)/m_cellSize;
+   left /= m_cellSize;
+@@ -936,11 +939,11 @@
+         painter->fillRect(b,QBrush(Qt::black));
+         painter->fillRect(r,QBrush(Qt::white));
+         painter->drawRect(r);
+-        QRect currentPage(r.left()+(50*x/patternHeight),r.top()+(50*y/patternHeight),(50*pageCellsWide/patternHeight)<?(50*(patternWidth-x)/patternHeight),(50*pageCellsTall/patternHeight)<?(50*(patternHeight-y)/patternHeight));
++        QRect currentPage(r.left()+(50*x/patternHeight),r.top()+(50*y/patternHeight),MIN((50*pageCellsWide/patternHeight),(50*(patternWidth-x))/patternHeight),MIN((50*pageCellsTall/patternHeight),(50*(patternHeight-y)/patternHeight)));
+         painter->fillRect(currentPage,QBrush(Qt::lightGray));
+         painter->drawRect(currentPage);
+       }
+-      printContents(printer, painter, x, y, printable, pageCellsWide<?(patternWidth-x), pageCellsTall<?(patternHeight-y), printCellSize);
++      printContents(printer, painter, x, y, printable, MIN(pageCellsWide,(patternWidth-x)), MIN(pageCellsTall,(patternHeight-y)), printCellSize);
+       // print footer
+       painter->drawText(0,height+dy,width,dy,Qt::AlignHCenter,QString(i18n("Page %1")).arg(++pages));
+       if (--totalPages)
+@@ -1758,7 +1761,7 @@
+                 m_end = snapToContents(bs->end);
+                 // found a backstitch that starts and ends where indicated
+                 m_doc->deleteBackstitch(bs); // this should also update the iterator
+-                updateContents(QRect(QPoint((m_start.x()<?m_end.x())-2,(m_start.y()<?m_end.y())-2),QPoint((m_start.x()>?m_end.x())+2,(m_start.y()>?m_end.y())+2)));
++                updateContents(QRect(QPoint(MIN(m_start.x(),m_end.x())-2,MIN(m_start.y(),m_end.y())-2),QPoint(MAX(m_start.x(),m_end.x())+2,MAX(m_start.y(),m_end.y())+2)));
+                 break;
+               }
+             }
+@@ -1810,7 +1813,7 @@
+           drawBoundingRect(m_start, m_end);
+           painter.begin(&dm);
+           painter.setPen(QPen(black,1));
+-          painter.drawRect(QRect(QPoint(m_start.x()<?m_end.x(),m_start.y()<?m_end.y()),QPoint(m_start.x()>?m_end.x(),m_start.y()>?m_end.y())));
++          painter.drawRect(QRect(QPoint(MIN(m_start.x(),m_end.x()),MIN(m_start.y(),m_end.y())),QPoint(MAX(m_start.x(),m_end.x()),MAX(m_start.y(),m_end.y()))));
+           painter.end();
+           m_doc->addStitches(processPixmap(dm),m_currentStitchType);
+           emit locationOrSize(QPoint(-1,-1));
+@@ -1821,7 +1824,7 @@
+           painter.begin(&dm);
+           painter.setPen(QPen(black,1));
+           painter.setBrush(black);
+-          painter.drawRect(QRect(QPoint(m_start.x()<?m_end.x(),m_start.y()<?m_end.y()),QPoint(m_start.x()>?m_end.x(),m_start.y()>?m_end.y())));
++          painter.drawRect(QRect(QPoint(MIN(m_start.x(),m_end.x()),MIN(m_start.y(),m_end.y())),QPoint(MAX(m_start.x(),m_end.x()),MAX(m_start.y(),m_end.y()))));
+           painter.end();
+           m_doc->addStitches(processPixmap(dm),m_currentStitchType);
+           emit locationOrSize(QPoint(-1,-1));
+@@ -1831,7 +1834,7 @@
+           drawBoundingEllipse(m_start, m_end);
+           painter.begin(&dm);
+           painter.setPen(QPen(black,1));
+-          painter.drawEllipse(QRect(QPoint(m_start.x()<?m_end.x(),m_start.y()<?m_end.y()),QPoint(m_start.x()>?m_end.x(),m_start.y()>?m_end.y())));
++          painter.drawEllipse(QRect(QPoint(MIN(m_start.x(),m_end.x()),MIN(m_start.y(),m_end.y())),QPoint(MAX(m_start.x(),m_end.x()),MAX(m_start.y(),m_end.y()))));
+           painter.end();
+           m_doc->addStitches(processPixmap(dm),m_currentStitchType);
+           emit locationOrSize(QPoint(-1,-1));
+@@ -1842,7 +1845,7 @@
+           painter.begin(&dm);
+           painter.setPen(QPen(black,1));
+           painter.setBrush(black);
+-          painter.drawEllipse(QRect(QPoint(m_start.x()<?m_end.x(),m_start.y()<?m_end.y()),QPoint(m_start.x()>?m_end.x(),m_start.y()>?m_end.y())));
++          painter.drawEllipse(QRect(QPoint(MIN(m_start.x(),m_end.x()),MIN(m_start.y(),m_end.y())),QPoint(MAX(m_start.x(),m_end.x()),MAX(m_start.y(),m_end.y()))));
+           painter.end();
+           m_doc->addStitches(processPixmap(dm),m_currentStitchType);
+           emit locationOrSize(QPoint(-1,-1));
+@@ -1971,7 +1974,7 @@
+   int height=m_doc->canvas()->patternHeight();
+   QPoint tl = contentsToCell(QPoint(contentsX(), contentsY()));
+   QPoint br = contentsToCell(QPoint(contentsX()+visibleWidth(), contentsY()+visibleHeight()));
+-  cells.setCoords(tl.x(), tl.y(), br.x()<?width, br.y()<?height);
++  cells.setCoords(tl.x(), tl.y(), MIN(br.x(),width), MIN(br.y(),height));
+   return cells;
+ }
+ 
+@@ -2271,7 +2274,7 @@
+ 
+ void EditView::slotFitPage()
+ {
+-  m_cellSize = (visibleWidth()/m_doc->canvas()->patternWidth())<?(visibleHeight()/m_doc->canvas()->patternHeight());
++  m_cellSize = MIN((visibleWidth()/m_doc->canvas()->patternWidth()),(visibleHeight()/m_doc->canvas()->patternHeight()));
+   resizeGrid();
+ }
+ 
+Only in kxstitch-0.7.orig/kxstitch: extendpattern.cpp
+Only in kxstitch-0.7.orig/kxstitch: extendpattern.h
+Only in kxstitch-0.7.orig/kxstitch: importimage.cpp
+diff -ru kxstitch-0.7.orig/kxstitch/importimagedlg.cpp kxstitch-0.7/kxstitch/importimagedlg.cpp
+--- kxstitch-0.7.orig/kxstitch/importimagedlg.cpp	2005-06-23 17:03:18.000000000 -0400
++++ kxstitch-0.7/kxstitch/importimagedlg.cpp	2007-09-27 21:37:25.000000000 -0400
+@@ -28,6 +28,9 @@
+ #include "flossscheme.h"
+ #include "floss.h"
+ 
++#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
++#define MAX(X,Y) ((X) < (Y) ? (Y) : (X))
++
+ ImportImageDlg::ImportImageDlg(const Magick::Image& image, QWidget *parent, const char *name, bool modal)
+   : ImportImage(parent,name,modal),
+     m_pixmap(new QPixmap),
+@@ -47,7 +50,7 @@
+   m_preferredSize = QSize(KXSConfig().NewPattern_Width,KXSConfig().NewPattern_Height);
+   int sw = m_preferredSize.width()*100/m_originalSize.width();
+   int sh = m_preferredSize.height()*100/m_originalSize.height();
+-  int s = sw <? sh; // pick smallest scale
++  int s = MIN(sw, sh); // pick smallest scale
+ 
+   Import_FlossScheme->insertStringList(((KXStitchApplication*)kapp)->schemes());
+   Configuration::setComboBoxItem(Import_FlossScheme,KXSConfig().NewPattern_FlossScheme);
+@@ -211,4 +214,4 @@
+ {
+   killTimers();
+   renderPixmap();
+-}
+\ No newline at end of file
++}
+Only in kxstitch-0.7.orig/kxstitch: importimage.h
+diff -ru kxstitch-0.7.orig/kxstitch/kxstitchdoc.cpp kxstitch-0.7/kxstitch/kxstitchdoc.cpp
+--- kxstitch-0.7.orig/kxstitch/kxstitchdoc.cpp	2005-06-30 18:30:14.000000000 -0400
++++ kxstitch-0.7/kxstitch/kxstitchdoc.cpp	2007-09-27 21:37:24.000000000 -0400
+@@ -45,6 +45,9 @@
+ #include "importimagedlg.h"
+ #include "configuration.h"
+ 
++#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
++#define MAX(X,Y) ((X) < (Y) ? (Y) : (X))
++
+ #define FILE_FORMAT_VERSION 5
+ 
+ QPtrList<KXStitchView> *KXStitchDoc::viewList = 0L;
+@@ -241,12 +244,12 @@
+           requestedSize.setHeight(currentRect.height());
+         if (requestedSize.width() > currentRect.width())
+         {
+-          l = (requestedSize.width()-currentRect.width())<?currentRect.left();
++          l = MIN((requestedSize.width()-currentRect.width()),currentRect.left());
+           r = requestedSize.width()-(currentRect.width()+l);
+         }
+         if (requestedSize.height() > currentRect.height())
+         {
+-          t = (requestedSize.height()-currentRect.height())<?currentRect.top();
++          t = MIN((requestedSize.height()-currentRect.height()),currentRect.top());
+           b = requestedSize.height()-(currentRect.height()+t);
+         }
+         cropCanvasToPattern();
+Only in kxstitch-0.7.orig/kxstitch: loadpalettedlg.cpp
+Only in kxstitch-0.7.orig/kxstitch: loadpalettedlg.h
+Only in kxstitch-0.7.orig/kxstitch: newcolordlg.cpp
+Only in kxstitch-0.7.orig/kxstitch: newcolordlg.h
+diff -ru kxstitch-0.7.orig/kxstitch/paletteview.cpp kxstitch-0.7/kxstitch/paletteview.cpp
+--- kxstitch-0.7.orig/kxstitch/paletteview.cpp	2005-07-03 06:55:17.000000000 -0400
++++ kxstitch-0.7/kxstitch/paletteview.cpp	2007-09-27 21:37:24.000000000 -0400
+@@ -33,6 +33,9 @@
+ #include "loadpalettedlg.h"
+ #include "patternpropertiesdialog.h"
+ 
++#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
++#define MAX(X,Y) ((X) < (Y) ? (Y) : (X))
++
+ const uchar swapCursor[] =
+ { 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00,
+@@ -422,7 +425,7 @@
+   {
+     ((KXStitchApp*)topLevelWidget())->slotStateChanged("palette_empty");
+   }
+-  f.setPixelSize(m_cellWidth<?m_cellHeight);
++  f.setPixelSize(MIN(m_cellWidth,m_cellHeight));
+   p->setFont(f);
+   for (int i = 0 ; i < palette->colors() ; i++)
+   {
+diff -ru kxstitch-0.7.orig/kxstitch/patterncanvas.cpp kxstitch-0.7/kxstitch/patterncanvas.cpp
+--- kxstitch-0.7.orig/kxstitch/patterncanvas.cpp	2005-06-20 12:55:39.000000000 -0400
++++ kxstitch-0.7/kxstitch/patterncanvas.cpp	2007-09-27 21:37:24.000000000 -0400
+@@ -13,6 +13,9 @@
+ #include "patterncanvas.h"
+ #include "stitch.h"
+ 
++#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
++#define MAX(X,Y) ((X) < (Y) ? (Y) : (X))
++
+ PatternCanvas::PatternCanvas()
+   : m_width(0),
+     m_height(0),
+@@ -143,10 +146,10 @@
+     int y2 = 0;
+     for (Knot *k = m_pKnot->first() ; k ; k = m_pKnot->next())
+     {
+-      x1 = x1 <? k->pos.x();
+-      y1 = y1 <? k->pos.y();
+-      x2 = x2 >? k->pos.x();
+-      y2 = y2 >? k->pos.y();
++      x1 = MIN(x1, k->pos.x());
++      y1 = MIN(y1, k->pos.y());
++      x2 = MAX(x2, k->pos.x());
++      y2 = MAX(y2, k->pos.y());
+     }
+     stitchesRect|=QRect(x1/2,y1/2,(x2-x1)/2,(y2-y1)/2);
+   }
+@@ -159,10 +162,10 @@
+       QPoint s = bs->start;
+       QPoint e = bs->end;
+       int x1,y1,x2,y2;
+-      x1 = s.x() <? e.x();
+-      x2 = s.x() >? e.x();
+-      y1 = s.y() <? e.y();
+-      y2 = s.y() >? e.y();
++      x1 = MIN(s.x(), e.x());
++      x2 = MAX(s.x(), e.x());
++      y1 = MIN(s.y(), e.y());
++      y2 = MAX(s.y(), e.y());
+       if (x1 == x2 || y1 == y2)
+       {
+         // special case as a QRect would show as zero m_width or m_height (ie invalid)

Reply via email to