Am Montag, den 01.12.2008, 12:34 +0100 schrieb Koen Deforche:
> Hey all,
Hello Koen,

> Wt 2.2.2 was released, and, if it weren't better than 2.2.1 we would
> not have done that.
Really ? Are you sure ? ;-)

> Not only have we fixed quite some little bugs in various places, but
> there are also some new classes and features:
[...]

> And Wt turns 3 years old today (still enjoying a fast growth rate!).
Congrats...

Unfortunately I stumbled on a problem with the long longs:

g++ -c -I. -I run/wt-cvs/include -g -Wall -ansi -pedantic -Werror
formbase.C -o build/formbase.o
In file included from run/wt-cvs/include/Wt/WAbstractItemModel:
run/wt-cvs/include/Wt/WModelIndex:169: error: ISO C++ does not support
'long long'
run/wt-cvs/include/Wt/WModelIndex:274: error: ISO C++ does not support
'long long'

Please have a look at the attached patch...

Goetz

-- 
Goetz Babin-Ebell <[EMAIL PROTECTED]>
4G Systems GmbH & Co KG
Index: src/Wt/WAbstractItemModel
===================================================================
RCS file: /opt/cvs/wt/src/Wt/WAbstractItemModel,v
retrieving revision 1.8
diff -u -r1.8 WAbstractItemModel
--- src/Wt/WAbstractItemModel	28 Nov 2008 10:39:56 -0000	1.8
+++ src/Wt/WAbstractItemModel	1 Dec 2008 14:13:59 -0000
@@ -14,6 +14,7 @@
 #include <Wt/WWidget>
 
 #include <boost/any.hpp>
