mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-22 09:12:13 -05:00
AK: Simplify usage of windows.h and winsock2.h
Use <AK/Windows.h> instead of windows.h/winsock2.h to avoid timeval-related errors. Note: winsock2.h includes windows.h
This commit is contained in:
parent
3eefa464ee
commit
49bdda1475
Notes:
github-actions[bot]
2025-01-02 17:18:48 +00:00
Author: https://github.com/stasoid Commit: https://github.com/LadybirdBrowser/ladybird/commit/49bdda14752 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2674 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/konradekk
4 changed files with 24 additions and 9 deletions
|
@ -8,9 +8,7 @@
|
|||
#include <AK/Time.h>
|
||||
|
||||
#ifdef AK_OS_WINDOWS
|
||||
# define timeval dummy_timeval
|
||||
# include <windows.h>
|
||||
# undef timeval
|
||||
# include <AK/Windows.h>
|
||||
#endif
|
||||
|
||||
namespace AK {
|
||||
|
|
21
AK/Windows.h
Normal file
21
AK/Windows.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Copyright (c) 2024, stasoid <stasoid@yahoo.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
// This header should be included only in cpp files.
|
||||
// It should be included after all other files and should be separated from them by a non-#include line to prevent clang-format from changing header order.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Platform.h>
|
||||
|
||||
#ifdef AK_OS_WINDOWS // needed for Swift
|
||||
# define timeval dummy_timeval
|
||||
# include <winsock2.h>
|
||||
# undef timeval
|
||||
# undef IN
|
||||
# pragma comment(lib, "ws2_32.lib")
|
||||
# include <io.h>
|
||||
#endif
|
|
@ -110,7 +110,3 @@ endif()
|
|||
if (ANDROID)
|
||||
target_link_libraries(LibCore PRIVATE log)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(LibCore PRIVATE ws2_32.lib)
|
||||
endif()
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
#include <LibCore/EventLoopImplementationWindows.h>
|
||||
#include <LibCore/Notifier.h>
|
||||
#include <LibCore/ThreadEventQueue.h>
|
||||
#include <WinSock2.h>
|
||||
#include <io.h>
|
||||
|
||||
#include <AK/Windows.h>
|
||||
|
||||
struct Handle {
|
||||
HANDLE handle = NULL;
|
||||
|
|
Loading…
Reference in a new issue