]> source.dussan.org Git - tigervnc.git/commitdiff
Merged the rdr library with VNC 4.1.1.
authorConstantin Kaplinsky <const@tightvnc.com>
Wed, 28 Sep 2005 10:37:29 +0000 (10:37 +0000)
committerConstantin Kaplinsky <const@tightvnc.com>
Wed, 28 Sep 2005 10:37:29 +0000 (10:37 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@333 3789f03b-4d11-0410-bbf8-ca57d06f2519

27 files changed:
rdr/Exception.cxx
rdr/Exception.h
rdr/FdInStream.cxx
rdr/FdInStream.h
rdr/FdOutStream.cxx
rdr/FdOutStream.h
rdr/FixedMemOutStream.h
rdr/HexInStream.cxx
rdr/HexInStream.h
rdr/HexOutStream.cxx
rdr/HexOutStream.h
rdr/InStream.cxx
rdr/InStream.h
rdr/Makefile.in
rdr/MemInStream.h
rdr/MemOutStream.h
rdr/NullOutStream.cxx [deleted file]
rdr/NullOutStream.h [deleted file]
rdr/RandomStream.cxx
rdr/RandomStream.h
rdr/SubstitutingInStream.h
rdr/ZlibInStream.cxx
rdr/ZlibInStream.h
rdr/ZlibOutStream.cxx
rdr/ZlibOutStream.h
rdr/types.h
rfb/Exception.h

index 5f7799f1adb74216ab1fbc7b10e476cbd253e692..1fcd154f94257a7eec6d22b089d2a17bb0a61172 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2003 RealVNC Ltd.  All Rights Reserved.
- *    
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -17,7 +17,7 @@
  */
 #include <rdr/Exception.h>
 #ifdef _WIN32
-#define WIN32_LEAN_AND_MEAN
+#include <tchar.h>
 #include <windows.h>
 #include <winsock2.h>
 #endif
@@ -25,7 +25,7 @@
 using namespace rdr;
 
 SystemException::SystemException(const char* s, int err_)
-  : Exception(s, "rdr::SystemException"), err(err_)
+  : Exception(s), err(err_)
 {
   strncat(str_, ": ", len-1-strlen(str_));
 #ifdef _WIN32
@@ -48,17 +48,26 @@ SystemException::SystemException(const char* s, int err_)
                              str_+strlen(str_), len-strlen(str_), 0, 0);
     delete [] tmsg;
 #else
+    char* currStr = str_+strlen(str_);
     FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
-                  0, err, 0, str_+strlen(str_), len-1-strlen(str_), 0);
+                  0, err, 0, currStr, len-1-strlen(str_), 0);
 #endif
+    int l = strlen(str_);
+    if ((l >= 2) && (str_[l-2] == '\r') && (str_[l-1] == '\n'))
+      str_[l-2] = 0;
   }
-    
+
 #else
   strncat(str_, strerror(err), len-1-strlen(str_));
 #endif
   strncat(str_, " (", len-1-strlen(str_));
   char buf[20];
-  sprintf(buf,"%d",err);
+#ifdef WIN32
+  if (err < 0)
+    sprintf(buf, "%x", err);
+  else
+#endif
+    sprintf(buf,"%d",err);
   strncat(str_, buf, len-1-strlen(str_));
   strncat(str_, ")", len-1-strlen(str_));
 }
