View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001615 | GNUnet | other | public | 2010-11-05 01:05 | 2010-12-23 23:50 |
Reporter | LRN | Assigned To | LRN | ||
Priority | low | Severity | tweak | Reproducibility | N/A |
Status | closed | Resolution | open | ||
Target Version | Git master | ||||
Summary | 0001615: Various minor tweaks | ||||
Description | This is a collection of tweaks, mostly eliminating compiler warnings | ||||
Additional Information | What it does: * Replaces #include <winsock.h> with #include <winsock2.h> (winsock2 is supported in all versions of NT, except maybe NT 4.x) * Adds #include <ws2tcpip.h> along (it contains definitions for some functions used by GNUnet, namely - getaddrinfo) * Changes some function prototypes to use const char * instead of char * (g++ warns that constant strings are converted to non-constant variants; in some places where strings CAN be modified i've used (char *) cast instead; but i'm open to suggestions) * Adds include <malloc.h> for Windows (for alloca() definition) * Adds GNUNET_ERROR_TYPE_NONE error type (useless in the code, but can be specified from command line as -L NONE to suppress any error messages - this is useful when working with debug builds, as they tend to produce lots of messages, which affects performance and leads to timeouts) * Fixes unsigned int -> socklen_t in some places * #if MINGW's the sighandler_pipe() function that is not used on NT * Removes unused int filenamelen; * Casts signal handler into __p_sig_fn_t * Adds backward-compatible (should, in theory, work with automake-1.10) support for silent rules * Adds WIN32_WINNT definition (getaddrinfo is not available in win32 subsystem implementations earlier than the one from NT 5.1, that is - XP/2003) | ||||
Tags | No tags attached. | ||||
Attached Files | misc.diff (9,204 bytes)
Index: src/include/winproc.h =================================================================== --- src/include/winproc.h (revision 13557) +++ src/include/winproc.h (working copy) @@ -34,8 +34,9 @@ #include <sys/timeb.h> #include <time.h> #include <dirent.h> +#include <winsock2.h> +#include <ws2tcpip.h> #include <windows.h> -#include <winsock.h> #include <winerror.h> #include <iphlpapi.h> #include <shlobj.h> @@ -198,7 +199,7 @@ BOOL CreateShortcut (const char *pszSrc, const char *pszDest); BOOL DereferenceShortcut (char *pszShortcut); - long QueryRegistry (HKEY hMainKey, char *pszKey, char *pszSubKey, + long QueryRegistry (HKEY hMainKey, const char *pszKey, const char *pszSubKey, char *pszBuffer, long *pdLength); int ListNICs (void (*callback) (void *, const char *, int), void *cls); BOOL AddPathAccessRights (char *lpszFileName, char *lpszAccountName, Index: src/include/platform.h =================================================================== --- src/include/platform.h (revision 13557) +++ src/include/platform.h (working copy) @@ -78,6 +78,7 @@ #ifdef _MSC_VER #include <Winsock2.h> +#include <ws2tcpip.h> #else #ifndef MINGW #include <netdb.h> @@ -108,6 +109,9 @@ #include <stdarg.h> #include <errno.h> #include <signal.h> +#ifdef WINDOWS +#include <malloc.h> /* for alloca(), on other OSes it's in stdlib.h */ +#endif #ifndef _MSC_VER #include <unistd.h> /* KLB_FIX */ #endif Index: src/include/plibc.h =================================================================== --- src/include/plibc.h (revision 13557) +++ src/include/plibc.h (working copy) @@ -50,8 +50,9 @@ #include "langinfo.h" #endif +#include <winsock2.h> +#include <ws2tcpip.h> #include <windows.h> -#include <ws2tcpip.h> #include <sys/types.h> #include <time.h> #include <stdio.h> @@ -334,7 +335,7 @@ BOOL _plibc_DereferenceShortcut(char *pszShortcut); char *plibc_ChooseDir(char *pszTitle, unsigned long ulFlags); char *plibc_ChooseFile(char *pszTitle, unsigned long ulFlags); -long QueryRegistry(HKEY hMainKey, char *pszKey, char *pszSubKey, +long QueryRegistry(HKEY hMainKey, const char *pszKey, const char *pszSubKey, char *pszBuffer, long *pdLength); BOOL __win_IsHandleMarkedAsBlocking(int hHandle); Index: src/include/gnunet_common.h =================================================================== --- src/include/gnunet_common.h (revision 13557) +++ src/include/gnunet_common.h (working copy) @@ -138,6 +138,7 @@ */ enum GNUNET_ErrorType { + GNUNET_ERROR_TYPE_NONE = 0, GNUNET_ERROR_TYPE_ERROR = 1, GNUNET_ERROR_TYPE_WARNING = 2, GNUNET_ERROR_TYPE_INFO = 4, Index: src/transport/gnunet-nat-client-windows.c =================================================================== --- src/transport/gnunet-nat-client-windows.c (revision 13557) +++ src/transport/gnunet-nat-client-windows.c (working copy) @@ -43,8 +43,8 @@ */ #define _GNU_SOURCE +#include <winsock2.h> #include <ws2tcpip.h> -#include <winsock2.h> #include <sys/time.h> #include <sys/types.h> #include <unistd.h> Index: src/vpn/gnunet-service-dns.c =================================================================== --- src/vpn/gnunet-service-dns.c (revision 13557) +++ src/vpn/gnunet-service-dns.c (working copy) @@ -452,7 +452,7 @@ struct sockaddr_in addr; memset(&addr, 0, sizeof addr); - unsigned int addrlen = sizeof addr; + socklen_t addrlen = sizeof addr; int r; r = GNUNET_NETWORK_socket_recvfrom(dnsout, Index: src/vpn/gnunet-vpn-pretty-print.c =================================================================== --- src/vpn/gnunet-vpn-pretty-print.c (revision 13557) +++ src/vpn/gnunet-vpn-pretty-print.c (working copy) @@ -5,6 +5,7 @@ #ifndef _WIN32 #include <arpa/inet.h> #else +#include <winsock2.h> #include <ws2tcpip.h> #endif Index: src/util/scheduler.c =================================================================== --- src/util/scheduler.c (revision 13557) +++ src/util/scheduler.c (working copy) @@ -692,12 +692,13 @@ /** * Signal handler called for SIGPIPE. */ +#ifndef MINGW static void sighandler_pipe () { return; } - +#endif /** * Signal handler called for signals that should cause us to shutdown. */ Index: src/util/os_priority.c =================================================================== --- src/util/os_priority.c (revision 13557) +++ src/util/os_priority.c (working copy) @@ -551,7 +551,6 @@ PROCESS_INFORMATION proc; int argcount = 0; char non_const_filename[MAX_PATH +1]; - int filenamelen = 0; struct GNUNET_OS_Process *gnunet_proc = NULL; GNUNET_assert (lsocks == NULL); Index: src/util/win.cc =================================================================== --- src/util/win.cc (revision 13557) +++ src/util/win.cc (working copy) @@ -346,7 +346,7 @@ * @remarks Call GetLastError() to obtain extended error information. * @see http://support.microsoft.com/?scid=kb;en-us;132958 */ -BOOL _GetAccountSid(LPTSTR SystemName, LPTSTR AccountName, PSID * Sid) +BOOL _GetAccountSid(LPCTSTR SystemName, LPCTSTR AccountName, PSID * Sid) { LPTSTR ReferencedDomain = NULL; DWORD cbSid = 128; /* initial allocation attempt */ @@ -452,7 +452,7 @@ * @param pszName the name of the account * @param pszDesc description of the account */ -int CreateServiceAccount(char *pszName, char *pszDesc) +int CreateServiceAccount(const char *pszName, const char *pszDesc) { USER_INFO_1 ui; USER_INFO_1008 ui2; @@ -486,14 +486,14 @@ STATUS_SUCCESS) return 3; - _GetAccountSid(NULL, (LPTSTR) pszName, &pSID); + _GetAccountSid(NULL, (LPCTSTR) pszName, &pSID); - if (_SetPrivilegeOnAccount(hPolicy, pSID, L"SeServiceLogonRight", TRUE) != STATUS_SUCCESS) + if (_SetPrivilegeOnAccount(hPolicy, pSID, (LPWSTR) L"SeServiceLogonRight", TRUE) != STATUS_SUCCESS) return 4; - _SetPrivilegeOnAccount(hPolicy, pSID, L"SeDenyInteractiveLogonRight", TRUE); - _SetPrivilegeOnAccount(hPolicy, pSID, L"SeDenyBatchLogonRight", TRUE); - _SetPrivilegeOnAccount(hPolicy, pSID, L"SeDenyNetworkLogonRight", TRUE); + _SetPrivilegeOnAccount(hPolicy, pSID, (LPWSTR) L"SeDenyInteractiveLogonRight", TRUE); + _SetPrivilegeOnAccount(hPolicy, pSID, (LPWSTR) L"SeDenyBatchLogonRight", TRUE); + _SetPrivilegeOnAccount(hPolicy, pSID, (LPWSTR) L"SeDenyNetworkLogonRight", TRUE); GNLsaClose(hPolicy); @@ -801,7 +801,7 @@ NULL, (DWORD) dwErr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &err, 0, NULL )) { - err = ""; + err = (char *) LocalAlloc(LMEM_FIXED | LMEM_ZEROINIT, 1); } mem = strlen(err) + strlen(prefix) + 20; Index: src/util/strings.c =================================================================== --- src/util/strings.c (revision 13557) +++ src/util/strings.c (working copy) @@ -199,7 +199,7 @@ itmp = tmp; finSize = tmpSize; if (iconv (cd, -#if FREEBSD || DARWIN +#if FREEBSD || DARWIN || WINDOWS (const char **) &input, #else (char **) &input, Index: src/util/common_logging.c =================================================================== --- src/util/common_logging.c (revision 13557) +++ src/util/common_logging.c (working copy) @@ -152,6 +152,8 @@ return GNUNET_ERROR_TYPE_WARNING; if (0 == strcasecmp (log, _("ERROR"))) return GNUNET_ERROR_TYPE_ERROR; + if (0 == strcasecmp (log, _("NONE"))) + return GNUNET_ERROR_TYPE_NONE; return GNUNET_ERROR_TYPE_INVALID; } Index: src/util/connection.c =================================================================== --- src/util/connection.c (revision 13557) +++ src/util/connection.c (working copy) @@ -719,7 +719,7 @@ struct GNUNET_CONNECTION_Handle *h = ap->h; struct AddressProbe *pos; int error; - unsigned int len; + socklen_t len; GNUNET_assert (ap->sock != NULL); GNUNET_CONTAINER_DLL_remove (h->ap_head, h->ap_tail, ap); Index: src/util/signal.c =================================================================== --- src/util/signal.c (revision 13557) +++ src/util/signal.c (working copy) @@ -68,7 +68,7 @@ w32_sigchld_handler = handler; else { - __p_sig_fn_t sigret = signal (signum, handler); + __p_sig_fn_t sigret = signal (signum, (__p_sig_fn_t) handler); if (sigret == SIG_ERR) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, Index: configure.ac =================================================================== --- configure.ac (revision 13557) +++ configure.ac (working copy) @@ -23,6 +23,7 @@ AC_PREREQ(2.61) AC_INIT([gnunet], [0.9.0pre1],[bug-gnunet@gnu.org]) AM_INIT_AUTOMAKE([gnunet], [0.9.0pre1]) +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AC_CONFIG_HEADERS([gnunet_config.h]) AH_TOP([#define _GNU_SOURCE 1]) @@ -141,6 +142,7 @@ LDFLAGS="$LDFLAGS -no-undefined -Wl,--export-all-symbols" LIBS="$LIBS -lws2_32 -lplibc" CFLAGS="-mms-bitfields $CFLAGS" + CPPFLAGS="-D_WIN32_WINNT=0x0501 $CPPFLAGS" build_target="mingw" AC_PROG_CXX LIBPREFIX=lib | ||||
Date Modified | Username | Field | Change |
---|---|---|---|
2010-11-05 01:05 | LRN | New Issue | |
2010-11-05 01:05 | LRN | File Added: misc.diff | |
2010-11-05 12:26 | Christian Grothoff | Note Added: 0004141 | |
2010-11-05 12:26 | Christian Grothoff | Assigned To | => LRN |
2010-11-05 12:26 | Christian Grothoff | Status | new => resolved |
2010-12-23 23:50 | Christian Grothoff | Status | resolved => closed |