diff options
author | Pierre Ossman <ossman@cendio.se> | 2023-01-23 19:55:20 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2023-02-04 14:03:13 +0100 |
commit | 4293dc42f60fff4542162deba616ec99b2d9fd09 (patch) | |
tree | 379f624f689919dda7d4e521abb3049ba596fcab /common | |
parent | adaedc9629c5f4b124a1872bac6a11844b7f576e (diff) | |
download | tigervnc-4293dc42f60fff4542162deba616ec99b2d9fd09.tar.gz tigervnc-4293dc42f60fff4542162deba616ec99b2d9fd09.zip |
Remove custom CharArray type
It has now been replaced, mostly by std::string, so remove the actual
type definition.
Diffstat (limited to 'common')
-rw-r--r-- | common/rfb/Hostname.h | 1 | ||||
-rw-r--r-- | common/rfb/PixelBuffer.cxx | 2 | ||||
-rw-r--r-- | common/rfb/util.cxx | 24 | ||||
-rw-r--r-- | common/rfb/util.h | 24 |
4 files changed, 4 insertions, 47 deletions
diff --git a/common/rfb/Hostname.h b/common/rfb/Hostname.h index 8e57f31d..1971e343 100644 --- a/common/rfb/Hostname.h +++ b/common/rfb/Hostname.h @@ -22,6 +22,7 @@ #include <assert.h> #include <ctype.h> #include <stdlib.h> +#include <string.h> #include <rdr/Exception.h> #include <rfb/util.h> diff --git a/common/rfb/PixelBuffer.cxx b/common/rfb/PixelBuffer.cxx index dedae3b2..28eea9a7 100644 --- a/common/rfb/PixelBuffer.cxx +++ b/common/rfb/PixelBuffer.cxx @@ -26,6 +26,8 @@ #include <config.h> #endif +#include <string.h> + #include <rfb/Exception.h> #include <rfb/LogWriter.h> #include <rfb/PixelBuffer.h> diff --git a/common/rfb/util.cxx b/common/rfb/util.cxx index c5eeed92..0df9e1e3 100644 --- a/common/rfb/util.cxx +++ b/common/rfb/util.cxx @@ -25,35 +25,13 @@ #include <ctype.h> #include <stdarg.h> #include <stdio.h> +#include <string.h> #include <sys/time.h> #include <rfb/util.h> namespace rfb { - void CharArray::format(const char *fmt, ...) { - va_list ap; - int len; - - va_start(ap, fmt); - len = vsnprintf(NULL, 0, fmt, ap); - va_end(ap); - - delete [] buf; - - if (len < 0) { - buf = new char[1]; - buf[0] = '\0'; - return; - } - - buf = new char[len+1]; - - va_start(ap, fmt); - vsnprintf(buf, len+1, fmt, ap); - va_end(ap); - } - char* strDup(const char* s) { if (!s) return 0; int l = strlen(s); diff --git a/common/rfb/util.h b/common/rfb/util.h index b361aa11..799e0756 100644 --- a/common/rfb/util.h +++ b/common/rfb/util.h @@ -25,7 +25,6 @@ #define __RFB_UTIL_H__ #include <limits.h> -#include <string.h> #include <stdint.h> #include <string> @@ -35,29 +34,6 @@ struct timeval; namespace rfb { - // -=- Class to handle cleanup of arrays of characters - class CharArray { - public: - CharArray() : buf(0) {} - CharArray(char* str) : buf(str) {} // note: assumes ownership - CharArray(size_t len) { - buf = new char[len](); - memset(buf, 0, len); - } - ~CharArray() { - delete [] buf; - } - void format(const char *fmt, ...) - __attribute__((__format__ (__printf__, 2, 3))); - // Get the buffer pointer & clear it (i.e. caller takes ownership) - char* takeBuf() {char* tmp = buf; buf = 0; return tmp;} - void replaceBuf(char* b) {delete [] buf; buf = b;} - char* buf; - private: - CharArray(const CharArray&); - CharArray& operator=(const CharArray&); - }; - char* strDup(const char* s); void strFree(char* s); |