+#include <stdint.h>
 
 namespace Wt {
 
@@ -675,7 +676,7 @@
    *
    * \sa WModelIndex::internalId()
    */
-  WModelIndex createIndex(int row, int column, unsigned long long id) const;
+  WModelIndex createIndex(int row, int column, uint64_t id) const;
 
   /*! \brief Create a model index for the given row and column.
    *
Index: src/Wt/WAbstractItemModel.C
===================================================================
RCS file: /opt/cvs/wt/src/Wt/WAbstractItemModel.C,v
retrieving revision 1.4
diff -u -r1.4 WAbstractItemModel.C
--- src/Wt/WAbstractItemModel.C	28 Nov 2008 10:39:56 -0000	1.4
+++ src/Wt/WAbstractItemModel.C	1 Dec 2008 14:13:59 -0000
@@ -433,8 +433,8 @@
   ELSE_LEXICAL_ANY(unsigned int);
   ELSE_LEXICAL_ANY(long);
   ELSE_LEXICAL_ANY(unsigned long);
-  ELSE_LEXICAL_ANY(long long);
-  ELSE_LEXICAL_ANY(unsigned long long);
+  ELSE_LEXICAL_ANY(int64_t);
+  ELSE_LEXICAL_ANY(uint64_t);
   ELSE_LEXICAL_ANY(float);
   ELSE_LEXICAL_ANY(double);
 
@@ -469,8 +469,8 @@
   ELSE_LEXICAL_ANY(unsigned int);
   ELSE_LEXICAL_ANY(long);
   ELSE_LEXICAL_ANY(unsigned long);
-  ELSE_LEXICAL_ANY(long long);
-  ELSE_LEXICAL_ANY(unsigned long long);
+  ELSE_LEXICAL_ANY(int64_t);
+  ELSE_LEXICAL_ANY(uint64_t);
   ELSE_LEXICAL_ANY(float);
   ELSE_LEXICAL_ANY(double);
 
@@ -510,8 +510,8 @@
   ELSE_NUMERICAL_ANY(unsigned int);
   ELSE_NUMERICAL_ANY(long);
   ELSE_NUMERICAL_ANY(unsigned long);
-  ELSE_NUMERICAL_ANY(long long);
-  ELSE_NUMERICAL_ANY(unsigned long long);
+  ELSE_NUMERICAL_ANY(int64_t);
+  ELSE_NUMERICAL_ANY(uint64_t);
   ELSE_NUMERICAL_ANY(float);
   ELSE_NUMERICAL_ANY(double);
 
@@ -543,8 +543,8 @@
   ELSE_LEXICAL_ANY(unsigned int);
   ELSE_LEXICAL_ANY(long);
   ELSE_LEXICAL_ANY(unsigned long);
-  ELSE_LEXICAL_ANY(long long);
-  ELSE_LEXICAL_ANY(unsigned long long);
+  ELSE_LEXICAL_ANY(int64_t);
+  ELSE_LEXICAL_ANY(uint64_t);
   ELSE_LEXICAL_ANY(float);
   ELSE_LEXICAL_ANY(double);
 
@@ -585,8 +585,8 @@
 	ELSE_COMPARE_ANY(unsigned int);
 	ELSE_COMPARE_ANY(long);
 	ELSE_COMPARE_ANY(unsigned long);
-	ELSE_COMPARE_ANY(long long);
-	ELSE_COMPARE_ANY(unsigned long long);
+	ELSE_COMPARE_ANY(int64_t);
+	ELSE_COMPARE_ANY(uint64_t);
 	ELSE_COMPARE_ANY(float);
 	ELSE_COMPARE_ANY(double);
 
Index: src/Wt/WModelIndex
===================================================================
RCS file: /opt/cvs/wt/src/Wt/WModelIndex,v
retrieving revision 1.7
diff -u -r1.7 WModelIndex
--- src/Wt/WModelIndex	6 Nov 2008 22:29:24 -0000	1.7
+++ src/Wt/WModelIndex	1 Dec 2008 14:13:59 -0000
@@ -11,6 +11,7 @@
 #include <set>
 #include <boost/any.hpp>
 #include <boost/array.hpp>
+#include <stdint.h>
 
 #include <Wt/WDllDefs.h>
 
@@ -106,7 +107,7 @@
  * the model.
  *
  * Upon the model's choice, model indexes for hierarchical models may
- * have an internal Id represented by a long long (internalId()), a
+ * have an internal Id represented by a int64_t (internalId()), a
  * pointer (internalPointer()), or an internal hash
  * (internalHashId()). The former are convenient for in-memory models,
  * while the latter is useful for models that keep data out of memory
@@ -162,12 +163,12 @@
    * corresponding data.
    *
    * This is only defined when the model created the index using
-   * WAbstractItemModel::createIndex(int, int, unsigned long long) const.
+   * WAbstractItemModel::createIndex(int, int, uint64_t) const.
    *
-   * \sa internalPointer(), WAbstractItemModel::createIndex(int, int, unsigned long long) const
+   * \sa internalPointer(), WAbstractItemModel::createIndex(int, int, uint64_t) const
    */
-  unsigned long long internalId() const {
-    return *reinterpret_cast<unsigned long long *>
+  uint64_t internalId() const {
+    return *reinterpret_cast<uint64_t*>
       (const_cast<WModelIndex *>(this)->internalId_.c_array());
   }
 
@@ -271,7 +272,7 @@
 
   WModelIndex(int row, int column, const WAbstractItemModel *model, void *ptr);
   WModelIndex(int row, int column, const WAbstractItemModel *model,
-	      unsigned long long id);
+	      uint64_t id);
   WModelIndex(int row, int column, const WAbstractItemModel *model,
 	      const Sha1::Digest& id);
 
Index: src/Wt/WModelIndex.C
===================================================================
RCS file: /opt/cvs/wt/src/Wt/WModelIndex.C,v
retrieving revision 1.5
diff -u -r1.5 WModelIndex.C
--- src/Wt/WModelIndex.C	27 Oct 2008 09:27:00 -0000	1.5
+++ src/Wt/WModelIndex.C	1 Dec 2008 14:13:59 -0000
@@ -145,13 +145,13 @@
 }
 
 WModelIndex::WModelIndex(int row, int column, const WAbstractItemModel *model,
-			 unsigned long long id)
+			 uint64_t id)
   : model_(model),
     row_(row),
     column_(column)
 {
   memset(internalId_.c_array(), 0, 20);
- *reinterpret_cast<unsigned long long *>(internalId_.c_array()) = id;
+ *reinterpret_cast<uint64_t *>(internalId_.c_array()) = id;
 }
 
 WModelIndex::WModelIndex(int row, int column, const WAbstractItemModel *model,
Index: src/Wt/WVirtualImage
===================================================================
RCS file: /opt/cvs/wt/src/Wt/WVirtualImage,v
retrieving revision 1.4
diff -u -r1.4 WVirtualImage
--- src/Wt/WVirtualImage	9 Oct 2008 13:41:52 -0000	1.4
+++ src/Wt/WVirtualImage	1 Dec 2008 14:13:59 -0000
@@ -7,6 +7,7 @@
 #ifndef WVIRTUALIMAGE_H_
 #define WVIRTUALIMAGE_H_
 
+#include <stdint.h>
 #include <limits>
 #include <Wt/WCompositeWidget>
 #include <Wt/WJavaScriptSlot>
@@ -48,7 +49,7 @@
 public:
   /*! \brief Special value for imageWidth or imageHeight
    */
-  static const long long Infinite;
+  static const int64_t Infinite;
 
   /*! \brief Construct a viewport for a virtual image.
    *
@@ -61,7 +62,7 @@
    * item. The default is 256 by 256.
    */
   WVirtualImage(int viewPortWidth, int viewPortHeight,
-		long long imageWidth, long long imageHeight,
+		int64_t imageWidth, int64_t imageHeight,
 		int gridImageSize = 256, WContainerWidget *parent = 0);
 
   /*! \brief Destructor
@@ -85,25 +86,25 @@
    *
    * Scroll the viewport over the image over an indicated distance.
    */
-  void scroll(long long dx, long long dy);
+  void scroll(int64_t dx, int64_t dy);
 
   /*! \brief Scroll the viewport of the image to a specific coordinate.
    *
    * Scroll the viewport so that its top left coordinate becomes (x, y).
    */
-  void scrollTo(long long x, long long y);
+  void scrollTo(int64_t x, int64_t y);
 
   /*! \brief Return the virtual image width.
    */
-  long long imageWidth() const { return imageWidth_; }
+  int64_t imageWidth() const { return imageWidth_; }
 
   /*! \brief Return the virtual image height.
    */
-  long long imageHeight() const { return imageHeight_; }
+  int64_t imageHeight() const { return imageHeight_; }
 
   /*! \brief Resize the virtual image.
    */
-  void resizeImage(long long w, long long h);
+  void resizeImage(int64_t w, int64_t h);
 
   /*! \brief Return the viewport width.
    */
@@ -119,23 +120,23 @@
 
   /*! \brief Returns the current top left X coordinate.
    */
-  long long currentTopLeftX() const { return currentX_; }
+  int64_t currentTopLeftX() const { return currentX_; }
 
   /*! \brief Returns the current top left Y coordinate.
    */
-  long long currentTopLeftY() const { return currentY_; }
+  int64_t currentTopLeftY() const { return currentY_; }
 
   /*! \brief Returns the current bottom right X coordinate.
    */
-  long long currentBottomRightX() const { return currentX_ + viewPortWidth_; }
+  int64_t currentBottomRightX() const { return currentX_ + viewPortWidth_; }
 
   /*! \brief Returns the current bottom right Y coordinate.
    */
-  long long currentBottomRightY() const { return currentY_ + viewPortHeight_; }
+  int64_t currentBottomRightY() const { return currentY_ + viewPortHeight_; }
 
   /*! \brief Signal emitted whenever the viewport changes.
    */
-  Signal<long long, long long> viewPortChanged;
+  Signal<int64_t, int64_t> viewPortChanged;
 
 protected:
   /*! \brief Create a grid image for the given rectangle.
@@ -154,7 +155,7 @@
    *
    * \sa render()
    */
-  virtual WImage *createImage(long long x, long long y, int width, int height);
+  virtual WImage *createImage(int64_t x, int64_t y, int width, int height);
 
   /*! \brief Render a grid image for the given rectangle.
    *
@@ -170,7 +171,7 @@
    *
    * \sa createImage()
    */
-  virtual WResource *render(long long x, long long y, int width, int height);
+  virtual WResource *render(int64_t x, int64_t y, int width, int height);
 
 private slots:
   void mouseUp(const WMouseEvent& e);
@@ -180,33 +181,33 @@
   WContainerWidget *contents_;
 
   struct Rect {
-    long long x1, y1, x2, y2;
+    int64_t x1, y1, x2, y2;
     
-    Rect(long long x1_, long long y1_, long long x2_, long long y2_)
+    Rect(int64_t x1_, int64_t y1_, int64_t x2_, int64_t y2_)
       : x1(x1_), y1(y1_), x2(x2_), y2(y2_) { }
   };
 
-  typedef std::map<long long, WImage *> GridMap;
+  typedef std::map<int64_t, WImage *> GridMap;
   GridMap grid_;
 
   int gridImageSize_;
 
   int viewPortWidth_;
   int viewPortHeight_;
-  long long imageWidth_;
-  long long imageHeight_;
+  int64_t imageWidth_;
+  int64_t imageHeight_;
 
-  long long currentX_;
-  long long currentY_;
+  int64_t currentX_;
+  int64_t currentY_;
 
-  Rect neighbourhood(long long x, long long y, int marginX, int marginY);
-  long long gridKey(long long i, long long j);
-  void decodeKey(long long key, long long& i, long long& j);
-  void generateGridItems(long long newX, long long newY);
+  Rect neighbourhood(int64_t x, int64_t y, int marginX, int marginY);
+  int64_t gridKey(int64_t i, int64_t j);
+  void decodeKey(int64_t key, int64_t& i, int64_t& j);
+  void generateGridItems(int64_t newX, int64_t newY);
   void cleanGrid();
-  bool visible(long long i, long long j) const;
+  bool visible(int64_t i, int64_t j) const;
 
-  void internalScrollTo(long long x, long long y, bool moveViewPort);
+  void internalScrollTo(int64_t x, int64_t y, bool moveViewPort);
 
   JSlot mouseDownJS_, mouseMovedJS_, mouseUpJS_;
 };
