[Refactoring] Improved rdr::Exception constructor. It now accepts variable
number of arguments.

[Bugfix] Minor compilation fixes (missing #includes)


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3168 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/common/rdr/Exception.cxx b/common/rdr/Exception.cxx
index 7d38711..a0a08f0 100644
--- a/common/rdr/Exception.cxx
+++ b/common/rdr/Exception.cxx
@@ -22,8 +22,21 @@
 #include <windows.h>
 #endif
 
+#include <string.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <os/print.h>
+
 using namespace rdr;
 
+Exception::Exception(const char *format, ...) {
+	va_list ap;
+
+	va_start(ap, format);
+	(void) vsnprintf(str_, len, format, ap);
+	va_end(ap);
+}
+
 SystemException::SystemException(const char* s, int err_)
   : Exception(s), err(err_)
 {
diff --git a/common/rdr/Exception.h b/common/rdr/Exception.h
index 2fdc0a2..ef6b368 100644
--- a/common/rdr/Exception.h
+++ b/common/rdr/Exception.h
@@ -19,21 +19,12 @@
 #ifndef __RDR_EXCEPTION_H__
 #define __RDR_EXCEPTION_H__
 
-#include <stdio.h>
-#include <string.h>
-
 namespace rdr {
 
   struct Exception {
     enum { len = 256 };
     char str_[len];
-    Exception(const char* s=0) {
-      str_[0] = 0;
-      if (s)
-        strncat(str_, s, len-1);
-      else
-        strcat(str_, "Exception");
-    }
+    Exception(const char *format = 0, ...);
     virtual ~Exception() {}
     virtual const char* str() const { return str_; }
   };
diff --git a/common/rdr/ZlibOutStream.cxx b/common/rdr/ZlibOutStream.cxx
index df1dbee..f60a620 100644
--- a/common/rdr/ZlibOutStream.cxx
+++ b/common/rdr/ZlibOutStream.cxx
@@ -18,6 +18,8 @@
 
 #include <rdr/ZlibOutStream.h>
 #include <rdr/Exception.h>
+#include <os/print.h>
+
 #include <zlib.h>
 
 using namespace rdr;