diff options
author | Pierre Ossman <ossman@cendio.se> | 2014-07-07 14:13:46 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2014-07-07 14:13:46 +0200 |
commit | 5ad4d06006e96b1c7ff663ffcd5e406e06bae1c2 (patch) | |
tree | 659c6081230675758edcfb66a394fc1aa3e1bacb /common/os | |
parent | 890c10118c8a0db4fddb53a161f207c6ad23c130 (diff) | |
download | tigervnc-5ad4d06006e96b1c7ff663ffcd5e406e06bae1c2.tar.gz tigervnc-5ad4d06006e96b1c7ff663ffcd5e406e06bae1c2.zip |
Remove a lot of platform compatibilty stuff
It's either not used, or no longer relevant.
Diffstat (limited to 'common/os')
-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 |
6 files changed, 5 insertions, 266 deletions
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 |