From: Pierre Ossman Date: Mon, 7 Jul 2014 12:13:46 +0000 (+0200) Subject: Remove a lot of platform compatibilty stuff X-Git-Tag: v1.3.90~48^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5ad4d06006e96b1c7ff663ffcd5e406e06bae1c2;p=tigervnc.git Remove a lot of platform compatibilty stuff It's either not used, or no longer relevant. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 2593a64b..c8de79f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -378,18 +378,10 @@ else() set(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h) endif() check_function_exists(inet_aton HAVE_INET_ATON) -check_function_exists(inet_ntop HAVE_INET_NTOP) check_function_exists(getaddrinfo HAVE_GETADDRINFO) -check_type_size(socklen_t SOCKLEN_T) set(CMAKE_EXTRA_INCLUDE_FILES) set(CMAKE_REQUIRED_LIBRARIES) -# Check for the newer standard string functions -check_function_exists(snprintf HAVE_SNPRINTF) -check_function_exists(strcasecmp HAVE_STRCASECMP) -check_function_exists(strncasecmp HAVE_STRNCASECMP) -check_function_exists(vsnprintf HAVE_VSNPRINTF) - # Generate config.h and make sure the source finds it configure_file(config.h.in config.h) add_definitions(-DHAVE_CONFIG_H) 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 #include -#include #include #include 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 -#endif - -#include -#include - -#ifdef WIN32 -#include -#include -#else -#include -#include -#include -#endif - -#include - - -#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 -#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 -#endif - -#include - -#include -#include -#include - -#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 -#endif - -#include -#include -#include - -#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 +/* 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 #endif +#include +#include + #include #include #ifdef _WIN32 @@ -30,8 +33,6 @@ #include #endif -#include - #include #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 + #include #include -#include #include 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 #include #include -#include #include #include 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 #include #include -#ifdef WIN32 -#define strcasecmp _stricmp -#define strncasecmp _strnicmp -#endif #include #include 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 #include -#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 #include #include -#include #include 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 #include #include -#include #include 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 -#ifdef WIN32 -#define strcasecmp _stricmp -#endif #include #include 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 #include #include -#ifdef WIN32 -#define strcasecmp _stricmp -#endif -#include #include #include #include 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 #include -#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 #include #include -#ifdef _WIN32 -#define strcasecmp _stricmp -#endif #include #include #include 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 -#ifdef _WIN32 -#define strcasecmp _stricmp -#endif #include #include 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 -// 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 diff --git a/config.h.in b/config.h.in index ec2aed90..0c9e71a5 100644 --- a/config.h.in +++ b/config.h.in @@ -1,14 +1,8 @@ #define PACKAGE_NAME "@CMAKE_PROJECT_NAME@" #define PACKAGE_VERSION "@VERSION@" -#cmakedefine HAVE_SOCKLEN_T #cmakedefine HAVE_INET_ATON -#cmakedefine HAVE_INET_NTOP #cmakedefine HAVE_GETADDRINFO -#cmakedefine HAVE_SNPRINTF -#cmakedefine HAVE_STRCASECMP -#cmakedefine HAVE_STRNCASECMP -#cmakedefine HAVE_VSNPRINTF #cmakedefine HAVE_GNUTLS_SET_GLOBAL_ERRNO #cmakedefine HAVE_GNUTLS_SET_ERRNO #cmakedefine HAVE_GNUTLS_X509_CRT_PRINT diff --git a/win/vncconfig/vncconfig.cxx b/win/vncconfig/vncconfig.cxx index 535febbe..16bf1727 100644 --- a/win/vncconfig/vncconfig.cxx +++ b/win/vncconfig/vncconfig.cxx @@ -19,9 +19,6 @@ #include #include #include -#ifdef WIN32 -#define strcasecmp _stricmp -#endif #include "resource.h" #include diff --git a/win/winvnc/JavaViewer.cxx b/win/winvnc/JavaViewer.cxx index e1cb6e5f..c9631229 100644 --- a/win/winvnc/JavaViewer.cxx +++ b/win/winvnc/JavaViewer.cxx @@ -25,8 +25,6 @@ #include -#define strcasecmp _stricmp - using namespace winvnc; using namespace rfb; diff --git a/win/winvnc/winvnc.cxx b/win/winvnc/winvnc.cxx index 4aa5dcb6..17b3a91c 100644 --- a/win/winvnc/winvnc.cxx +++ b/win/winvnc/winvnc.cxx @@ -19,9 +19,6 @@ // -=- VNC Server 4.0 for Windows (WinVNC4) #include -#ifdef WIN32 -#define strcasecmp _stricmp -#endif #include #include