tags 385520 patch
tags 385520 forwarded [EMAIL PROTECTED]
thanks

Attached are two patches, one (kxstitch.gcc-4.2.diff) is a patch I sent
upstream which fixes this bug only.  I forwarded this patch to the
upstream author.

The second (kxstitch_0.7-2_0.7-2.1.inter.diff) is an interdiff for an
NMU of the package which fixes this bug, but also fixes all of the
lintian warnings of the package:
http://lintian.debian.org/reports/meric_pareja.html#kxstitch

This NMU is also available here:

http://vireo.org/debian/kxstitch

thanks,
stew
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)
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,15 @@
+kxstitch (0.7-2.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Eliminated obsolete minimum/maximum operator (Closes: 385520)
+  * No longer ignoring errors on make distclean
+  * update policy to 3.7.2.2 (no changes necessary)
+  * move menu entry from Apps to Applications
+  * removing rpath with chrpath
+  * Removing deprecated MenuIcon from desktop file
+
+ -- Mike O'Connor <[EMAIL PROTECTED]>  Fri, 28 Sep 2007 02:39:19 -0400
+
 kxstitch (0.7-2) unstable; urgency=low
 
   * Fixed Build-Depends to depend on libmagick++9-dev (Closes: #332459)
diff -u kxstitch-0.7/debian/menu kxstitch-0.7/debian/menu
--- kxstitch-0.7/debian/menu
+++ kxstitch-0.7/debian/menu
@@ -1,2 +1,2 @@
-?package(kxstitch):needs="X11" section="Apps/Graphics"\
+?package(kxstitch):needs="X11" section="Applications/Graphics"\
   title="KXstitch" command="/usr/bin/kxstitch"
diff -u kxstitch-0.7/debian/control kxstitch-0.7/debian/control
--- kxstitch-0.7/debian/control
+++ kxstitch-0.7/debian/control
@@ -2,8 +2,8 @@
 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
-Standards-Version: 3.6.2
+Build-Depends: debhelper (>= 4.0.0), kdelibs4-dev, libmagick++9-dev, libqt3-mt-dev, libltdl3-dev, chrpath
+Standards-Version: 3.7.2.2
 
 Package: kxstitch
 Architecture: any
diff -u kxstitch-0.7/debian/rules kxstitch-0.7/debian/rules
--- kxstitch-0.7/debian/rules
+++ kxstitch-0.7/debian/rules
@@ -33,6 +33,7 @@
 build-stamp:  config.status
 	dh_testdir
 	$(MAKE)
+	chrpath -d kxstitch/kxstitch
 	touch build-stamp
 
 clean:
@@ -40,7 +41,7 @@
 	dh_testroot
 	rm -f build-stamp 
 
-	-$(MAKE) distclean
+	[ ! -f Makefile ] || $(MAKE) distclean
 ifneq "$(wildcard /usr/share/misc/config.sub)" ""
 	cp -f /usr/share/misc/config.sub config.sub
 endif
@@ -57,7 +58,8 @@
 	dh_clean -k 
 	dh_installdirs
 	$(MAKE) install DESTDIR=$(CURDIR)/debian/kxstitch
-
+	rm debian/kxstitch/usr/share/man/man1/kxstitch.1.gz
+	sed -i '/MiniIcon/d' debian/kxstitch/usr/share/applnk/Graphics/kxstitch.desktop
 
 # Build architecture-independent files here.
 binary-indep: build install
only in patch2:
unchanged:
--- kxstitch-0.7.orig/kxstitch/editview.cpp
+++ kxstitch-0.7/kxstitch/editview.cpp
@@ -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 patch2:
unchanged:
--- kxstitch-0.7.orig/kxstitch/kxstitchdoc.cpp
+++ kxstitch-0.7/kxstitch/kxstitchdoc.cpp
@@ -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 patch2:
unchanged:
--- kxstitch-0.7.orig/kxstitch/importimagedlg.cpp
+++ kxstitch-0.7/kxstitch/importimagedlg.cpp
@@ -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 patch2:
unchanged:
--- kxstitch-0.7.orig/kxstitch/patterncanvas.cpp
+++ kxstitch-0.7/kxstitch/patterncanvas.cpp
@@ -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)
only in patch2:
unchanged:
--- kxstitch-0.7.orig/kxstitch/paletteview.cpp
+++ kxstitch-0.7/kxstitch/paletteview.cpp
@@ -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++)
   {

Attachment: signature.asc
Description: Digital signature

Reply via email to