index 98b3f0e99fad0473bf2fea23b557e067d10ad60b..1b92f7778e5d11ba2584f85606c83f645c4cdcd3 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2003 RealVNC Ltd.  All Rights Reserved.
- *    
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -27,18 +27,14 @@ namespace rdr {
   struct Exception {
     enum { len = 256 };
     char str_[len];
-    char type_[len];
-    Exception(const char* s=0, const char* e="rdr::Exception") {
+    Exception(const char* s=0) {
       str_[0] = 0;
       if (s)
         strncat(str_, s, len-1);
       else
         strcat(str_, "Exception");
-      type_[0] = 0;
-      strncat(type_, e, len-1);
     }
     virtual const char* str() const { return str_; }
-    virtual const char* type() const { return type_; }
   };
 
   struct SystemException : public Exception {
@@ -47,12 +43,15 @@ namespace rdr {
   }; 
 
   struct TimedOut : public Exception {
-    TimedOut(const char* s="Timed out") : Exception(s,"rdr::TimedOut") {}
+    TimedOut(const char* s="Timed out") : Exception(s) {}
   };
  
   struct EndOfStream : public Exception {
-    EndOfStream(const char* s="End of stream")
-      : Exception(s,"rdr::EndOfStream") {}
+    EndOfStream(const char* s="End of stream") : Exception(s) {}
+  };
+
+  struct FrameException : public Exception {
+    FrameException(const char* s="Frame exception") : Exception(s) {}
   };
 }
 
index b65566dc084bd5d0b9a15d26c9ba156e08dd64d4..f64f68e172593d0746723ab7a71b139109d9e7a1 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2003 RealVNC Ltd.  All Rights Reserved.
- *    
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
index d038b1b323e2bd859e73aacf2e79f34cf02bd7e1..5d9598c82c250a82693749dd310114a3c48178dd 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2003 RealVNC Ltd.  All Rights Reserved.
- *    
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
index a9075cc969b4b93e97cde54cc5d7e7e892f5ed12..e65133dac83c327b42c95fbfa37bfe51f6fd19a5 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2003 RealVNC Ltd.  All Rights Reserved.
- *    
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
index 5294b7044ca9b4769434e744e8c762599e6d4c8f..a3e29127921cf7320c05a3a503da82832428fb3f 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2003 RealVNC Ltd.  All Rights Reserved.
- *    
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
index f149e600b73a2680ac61f451b5b23ab8be0c73aa..e4ec52cbd3c02dd995688ecadee5302bd2e7873d 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2003 RealVNC Ltd.  All Rights Reserved.
- *    
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
index a454ca8e49f7a5f6f68b698bd5b39fa412238e41..80f8a7967496e6978d27a1a0bb71b87116cda0ff 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2004 RealVNC Ltd.  All Rights Reserved.
- *    
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
index fbfc27381b2cc83c5945dd7dce9916b9b9b20ac3..6bfb84338473d525f5249533dab93d96ddbfb12c 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2003 RealVNC Ltd.  All Rights Reserved.
- *    
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
index f82d9f5505e1a3a0bbb263ce0829ec0a603ccf1d..9b0b6c4d1a9802da8c13a110fa60889465874087 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2004 RealVNC Ltd.  All Rights Reserved.
- *    
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
index 691a16bc1518a80300d3d7e6116cd365d9a7728f..10247e6839cfa966df3d2ca924120a58304fa23c 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2004 RealVNC Ltd.  All Rights Reserved.
- *    
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
index 13a6fa19699d678d33c482bd4f9f5e7aeaa287fd..a413b6c1bbbbe4c514a006805515b0a544baefef 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2003 RealVNC Ltd.  All Rights Reserved.
- *    
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
index a3eeaadad7d042b59fca87c4bfce6e05e070b2e1..6d22ac6af509f9305f729435bd93274a81458a6f 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2003 RealVNC Ltd.  All Rights Reserved.
- *    
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
index 9edf28421bd4e811e77bf7057349e83765ed7a9a..09fa5544aef4e2d8d7b3f8236386d99641986c0b 100644 (file)
@@ -1,6 +1,6 @@
 
 SRCS = Exception.cxx FdInStream.cxx FdOutStream.cxx InStream.cxx \
-       NullOutStream.cxx RandomStream.cxx ZlibInStream.cxx ZlibOutStream.cxx \
+       RandomStream.cxx ZlibInStream.cxx ZlibOutStream.cxx \
        HexInStream.cxx HexOutStream.cxx
 
 OBJS = $(SRCS:.cxx=.o)
index 2b05e3dfa0b8da78757ccc0e58a5a79d427f3bdc..77ca3f3a58121e099ad5fa799ec6140853ad0993 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2003 RealVNC Ltd.  All Rights Reserved.
- *    
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
index 3456f5c7ef214bf26f544e3c12352eed26318e91..ee3e9500fd956fdc3be87cc2f0e0ea3fc107eb70 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2003 RealVNC Ltd.  All Rights Reserved.
- *    
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -48,6 +48,7 @@ namespace rdr {
 
     int length() { return ptr - start; }
     void clear() { ptr = start; };
+    void clearAndZero() { memset(start, 0, ptr-start); clear(); }
     void reposition(int pos) { ptr = start + pos; }
 
     // data() returns a pointer to the buffer.
diff --git a/rdr/NullOutStream.cxx b/rdr/NullOutStream.cxx
deleted file mode 100644 (file)
index e940f2a..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Copyright (C) 2002-2003 RealVNC Ltd.  All Rights Reserved.
- *    
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
- * USA.
- */
-
-#include <rdr/NullOutStream.h>
-#include <rdr/Exception.h>
-
-using namespace rdr;
-
-static const int bufferSize = 1024;
-
-NullOutStream::NullOutStream()
-  : offset(0)
-{
-  start = ptr = new U8[bufferSize];
-  end = start + bufferSize;
-}
-
-NullOutStream::~NullOutStream()
-{
-  delete [] start;
-}
-
-int NullOutStream::length()
-{
-  return offset + ptr - start;
-}
-
-void NullOutStream::writeBytes(const void* data, int length)
-{
-  offset += length;
-}
-
-int NullOutStream::overrun(int itemSize, int nItems)
-{
-  if (itemSize > bufferSize)
-    throw Exception("NullOutStream overrun: max itemSize exceeded");
-
-  offset += ptr - start;
-  ptr = start;
-
-  if (itemSize * nItems > end - ptr)
-    nItems = (end - ptr) / itemSize;
-
-  return nItems;
-}
diff --git a/rdr/NullOutStream.h b/rdr/NullOutStream.h
deleted file mode 100644 (file)
index 84a56e5..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 2002-2003 RealVNC Ltd.  All Rights Reserved.
- *    
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
- * USA.
- */
-
-#ifndef __RDR_NULLOUTSTREAM_H__
-#define __RDR_NULLOUTSTREAM_H__
-
-#include <rdr/OutStream.h>
-
-namespace rdr {
-
-  class NullOutStream : public OutStream {
-
-  public:
-    NullOutStream();
-    virtual ~NullOutStream();
-    int length();
-    void writeBytes(const void* data, int length);
-
-  private:
-    int overrun(int itemSize, int nItems);
-    int offset;
-    U8* start;
-  };
-
-}
-
-#endif
index 7f62e091f988e45bd554f8ea74b749a8648fd93c..7056c2ccf3d40b71f1693b2e5965599bf9bec24b 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2003 RealVNC Ltd.  All Rights Reserved.
- *    
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -25,6 +25,9 @@
 #include <errno.h>
 #else
 #define getpid() GetCurrentProcessId()
+#ifndef RFB_HAVE_WINCRYPT
+#pragma message("  NOTE: Not building WinCrypt-based RandomStream")
+#endif
 #endif
 
 using namespace rdr;
@@ -38,7 +41,7 @@ RandomStream::RandomStream()
 {
   ptr = end = start = new U8[DEFAULT_BUF_LEN];
 
-#ifdef WIN32
+#ifdef RFB_HAVE_WINCRYPT
   provider = 0;
   if (!CryptAcquireContext(&provider, 0, 0, PROV_RSA_FULL, 0)) {
     if (GetLastError() == NTE_BAD_KEYSET) {
@@ -53,10 +56,14 @@ RandomStream::RandomStream()
   }
   if (!provider) {
 #else
+#ifndef WIN32
   fp = fopen("/dev/urandom", "r");
   if (!fp)
     fp = fopen("/dev/random", "r");
   if (!fp) {
+#else
+  {
+#endif
 #endif
     fprintf(stderr,"RandomStream: warning: no OS supplied random source - using rand()\n");
     seed += (unsigned int) time(0) + getpid() + getpid() * 987654 + rand();
@@ -67,11 +74,11 @@ RandomStream::RandomStream()
 RandomStream::~RandomStream() {
   delete [] start;
 
-#ifdef WIN32
-  if (provider) {
+#ifdef RFB_HAVE_WINCRYPT
+  if (provider)
     CryptReleaseContext(provider, 0);
-  }
-#else
+#endif
+#ifndef WIN32
   if (fp) fclose(fp);
 #endif
 }
@@ -93,20 +100,25 @@ int RandomStream::overrun(int itemSize, int nItems, bool wait) {
 
   int length = start + DEFAULT_BUF_LEN - end;
 
-#ifdef WIN32
+#ifdef RFB_HAVE_WINCRYPT
   if (provider) {
     if (!CryptGenRandom(provider, length, (U8*)end))
       throw rdr::SystemException("unable to CryptGenRandom", GetLastError());
     end += length;
+  } else {
 #else
+#ifndef WIN32
   if (fp) {
     int n = fread((U8*)end, length, 1, fp);
     if (n != 1)
       throw rdr::SystemException("reading /dev/urandom or /dev/random failed",
                                  errno);
     end += length;
-#endif
   } else {
+#else
+  {
+#endif
+#endif
     for (int i=0; i<length; i++)
       *(U8*)end++ = (int) (256.0*rand()/(RAND_MAX+1.0));
   }
index c4aaaa6a126e1b2f8bb8d58f292907d878afdf7c..c33360d73796a3642c6872204d8fcaf64713c3db 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2003 RealVNC Ltd.  All Rights Reserved.
- *    
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
 #include <rdr/InStream.h>
 
 #ifdef WIN32
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0400
-#endif
-#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <wincrypt.h>
+#ifdef WINCRYPT32API
+#define RFB_HAVE_WINCRYPT
+#endif
 #endif
 
 namespace rdr {
@@ -50,9 +49,10 @@ namespace rdr {
     int offset;
 
     static unsigned int seed;
-#ifdef WIN32
+#ifdef RFB_HAVE_WINCRYPT
     HCRYPTPROV provider;
-#else
+#endif
+#ifndef WIN32
     FILE* fp;
 #endif
 
index 3a0559b74f7b030a01ce57f32347306820620900..325b01c5e9df6a2eff2866aff4fab4cc0e134e55 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2004 RealVNC Ltd.  All Rights Reserved.
- *    
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
index 52e4dd3558778a26e87ae4474ebfb4a3d02b916e..6f3a7d02fb7b33181004bc0ce82fef0cc01b55bb 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2003 RealVNC Ltd.  All Rights Reserved.
- *    
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
index 81eb161c14400f082dc0bc73bf2355c8b339d80e..c26b6d638bc1fb96b1f02b98160c7a50fc9512fa 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2003 RealVNC Ltd.  All Rights Reserved.
- *    
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
index 6aadde132a86bc3e62551a32967c4e2bf3861c23..181e35679f52df148f22a8e4363245d7fa7731bc 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2004 RealVNC Ltd.  All Rights Reserved.
- *    
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
index e51db73b921588980653a88d2e8648bbe78d2c40..7d737c1473c2b77169145c961e60e59542006cb1 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2004 RealVNC Ltd.  All Rights Reserved.
- *    
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
index 3798c9756f14e40dfa0d5c629a291a7897c797f9..6421b13726536efd5265303cc2f19c935431a009 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2004 RealVNC Ltd.  All Rights Reserved.
- *    
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -51,6 +51,16 @@ namespace rdr {
     U16* buf;
   };
 
+  class U32Array {
+  public:
+    U32Array() : buf(0) {}
+    U32Array(U32* a) : buf(a) {} // note: assumes ownership
+    U32Array(int len) : buf(new U32[len]) {}
+    ~U32Array() { delete [] buf; }
+    U32* takeBuf() { U32* tmp = buf; buf = 0; return tmp; }
+    U32* buf;
+  };
+
 } // end of namespace rdr
 
 #endif
index aa98271b80e74b8fc62ce12ec0b828a09bb5b962..7c2cbcaab6cd8bbce85acedd174fc8bffad967c8 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2003 RealVNC Ltd.  All Rights Reserved.
- *    
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
 #include <rdr/Exception.h>
 
 namespace rfb {
-  struct Exception : public rdr::Exception {
-    Exception(const char* s=0, const char* e="rfb::Exception")
-      : rdr::Exception(s,e) {}
-  };
+  typedef rdr::Exception Exception;
   struct AuthFailureException : public Exception {
     AuthFailureException(const char* s="Authentication failure")
-      : Exception(s,"rfb::AuthFailureException") {}
+      : Exception(s) {}
+  };
+  struct AuthCancelledException : public rfb::Exception {
+    AuthCancelledException(const char* s="Authentication cancelled")
+      : Exception(s) {}
   };
   struct ConnFailedException : public Exception {
-    ConnFailedException(const char* s="Connection failed")
-      : Exception(s,"rfb::ConnFailedException") {}
+    ConnFailedException(const char* s="Connection failed") : Exception(s) {}
   };
 }
 #endif