mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-22 23:29:16 +02:00
Merge branch 'remove-broken-xp-code' into 'master'
gio: Remove broken support for XP See merge request GNOME/glib!1583
This commit is contained in:
commit
b79747eee1
@ -4525,7 +4525,6 @@ CMSG_LEN
|
|||||||
CMSG_SPACE
|
CMSG_SPACE
|
||||||
GLIB_ALIGN_TO_SIZEOF
|
GLIB_ALIGN_TO_SIZEOF
|
||||||
T_SRV
|
T_SRV
|
||||||
ws2funcs
|
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
|
@ -31,13 +31,6 @@
|
|||||||
#include "glibintl.h"
|
#include "glibintl.h"
|
||||||
#include "gnetworkingprivate.h"
|
#include "gnetworkingprivate.h"
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
|
||||||
/* Ensure Windows XP runtime compatibility, while using
|
|
||||||
* inet_pton() and inet_ntop() if available
|
|
||||||
*/
|
|
||||||
#include "gwin32networking.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct _GInetAddressPrivate
|
struct _GInetAddressPrivate
|
||||||
{
|
{
|
||||||
GSocketFamily family;
|
GSocketFamily family;
|
||||||
|
@ -830,36 +830,6 @@ get_mount_info (GFileInfo *fs_info,
|
|||||||
|
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
|
|
||||||
static gboolean
|
|
||||||
is_xp_or_later (void)
|
|
||||||
{
|
|
||||||
static int result = -1;
|
|
||||||
|
|
||||||
if (result == -1)
|
|
||||||
{
|
|
||||||
#ifndef _MSC_VER
|
|
||||||
OSVERSIONINFOEX ver_info = {0};
|
|
||||||
DWORDLONG cond_mask = 0;
|
|
||||||
int op = VER_GREATER_EQUAL;
|
|
||||||
|
|
||||||
ver_info.dwOSVersionInfoSize = sizeof ver_info;
|
|
||||||
ver_info.dwMajorVersion = 5;
|
|
||||||
ver_info.dwMinorVersion = 1;
|
|
||||||
|
|
||||||
VER_SET_CONDITION (cond_mask, VER_MAJORVERSION, op);
|
|
||||||
VER_SET_CONDITION (cond_mask, VER_MINORVERSION, op);
|
|
||||||
|
|
||||||
result = VerifyVersionInfo (&ver_info,
|
|
||||||
VER_MAJORVERSION | VER_MINORVERSION,
|
|
||||||
cond_mask) != 0;
|
|
||||||
#else
|
|
||||||
result = ((DWORD)(LOBYTE (LOWORD (GetVersion ())))) >= 5;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static wchar_t *
|
static wchar_t *
|
||||||
get_volume_for_path (const char *path)
|
get_volume_for_path (const char *path)
|
||||||
{
|
{
|
||||||
@ -917,20 +887,12 @@ get_filesystem_readonly (GFileInfo *info,
|
|||||||
rootdir = get_volume_for_path (path);
|
rootdir = get_volume_for_path (path);
|
||||||
|
|
||||||
if (rootdir)
|
if (rootdir)
|
||||||
{
|
|
||||||
if (is_xp_or_later ())
|
|
||||||
{
|
{
|
||||||
DWORD flags;
|
DWORD flags;
|
||||||
if (GetVolumeInformationW (rootdir, NULL, 0, NULL, NULL, &flags, NULL, 0))
|
if (GetVolumeInformationW (rootdir, NULL, 0, NULL, NULL, &flags, NULL, 0))
|
||||||
g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY,
|
g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY,
|
||||||
(flags & FILE_READ_ONLY_VOLUME) != 0);
|
(flags & FILE_READ_ONLY_VOLUME) != 0);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (GetDriveTypeW (rootdir) == DRIVE_CDROM)
|
|
||||||
g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY, TRUE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free (rootdir);
|
g_free (rootdir);
|
||||||
}
|
}
|
||||||
|
@ -22,13 +22,6 @@
|
|||||||
|
|
||||||
#include "gnetworking.h"
|
#include "gnetworking.h"
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
|
||||||
/* For Windows XP run-time compatibility */
|
|
||||||
#include "gwin32networking.h"
|
|
||||||
|
|
||||||
GWin32WinsockFuncs ws2funcs = {0};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION:gnetworking
|
* SECTION:gnetworking
|
||||||
* @title: gnetworking.h
|
* @title: gnetworking.h
|
||||||
@ -73,40 +66,10 @@ g_networking_init (void)
|
|||||||
if (g_once_init_enter (&inited))
|
if (g_once_init_enter (&inited))
|
||||||
{
|
{
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
HMODULE ws2dll, iphlpapidll;
|
|
||||||
|
|
||||||
if (WSAStartup (MAKEWORD (2, 0), &wsadata) != 0)
|
if (WSAStartup (MAKEWORD (2, 0), &wsadata) != 0)
|
||||||
g_error ("Windows Sockets could not be initialized");
|
g_error ("Windows Sockets could not be initialized");
|
||||||
|
|
||||||
/* We want to use these functions if they are available, but
|
|
||||||
* still need to make sure the code still runs on Windows XP
|
|
||||||
*/
|
|
||||||
ws2dll = LoadLibraryW (L"ws2_32.dll");
|
|
||||||
iphlpapidll = LoadLibraryW (L"iphlpapi.dll");
|
|
||||||
|
|
||||||
if (ws2dll != NULL)
|
|
||||||
{
|
|
||||||
ws2funcs.pInetNtop =
|
|
||||||
(PFN_InetNtop) GetProcAddress (ws2dll, "inet_ntop");
|
|
||||||
ws2funcs.pInetPton =
|
|
||||||
(PFN_InetPton) GetProcAddress (ws2dll, "inet_pton");
|
|
||||||
FreeLibrary (ws2dll);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ws2funcs.pInetNtop = NULL;
|
|
||||||
ws2funcs.pInetPton = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iphlpapidll != NULL)
|
|
||||||
{
|
|
||||||
ws2funcs.pIfNameToIndex =
|
|
||||||
(PFN_IfNameToIndex) GetProcAddress (iphlpapidll, "if_nametoindex");
|
|
||||||
FreeLibrary (iphlpapidll);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ws2funcs.pIfNameToIndex = NULL;
|
|
||||||
|
|
||||||
g_once_init_leave (&inited, 1);
|
g_once_init_leave (&inited, 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -22,15 +22,11 @@
|
|||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
|
|
||||||
#ifndef _WIN32_WINNT
|
|
||||||
#define _WIN32_WINNT 0x0501
|
|
||||||
#endif
|
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
#include <windns.h>
|
#include <windns.h>
|
||||||
#include <mswsock.h>
|
#include <mswsock.h>
|
||||||
@WSPIAPI_INCLUDE@
|
#include <wspiapi.h>
|
||||||
#include <iphlpapi.h>
|
#include <iphlpapi.h>
|
||||||
#undef interface
|
#undef interface
|
||||||
|
|
||||||
|
@ -76,11 +76,6 @@
|
|||||||
#include "glibintl.h"
|
#include "glibintl.h"
|
||||||
#include "gioprivate.h"
|
#include "gioprivate.h"
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
|
||||||
/* For Windows XP runtime compatibility, but use the system's if_nametoindex() if available */
|
|
||||||
#include "gwin32networking.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION:gsocket
|
* SECTION:gsocket
|
||||||
* @short_description: Low-level socket object
|
* @short_description: Low-level socket object
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
/* GIO - GLib Input, Output and Streaming Library
|
|
||||||
*
|
|
||||||
* Copyright (C) 2015 Chun-wei Fan
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library 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
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __G_WIN32_NETWORKING_H__
|
|
||||||
#define __G_WIN32_NETWORKING_H__
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
/* Check if more ANSI-compliant Winsock2 functions are provided */
|
|
||||||
/* For run-time compatibility with Windows XP, remove when XP support dropped */
|
|
||||||
|
|
||||||
typedef INT (WSAAPI *PFN_InetPton) (INT, PCTSTR, PVOID);
|
|
||||||
typedef PCTSTR (WSAAPI *PFN_InetNtop) (INT, PVOID, PTSTR, size_t);
|
|
||||||
typedef NET_IFINDEX (WINAPI *PFN_IfNameToIndex) (PCSTR);
|
|
||||||
|
|
||||||
typedef struct _GWin32WinsockFuncs
|
|
||||||
{
|
|
||||||
PFN_InetPton pInetPton;
|
|
||||||
PFN_InetNtop pInetNtop;
|
|
||||||
PFN_IfNameToIndex pIfNameToIndex;
|
|
||||||
} GWin32WinsockFuncs;
|
|
||||||
|
|
||||||
extern GWin32WinsockFuncs ws2funcs;
|
|
||||||
|
|
||||||
G_END_DECLS /* __G_WIN32_NETWORKING_H__ */
|
|
||||||
|
|
||||||
#endif
|
|
@ -10,15 +10,9 @@ gio_c_args += glib_hidden_visibility_args
|
|||||||
|
|
||||||
gnetworking_h_conf = configuration_data()
|
gnetworking_h_conf = configuration_data()
|
||||||
|
|
||||||
gnetworking_h_wspiapi_include = ''
|
|
||||||
gnetworking_h_nameser_compat_include = ''
|
gnetworking_h_nameser_compat_include = ''
|
||||||
|
|
||||||
if host_system == 'windows'
|
if host_system != 'windows' and not host_system.contains('android')
|
||||||
# <wspiapi.h> in the Windows SDK and in mingw-w64 has wrappers for
|
|
||||||
# inline workarounds for getaddrinfo, getnameinfo and freeaddrinfo if
|
|
||||||
# they aren't present at run-time (on Windows 2000).
|
|
||||||
gnetworking_h_wspiapi_include = '#include <wspiapi.h>'
|
|
||||||
elif not host_system.contains('android')
|
|
||||||
# Don't check for C_IN on Android since it does not define it in public
|
# Don't check for C_IN on Android since it does not define it in public
|
||||||
# headers, we define it ourselves wherever necessary
|
# headers, we define it ourselves wherever necessary
|
||||||
if not cc.compiles('''#include <sys/types.h>
|
if not cc.compiles('''#include <sys/types.h>
|
||||||
@ -168,7 +162,6 @@ if host_system.contains('android')
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
gnetworking_h_conf.set('WSPIAPI_INCLUDE', gnetworking_h_wspiapi_include)
|
|
||||||
gnetworking_h_conf.set('NAMESER_COMPAT_INCLUDE', gnetworking_h_nameser_compat_include)
|
gnetworking_h_conf.set('NAMESER_COMPAT_INCLUDE', gnetworking_h_nameser_compat_include)
|
||||||
|
|
||||||
gnetworking_h = configure_file(input : 'gnetworking.h.in',
|
gnetworking_h = configure_file(input : 'gnetworking.h.in',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user