Index: src/Wt/WVirtualImage.C
===================================================================
RCS file: /opt/cvs/wt/src/Wt/WVirtualImage.C,v
retrieving revision 1.2
diff -u -r1.2 WVirtualImage.C
--- src/Wt/WVirtualImage.C	9 Oct 2008 13:41:52 -0000	1.2
+++ src/Wt/WVirtualImage.C	1 Dec 2008 14:13:59 -0000
@@ -15,11 +15,11 @@
 
 namespace Wt {
 
-const long long WVirtualImage::Infinite
-  = std::numeric_limits<long long>::max();
+const int64_t WVirtualImage::Infinite
+  = std::numeric_limits<int64_t>::max();
 
 WVirtualImage::WVirtualImage(int viewPortWidth, int viewPortHeight,
-			     long long imageWidth, long long imageHeight,
+			     int64_t imageWidth, int64_t imageHeight,
 			     int gridImageSize,
 			     WContainerWidget *parent)
   : WCompositeWidget(parent),
@@ -116,7 +116,7 @@
   generateGridItems(currentX_, currentY_);
 }
 
-void WVirtualImage::resizeImage(long long w, long long h)
+void WVirtualImage::resizeImage(int64_t w, int64_t h)
 {
   imageWidth_ = w;
   imageHeight_ = h;
@@ -124,20 +124,20 @@
   redrawAll();
 }
 
