mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 23:13:40 +02:00
Windows: Compile with the UNICODE / _UNICODE macros
It's the recommended way to build C/C++ projects on Windows, see https://learn.microsoft.com/en-us/windows/win32/intl/conventions-for-function-prototypes
This commit is contained in:
@@ -340,17 +340,21 @@ test_pipe_io_overlap (void)
|
||||
PipeIOOverlapReader rs, rc;
|
||||
HANDLE server, client;
|
||||
gchar name[256];
|
||||
wchar_t *name_utf16;
|
||||
|
||||
g_snprintf (name, sizeof (name),
|
||||
"\\\\.\\pipe\\gtest-io-overlap-%u", (guint) GetCurrentProcessId ());
|
||||
|
||||
server = CreateNamedPipe (name,
|
||||
name_utf16 = g_utf8_to_utf16 (name, -1, NULL, NULL, NULL);
|
||||
g_assert_nonnull (name_utf16);
|
||||
|
||||
server = CreateNamedPipe (name_utf16,
|
||||
PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
|
||||
PIPE_READMODE_BYTE | PIPE_WAIT,
|
||||
1, 0, 0, 0, NULL);
|
||||
g_assert (server != INVALID_HANDLE_VALUE);
|
||||
|
||||
client = CreateFile (name, GENERIC_WRITE | GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||
client = CreateFile (name_utf16, GENERIC_WRITE | GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||
g_assert (client != INVALID_HANDLE_VALUE);
|
||||
|
||||
out_server = g_win32_output_stream_new (server, TRUE);
|
||||
@@ -372,6 +376,8 @@ test_pipe_io_overlap (void)
|
||||
g_object_unref (rc.in);
|
||||
g_object_unref (out_server);
|
||||
g_object_unref (out_client);
|
||||
|
||||
g_free (name_utf16);
|
||||
}
|
||||
|
||||
static gpointer
|
||||
@@ -419,18 +425,22 @@ test_pipe_io_concurrent (void)
|
||||
PipeIOOverlapReader rc1, rc2;
|
||||
HANDLE server, client;
|
||||
gchar name[256], c;
|
||||
wchar_t *name_utf16;
|
||||
|
||||
g_snprintf (name, sizeof (name),
|
||||
"\\\\.\\pipe\\gtest-io-concurrent-%u", (guint) GetCurrentProcessId ());
|
||||
|
||||
server = CreateNamedPipe (name,
|
||||
name_utf16 = g_utf8_to_utf16 (name, -1, NULL, NULL, NULL);
|
||||
g_assert_nonnull (name_utf16);
|
||||
|
||||
server = CreateNamedPipe (name_utf16,
|
||||
PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
|
||||
PIPE_READMODE_BYTE | PIPE_WAIT,
|
||||
1, 0, 0, 0, NULL);
|
||||
g_assert (server != INVALID_HANDLE_VALUE);
|
||||
g_assert (_pipe (writer_pipe, 10, _O_BINARY) == 0);
|
||||
|
||||
client = CreateFile (name, GENERIC_WRITE | GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
|
||||
client = CreateFile (name_utf16, GENERIC_WRITE | GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
|
||||
g_assert (client != INVALID_HANDLE_VALUE);
|
||||
|
||||
rc1.in = g_win32_input_stream_new (client, TRUE);
|
||||
@@ -467,6 +477,8 @@ test_pipe_io_concurrent (void)
|
||||
|
||||
close (writer_pipe[0]);
|
||||
close (writer_pipe[1]);
|
||||
|
||||
g_free (name_utf16);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -491,17 +503,21 @@ test_pipe_io_cancel (void)
|
||||
GOutputStream *out;
|
||||
HANDLE in_handle, out_handle;
|
||||
gchar name[256];
|
||||
wchar_t *name_utf16;
|
||||
|
||||
g_snprintf (name, sizeof (name),
|
||||
"\\\\.\\pipe\\gtest-io-cancel-%u", (guint) GetCurrentProcessId ());
|
||||
|
||||
in_handle = CreateNamedPipe (name,
|
||||
name_utf16 = g_utf8_to_utf16 (name, -1, NULL, NULL, NULL);
|
||||
g_assert_nonnull (name_utf16);
|
||||
|
||||
in_handle = CreateNamedPipe (name_utf16,
|
||||
PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED,
|
||||
PIPE_READMODE_BYTE | PIPE_WAIT,
|
||||
1, 0, 0, 0, NULL);
|
||||
g_assert (in_handle != INVALID_HANDLE_VALUE);
|
||||
|
||||
out_handle = CreateFile (name, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||
out_handle = CreateFile (name_utf16, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||
g_assert (out_handle != INVALID_HANDLE_VALUE);
|
||||
|
||||
in = g_win32_input_stream_new (in_handle, TRUE);
|
||||
@@ -521,6 +537,8 @@ test_pipe_io_cancel (void)
|
||||
g_object_unref (reader_cancel);
|
||||
g_object_unref (in);
|
||||
g_object_unref (out);
|
||||
|
||||
g_free (name_utf16);
|
||||
}
|
||||
|
||||
int
|
||||
|
Reference in New Issue
Block a user