aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorConstantin Kaplinsky <const@tightvnc.com>2005-09-28 10:37:29 +0000
committerConstantin Kaplinsky <const@tightvnc.com>2005-09-28 10:37:29 +0000
commitb0f89f834aaad65ab5f9988ca187f45724a1b8d0 (patch)
treeced53843f754a28f715c462f5859882c05ad4368
parent6ea636b217b42f3f8fb681eb4bdee0738e0ed7d4 (diff)
downloadtigervnc-b0f89f834aaad65ab5f9988ca187f45724a1b8d0.tar.gz
tigervnc-b0f89f834aaad65ab5f9988ca187f45724a1b8d0.zip
Merged the rdr library with VNC 4.1.1.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@333 3789f03b-4d11-0410-bbf8-ca57d06f2519
-rw-r--r--rdr/Exception.cxx23
-rw-r--r--rdr/Exception.h19
-rw-r--r--rdr/FdInStream.cxx4
-rw-r--r--rdr/FdInStream.h4
-rw-r--r--rdr/FdOutStream.cxx4
-rw-r--r--rdr/FdOutStream.h4
-rw-r--r--rdr/FixedMemOutStream.h4
-rw-r--r--rdr/HexInStream.cxx4
-rw-r--r--rdr/HexInStream.h4
-rw-r--r--rdr/HexOutStream.cxx4
-rw-r--r--rdr/HexOutStream.h4
-rw-r--r--rdr/InStream.cxx4
-rw-r--r--rdr/InStream.h4
-rw-r--r--rdr/Makefile.in2
-rw-r--r--rdr/MemInStream.h4
-rw-r--r--rdr/MemOutStream.h5
-rw-r--r--rdr/NullOutStream.cxx60
-rw-r--r--rdr/NullOutStream.h42
-rw-r--r--rdr/RandomStream.cxx30
-rw-r--r--rdr/RandomStream.h16
-rw-r--r--rdr/SubstitutingInStream.h4
-rw-r--r--rdr/ZlibInStream.cxx4
-rw-r--r--rdr/ZlibInStream.h4
-rw-r--r--rdr/ZlibOutStream.cxx4
-rw-r--r--rdr/ZlibOutStream.h4
-rw-r--r--rdr/types.h14
-rw-r--r--rfb/Exception.h18
27 files changed, 113 insertions, 184 deletions
diff --git a/rdr/Exception.cxx b/rdr/Exception.cxx
index 5f7799f1..1fcd154f 100644
--- a/rdr/Exception.cxx
+++ b/rdr/Exception.cxx
@@ -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_));
}
diff --git a/rdr/Exception.h b/rdr/Exception.h
index 98b3f0e9..1b92f777 100644
--- a/rdr/Exception.h
+++ b/rdr/Exception.h
@@ -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) {}
};
}
diff --git a/rdr/FdInStream.cxx b/rdr/FdInStream.cxx
index b65566dc..f64f68e1 100644
--- a/rdr/FdInStream.cxx
+++ b/rdr/FdInStream.cxx
@@ -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
diff --git a/rdr/FdInStream.h b/rdr/FdInStream.h
index d038b1b3..5d9598c8 100644
--- a/rdr/FdInStream.h
+++ b/rdr/FdInStream.h
@@ -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
diff --git a/rdr/FdOutStream.cxx b/rdr/FdOutStream.cxx
index a9075cc9..e65133da 100644
--- a/rdr/FdOutStream.cxx
+++ b/rdr/FdOutStream.cxx
@@ -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
diff --git a/rdr/FdOutStream.h b/rdr/FdOutStream.h
index 5294b704..a3e29127 100644
--- a/rdr/FdOutStream.h
+++ b/rdr/FdOutStream.h
@@ -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
diff --git a/rdr/FixedMemOutStream.h b/rdr/FixedMemOutStream.h
index f149e600..e4ec52cb 100644
--- a/rdr/FixedMemOutStream.h
+++ b/rdr/FixedMemOutStream.h
@@ -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
diff --git a/rdr/HexInStream.cxx b/rdr/HexInStream.cxx
index a454ca8e..80f8a796 100644
--- a/rdr/HexInStream.cxx
+++ b/rdr/HexInStream.cxx
@@ -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
diff --git a/rdr/HexInStream.h b/rdr/HexInStream.h
index fbfc2738..6bfb8433 100644
--- a/rdr/HexInStream.h
+++ b/rdr/HexInStream.h
@@ -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
diff --git a/rdr/HexOutStream.cxx b/rdr/HexOutStream.cxx
index f82d9f55..9b0b6c4d 100644
--- a/rdr/HexOutStream.cxx
+++ b/rdr/HexOutStream.cxx
@@ -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
diff --git a/rdr/HexOutStream.h b/rdr/HexOutStream.h
index 691a16bc..10247e68 100644
--- a/rdr/HexOutStream.h
+++ b/rdr/HexOutStream.h
@@ -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
diff --git a/rdr/InStream.cxx b/rdr/InStream.cxx
index 13a6fa19..a413b6c1 100644
--- a/rdr/InStream.cxx
+++ b/rdr/InStream.cxx
@@ -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
diff --git a/rdr/InStream.h b/rdr/InStream.h
index a3eeaada..6d22ac6a 100644
--- a/rdr/InStream.h
+++ b/rdr/InStream.h
@@ -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
diff --git a/rdr/Makefile.in b/rdr/Makefile.in
index 9edf2842..09fa5544 100644
--- a/rdr/Makefile.in
+++ b/rdr/Makefile.in
@@ -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)
diff --git a/rdr/MemInStream.h b/rdr/MemInStream.h
index 2b05e3df..77ca3f3a 100644
--- a/rdr/MemInStream.h
+++ b/rdr/MemInStream.h
@@ -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
diff --git a/rdr/MemOutStream.h b/rdr/MemOutStream.h
index 3456f5c7..ee3e9500 100644
--- a/rdr/MemOutStream.h
+++ b/rdr/MemOutStream.h
@@ -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
index e940f2af..00000000
--- a/rdr/NullOutStream.cxx
+++ /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
index 84a56e5f..00000000
--- a/rdr/NullOutStream.h
+++ /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
diff --git a/rdr/RandomStream.cxx b/rdr/RandomStream.cxx
index 7f62e091..7056c2cc 100644
--- a/rdr/RandomStream.cxx
+++ b/rdr/RandomStream.cxx
@@ -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));
}
diff --git a/rdr/RandomStream.h b/rdr/RandomStream.h
index c4aaaa6a..c33360d7 100644
--- a/rdr/RandomStream.h
+++ b/rdr/RandomStream.h
@@ -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
@@ -23,12 +23,11 @@
#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
diff --git a/rdr/SubstitutingInStream.h b/rdr/SubstitutingInStream.h
index 3a0559b7..325b01c5 100644
--- a/rdr/SubstitutingInStream.h
+++ b/rdr/SubstitutingInStream.h
@@ -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
diff --git a/rdr/ZlibInStream.cxx b/rdr/ZlibInStream.cxx
index 52e4dd35..6f3a7d02 100644
--- a/rdr/ZlibInStream.cxx
+++ b/rdr/ZlibInStream.cxx
@@ -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
diff --git a/rdr/ZlibInStream.h b/rdr/ZlibInStream.h
index 81eb161c..c26b6d63 100644
--- a/rdr/ZlibInStream.h
+++ b/rdr/ZlibInStream.h
@@ -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
diff --git a/rdr/ZlibOutStream.cxx b/rdr/ZlibOutStream.cxx
index 6aadde13..181e3567 100644
--- a/rdr/ZlibOutStream.cxx
+++ b/rdr/ZlibOutStream.cxx
@@ -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
diff --git a/rdr/ZlibOutStream.h b/rdr/ZlibOutStream.h
index e51db73b..7d737c14 100644
--- a/rdr/ZlibOutStream.h
+++ b/rdr/ZlibOutStream.h
@@ -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
diff --git a/rdr/types.h b/rdr/types.h
index 3798c975..6421b137 100644
--- a/rdr/types.h
+++ b/rdr/types.h
@@ -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
diff --git a/rfb/Exception.h b/rfb/Exception.h
index aa98271b..7c2cbcaa 100644
--- a/rfb/Exception.h
+++ b/rfb/Exception.h
@@ -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
@@ -21,17 +21,17 @@
#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