-void WVirtualImage::scrollTo(long long newX, long long newY)
+void WVirtualImage::scrollTo(int64_t newX, int64_t newY)
 {
   internalScrollTo(newX, newY, true);
 }
 
-void WVirtualImage::internalScrollTo(long long newX, long long newY,
+void WVirtualImage::internalScrollTo(int64_t newX, int64_t newY,
 				     bool moveViewPort)
 {
   if (imageWidth_ != Infinite)
     newX = std::min(imageWidth_ - viewPortWidth_,
-		    std::max((long long)0, newX));
+		    std::max((int64_t)0, newX));
   if (imageHeight_ != Infinite)
     newY = std::min(imageHeight_ - viewPortHeight_,
-		    std::max((long long)0, newY));
+		    std::max((int64_t)0, newY));
 
   if (moveViewPort) {
     contents_->setOffsets((double)-newX, Left);
@@ -149,25 +149,25 @@
   viewPortChanged.emit(currentX_, currentY_);
 }
 
-void WVirtualImage::scroll(long long dx, long long dy)
+void WVirtualImage::scroll(int64_t dx, int64_t dy)
 {
   scrollTo(currentX_ + dx, currentY_ + dy);
 }
 
-WImage *WVirtualImage::createImage(long long x, long long y,
+WImage *WVirtualImage::createImage(int64_t x, int64_t y,
 				   int width, int height)
 {
   WResource *r = render(x, y, width, height);
   return new WImage(r, "");
 }
 
-WResource *WVirtualImage::render(long long x, long long y,
+WResource *WVirtualImage::render(int64_t x, int64_t y,
 				 int width, int height)
 {
   throw WtException("You should reimplement WVirtualImage::render()");
 }
 
-void WVirtualImage::generateGridItems(long long newX, long long newY)
+void WVirtualImage::generateGridItems(int64_t newX, int64_t newY)
 {
   /*
    * The coordinates of the two extreme corners of the new rendered
@@ -175,22 +175,22 @@
    */
   Rect newNb = neighbourhood(newX, newY, viewPortWidth_, viewPortHeight_);  
 
-  long long i1 = newNb.x1 / gridImageSize_;
-  long long j1 = newNb.y1 / gridImageSize_;
-  long long i2 = newNb.x2 / gridImageSize_ + 1;
-  long long j2 = newNb.y2 / gridImageSize_ + 1;
+  int64_t i1 = newNb.x1 / gridImageSize_;
+  int64_t j1 = newNb.y1 / gridImageSize_;
+  int64_t i2 = newNb.x2 / gridImageSize_ + 1;
+  int64_t j2 = newNb.y2 / gridImageSize_ + 1;
 
   for (int invisible = 0; invisible < 2; ++invisible) {
-    for (long long i = i1; i < i2; ++i)
-      for (long long j = j1; j < j2; ++j) {
-	long long key = gridKey(i, j);
+    for (int64_t i = i1; i < i2; ++i)
+      for (int64_t j = j1; j < j2; ++j) {
+	int64_t key = gridKey(i, j);
 
 	GridMap::iterator it = grid_.find(key);
 	if (it == grid_.end()) {
 	  bool v = visible(i, j);
 	  if ((v && !invisible) || (!v && invisible)) {
-	    long long brx = i * gridImageSize_ + gridImageSize_;
-	    long long bry = j * gridImageSize_ + gridImageSize_;
+	    int64_t brx = i * gridImageSize_ + gridImageSize_;
+	    int64_t bry = j * gridImageSize_ + gridImageSize_;
 	    brx = std::min(brx, imageWidth_);
 	    bry = std::min(bry, imageHeight_);
 
@@ -216,24 +216,24 @@
   cleanGrid();
 }
 
-long long WVirtualImage::gridKey(long long i, long long j)
+int64_t WVirtualImage::gridKey(int64_t i, int64_t j)
 {
   return i * 1000 + j; // I should consider fixing this properly ...
 }
 
-bool WVirtualImage::visible(long long i, long long j) const
+bool WVirtualImage::visible(int64_t i, int64_t j) const
 {
-  long long x1 = i * gridImageSize_;
-  long long y1 = j * gridImageSize_;
-  long long x2 = x1 + gridImageSize_;
-  long long y2 = y1 + gridImageSize_;
+  int64_t x1 = i * gridImageSize_;
+  int64_t y1 = j * gridImageSize_;
+  int64_t x2 = x1 + gridImageSize_;
+  int64_t y2 = y1 + gridImageSize_;
 
   return ((x2 >= currentX_) && (y2 >= currentY_)
 	  && (x1 <= currentX_ + viewPortWidth_)
 	  && (y1 <= currentY_ + viewPortHeight_));
 }
 
-void WVirtualImage::decodeKey(long long key, long long& i, long long& j)
+void WVirtualImage::decodeKey(int64_t key, int64_t& i, int64_t& j)
 {
   i = key / 1000;
   j = key % 1000;
@@ -244,13 +244,13 @@
   Rect cleanNb = neighbourhood(currentX_, currentY_, 
 			       viewPortWidth_ * 3, viewPortHeight_ * 3);
 
-  long long i1 = cleanNb.x1 / gridImageSize_;
-  long long j1 = cleanNb.y1 / gridImageSize_;
-  long long i2 = cleanNb.x2 / gridImageSize_ + 1;
-  long long j2 = cleanNb.y2 / gridImageSize_ + 1;
+  int64_t i1 = cleanNb.x1 / gridImageSize_;
+  int64_t j1 = cleanNb.y1 / gridImageSize_;
+  int64_t i2 = cleanNb.x2 / gridImageSize_ + 1;
+  int64_t j2 = cleanNb.y2 / gridImageSize_ + 1;
 
   for (GridMap::iterator it = grid_.begin(); it != grid_.end();) {
-    long long i, j;
+    int64_t i, j;
     decodeKey(it->first, i, j);
 
     if (i < i1 || i > i2 || j < j1 || j > j2) {
@@ -264,21 +264,21 @@
   }
 }
 
-WVirtualImage::Rect WVirtualImage::neighbourhood(long long x, long long y,
+WVirtualImage::Rect WVirtualImage::neighbourhood(int64_t x, int64_t y,
 						 int marginX, int marginY)
 {
-  long long x1 = x - marginX;
+  int64_t x1 = x - marginX;
 
   if (imageWidth_ != Infinite)
-    x1 = std::max((long long)0, x1);
+    x1 = std::max((int64_t)0, x1);
 
-  long long y1 = std::max((long long)0, y - marginY);
+  int64_t y1 = std::max((int64_t)0, y - marginY);
 
-  long long x2 = x + viewPortWidth_ + marginX;
+  int64_t x2 = x + viewPortWidth_ + marginX;
   if (imageWidth_ != Infinite)
     x2 = std::min(imageWidth_, x2);
   
-  long long y2 = std::min(imageHeight_, y + viewPortHeight_ + marginY);
+  int64_t y2 = std::min(imageHeight_, y + viewPortHeight_ + marginY);
 
   return Rect(x1, y1, x2, y2);
 }
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to