Real VNC 4.X

Russell Jackson raj at cserv62.csub.edu
Thu Dec 9 22:35:32 PST 2004


James Raftery wrote:
> Hi,
> 
> On Wed, Dec 01, 2004 at 10:21:36AM -0600, Vladimir Egorin wrote:
> 
>>See if http://www.math.uic.edu/~vladimir/vnc4.tar.gz works for you.
>>I'll try to submit an update if the maintainer doesn't get
>>around to updating the port soon (I probably did a worse job
>>than he did).
> 
> 
> I don't think so :)
> 
> That port skeleton fails to build Xvnc on 4.x i386. What's been holding
> up an update to VNC 4.0 is trying to get a port that can build a VNC
> server on both 4.x and 5.x, and on non-i386 platforms.
> 
> I'm considering proposing a new `vnc4' port to get VNC 4.0 into ports
> without removing the (working) 3.3.7 port.
> 
> 
> All the best,
> james

While not fixing the 4.x problem, I have come up with a patch to compile 
on 5.x with gcc 3.4. Hope it helps.

--- begin patch ---

--- rfb/ComparingUpdateTracker.cxx	Mon Apr 12 08:53:11 2004
+++ rfb/ComparingUpdateTracker.cxx	Thu Dec  9 21:40:35 2004
@@ -20,6 +20,7 @@
  #include <rdr/types.h>
  #include <rfb/Exception.h>
  #include <rfb/ComparingUpdateTracker.h>
+#include <algorithm>

  using namespace rfb;

@@ -60,7 +61,7 @@
      // since in effect the entire framebuffer has changed.
      oldFb.setSize(fb->width(), fb->height());
      for (int y=0; y<fb->height(); y+=BLOCK_SIZE) {
-      Rect pos(0, y, fb->width(), min(fb->height(), y+BLOCK_SIZE));
+      Rect pos(0, y, fb->width(), std::min(fb->height(), y+BLOCK_SIZE));
        int srcStride;
        const rdr::U8* srcData = fb->getPixelsR(pos, &srcStride);
        oldFb.imageRect(pos, srcData, srcStride);
@@ -100,20 +101,20 @@
    for (int blockTop = r.tl.y; blockTop < r.br.y; blockTop += BLOCK_SIZE)
    {
      // Get a strip of the source buffer
-    Rect pos(r.tl.x, blockTop, r.br.x, min(r.br.y, blockTop+BLOCK_SIZE));
+    Rect pos(r.tl.x, blockTop, r.br.x, std::min(r.br.y, 
blockTop+BLOCK_SIZE));
      int fbStride;
      const rdr::U8* newBlockPtr = fb->getPixelsR(pos, &fbStride);
      int newStrideBytes = fbStride * bytesPerPixel;

      rdr::U8* oldBlockPtr = oldData;
-    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)
      {
        const 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++)
--- rfb/Rect.h	Mon Jun 30 13:50:25 2003
+++ rfb/Rect.h	Thu Dec  9 21:37:34 2004
@@ -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 {
--- rfb/hextileDecode.h	Thu Jul 31 11:03:38 2003
+++ rfb/hextileDecode.h	Thu Dec  9 21:39:27 2004
@@ -26,6 +26,7 @@

  #include <rdr/InStream.h>
  #include <rfb/hextileConstants.h>
+#include <algorithm>

  namespace rfb {

@@ -52,11 +53,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();

--- rfb/hextileEncode.h	Thu Jul 31 11:03:38 2003
+++ rfb/hextileEncode.h	Thu Dec  9 21:42:00 2004
@@ -25,6 +25,7 @@

  #include <rdr/OutStream.h>
  #include <rfb/hextileConstants.h>
+#include <algorithm>

  namespace rfb {

@@ -60,11 +61,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);

--- rfb/zrleDecode.h	Thu Jul 31 11:03:38 2003
+++ rfb/zrleDecode.h	Thu Dec  9 21:41:22 2004
@@ -28,6 +28,7 @@
  #include <rdr/InStream.h>
  #include <rdr/ZlibInStream.h>
  #include <assert.h>
+#include <algorithm>

  namespace rfb {

@@ -61,11 +62,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;
--- rfb/zrleEncode.h	Fri Jun 11 08:13:52 2004
+++ rfb/zrleEncode.h	Thu Dec  9 21:43:16 2004
@@ -32,6 +32,7 @@
  #include <rdr/OutStream.h>
  #include <rdr/ZlibOutStream.h>
  #include <assert.h>
+#include <algorithm>

  namespace rfb {

@@ -130,7 +131,7 @@

    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);

      if (os->length() + worstCaseLine > maxLen) {
        if (t.tl.y == r.tl.y)
@@ -143,7 +144,7 @@

      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);

--- tx/TXImage.cxx	Thu Mar 18 09:25:19 2004
+++ tx/TXImage.cxx	Thu Dec  9 21:45:04 2004
@@ -31,6 +31,7 @@
  #include <rfb/TransImageGetter.h>
  #include <rfb/Exception.h>
  #include <rfb/LogWriter.h>
+#include <algorithm>
  #include "TXWindow.h"
  #include "TXImage.h"

@@ -71,8 +72,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;

--- end patch ---


More information about the freebsd-ports mailing list