The use of macros for min() and max() interferes with STL, which
defines std::min and std::max in <algorithm>. Here is a patch to use
the STL-provided definitions instead. This prevents several errors
when compiling with the 3.4 branch of GCC (in CVS).
Tim.
*/
--- vnc-4.0b4-unixsrc/rfb/Rect.h.gcc34 2003-06-30 21:50:25.000000000 +0100
+++ vnc-4.0b4-unixsrc/rfb/Rect.h 2004-02-01 17:33:31.000000000 +0000
@@ -21,13 +21,7 @@
#ifndef __RFB_RECT_INCLUDED__
#define __RFB_RECT_INCLUDED__
-#ifndef max
-#define max(a,b) (((a) > (b)) ? (a) : (b))
-#endif
-
-#ifndef min
-#define min(a,b) (((a) < (b)) ? (a) : (b))
-#endif
+#include <algorithm>
namespace rfb {
@@ -70,20 +64,20 @@
}
inline Rect intersect(const Rect &r) const {
Rect result;
- result.tl.x = max(tl.x, r.tl.x);
- result.tl.y = max(tl.y, r.tl.y);
- result.br.x = max(min(br.x, r.br.x), result.tl.x);
- result.br.y = max(min(br.y, r.br.y), result.tl.y);
+ result.tl.x = std::max(tl.x, r.tl.x);
+ result.tl.y = std::max(tl.y, r.tl.y);
+ result.br.x = std::max(std::min(br.x, r.br.x), result.tl.x);
+ result.br.y = std::max(std::min(br.y, r.br.y), result.tl.y);
return result;
}
inline Rect union_boundary(const Rect &r) const {
if (r.is_empty()) return *this;
if (is_empty()) return r;
Rect result;
- result.tl.x = min(tl.x, r.tl.x);
- result.tl.y = min(tl.y, r.tl.y);
- result.br.x = max(br.x, r.br.x);
- result.br.y = max(br.y, r.br.y);
+ result.tl.x = std::min(tl.x, r.tl.x);
+ result.tl.y = std::min(tl.y, r.tl.y);
+ result.br.x = std::max(br.x, r.br.x);
+ result.br.y = std::max(br.y, r.br.y);
return result;
}
inline Rect translate(const Point &p) const {
--- vnc-4.0b4-unixsrc/rfb/ComparingUpdateTracker.cxx.gcc34 2003-05-30
11:42:37.000000000 +0100
+++ vnc-4.0b4-unixsrc/rfb/ComparingUpdateTracker.cxx 2004-02-01 17:33:31.000000000
+0000
@@ -96,13 +96,13 @@
rdr::U8* oldBlockPtr = (((rdr::U8*)oldFb.data) + blockTop * oldStrideBytes
+ r.tl.x * bytesPerPixel);
- int blockBottom = min(blockTop+BLOCK_SIZE, r.br.y);
+ int blockBottom = std::min(blockTop+BLOCK_SIZE, r.br.y);
for (int blockLeft = r.tl.x; blockLeft < r.br.x; blockLeft += BLOCK_SIZE)
{
rdr::U8* newPtr = newBlockPtr;
rdr::U8* oldPtr = oldBlockPtr;
- int blockRight = min(blockLeft+BLOCK_SIZE, r.br.x);
+ int blockRight = std::min(blockLeft+BLOCK_SIZE, r.br.x);
int blockWidthInBytes = (blockRight-blockLeft) * bytesPerPixel;
for (int y = blockTop; y < blockBottom; y++)
--- vnc-4.0b4-unixsrc/rfb/Cursor.cxx.gcc34 2004-02-01 17:33:31.000000000 +0000
+++ vnc-4.0b4-unixsrc/rfb/Cursor.cxx 2004-02-01 17:33:31.000000000 +0000
@@ -133,8 +133,8 @@
int byte = y * maskBytesPerRow + x / 8;
int bit = 7 - x % 8;
if (mask.buf[byte] & (1 << bit)) {
- busy.br.y = max(busy.br.y, y+1);
- busy.br.x = max(busy.br.x, x+1);
+ busy.br.y = std::max(busy.br.y, y+1);
+ busy.br.x = std::max(busy.br.x, x+1);
break;
}
}
--- vnc-4.0b4-unixsrc/rfb/hextileDecode.h.gcc34 2003-07-31 19:03:38.000000000 +0100
+++ vnc-4.0b4-unixsrc/rfb/hextileDecode.h 2004-02-01 17:33:31.000000000 +0000
@@ -52,11 +52,11 @@
for (t.tl.y = r.tl.y; t.tl.y < r.br.y; t.tl.y += 16) {
- t.br.y = min(r.br.y, t.tl.y + 16);
+ t.br.y = std::min(r.br.y, t.tl.y + 16);
for (t.tl.x = r.tl.x; t.tl.x < r.br.x; t.tl.x += 16) {
- t.br.x = min(r.br.x, t.tl.x + 16);
+ t.br.x = std::min(r.br.x, t.tl.x + 16);
int tileType = is->readU8();
--- vnc-4.0b4-unixsrc/rfb/hextileEncode.h.gcc34 2003-07-31 19:03:38.000000000 +0100
+++ vnc-4.0b4-unixsrc/rfb/hextileEncode.h 2004-02-01 17:33:31.000000000 +0000
@@ -60,11 +60,11 @@
for (t.tl.y = r.tl.y; t.tl.y < r.br.y; t.tl.y += 16) {
- t.br.y = min(r.br.y, t.tl.y + 16);
+ t.br.y = std::min(r.br.y, t.tl.y + 16);
for (t.tl.x = r.tl.x; t.tl.x < r.br.x; t.tl.x += 16) {
- t.br.x = min(r.br.x, t.tl.x + 16);
+ t.br.x = std::min(r.br.x, t.tl.x + 16);
GET_IMAGE_INTO_BUF(t,buf);
--- vnc-4.0b4-unixsrc/rfb/zrleEncode.h.gcc34 2003-07-31 19:03:38.000000000 +0100
+++ vnc-4.0b4-unixsrc/rfb/zrleEncode.h 2004-02-01 17:33:31.000000000 +0000
@@ -126,11 +126,11 @@
for (t.tl.y = r.tl.y; t.tl.y < r.br.y; t.tl.y += 64) {
- t.br.y = min(r.br.y, t.tl.y + 64);
+ t.br.y = std::min(r.br.y, t.tl.y + 64);
for (t.tl.x = r.tl.x; t.tl.x < r.br.x; t.tl.x += 64) {
- t.br.x = min(r.br.x, t.tl.x + 64);
+ t.br.x = std::min(r.br.x, t.tl.x + 64);
GET_IMAGE_INTO_BUF(t,buf);
--- vnc-4.0b4-unixsrc/rfb/zrleDecode.h.gcc34 2003-07-31 19:03:38.000000000 +0100
+++ vnc-4.0b4-unixsrc/rfb/zrleDecode.h 2004-02-01 17:33:31.000000000 +0000
@@ -61,11 +61,11 @@
for (t.tl.y = r.tl.y; t.tl.y < r.br.y; t.tl.y += 64) {
- t.br.y = min(r.br.y, t.tl.y + 64);
+ t.br.y = std::min(r.br.y, t.tl.y + 64);
for (t.tl.x = r.tl.x; t.tl.x < r.br.x; t.tl.x += 64) {
- t.br.x = min(r.br.x, t.tl.x + 64);
+ t.br.x = std::min(r.br.x, t.tl.x + 64);
int mode = zis->readU8();
bool rle = mode & 128;
--- vnc-4.0b4-unixsrc/tx/TXImage.cxx.gcc34 2004-02-01 17:36:15.000000000 +0000
+++ vnc-4.0b4-unixsrc/tx/TXImage.cxx 2004-02-01 17:36:29.000000000 +0000
@@ -71,8 +71,8 @@
if (w == width() && h == height()) return;
int oldStrideBytes = getStride() * (format.bpp/8);
- int rowsToCopy = min(h, height());
- int bytesPerRow = min(w, width()) * (format.bpp/8);
+ int rowsToCopy = std::min(h, height());
+ int bytesPerRow = std::min(w, width()) * (format.bpp/8);
rdr::U8* oldData = 0;
bool allocData = false;
_______________________________________________
VNC-List mailing list
[EMAIL PROTECTED]
To remove yourself from the list visit:
http://www.realvnc.com/mailman/listinfo/vnc-list