diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/network/TcpSocket.cxx | 1 | ||||
-rw-r--r-- | common/os/CMakeLists.txt | 2 | ||||
-rw-r--r-- | common/os/net.c | 53 | ||||
-rw-r--r-- | common/os/net.h | 50 | ||||
-rw-r--r-- | common/os/print.c | 104 | ||||
-rw-r--r-- | common/os/print.h | 57 | ||||
-rw-r--r-- | common/os/w32tiger.h | 5 | ||||
-rw-r--r-- | common/rdr/Exception.cxx | 5 | ||||
-rw-r--r-- | common/rdr/ZlibOutStream.cxx | 3 | ||||
-rw-r--r-- | common/rdr/msvcwarning.h | 26 | ||||
-rw-r--r-- | common/rfb/CSecurityTLS.cxx | 1 | ||||
-rw-r--r-- | common/rfb/Configuration.cxx | 4 | ||||
-rw-r--r-- | common/rfb/HTTPServer.cxx | 4 | ||||
-rw-r--r-- | common/rfb/JpegCompressor.cxx | 1 | ||||
-rw-r--r-- | common/rfb/JpegDecompressor.cxx | 1 | ||||
-rw-r--r-- | common/rfb/LogWriter.cxx | 3 | ||||
-rw-r--r-- | common/rfb/Logger.cxx | 4 | ||||
-rw-r--r-- | common/rfb/ScaleFilters.cxx | 4 | ||||
-rw-r--r-- | common/rfb/Security.cxx | 3 | ||||
-rw-r--r-- | common/rfb/encodings.cxx | 3 | ||||
-rw-r--r-- | common/rfb/util.cxx | 91 | ||||
-rw-r--r-- | common/rfb/util.h | 13 |
22 files changed, 10 insertions, 428 deletions
diff --git a/common/network/TcpSocket.cxx b/common/network/TcpSocket.cxx index e494a112..d9e9376a 100644 --- a/common/network/TcpSocket.cxx +++ b/common/network/TcpSocket.cxx @@ -43,7 +43,6 @@ #include <stdlib.h> #include <network/TcpSocket.h> -#include <os/net.h> #include <rfb/util.h> #include <rfb/LogWriter.h> diff --git a/common/os/CMakeLists.txt b/common/os/CMakeLists.txt index 39d5c106..fd3794dc 100644 --- a/common/os/CMakeLists.txt +++ b/common/os/CMakeLists.txt @@ -1,8 +1,6 @@ include_directories(${CMAKE_SOURCE_DIR}/common) add_library(os STATIC - print.c - net.c w32tiger.c os.cxx tls.cxx) diff --git a/common/os/net.c b/common/os/net.c deleted file mode 100644 index 7bad36c9..00000000 --- a/common/os/net.c +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright (C) 2008 TightVNC Team. 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdlib.h> -#include <string.h> - -#ifdef WIN32 -#include <winsock2.h> -#include <ws2tcpip.h> -#else -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#endif - -#include <os/net.h> - - -#ifndef HAVE_INET_NTOP -const char *tight_inet_ntop(int af, const void *src, char *dst, - socklen_t size) { - char *tempstr; - - /* Catch bugs - we should not use IPv6 if we don't have inet_ntop */ - if (af != AF_INET) - abort(); - - /* inet_ntoa never fails */ - tempstr = inet_ntoa(*(struct in_addr *)(src)); - memcpy(dst, tempstr, strlen(tempstr) + 1); - - return dst; -} -#endif diff --git a/common/os/net.h b/common/os/net.h deleted file mode 100644 index bd8b21cc..00000000 --- a/common/os/net.h +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (C) 2008 TightVNC Team. 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 OS_NET_H -#define OS_NET_H - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef HAVE_SOCKLEN_T -typedef int socklen_t; -#endif - -/* IPv6 support on server side - we have to have all those functions */ -#if defined(HAVE_INET_NTOP) -#define HAVE_IPV6 -#endif - -/* IPv4-only stub implementation */ -#ifndef HAVE_INET_NTOP -const char *tight_inet_ntop(int af, const void *src, - char *dst, socklen_t size); -#define inet_ntop tight_inet_ntop -#endif - -#ifdef __cplusplus -}; -#endif - -#endif /* OS_NET_H */ diff --git a/common/os/print.c b/common/os/print.c deleted file mode 100644 index 4be22035..00000000 --- a/common/os/print.c +++ /dev/null @@ -1,104 +0,0 @@ -/* Copyright (C) 2008 TightVNC Team. 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <os/print.h> - -#include <stdarg.h> -#include <stdlib.h> -#include <string.h> - -#ifndef HAVE_VSNPRINTF -size_t internal_memcpy(char *dest, const char *src, size_t destsize, - size_t srcsize) { - size_t copied; - - copied = ((destsize) < (srcsize)) ? (destsize) : (srcsize); - memcpy(dest, src, copied); - - return copied; -} - -int tight_vsnprintf(char *str, size_t n, const char *format, va_list ap) { - int written = 0; - int tmpint, len; - char buf[64]; /* Is it enough? */ - char *tmpstr; - - if (format == NULL || n < 1) - return 0; - - while (*format != '\0' && written < n - 1) { - if (*format != '%') { - if (written < n) { - str[written++] = *format++; - continue; - } else - break; - } - - format++; - switch (*format) { - case '\0': - str[written++] = '%'; - continue; - case 'd': - tmpint = va_arg(ap, int); - sprintf(buf, "%d", tmpint); - len = strlen(buf); - written += internal_memcpy (&str[written], buf, - len, n - written); - break; - case 's': - tmpstr = va_arg(ap, char *); - len = strlen(tmpstr); - written += internal_memcpy (&str[written], - tmpstr, len, - n - written); - break; - /* Catch unimplemented stuff */ - default: - fprintf(stderr, "Unimplemented format: %c\n", - *format); - abort(); - } - format++; - } - - str[written] = '\0'; - - return written; -} -#endif /* HAVE_VSNPRINTF */ - -#ifndef HAVE_SNPRINTF -int tight_snprintf(char *str, size_t n, const char *format, ...) { - va_list ap; - int written; - - va_start(ap, format); - written = vsnprintf(str, n, format, ap); - va_end(ap); - - return written; -} -#endif /* HAVE_SNPRINTF */ - diff --git a/common/os/print.h b/common/os/print.h deleted file mode 100644 index 442dd642..00000000 --- a/common/os/print.h +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright (C) 2008 TightVNC Team. 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 OS_PRINT_H -#define OS_PRINT_H - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdarg.h> -#include <stdio.h> -#include <sys/types.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef HAVE_VSNPRINTF -/* NOTE: - * - * This is only very limited implementation for our internal purposes. It - * doesn't conform to C99/POSIX - * - limited conversion specifiers - * - returns written number of characters instead of number what would be - * written - */ -int tight_vsnprintf(char *str, size_t n, const char *format, va_list ap); -#define vsnprintf tight_vsnprintf -#endif - -#ifndef HAVE_SNPRINTF -/* Inherits tight_vsnprintf limitations if vsnprintf is not present */ -int tight_snprintf(char *str, size_t n, const char *format, ...); -#define snprintf tight_snprintf -#endif - -#ifdef __cplusplus -}; -#endif - -#endif /* OS_PRINT_H */ diff --git a/common/os/w32tiger.h b/common/os/w32tiger.h index 5e0c5de2..d09994f2 100644 --- a/common/os/w32tiger.h +++ b/common/os/w32tiger.h @@ -28,6 +28,11 @@ #include <wininet.h> +/* Windows has different names for these */ +#define strcasecmp _stricmp +#define strncasecmp _strnicmp + + /* MSLLHOOKSTRUCT structure*/ #ifndef LLMHF_INJECTED #define LLMHF_INJECTED 0x00000001 diff --git a/common/rdr/Exception.cxx b/common/rdr/Exception.cxx index fd40582f..d70cd9fc 100644 --- a/common/rdr/Exception.cxx +++ b/common/rdr/Exception.cxx @@ -22,6 +22,9 @@ #include <config.h> #endif +#include <stdio.h> +#include <stdarg.h> + #include <rdr/Exception.h> #include <rdr/TLSException.h> #ifdef _WIN32 @@ -30,8 +33,6 @@ #include <windows.h> #endif -#include <os/print.h> - #include <string.h> #ifdef HAVE_GNUTLS diff --git a/common/rdr/ZlibOutStream.cxx b/common/rdr/ZlibOutStream.cxx index 260bd1a4..9d9f8ba1 100644 --- a/common/rdr/ZlibOutStream.cxx +++ b/common/rdr/ZlibOutStream.cxx @@ -17,9 +17,10 @@ * USA. */ +#include <stdio.h> + #include <rdr/ZlibOutStream.h> #include <rdr/Exception.h> -#include <os/print.h> #include <zlib.h> diff --git a/common/rdr/msvcwarning.h b/common/rdr/msvcwarning.h deleted file mode 100644 index bea8d3f4..00000000 --- a/common/rdr/msvcwarning.h +++ /dev/null @@ -1,26 +0,0 @@ -/* 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 - * (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. - */ - -// Trim out extraneous cruft from windows.h includes -#define WIN32_LEAN_AND_MEAN - -// Force all Windows NT-specific APIs to be visible -#define _WIN32_WINNT 0xffff - -#pragma warning( disable : 4800 ) // forcing bool 'true' or 'false' -#pragma warning( disable : 4786 ) // truncating debug information to 255 chars
\ No newline at end of file diff --git a/common/rfb/CSecurityTLS.cxx b/common/rfb/CSecurityTLS.cxx index 59fd5067..a8abeeb0 100644 --- a/common/rfb/CSecurityTLS.cxx +++ b/common/rfb/CSecurityTLS.cxx @@ -42,7 +42,6 @@ #include <rdr/TLSInStream.h> #include <rdr/TLSOutStream.h> #include <os/os.h> -#include <os/print.h> #include <os/tls.h> #include <gnutls/x509.h> diff --git a/common/rfb/Configuration.cxx b/common/rfb/Configuration.cxx index 414b18f7..d7005221 100644 --- a/common/rfb/Configuration.cxx +++ b/common/rfb/Configuration.cxx @@ -22,10 +22,6 @@ #include <stdlib.h> #include <ctype.h> #include <string.h> -#ifdef WIN32 -#define strcasecmp _stricmp -#define strncasecmp _strnicmp -#endif #include <rfb/util.h> #include <rfb/Configuration.h> diff --git a/common/rfb/HTTPServer.cxx b/common/rfb/HTTPServer.cxx index 94f06090..f50722ab 100644 --- a/common/rfb/HTTPServer.cxx +++ b/common/rfb/HTTPServer.cxx @@ -21,10 +21,6 @@ #include <rfb/util.h> #include <rdr/MemOutStream.h> -#ifdef WIN32 -#define strcasecmp _stricmp -#endif - using namespace rfb; using namespace rdr; diff --git a/common/rfb/JpegCompressor.cxx b/common/rfb/JpegCompressor.cxx index 960bd378..c19af34e 100644 --- a/common/rfb/JpegCompressor.cxx +++ b/common/rfb/JpegCompressor.cxx @@ -23,7 +23,6 @@ #include <rfb/Rect.h> #include <rfb/PixelFormat.h> #include <rfb/ConnParams.h> -#include <os/print.h> #include <stdio.h> extern "C" { diff --git a/common/rfb/JpegDecompressor.cxx b/common/rfb/JpegDecompressor.cxx index 3f4d2d00..ca1ad226 100644 --- a/common/rfb/JpegDecompressor.cxx +++ b/common/rfb/JpegDecompressor.cxx @@ -23,7 +23,6 @@ #include <rdr/Exception.h> #include <rfb/Rect.h> #include <rfb/PixelFormat.h> -#include <os/print.h> #include <stdio.h> extern "C" { diff --git a/common/rfb/LogWriter.cxx b/common/rfb/LogWriter.cxx index c6461d14..37a9d1ce 100644 --- a/common/rfb/LogWriter.cxx +++ b/common/rfb/LogWriter.cxx @@ -19,9 +19,6 @@ // -=- LogWriter.cxx - client-side logging interface #include <string.h> -#ifdef WIN32 -#define strcasecmp _stricmp -#endif #include <rfb/LogWriter.h> #include <rfb/Configuration.h> diff --git a/common/rfb/Logger.cxx b/common/rfb/Logger.cxx index 451cee25..3daf2486 100644 --- a/common/rfb/Logger.cxx +++ b/common/rfb/Logger.cxx @@ -21,11 +21,7 @@ #include <stdarg.h> #include <stdio.h> #include <string.h> -#ifdef WIN32 -#define strcasecmp _stricmp -#endif -#include <os/print.h> #include <rfb/Logger.h> #include <rfb/LogWriter.h> #include <rfb/util.h> diff --git a/common/rfb/ScaleFilters.cxx b/common/rfb/ScaleFilters.cxx index 07f3db85..3e414d90 100644 --- a/common/rfb/ScaleFilters.cxx +++ b/common/rfb/ScaleFilters.cxx @@ -23,10 +23,6 @@ #include <rfb/Rect.h> #include <rfb/ScaleFilters.h> -#ifdef _WIN32 -#define strcasecmp _stricmp -#endif - using namespace rfb; // diff --git a/common/rfb/Security.cxx b/common/rfb/Security.cxx index 238f3351..62ea50e6 100644 --- a/common/rfb/Security.cxx +++ b/common/rfb/Security.cxx @@ -24,9 +24,6 @@ #include <assert.h> #include <stdlib.h> #include <string.h> -#ifdef _WIN32 -#define strcasecmp _stricmp -#endif #include <rfb/CSecurityNone.h> #include <rfb/CSecurityStack.h> #include <rfb/CSecurityVeNCrypt.h> diff --git a/common/rfb/encodings.cxx b/common/rfb/encodings.cxx index 97f547bf..190e0324 100644 --- a/common/rfb/encodings.cxx +++ b/common/rfb/encodings.cxx @@ -16,9 +16,6 @@ * USA. */ #include <string.h> -#ifdef _WIN32 -#define strcasecmp _stricmp -#endif #include <rfb/encodings.h> #include <rfb/util.h> diff --git a/common/rfb/util.cxx b/common/rfb/util.cxx index 2709f2cc..a41ad96a 100644 --- a/common/rfb/util.cxx +++ b/common/rfb/util.cxx @@ -38,97 +38,6 @@ #include <rfb/util.h> -// Provide strcasecmp() and/or strncasecmp() if absent on this system. - -#ifndef WIN32 -#if !defined(HAVE_STRCASECMP) || !defined(HAVE_STRNCASECMP) - -extern "C" { - -/* - * This array is designed for mapping upper and lower case letter - * together for a case independent comparison. The mappings are - * based upon ascii character sequences. - */ -static unsigned char s_charmap[] = { - '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', - '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', - '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', - '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037', - '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', - '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', - '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', - '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', - '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', - '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', - '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', - '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', - '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', - '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', - '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', - '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', - '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', - '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', - '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', - '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', - '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', - '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', - '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', - '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', - '\300', '\341', '\342', '\343', '\344', '\345', '\346', '\347', - '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', - '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', - '\370', '\371', '\372', '\333', '\334', '\335', '\336', '\337', - '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', - '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', - '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', - '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377', -}; - -#ifndef HAVE_STRCASECMP -int -strcasecmp(const char *s1, const char *s2) -{ - unsigned char u1, u2; - - for (;;) { - u1 = (unsigned char) *s1++; - u2 = (unsigned char) *s2++; - if (s_charmap[u1] != s_charmap[u2]) { - return s_charmap[u1] - s_charmap[u2]; - } - if (u1 == '\0') { - return 0; - } - } -} -#endif // !defined(HAVE_STRCASECMP) - -#ifndef HAVE_STRNCASECMP -int -strncasecmp(const char *s1, const char *s2, size_t n) -{ - unsigned char u1, u2; - - for (; n != 0; --n) { - u1 = (unsigned char) *s1++; - u2 = (unsigned char) *s2++; - if (s_charmap[u1] != s_charmap[u2]) { - return s_charmap[u1] - s_charmap[u2]; - } - if (u1 == '\0') { - return 0; - } - } - return 0; -} -#endif // !defined(HAVE_STRNCASECMP) - -} // extern "C" - -#endif // !defined(HAVE_STRCASECMP) || !defined(HAVE_STRNCASECMP) -#endif // defined(WIN32) - namespace rfb { char* strDup(const char* s) { diff --git a/common/rfb/util.h b/common/rfb/util.h index 7d90a6b2..13dbe68e 100644 --- a/common/rfb/util.h +++ b/common/rfb/util.h @@ -104,17 +104,4 @@ namespace rfb { #define __rfbmin(a,b) (((a) < (b)) ? (a) : (b)) #endif -// Declare strcasecmp() and/or strncasecmp() if absent on this system. - -#if !defined(WIN32) && !defined(HAVE_STRCASECMP) -extern "C" { - int strcasecmp(const char *s1, const char *s2); -} -#endif -#if !defined(WIN32) && !defined(HAVE_STRNCASECMP) -extern "C" { - int strncasecmp(const char *s1, const char *s2, size_t n); -} -#endif - #endif |