Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
dfaf0874
Commit
dfaf0874
authored
Dec 12, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*: check defined(_WIN32) instead of defined(WIN32)
Only _WIN32 is defined by the compiler, and WIN32 is not standardized and may be missing. Closes #169
parent
d9552d8a
Hide whitespace changes
Inline
Side-by-side
Showing
91 changed files
with
226 additions
and
225 deletions
+226
-225
NEWS
NEWS
+1
-0
configure.ac
configure.ac
+1
-1
CommandLine.cxx
src/CommandLine.cxx
+2
-2
LocateUri.hxx
src/LocateUri.hxx
+1
-1
LogBackend.cxx
src/LogBackend.cxx
+1
-1
LogInit.cxx
src/LogInit.cxx
+2
-2
LogLevel.hxx
src/LogLevel.hxx
+1
-1
Main.cxx
src/Main.cxx
+6
-6
Main.hxx
src/Main.hxx
+1
-1
Stats.cxx
src/Stats.cxx
+2
-2
TimePrint.cxx
src/TimePrint.cxx
+2
-2
ClientFile.cxx
src/client/ClientFile.cxx
+1
-1
ClientMessage.hxx
src/client/ClientMessage.hxx
+1
-1
ClientNew.cxx
src/client/ClientNew.cxx
+1
-1
CommandResult.hxx
src/command/CommandResult.hxx
+1
-1
FileCommands.cxx
src/command/FileCommands.cxx
+2
-2
StorageCommands.cxx
src/command/StorageCommands.cxx
+2
-2
ConfigOption.hxx
src/config/ConfigOption.hxx
+2
-2
ConfigPath.cxx
src/config/ConfigPath.cxx
+3
-3
SimpleDatabasePlugin.cxx
src/db/plugins/simple/SimpleDatabasePlugin.cxx
+2
-2
UpdateIO.cxx
src/db/update/UpdateIO.cxx
+1
-1
Walk.cxx
src/db/update/Walk.cxx
+4
-4
Walk.hxx
src/db/update/Walk.hxx
+1
-1
FlacIOHandle.cxx
src/decoder/plugins/FlacIOHandle.cxx
+1
-1
MultiSocketMonitor.cxx
src/event/MultiSocketMonitor.cxx
+2
-2
MultiSocketMonitor.hxx
src/event/MultiSocketMonitor.hxx
+3
-3
ServerSocket.cxx
src/event/ServerSocket.cxx
+1
-1
SignalMonitor.cxx
src/event/SignalMonitor.cxx
+1
-1
SignalMonitor.hxx
src/event/SignalMonitor.hxx
+1
-1
SocketMonitor.cxx
src/event/SocketMonitor.cxx
+1
-1
SocketMonitor.hxx
src/event/SocketMonitor.hxx
+1
-1
AllocatedPath.cxx
src/fs/AllocatedPath.cxx
+2
-2
Charset.cxx
src/fs/Charset.cxx
+5
-5
Charset.hxx
src/fs/Charset.hxx
+1
-1
CheckFile.cxx
src/fs/CheckFile.cxx
+1
-1
DirectoryReader.cxx
src/fs/DirectoryReader.cxx
+1
-1
DirectoryReader.hxx
src/fs/DirectoryReader.hxx
+1
-1
FileInfo.hxx
src/fs/FileInfo.hxx
+10
-10
FileSystem.cxx
src/fs/FileSystem.cxx
+4
-4
FileSystem.hxx
src/fs/FileSystem.hxx
+8
-8
Glob.hxx
src/fs/Glob.hxx
+4
-4
Limits.hxx
src/fs/Limits.hxx
+1
-1
StandardDirectory.cxx
src/fs/StandardDirectory.cxx
+7
-7
StandardDirectory.hxx
src/fs/StandardDirectory.hxx
+1
-1
Traits.cxx
src/fs/Traits.cxx
+1
-1
Traits.hxx
src/fs/Traits.hxx
+10
-10
FileOutputStream.cxx
src/fs/io/FileOutputStream.cxx
+2
-2
FileOutputStream.hxx
src/fs/io/FileOutputStream.hxx
+6
-6
FileReader.cxx
src/fs/io/FileReader.cxx
+1
-1
FileReader.hxx
src/fs/io/FileReader.hxx
+8
-8
InputPlugin.hxx
src/input/InputPlugin.hxx
+1
-1
CurlInputPlugin.cxx
src/input/plugins/CurlInputPlugin.cxx
+2
-2
CaseFold.cxx
src/lib/icu/CaseFold.cxx
+2
-2
Collate.cxx
src/lib/icu/Collate.cxx
+2
-2
Resolver.cxx
src/net/Resolver.cxx
+1
-1
SocketAddress.hxx
src/net/SocketAddress.hxx
+2
-2
SocketError.cxx
src/net/SocketError.cxx
+1
-1
SocketError.hxx
src/net/SocketError.hxx
+7
-7
ToString.cxx
src/net/ToString.cxx
+1
-1
SampleFormat.hxx
src/pcm/SampleFormat.hxx
+2
-2
LocalStorage.cxx
src/storage/plugins/LocalStorage.cxx
+1
-1
Clock.cxx
src/system/Clock.cxx
+1
-1
Clock.hxx
src/system/Clock.hxx
+1
-1
Error.hxx
src/system/Error.hxx
+6
-6
EventPipe.cxx
src/system/EventPipe.cxx
+7
-7
FatalError.cxx
src/system/FatalError.cxx
+3
-3
FatalError.hxx
src/system/FatalError.hxx
+2
-2
FileDescriptor.cxx
src/system/FileDescriptor.cxx
+3
-3
FileDescriptor.hxx
src/system/FileDescriptor.hxx
+2
-2
fd_util.c
src/system/fd_util.c
+7
-7
fd_util.h
src/system/fd_util.h
+1
-1
Format.cxx
src/tag/Format.cxx
+2
-2
Cond.hxx
src/thread/Cond.hxx
+1
-1
Id.hxx
src/thread/Id.hxx
+6
-6
Mutex.hxx
src/thread/Mutex.hxx
+1
-1
Thread.cxx
src/thread/Thread.cxx
+3
-3
Thread.hxx
src/thread/Thread.hxx
+5
-5
Util.cxx
src/thread/Util.cxx
+2
-2
Daemon.cxx
src/unix/Daemon.cxx
+3
-3
Daemon.hxx
src/unix/Daemon.hxx
+7
-7
SignalHandlers.cxx
src/unix/SignalHandlers.cxx
+2
-2
FormatString.cxx
src/util/FormatString.cxx
+2
-2
HugeAllocator.cxx
src/util/HugeAllocator.cxx
+1
-1
HugeAllocator.hxx
src/util/HugeAllocator.hxx
+1
-1
StringAPI.hxx
src/util/StringAPI.hxx
+1
-1
TimeParser.cxx
src/util/TimeParser.cxx
+3
-3
WStringAPI.hxx
src/util/WStringAPI.hxx
+1
-1
Win32Main.cxx
src/win32/Win32Main.cxx
+1
-1
ShutdownHandler.cxx
test/ShutdownHandler.cxx
+1
-1
ShutdownHandler.hxx
test/ShutdownHandler.hxx
+1
-1
run_resolver.cxx
test/run_resolver.cxx
+1
-1
No files found.
NEWS
View file @
dfaf0874
...
...
@@ -5,6 +5,7 @@ ver 0.20.13 (not yet released)
- upnp: work around libupnp 1.6.24 API breakage
* queue: fix spuriously misplaced prioritized songs
* include Windows cross-build script in source tarball
* fix Windows build failures
ver 0.20.12 (2017/11/25)
* database
...
...
configure.ac
View file @
dfaf0874
...
...
@@ -492,7 +492,7 @@ if test x$enable_ipv6 = xyes; then
AC_EGREP_CPP([AP_maGiC_VALUE],
[
#include <sys/types.h>
#ifdef WIN32
#ifdef
_
WIN32
#include <winsock2.h>
#else
#include <sys/socket.h>
...
...
src/CommandLine.cxx
View file @
dfaf0874
...
...
@@ -67,7 +67,7 @@
#include <stdio.h>
#include <stdlib.h>
#ifdef WIN32
#ifdef
_
WIN32
#define CONFIG_FILE_LOCATION PATH_LITERAL("mpd\\mpd.conf")
#define APP_CONFIG_FILE_LOCATION PATH_LITERAL("conf\\mpd.conf")
#else
...
...
@@ -389,7 +389,7 @@ ParseCommandLine(int argc, char **argv, struct options *options)
ConfigLoader
loader
;
bool
found
=
#ifdef WIN32
#ifdef
_
WIN32
loader
.
TryFile
(
GetUserConfigDir
(),
CONFIG_FILE_LOCATION
)
||
loader
.
TryFile
(
GetSystemConfigDir
(),
CONFIG_FILE_LOCATION
)
||
loader
.
TryFile
(
GetAppBaseDir
(),
APP_CONFIG_FILE_LOCATION
);
...
...
src/LocateUri.hxx
View file @
dfaf0874
...
...
@@ -24,7 +24,7 @@
#include "Compiler.h"
#include "fs/AllocatedPath.hxx"
#ifdef WIN32
#ifdef
_
WIN32
#include <windows.h>
/* damn you, windows.h! */
#ifdef ABSOLUTE
...
...
src/LogBackend.cxx
View file @
dfaf0874
...
...
@@ -162,7 +162,7 @@ FileLog(const Domain &domain, const char *message)
domain
.
GetName
(),
chomp_length
(
message
),
message
);
#ifdef WIN32
#ifdef
_
WIN32
/* force-flush the log file, because setvbuf() does not seem
to have an effect on WIN32 */
fflush
(
stderr
);
...
...
src/LogInit.cxx
View file @
dfaf0874
...
...
@@ -72,7 +72,7 @@ log_init_file(int line)
out_fd
=
open_log_file
();
if
(
out_fd
<
0
)
{
#ifdef WIN32
#ifdef
_
WIN32
const
std
::
string
out_path_utf8
=
out_path
.
ToUTF8
();
throw
FormatRuntimeError
(
"failed to open log file
\"
%s
\"
(config line %d)"
,
out_path_utf8
.
c_str
(),
line
);
...
...
@@ -182,7 +182,7 @@ void setup_log_output()
fflush
(
nullptr
);
if
(
out_fd
<
0
)
{
#ifdef WIN32
#ifdef
_
WIN32
return
;
#else
out_fd
=
open
(
"/dev/null"
,
O_WRONLY
);
...
...
src/LogLevel.hxx
View file @
dfaf0874
...
...
@@ -20,7 +20,7 @@
#ifndef MPD_LOG_LEVEL_HXX
#define MPD_LOG_LEVEL_HXX
#ifdef WIN32
#ifdef
_
WIN32
#include <windows.h>
/* damn you, windows.h! */
#ifdef ERROR
...
...
src/Main.cxx
View file @
dfaf0874
...
...
@@ -106,7 +106,7 @@
#include <locale.h>
#endif
#ifdef WIN32
#ifdef
_
WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
...
...
@@ -289,7 +289,7 @@ glue_state_file_init()
*/
static
void
winsock_init
(
void
)
{
#ifdef WIN32
#ifdef
_
WIN32
WSADATA
sockinfo
;
int
retval
=
WSAStartup
(
MAKEWORD
(
2
,
2
),
&
sockinfo
);
...
...
@@ -418,7 +418,7 @@ Instance::OnIdle(unsigned flags)
int
main
(
int
argc
,
char
*
argv
[])
{
#ifdef WIN32
#ifdef
_
WIN32
return
win32_main
(
argc
,
argv
);
#else
return
mpd_main
(
argc
,
argv
);
...
...
@@ -615,7 +615,7 @@ try {
playlist_state_restore() */
instance
->
partition
->
pc
.
LockUpdateAudio
();
#ifdef WIN32
#ifdef
_
WIN32
win32_app_started
();
#endif
...
...
@@ -630,7 +630,7 @@ try {
/* run the main loop */
instance
->
event_loop
.
Run
();
#ifdef WIN32
#ifdef
_
WIN32
win32_app_stopping
();
#endif
...
...
@@ -702,7 +702,7 @@ try {
daemonize_finish
();
#endif
#ifdef WIN32
#ifdef
_
WIN32
WSACleanup
();
#endif
...
...
src/Main.hxx
View file @
dfaf0874
...
...
@@ -42,7 +42,7 @@ int mpd_main(int argc, char *argv[]);
#endif
#ifdef WIN32
#ifdef
_
WIN32
/**
* If program is run as windows service performs nessesary initialization
...
...
src/Stats.cxx
View file @
dfaf0874
...
...
@@ -31,7 +31,7 @@
#include <chrono>
#ifndef WIN32
#ifndef
_
WIN32
/**
* The monotonic time stamp when MPD was started. It is used to
* calculate the uptime.
...
...
@@ -114,7 +114,7 @@ stats_print(Response &r, const Partition &partition)
{
r
.
Format
(
"uptime: %u
\n
"
"playtime: %lu
\n
"
,
#ifdef WIN32
#ifdef
_
WIN32
GetProcessUptimeS
(),
#else
(
unsigned
)
std
::
chrono
::
duration_cast
<
std
::
chrono
::
seconds
>
(
std
::
chrono
::
steady_clock
::
now
()
-
start_time
).
count
(),
...
...
src/TimePrint.cxx
View file @
dfaf0874
...
...
@@ -24,7 +24,7 @@
void
time_print
(
Response
&
r
,
const
char
*
name
,
time_t
t
)
{
#ifdef WIN32
#ifdef
_
WIN32
const
struct
tm
*
tm2
=
gmtime
(
&
t
);
#else
struct
tm
tm
;
...
...
@@ -35,7 +35,7 @@ time_print(Response &r, const char *name, time_t t)
char
buffer
[
32
];
strftime
(
buffer
,
sizeof
(
buffer
),
#ifdef WIN32
#ifdef
_
WIN32
"%Y-%m-%dT%H:%M:%SZ"
,
#else
"%FT%TZ"
,
...
...
src/client/ClientFile.cxx
View file @
dfaf0874
...
...
@@ -28,7 +28,7 @@
void
Client
::
AllowFile
(
Path
path_fs
)
const
{
#ifdef WIN32
#ifdef
_
WIN32
(
void
)
path_fs
;
throw
ProtocolError
(
ACK_ERROR_PERMISSION
,
"Access denied"
);
...
...
src/client/ClientMessage.hxx
View file @
dfaf0874
...
...
@@ -24,7 +24,7 @@
#include <string>
#ifdef WIN32
#ifdef
_
WIN32
/* fuck WIN32! */
#include <windows.h>
#undef GetMessage
...
...
src/client/ClientNew.cxx
View file @
dfaf0874
...
...
@@ -29,7 +29,7 @@
#include "Log.hxx"
#include <assert.h>
#ifdef WIN32
#ifdef
_
WIN32
#include <winsock2.h>
#else
#include <sys/socket.h>
...
...
src/command/CommandResult.hxx
View file @
dfaf0874
...
...
@@ -20,7 +20,7 @@
#ifndef MPD_COMMAND_RESULT_HXX
#define MPD_COMMAND_RESULT_HXX
#ifdef WIN32
#ifdef
_
WIN32
#include <windows.h>
/* damn you, windows.h! */
#ifdef ERROR
...
...
src/command/FileCommands.cxx
View file @
dfaf0874
...
...
@@ -58,7 +58,7 @@ skip_path(Path name_fs) noexcept
return
name_fs
.
HasNewline
();
}
#if defined(WIN32) && GCC_CHECK_VERSION(4,6)
#if defined(
_
WIN32) && GCC_CHECK_VERSION(4,6)
/* PRIu64 causes bogus compiler warning */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat"
...
...
@@ -101,7 +101,7 @@ handle_listfiles_local(Response &r, Path path_fs)
return
CommandResult
::
OK
;
}
#if defined(WIN32) && GCC_CHECK_VERSION(4,6)
#if defined(
_
WIN32) && GCC_CHECK_VERSION(4,6)
#pragma GCC diagnostic pop
#endif
...
...
src/command/StorageCommands.cxx
View file @
dfaf0874
...
...
@@ -50,7 +50,7 @@ skip_path(const char *name_utf8) noexcept
return
strchr
(
name_utf8
,
'\n'
)
!=
nullptr
;
}
#if defined(WIN32) && GCC_CHECK_VERSION(4,6)
#if defined(
_
WIN32) && GCC_CHECK_VERSION(4,6)
/* PRIu64 causes bogus compiler warning */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat"
...
...
@@ -94,7 +94,7 @@ handle_listfiles_storage(Response &r, StorageDirectoryReader &reader)
}
}
#if defined(WIN32) && GCC_CHECK_VERSION(4,6)
#if defined(
_
WIN32) && GCC_CHECK_VERSION(4,6)
#pragma GCC diagnostic pop
#endif
...
...
src/config/ConfigOption.hxx
View file @
dfaf0874
...
...
@@ -22,7 +22,7 @@
#include "Compiler.h"
#if defined(WIN32) && CLANG_OR_GCC_VERSION(4,7)
#if defined(
_
WIN32) && CLANG_OR_GCC_VERSION(4,7)
/* "INPUT" is declared by winuser.h */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
...
...
@@ -93,7 +93,7 @@ enum class ConfigBlockOption {
MAX
};
#if defined(WIN32) && CLANG_OR_GCC_VERSION(4,7)
#if defined(
_
WIN32) && CLANG_OR_GCC_VERSION(4,7)
#pragma GCC diagnostic pop
#endif
...
...
src/config/ConfigPath.cxx
View file @
dfaf0874
...
...
@@ -29,7 +29,7 @@
#include <assert.h>
#include <string.h>
#ifndef WIN32
#ifndef
_
WIN32
#include <pwd.h>
/**
...
...
@@ -79,7 +79,7 @@ ParsePath(const char *path)
{
assert
(
path
!=
nullptr
);
#ifndef WIN32
#ifndef
_
WIN32
if
(
path
[
0
]
==
'~'
)
{
++
path
;
...
...
@@ -119,7 +119,7 @@ ParsePath(const char *path)
}
else
{
#endif
return
AllocatedPath
::
FromUTF8Throw
(
path
);
#ifndef WIN32
#ifndef
_
WIN32
}
#endif
}
src/db/plugins/simple/SimpleDatabasePlugin.cxx
View file @
dfaf0874
...
...
@@ -115,7 +115,7 @@ SimpleDatabase::Check() const
path_utf8
+
"
\"
because the "
"parent path is not a directory"
);
#ifndef WIN32
#ifndef
_
WIN32
/* Check if we can write to the directory */
if
(
!
CheckAccess
(
dirPath
,
X_OK
|
W_OK
))
{
const
int
e
=
errno
;
...
...
@@ -134,7 +134,7 @@ SimpleDatabase::Check() const
if
(
!
fi
.
IsRegular
())
throw
std
::
runtime_error
(
"db file
\"
"
+
path_utf8
+
"
\"
is not a regular file"
);
#ifndef WIN32
#ifndef
_
WIN32
/* And check that we can write to it */
if
(
!
CheckAccess
(
path
,
R_OK
|
W_OK
))
throw
FormatErrno
(
"Can't open db file
\"
%s
\"
for reading/writing"
,
...
...
src/db/update/UpdateIO.cxx
View file @
dfaf0874
...
...
@@ -91,7 +91,7 @@ bool
directory_child_access
(
Storage
&
storage
,
const
Directory
&
directory
,
const
char
*
name
,
int
mode
)
noexcept
{
#ifdef WIN32
#ifdef
_
WIN32
/* CheckAccess() is useless on WIN32 */
(
void
)
storage
;
(
void
)
directory
;
...
...
src/db/update/Walk.cxx
View file @
dfaf0874
...
...
@@ -55,7 +55,7 @@ UpdateWalk::UpdateWalk(EventLoop &_loop, DatabaseListener &_listener,
storage
(
_storage
),
editor
(
_loop
,
_listener
)
{
#ifndef WIN32
#ifndef
_
WIN32
follow_inside_symlinks
=
config_get_bool
(
ConfigOption
::
FOLLOW_INSIDE_SYMLINKS
,
DEFAULT_FOLLOW_INSIDE_SYMLINKS
);
...
...
@@ -133,7 +133,7 @@ UpdateWalk::PurgeDeletedFromDirectory(Directory &directory)
}
}
#ifndef WIN32
#ifndef
_
WIN32
static
bool
update_directory_stat
(
Storage
&
storage
,
Directory
&
directory
)
{
...
...
@@ -156,7 +156,7 @@ static int
FindAncestorLoop
(
Storage
&
storage
,
Directory
*
parent
,
unsigned
inode
,
unsigned
device
)
{
#ifndef WIN32
#ifndef
_
WIN32
if
(
device
==
0
&&
inode
==
0
)
/* can't detect loops if the Storage does not support
these numbers */
...
...
@@ -258,7 +258,7 @@ bool
UpdateWalk
::
SkipSymlink
(
const
Directory
*
directory
,
const
char
*
utf8_name
)
const
noexcept
{
#ifndef WIN32
#ifndef
_
WIN32
const
auto
path_fs
=
storage
.
MapChildFS
(
directory
->
GetPath
(),
utf8_name
);
if
(
path_fs
.
IsNull
())
...
...
src/db/update/Walk.hxx
View file @
dfaf0874
...
...
@@ -36,7 +36,7 @@ class UpdateWalk final {
friend
class
UpdateArchiveVisitor
;
#endif
#ifndef WIN32
#ifndef
_
WIN32
static
constexpr
bool
DEFAULT_FOLLOW_INSIDE_SYMLINKS
=
true
;
static
constexpr
bool
DEFAULT_FOLLOW_OUTSIDE_SYMLINKS
=
true
;
...
...
src/decoder/plugins/FlacIOHandle.cxx
View file @
dfaf0874
...
...
@@ -46,7 +46,7 @@ FlacIORead(void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle)
p
+=
nbytes
;
#ifndef WIN32
#ifndef
_
WIN32
}
catch
(
const
std
::
system_error
&
e
)
{
errno
=
e
.
code
().
category
()
==
ErrnoCategory
()
?
e
.
code
().
value
()
...
...
src/event/MultiSocketMonitor.cxx
View file @
dfaf0874
...
...
@@ -23,7 +23,7 @@
#include <algorithm>
#ifndef WIN32
#ifndef
_
WIN32
#include <poll.h>
#endif
...
...
@@ -50,7 +50,7 @@ MultiSocketMonitor::ClearSocketList()
fds
.
clear
();
}
#ifndef WIN32
#ifndef
_
WIN32
void
MultiSocketMonitor
::
ReplaceSocketList
(
pollfd
*
pfds
,
unsigned
n
)
...
...
src/event/MultiSocketMonitor.hxx
View file @
dfaf0874
...
...
@@ -31,7 +31,7 @@
#include <assert.h>
#ifdef WIN32
#ifdef
_
WIN32
/* ERROR is a WIN32 macro that poisons our namespace; this is a kludge
to allow us to use it anyway */
#ifdef ERROR
...
...
@@ -39,7 +39,7 @@
#endif
#endif
#ifndef WIN32
#ifndef
_
WIN32
struct
pollfd
;
#endif
...
...
@@ -189,7 +189,7 @@ public:
}
}
#ifndef WIN32
#ifndef
_
WIN32
/**
* Replace the socket list with the given file descriptors.
* The given pollfd array will be modified by this method.
...
...
src/event/ServerSocket.cxx
View file @
dfaf0874
...
...
@@ -43,7 +43,7 @@
#include <unistd.h>
#include <assert.h>
#ifdef WIN32
#ifdef
_
WIN32
#include <ws2tcpip.h>
#include <winsock.h>
#else
...
...
src/event/SignalMonitor.cxx
View file @
dfaf0874
...
...
@@ -20,7 +20,7 @@
#include "config.h"
#include "SignalMonitor.hxx"
#ifndef WIN32
#ifndef
_
WIN32
#include "SocketMonitor.hxx"
#include "util/Manual.hxx"
...
...
src/event/SignalMonitor.hxx
View file @
dfaf0874
...
...
@@ -24,7 +24,7 @@
class
EventLoop
;
#ifndef WIN32
#ifndef
_
WIN32
#include "util/BindMethod.hxx"
...
...
src/event/SocketMonitor.cxx
View file @
dfaf0874
...
...
@@ -24,7 +24,7 @@
#include <assert.h>
#ifdef WIN32
#ifdef
_
WIN32
#include <winsock2.h>
#else
#include <sys/socket.h>
...
...
src/event/SocketMonitor.hxx
View file @
dfaf0874
...
...
@@ -28,7 +28,7 @@
#include <assert.h>
#include <stddef.h>
#ifdef WIN32
#ifdef
_
WIN32
/* ERROR is a WIN32 macro that poisons our namespace; this is a kludge
to allow us to use it anyway */
#ifdef ERROR
...
...
src/fs/AllocatedPath.cxx
View file @
dfaf0874
...
...
@@ -31,7 +31,7 @@ AllocatedPath::~AllocatedPath() {}
AllocatedPath
AllocatedPath
::
FromUTF8
(
const
char
*
path_utf8
)
noexcept
{
#if defined(HAVE_FS_CHARSET) || defined(WIN32)
#if defined(HAVE_FS_CHARSET) || defined(
_
WIN32)
try
{
return
AllocatedPath
(
::
PathFromUTF8
(
path_utf8
));
}
catch
(
const
std
::
runtime_error
&
)
{
...
...
@@ -45,7 +45,7 @@ AllocatedPath::FromUTF8(const char *path_utf8) noexcept
AllocatedPath
AllocatedPath
::
FromUTF8Throw
(
const
char
*
path_utf8
)
{
#if defined(HAVE_FS_CHARSET) || defined(WIN32)
#if defined(HAVE_FS_CHARSET) || defined(
_
WIN32)
return
AllocatedPath
(
::
PathFromUTF8
(
path_utf8
));
#else
return
FromFS
(
path_utf8
);
...
...
src/fs/Charset.cxx
View file @
dfaf0874
...
...
@@ -24,7 +24,7 @@
#include "lib/icu/Converter.hxx"
#include "util/AllocatedString.hxx"
#ifdef WIN32
#ifdef
_
WIN32
#include "lib/icu/Win32.hxx"
#include <windows.h>
#endif
...
...
@@ -70,7 +70,7 @@ GetFSCharset() noexcept
{
#ifdef HAVE_FS_CHARSET
return
fs_charset
.
empty
()
?
"UTF-8"
:
fs_charset
.
c_str
();
#elif defined(WIN32)
#elif defined(
_
WIN32)
return
"ACP"
;
#else
return
"UTF-8"
;
...
...
@@ -100,7 +100,7 @@ PathToUTF8(PathTraitsFS::const_pointer_type path_fs)
assert
(
path_fs
!=
nullptr
);
#endif
#ifdef WIN32
#ifdef
_
WIN32
const
auto
buffer
=
WideCharToMultiByte
(
CP_UTF8
,
path_fs
);
return
FixSeparators
(
PathTraitsUTF8
::
string
(
buffer
.
c_str
()));
#else
...
...
@@ -116,7 +116,7 @@ PathToUTF8(PathTraitsFS::const_pointer_type path_fs)
#endif
}
#if defined(HAVE_FS_CHARSET) || defined(WIN32)
#if defined(HAVE_FS_CHARSET) || defined(
_
WIN32)
PathTraitsFS
::
string
PathFromUTF8
(
PathTraitsUTF8
::
const_pointer_type
path_utf8
)
...
...
@@ -126,7 +126,7 @@ PathFromUTF8(PathTraitsUTF8::const_pointer_type path_utf8)
assert
(
path_utf8
!=
nullptr
);
#endif
#ifdef WIN32
#ifdef
_
WIN32
const
auto
buffer
=
MultiByteToWideChar
(
CP_UTF8
,
path_utf8
);
return
PathTraitsFS
::
string
(
buffer
.
c_str
());
#else
...
...
src/fs/Charset.hxx
View file @
dfaf0874
...
...
@@ -24,7 +24,7 @@
#include "Compiler.h"
#include "Traits.hxx"
#if (defined(HAVE_ICU) || defined(HAVE_ICONV)) && !defined(WIN32)
#if (defined(HAVE_ICU) || defined(HAVE_ICONV)) && !defined(
_
WIN32)
#define HAVE_FS_CHARSET
#endif
...
...
src/fs/CheckFile.cxx
View file @
dfaf0874
...
...
@@ -41,7 +41,7 @@ try {
return
;
}
#ifndef WIN32
#ifndef
_
WIN32
try
{
const
auto
x
=
AllocatedPath
::
Build
(
path_fs
,
PathTraitsFS
::
CURRENT_DIRECTORY
);
...
...
src/fs/DirectoryReader.cxx
View file @
dfaf0874
...
...
@@ -21,7 +21,7 @@
#include "DirectoryReader.hxx"
#include "system/Error.hxx"
#ifdef WIN32
#ifdef
_
WIN32
DirectoryReader
::
DirectoryReader
(
Path
dir
)
:
handle
(
FindFirstFile
(
MakeWildcardPath
(
dir
.
c_str
()),
&
data
))
...
...
src/fs/DirectoryReader.hxx
View file @
dfaf0874
...
...
@@ -23,7 +23,7 @@
#include "check.h"
#include "Path.hxx"
#ifdef WIN32
#ifdef
_
WIN32
#include <windows.h>
#include <tchar.h>
...
...
src/fs/FileInfo.hxx
View file @
dfaf0874
...
...
@@ -26,13 +26,13 @@
#include <stdint.h>
#ifdef WIN32
#ifdef
_
WIN32
#include <fileapi.h>
#else
#include <sys/stat.h>
#endif
#ifdef WIN32
#ifdef
_
WIN32
static
inline
constexpr
uint64_t
ConstructUint64
(
DWORD
lo
,
DWORD
hi
)
...
...
@@ -54,7 +54,7 @@ class FileInfo {
bool
follow_symlinks
);
friend
class
FileReader
;
#ifdef WIN32
#ifdef
_
WIN32
WIN32_FILE_ATTRIBUTE_DATA
data
;
#else
struct
stat
st
;
...
...
@@ -65,7 +65,7 @@ public:
FileInfo
(
Path
path
,
bool
follow_symlinks
=
true
)
{
if
(
!
GetFileInfo
(
path
,
*
this
,
follow_symlinks
))
{
#ifdef WIN32
#ifdef
_
WIN32
throw
FormatLastError
(
"Failed to access %s"
,
path
.
ToUTF8
().
c_str
());
#else
...
...
@@ -76,7 +76,7 @@ public:
}
bool
IsRegular
()
const
{
#ifdef WIN32
#ifdef
_
WIN32
return
(
data
.
dwFileAttributes
&
(
FILE_ATTRIBUTE_DIRECTORY
|
FILE_ATTRIBUTE_DEVICE
))
==
0
;
#else
...
...
@@ -85,7 +85,7 @@ public:
}
bool
IsDirectory
()
const
{
#ifdef WIN32
#ifdef
_
WIN32
return
data
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
;
#else
return
S_ISDIR
(
st
.
st_mode
);
...
...
@@ -93,7 +93,7 @@ public:
}
uint64_t
GetSize
()
const
{
#ifdef WIN32
#ifdef
_
WIN32
return
ConstructUint64
(
data
.
nFileSizeLow
,
data
.
nFileSizeHigh
);
#else
return
st
.
st_size
;
...
...
@@ -101,14 +101,14 @@ public:
}
time_t
GetModificationTime
()
const
{
#ifdef WIN32
#ifdef
_
WIN32
return
FileTimeToTimeT
(
data
.
ftLastWriteTime
);
#else
return
st
.
st_mtime
;
#endif
}
#ifndef WIN32
#ifndef
_
WIN32
uid_t
GetUid
()
const
{
return
st
.
st_uid
;
}
...
...
@@ -130,7 +130,7 @@ public:
inline
bool
GetFileInfo
(
Path
path
,
FileInfo
&
info
,
bool
follow_symlinks
=
true
)
{
#ifdef WIN32
#ifdef
_
WIN32
(
void
)
follow_symlinks
;
return
GetFileAttributesEx
(
path
.
c_str
(),
GetFileExInfoStandard
,
&
info
.
data
);
...
...
src/fs/FileSystem.cxx
View file @
dfaf0874
...
...
@@ -29,7 +29,7 @@
void
RenameFile
(
Path
oldpath
,
Path
newpath
)
{
#ifdef WIN32
#ifdef
_
WIN32
if
(
!
MoveFileEx
(
oldpath
.
c_str
(),
newpath
.
c_str
(),
MOVEFILE_REPLACE_EXISTING
))
throw
MakeLastError
(
"Failed to rename file"
);
...
...
@@ -42,7 +42,7 @@ RenameFile(Path oldpath, Path newpath)
AllocatedPath
ReadLink
(
Path
path
)
{
#ifdef WIN32
#ifdef
_
WIN32
(
void
)
path
;
errno
=
EINVAL
;
return
AllocatedPath
::
Null
();
...
...
@@ -63,7 +63,7 @@ ReadLink(Path path)
void
TruncateFile
(
Path
path
)
{
#ifdef WIN32
#ifdef
_
WIN32
HANDLE
h
=
CreateFile
(
path
.
c_str
(),
GENERIC_WRITE
,
0
,
nullptr
,
TRUNCATE_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
nullptr
);
...
...
@@ -83,7 +83,7 @@ TruncateFile(Path path)
void
RemoveFile
(
Path
path
)
{
#ifdef WIN32
#ifdef
_
WIN32
if
(
!
DeleteFile
(
path
.
c_str
()))
throw
FormatLastError
(
"Failed to delete %s"
,
path
.
c_str
());
#else
...
...
src/fs/FileSystem.hxx
View file @
dfaf0874
...
...
@@ -26,7 +26,7 @@
#include "Path.hxx"
#ifdef WIN32
#ifdef
_
WIN32
#include <fileapi.h>
#endif
...
...
@@ -43,7 +43,7 @@ class AllocatedPath;
static
inline
FILE
*
FOpen
(
Path
file
,
PathTraitsFS
::
const_pointer_type
mode
)
{
#ifdef WIN32
#ifdef
_
WIN32
return
_tfopen
(
file
.
c_str
(),
mode
);
#else
return
fopen
(
file
.
c_str
(),
mode
);
...
...
@@ -56,7 +56,7 @@ FOpen(Path file, PathTraitsFS::const_pointer_type mode)
static
inline
int
OpenFile
(
Path
file
,
int
flags
,
int
mode
)
{
#ifdef WIN32
#ifdef
_
WIN32
return
_topen
(
file
.
c_str
(),
flags
,
mode
);
#else
return
open_cloexec
(
file
.
c_str
(),
flags
,
mode
);
...
...
@@ -71,7 +71,7 @@ OpenFile(Path file, int flags, int mode)
void
RenameFile
(
Path
oldpath
,
Path
newpath
);
#ifndef WIN32
#ifndef
_
WIN32
/**
* Wrapper for stat() that uses #Path names.
...
...
@@ -107,7 +107,7 @@ RemoveFile(Path path);
AllocatedPath
ReadLink
(
Path
path
);
#ifndef WIN32
#ifndef
_
WIN32
static
inline
bool
MakeFifo
(
Path
path
,
mode_t
mode
)
...
...
@@ -132,7 +132,7 @@ CheckAccess(Path path, int mode)
static
inline
bool
FileExists
(
Path
path
,
bool
follow_symlinks
=
true
)
{
#ifdef WIN32
#ifdef
_
WIN32
(
void
)
follow_symlinks
;
const
auto
a
=
GetFileAttributes
(
path
.
c_str
());
...
...
@@ -150,7 +150,7 @@ FileExists(Path path, bool follow_symlinks = true)
static
inline
bool
DirectoryExists
(
Path
path
,
bool
follow_symlinks
=
true
)
{
#ifdef WIN32
#ifdef
_
WIN32
(
void
)
follow_symlinks
;
const
auto
a
=
GetFileAttributes
(
path
.
c_str
());
...
...
@@ -167,7 +167,7 @@ DirectoryExists(Path path, bool follow_symlinks = true)
static
inline
bool
PathExists
(
Path
path
)
{
#ifdef WIN32
#ifdef
_
WIN32
return
GetFileAttributes
(
path
.
c_str
())
!=
INVALID_FILE_ATTRIBUTES
;
#else
return
CheckAccess
(
path
,
F_OK
);
...
...
src/fs/Glob.hxx
View file @
dfaf0874
...
...
@@ -26,7 +26,7 @@
#define HAVE_CLASS_GLOB
#include <string>
#include <fnmatch.h>
#elif defined(WIN32)
#elif defined(
_
WIN32)
#define HAVE_CLASS_GLOB
#include <string>
#include <shlwapi.h>
...
...
@@ -40,12 +40,12 @@
* (asterisk and question mark).
*/
class
Glob
{
#if defined(HAVE_FNMATCH) || defined(WIN32)
#if defined(HAVE_FNMATCH) || defined(
_
WIN32)
std
::
string
pattern
;
#endif
public
:
#if defined(HAVE_FNMATCH) || defined(WIN32)
#if defined(HAVE_FNMATCH) || defined(
_
WIN32)
explicit
Glob
(
const
char
*
_pattern
)
:
pattern
(
_pattern
)
{}
...
...
@@ -57,7 +57,7 @@ public:
bool
Check
(
const
char
*
name_fs
)
const
noexcept
{
#ifdef HAVE_FNMATCH
return
fnmatch
(
pattern
.
c_str
(),
name_fs
,
0
)
==
0
;
#elif defined(WIN32)
#elif defined(
_
WIN32)
return
PathMatchSpecA
(
name_fs
,
pattern
.
c_str
());
#endif
}
...
...
src/fs/Limits.hxx
View file @
dfaf0874
...
...
@@ -25,7 +25,7 @@
#include <stddef.h>
#include <limits.h>
#if defined(WIN32)
#if defined(
_
WIN32)
static
constexpr
size_t
MPD_PATH_MAX
=
260
;
#elif defined(MAXPATHLEN)
static
constexpr
size_t
MPD_PATH_MAX
=
MAXPATHLEN
;
...
...
src/fs/StandardDirectory.cxx
View file @
dfaf0874
...
...
@@ -20,7 +20,7 @@
#include "config.h"
// Use X Desktop guidelines where applicable
#if !defined(__APPLE__) && !defined(WIN32) && !defined(ANDROID)
#if !defined(__APPLE__) && !defined(
_
WIN32) && !defined(ANDROID)
#define USE_XDG
#endif
...
...
@@ -29,7 +29,7 @@
#include <array>
#ifdef WIN32
#ifdef
_
WIN32
#include <windows.h>
#include <shlobj.h>
#else
...
...
@@ -53,7 +53,7 @@
#include "Main.hxx"
#endif
#if !defined(WIN32) && !defined(ANDROID)
#if !defined(
_
WIN32) && !defined(ANDROID)
class
PasswdEntry
{
#if defined(HAVE_GETPWNAM_R) || defined(HAVE_GETPWUID_R)
...
...
@@ -113,7 +113,7 @@ SafePathFromFS(PathTraitsFS::const_pointer_type dir)
}
#endif
#ifdef WIN32
#ifdef
_
WIN32
static
AllocatedPath
GetStandardDir
(
int
folder_id
)
{
std
::
array
<
PathTraitsFS
::
value_type
,
MAX_PATH
>
dir
;
...
...
@@ -226,7 +226,7 @@ try {
AllocatedPath
GetUserConfigDir
()
noexcept
{
#if defined(WIN32)
#if defined(
_
WIN32)
return
GetStandardDir
(
CSIDL_LOCAL_APPDATA
);
#elif defined(USE_XDG)
// Check for $XDG_CONFIG_HOME
...
...
@@ -251,7 +251,7 @@ GetUserConfigDir() noexcept
AllocatedPath
GetUserMusicDir
()
noexcept
{
#if defined(WIN32)
#if defined(
_
WIN32)
return
GetStandardDir
(
CSIDL_MYMUSIC
);
#elif defined(USE_XDG)
return
GetUserDir
(
"XDG_MUSIC_DIR"
);
...
...
@@ -287,7 +287,7 @@ GetUserCacheDir() noexcept
#endif
}
#ifdef WIN32
#ifdef
_
WIN32
AllocatedPath
GetSystemConfigDir
()
noexcept
...
...
src/fs/StandardDirectory.hxx
View file @
dfaf0874
...
...
@@ -42,7 +42,7 @@ gcc_pure
AllocatedPath
GetUserCacheDir
()
noexcept
;
#ifdef WIN32
#ifdef
_
WIN32
/**
* Obtains system configuration directory.
...
...
src/fs/Traits.cxx
View file @
dfaf0874
...
...
@@ -78,7 +78,7 @@ GetParentPathImpl(typename Traits::const_pointer_type p)
return
typename
Traits
::
string
(
Traits
::
CURRENT_DIRECTORY
);
if
(
sep
==
p
)
return
typename
Traits
::
string
(
p
,
p
+
1
);
#ifdef WIN32
#ifdef
_
WIN32
if
(
Traits
::
IsDrive
(
p
)
&&
sep
==
p
+
2
)
return
typename
Traits
::
string
(
p
,
p
+
3
);
#endif
...
...
src/fs/Traits.hxx
View file @
dfaf0874
...
...
@@ -25,7 +25,7 @@
#include "util/StringPointer.hxx"
#include "util/StringAPI.hxx"
#ifdef WIN32
#ifdef
_
WIN32
#include "util/CharUtil.hxx"
#include <tchar.h>
#endif
...
...
@@ -34,7 +34,7 @@
#include <assert.h>
#ifdef WIN32
#ifdef
_
WIN32
#define PATH_LITERAL(s) _T(s)
#else
#define PATH_LITERAL(s) (s)
...
...
@@ -44,7 +44,7 @@
* This class describes the nature of a native filesystem path.
*/
struct
PathTraitsFS
{
#ifdef WIN32
#ifdef
_
WIN32
typedef
std
::
wstring
string
;
#else
typedef
std
::
string
string
;
...
...
@@ -55,7 +55,7 @@ struct PathTraitsFS {
typedef
Pointer
::
pointer_type
pointer_type
;
typedef
Pointer
::
const_pointer_type
const_pointer_type
;
#ifdef WIN32
#ifdef
_
WIN32
static
constexpr
value_type
SEPARATOR
=
'\\'
;
#else
static
constexpr
value_type
SEPARATOR
=
'/'
;
...
...
@@ -65,7 +65,7 @@ struct PathTraitsFS {
static
constexpr
bool
IsSeparator
(
value_type
ch
)
noexcept
{
return
#ifdef WIN32
#ifdef
_
WIN32
ch
==
'/'
||
#endif
ch
==
SEPARATOR
;
...
...
@@ -78,7 +78,7 @@ struct PathTraitsFS {
assert
(
p
!=
nullptr
);
#endif
#ifdef WIN32
#ifdef
_
WIN32
const_pointer_type
pos
=
p
+
GetLength
(
p
);
while
(
p
!=
pos
&&
!
IsSeparator
(
*
pos
))
--
pos
;
...
...
@@ -88,7 +88,7 @@ struct PathTraitsFS {
#endif
}
#ifdef WIN32
#ifdef
_
WIN32
gcc_pure
gcc_nonnull_all
static
constexpr
bool
IsDrive
(
const_pointer_type
p
)
noexcept
{
return
IsAlphaASCII
(
p
[
0
])
&&
p
[
1
]
==
':'
;
...
...
@@ -102,7 +102,7 @@ struct PathTraitsFS {
assert
(
p
!=
nullptr
);
#endif
#ifdef WIN32
#ifdef
_
WIN32
if
(
IsDrive
(
p
)
&&
IsSeparator
(
p
[
2
]))
return
true
;
#endif
...
...
@@ -188,7 +188,7 @@ struct PathTraitsUTF8 {
return
strrchr
(
p
,
SEPARATOR
);
}
#ifdef WIN32
#ifdef
_
WIN32
gcc_pure
gcc_nonnull_all
static
constexpr
bool
IsDrive
(
const_pointer_type
p
)
noexcept
{
return
IsAlphaASCII
(
p
[
0
])
&&
p
[
1
]
==
':'
;
...
...
@@ -202,7 +202,7 @@ struct PathTraitsUTF8 {
assert
(
p
!=
nullptr
);
#endif
#ifdef WIN32
#ifdef
_
WIN32
if
(
IsDrive
(
p
)
&&
IsSeparator
(
p
[
2
]))
return
true
;
#endif
...
...
src/fs/io/FileOutputStream.cxx
View file @
dfaf0874
...
...
@@ -43,7 +43,7 @@ FileOutputStream::FileOutputStream(Path _path, Mode _mode)
}
}
#ifdef WIN32
#ifdef
_
WIN32
inline
void
FileOutputStream
::
OpenCreate
(
gcc_unused
bool
visible
)
...
...
@@ -223,7 +223,7 @@ FileOutputStream::Commit()
#endif
if
(
!
Close
())
{
#ifdef WIN32
#ifdef
_
WIN32
throw
FormatLastError
(
"Failed to commit %s"
,
path
.
ToUTF8
().
c_str
());
#else
...
...
src/fs/io/FileOutputStream.hxx
View file @
dfaf0874
...
...
@@ -25,14 +25,14 @@
#include "fs/AllocatedPath.hxx"
#include "Compiler.h"
#ifndef WIN32
#ifndef
_
WIN32
#include "system/FileDescriptor.hxx"
#endif
#include <assert.h>
#include <stdint.h>
#ifdef WIN32
#ifdef
_
WIN32
#include <windows.h>
#endif
...
...
@@ -41,7 +41,7 @@ class Path;
class
FileOutputStream
final
:
public
OutputStream
{
const
AllocatedPath
path
;
#ifdef WIN32
#ifdef
_
WIN32
HANDLE
handle
=
INVALID_HANDLE_VALUE
;
#else
FileDescriptor
fd
=
FileDescriptor
::
Undefined
();
...
...
@@ -116,7 +116,7 @@ private:
bool
Close
()
{
assert
(
IsDefined
());
#ifdef WIN32
#ifdef
_
WIN32
CloseHandle
(
handle
);
handle
=
INVALID_HANDLE_VALUE
;
return
true
;
...
...
@@ -125,7 +125,7 @@ private:
#endif
}
#ifdef WIN32
#ifdef
_
WIN32
bool
SeekEOF
()
{
return
SetFilePointer
(
handle
,
0
,
nullptr
,
FILE_END
)
!=
0xffffffff
;
...
...
@@ -133,7 +133,7 @@ private:
#endif
bool
IsDefined
()
const
{
#ifdef WIN32
#ifdef
_
WIN32
return
handle
!=
INVALID_HANDLE_VALUE
;
#else
return
fd
.
IsDefined
();
...
...
src/fs/io/FileReader.cxx
View file @
dfaf0874
...
...
@@ -24,7 +24,7 @@
#include <assert.h>
#ifdef WIN32
#ifdef
_
WIN32
FileReader
::
FileReader
(
Path
_path
)
:
path
(
_path
),
...
...
src/fs/io/FileReader.hxx
View file @
dfaf0874
...
...
@@ -25,11 +25,11 @@
#include "fs/AllocatedPath.hxx"
#include "Compiler.h"
#ifndef WIN32
#ifndef
_
WIN32
#include "system/FileDescriptor.hxx"
#endif
#ifdef WIN32
#ifdef
_
WIN32
#include <windows.h>
#endif
...
...
@@ -39,7 +39,7 @@ class FileInfo;
class
FileReader
final
:
public
Reader
{
AllocatedPath
path
;
#ifdef WIN32
#ifdef
_
WIN32
HANDLE
handle
;
#else
FileDescriptor
fd
;
...
...
@@ -48,7 +48,7 @@ class FileReader final : public Reader {
public
:
explicit
FileReader
(
Path
_path
);
#ifdef WIN32
#ifdef
_
WIN32
FileReader
(
FileReader
&&
other
)
:
path
(
std
::
move
(
other
.
path
)),
handle
(
other
.
handle
)
{
...
...
@@ -70,7 +70,7 @@ public:
protected
:
bool
IsDefined
()
const
{
#ifdef WIN32
#ifdef
_
WIN32
return
handle
!=
INVALID_HANDLE_VALUE
;
#else
return
fd
.
IsDefined
();
...
...
@@ -78,7 +78,7 @@ protected:
}
public
:
#ifndef WIN32
#ifndef
_
WIN32
FileDescriptor
GetFD
()
const
{
return
fd
;
}
...
...
@@ -90,7 +90,7 @@ public:
gcc_pure
uint64_t
GetSize
()
const
noexcept
{
#ifdef WIN32
#ifdef
_
WIN32
LARGE_INTEGER
size
;
return
GetFileSizeEx
(
handle
,
&
size
)
?
size
.
QuadPart
...
...
@@ -102,7 +102,7 @@ public:
gcc_pure
uint64_t
GetPosition
()
const
noexcept
{
#ifdef WIN32
#ifdef
_
WIN32
LARGE_INTEGER
zero
;
zero
.
QuadPart
=
0
;
LARGE_INTEGER
position
;
...
...
src/input/InputPlugin.hxx
View file @
dfaf0874
...
...
@@ -26,7 +26,7 @@
#include <stddef.h>
#include <stdint.h>
#ifdef WIN32
#ifdef
_
WIN32
#include <windows.h>
/* damn you, windows.h! */
#ifdef ERROR
...
...
src/input/plugins/CurlInputPlugin.cxx
View file @
dfaf0874
...
...
@@ -227,7 +227,7 @@ CurlInputStream::OnHeaders(unsigned status,
if
(
i
!=
headers
.
end
())
{
size_t
icy_metaint
=
ParseUint64
(
i
->
second
.
c_str
());
#ifndef WIN32
#ifndef
_
WIN32
/* Windows doesn't know "%z" */
FormatDebug
(
curl_domain
,
"icy-metaint=%zu"
,
icy_metaint
);
#endif
...
...
@@ -414,7 +414,7 @@ CurlInputStream::SeekInternal(offset_type new_offset)
if
(
offset
>
0
)
{
char
range
[
32
];
#ifdef WIN32
#ifdef
_
WIN32
// TODO: what can we use on Windows to format 64 bit?
sprintf
(
range
,
"%lu-"
,
(
long
)
offset
);
#else
...
...
src/lib/icu/CaseFold.cxx
View file @
dfaf0874
...
...
@@ -36,7 +36,7 @@
#include <ctype.h>
#endif
#ifdef WIN32
#ifdef
_
WIN32
#include "Win32.hxx"
#include <windows.h>
#endif
...
...
@@ -73,7 +73,7 @@ try {
folded
.
SetSize
(
folded_length
);
return
UCharToUTF8
({
folded
.
begin
(),
folded
.
size
()});
#elif defined(WIN32)
#elif defined(
_
WIN32)
const
auto
u
=
MultiByteToWideChar
(
CP_UTF8
,
src
);
const
int
size
=
LCMapStringEx
(
LOCALE_NAME_INVARIANT
,
...
...
src/lib/icu/Collate.cxx
View file @
dfaf0874
...
...
@@ -32,7 +32,7 @@
#include <ctype.h>
#endif
#ifdef WIN32
#ifdef
_
WIN32
#include "Win32.hxx"
#include "util/AllocatedString.hxx"
#include <windows.h>
...
...
@@ -103,7 +103,7 @@ IcuCollate(const char *a, const char *b) noexcept
}
#endif
#elif defined(WIN32)
#elif defined(
_
WIN32)
AllocatedString
<
wchar_t
>
wa
=
nullptr
,
wb
=
nullptr
;
try
{
...
...
src/net/Resolver.cxx
View file @
dfaf0874
...
...
@@ -23,7 +23,7 @@
#include <string>
#ifdef WIN32
#ifdef
_
WIN32
#include <ws2tcpip.h>
#else
#include <sys/types.h>
...
...
src/net/SocketAddress.hxx
View file @
dfaf0874
...
...
@@ -34,7 +34,7 @@
#include <cstddef>
#ifdef WIN32
#ifdef
_
WIN32
#include <winsock2.h>
#else
#include <sys/socket.h>
...
...
@@ -45,7 +45,7 @@
*/
class
SocketAddress
{
public
:
#ifdef WIN32
#ifdef
_
WIN32
typedef
int
size_type
;
#else
typedef
socklen_t
size_type
;
...
...
src/net/SocketError.cxx
View file @
dfaf0874
...
...
@@ -23,7 +23,7 @@
#include <string.h>
#ifdef WIN32
#ifdef
_
WIN32
SocketErrorMessage
::
SocketErrorMessage
(
socket_error_t
code
)
noexcept
{
...
...
src/net/SocketError.hxx
View file @
dfaf0874
...
...
@@ -23,7 +23,7 @@
#include "Compiler.h"
#include "system/Error.hxx"
#ifdef WIN32
#ifdef
_
WIN32
#include <winsock2.h>
typedef
DWORD
socket_error_t
;
#else
...
...
@@ -35,7 +35,7 @@ gcc_pure
static
inline
socket_error_t
GetSocketError
()
noexcept
{
#ifdef WIN32
#ifdef
_
WIN32
return
WSAGetLastError
();
#else
return
errno
;
...
...
@@ -46,7 +46,7 @@ gcc_const
static
inline
bool
IsSocketErrorAgain
(
socket_error_t
code
)
noexcept
{
#ifdef WIN32
#ifdef
_
WIN32
return
code
==
WSAEINPROGRESS
;
#else
return
code
==
EAGAIN
;
...
...
@@ -57,7 +57,7 @@ gcc_const
static
inline
bool
IsSocketErrorInterruped
(
socket_error_t
code
)
noexcept
{
#ifdef WIN32
#ifdef
_
WIN32
return
code
==
WSAEINTR
;
#else
return
code
==
EINTR
;
...
...
@@ -68,7 +68,7 @@ gcc_const
static
inline
bool
IsSocketErrorClosed
(
socket_error_t
code
)
noexcept
{
#ifdef WIN32
#ifdef
_
WIN32
return
code
==
WSAECONNRESET
;
#else
return
code
==
EPIPE
||
code
==
ECONNRESET
;
...
...
@@ -81,7 +81,7 @@ IsSocketErrorClosed(socket_error_t code) noexcept
* and this class hosts the buffer.
*/
class
SocketErrorMessage
{
#ifdef WIN32
#ifdef
_
WIN32
char
msg
[
256
];
#else
const
char
*
const
msg
;
...
...
@@ -99,7 +99,7 @@ gcc_const
static
inline
std
::
system_error
MakeSocketError
(
socket_error_t
code
,
const
char
*
msg
)
noexcept
{
#ifdef WIN32
#ifdef
_
WIN32
return
MakeLastError
(
code
,
msg
);
#else
return
MakeErrno
(
code
,
msg
);
...
...
src/net/ToString.cxx
View file @
dfaf0874
...
...
@@ -34,7 +34,7 @@
#include <algorithm>
#ifdef WIN32
#ifdef
_
WIN32
#include <ws2tcpip.h>
#else
#include <netdb.h>
...
...
src/pcm/SampleFormat.hxx
View file @
dfaf0874
...
...
@@ -24,7 +24,7 @@
#include <stdint.h>
#if defined(WIN32) && GCC_CHECK_VERSION(4,6)
#if defined(
_
WIN32) && GCC_CHECK_VERSION(4,6)
/* on WIN32, "FLOAT" is already defined, and this triggers -Wshadow */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
...
...
@@ -57,7 +57,7 @@ enum class SampleFormat : uint8_t {
DSD
,
};
#if defined(WIN32) && GCC_CHECK_VERSION(4,6)
#if defined(
_
WIN32) && GCC_CHECK_VERSION(4,6)
#pragma GCC diagnostic pop
#endif
...
...
src/storage/plugins/LocalStorage.cxx
View file @
dfaf0874
...
...
@@ -86,7 +86,7 @@ Stat(Path path, bool follow)
info
.
size
=
src
.
GetSize
();
info
.
mtime
=
src
.
GetModificationTime
();
#ifdef WIN32
#ifdef
_
WIN32
info
.
device
=
info
.
inode
=
0
;
#else
info
.
device
=
src
.
GetDevice
();
...
...
src/system/Clock.cxx
View file @
dfaf0874
...
...
@@ -19,7 +19,7 @@
#include "Clock.hxx"
#ifdef WIN32
#ifdef
_
WIN32
#include <windows.h>
gcc_const
...
...
src/system/Clock.hxx
View file @
dfaf0874
...
...
@@ -22,7 +22,7 @@
#include "Compiler.h"
#ifdef WIN32
#ifdef
_
WIN32
/**
* Returns the uptime of the current process in seconds.
...
...
src/system/Error.hxx
View file @
dfaf0874
...
...
@@ -47,7 +47,7 @@ FormatSystemError(std::error_code code, const char *fmt, Args&&... args)
return
std
::
system_error
(
code
,
buffer
);
}
#ifdef WIN32
#ifdef
_
WIN32
#include <windows.h>
...
...
@@ -90,7 +90,7 @@ FormatLastError(const char *fmt, Args&&... args)
std
::
forward
<
Args
>
(
args
)...);
}
#endif
/* WIN32 */
#endif
/*
_
WIN32 */
#include <errno.h>
#include <string.h>
...
...
@@ -106,7 +106,7 @@ FormatLastError(const char *fmt, Args&&... args)
static
inline
const
std
::
error_category
&
ErrnoCategory
()
{
#ifdef WIN32
#ifdef
_
WIN32
/* on Windows, the generic_category() is used for errno
values */
return
std
::
generic_category
();
...
...
@@ -151,7 +151,7 @@ gcc_pure
static
inline
bool
IsFileNotFound
(
const
std
::
system_error
&
e
)
noexcept
{
#ifdef WIN32
#ifdef
_
WIN32
return
e
.
code
().
category
()
==
std
::
system_category
()
&&
e
.
code
().
value
()
==
ERROR_FILE_NOT_FOUND
;
#else
...
...
@@ -164,7 +164,7 @@ gcc_pure
static
inline
bool
IsPathNotFound
(
const
std
::
system_error
&
e
)
noexcept
{
#ifdef WIN32
#ifdef
_
WIN32
return
e
.
code
().
category
()
==
std
::
system_category
()
&&
e
.
code
().
value
()
==
ERROR_PATH_NOT_FOUND
;
#else
...
...
@@ -177,7 +177,7 @@ gcc_pure
static
inline
bool
IsAccessDenied
(
const
std
::
system_error
&
e
)
noexcept
{
#ifdef WIN32
#ifdef
_
WIN32
return
e
.
code
().
category
()
==
std
::
system_category
()
&&
e
.
code
().
value
()
==
ERROR_ACCESS_DENIED
;
#else
...
...
src/system/EventPipe.cxx
View file @
dfaf0874
...
...
@@ -26,19 +26,19 @@
#include <assert.h>
#include <unistd.h>
#ifdef WIN32
#ifdef
_
WIN32
#include <ws2tcpip.h>
#include <winsock2.h>
#include <cstring>
/* for memset() */
#endif
#ifdef WIN32
#ifdef
_
WIN32
static
bool
PoorSocketPair
(
int
fd
[
2
]);
#endif
EventPipe
::
EventPipe
()
{
#ifdef WIN32
#ifdef
_
WIN32
bool
success
=
PoorSocketPair
(
fds
);
#else
bool
success
=
pipe_cloexec_nonblock
(
fds
)
>=
0
;
...
...
@@ -49,7 +49,7 @@ EventPipe::EventPipe()
EventPipe
::~
EventPipe
()
{
#ifdef WIN32
#ifdef
_
WIN32
closesocket
(
fds
[
0
]);
closesocket
(
fds
[
1
]);
#else
...
...
@@ -65,7 +65,7 @@ EventPipe::Read()
assert
(
fds
[
1
]
>=
0
);
char
buffer
[
256
];
#ifdef WIN32
#ifdef
_
WIN32
return
recv
(
fds
[
0
],
buffer
,
sizeof
(
buffer
),
0
)
>
0
;
#else
return
read
(
fds
[
0
],
buffer
,
sizeof
(
buffer
))
>
0
;
...
...
@@ -78,14 +78,14 @@ EventPipe::Write()
assert
(
fds
[
0
]
>=
0
);
assert
(
fds
[
1
]
>=
0
);
#ifdef WIN32
#ifdef
_
WIN32
send
(
fds
[
1
],
""
,
1
,
0
);
#else
gcc_unused
ssize_t
nbytes
=
write
(
fds
[
1
],
""
,
1
);
#endif
}
#ifdef WIN32
#ifdef
_
WIN32
static
void
SafeCloseSocket
(
SOCKET
s
)
{
...
...
src/system/FatalError.cxx
View file @
dfaf0874
...
...
@@ -28,7 +28,7 @@
#include <stdlib.h>
#include <string.h>
#ifdef WIN32
#ifdef
_
WIN32
#include <windows.h>
#else
#include <errno.h>
...
...
@@ -61,7 +61,7 @@ FormatFatalError(const char *fmt, ...)
Abort
();
}
#ifdef WIN32
#ifdef
_
WIN32
void
FatalSystemError
(
const
char
*
msg
,
DWORD
code
)
...
...
@@ -79,7 +79,7 @@ FatalSystemError(const char *msg, DWORD code)
void
FatalSystemError
(
const
char
*
msg
)
{
#ifdef WIN32
#ifdef
_
WIN32
FatalSystemError
(
msg
,
GetLastError
());
#else
const
char
*
system_error
=
strerror
(
errno
);
...
...
src/system/FatalError.hxx
View file @
dfaf0874
...
...
@@ -23,7 +23,7 @@
#include "check.h"
#include "Compiler.h"
#ifdef WIN32
#ifdef
_
WIN32
#include <windef.h>
#endif
...
...
@@ -47,7 +47,7 @@ gcc_noreturn
void
FatalSystemError
(
const
char
*
msg
);
#ifdef WIN32
#ifdef
_
WIN32
gcc_noreturn
void
...
...
src/system/FileDescriptor.cxx
View file @
dfaf0874
...
...
@@ -33,7 +33,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#ifndef WIN32
#ifndef
_
WIN32
#include <poll.h>
#endif
...
...
@@ -70,7 +70,7 @@ FileDescriptor::OpenReadOnly(const char *pathname) noexcept
return
Open
(
pathname
,
O_RDONLY
);
}
#ifndef WIN32
#ifndef
_
WIN32
bool
FileDescriptor
::
OpenNonBlocking
(
const
char
*
pathname
)
noexcept
...
...
@@ -184,7 +184,7 @@ FileDescriptor::GetSize() const noexcept
:
-
1
;
}
#ifndef WIN32
#ifndef
_
WIN32
int
FileDescriptor
::
Poll
(
short
events
,
int
timeout
)
const
noexcept
...
...
src/system/FileDescriptor.hxx
View file @
dfaf0874
...
...
@@ -93,7 +93,7 @@ public:
bool
Open
(
const
char
*
pathname
,
int
flags
,
mode_t
mode
=
0666
)
noexcept
;
bool
OpenReadOnly
(
const
char
*
pathname
)
noexcept
;
#ifndef WIN32
#ifndef
_
WIN32
bool
OpenNonBlocking
(
const
char
*
pathname
)
noexcept
;
static
bool
CreatePipe
(
FileDescriptor
&
r
,
FileDescriptor
&
w
)
noexcept
;
...
...
@@ -169,7 +169,7 @@ public:
return
::
write
(
fd
,
buffer
,
length
);
}
#ifndef WIN32
#ifndef
_
WIN32
int
Poll
(
short
events
,
int
timeout
)
const
noexcept
;
int
WaitReadable
(
int
timeout
)
const
noexcept
;
...
...
src/system/fd_util.c
View file @
dfaf0874
...
...
@@ -34,7 +34,7 @@
#include <fcntl.h>
#include <errno.h>
#ifdef WIN32
#ifdef
_
WIN32
#include <ws2tcpip.h>
#include <winsock2.h>
#else
...
...
@@ -45,7 +45,7 @@
#include <sys/eventfd.h>
#endif
#ifndef WIN32
#ifndef
_
WIN32
static
int
fd_mask_flags
(
int
fd
,
int
and_mask
,
int
xor_mask
)
...
...
@@ -63,12 +63,12 @@ fd_mask_flags(int fd, int and_mask, int xor_mask)
return
fcntl
(
fd
,
F_SETFD
,
new_flags
);
}
#endif
/* !WIN32 */
#endif
/* !
_
WIN32 */
int
fd_set_cloexec
(
int
fd
,
bool
enable
)
{
#ifndef WIN32
#ifndef
_
WIN32
return
fd_mask_flags
(
fd
,
~
FD_CLOEXEC
,
enable
?
FD_CLOEXEC
:
0
);
#else
(
void
)
fd
;
...
...
@@ -85,7 +85,7 @@ fd_set_cloexec(int fd, bool enable)
static
int
fd_set_nonblock
(
int
fd
)
{
#ifdef WIN32
#ifdef
_
WIN32
u_long
val
=
1
;
return
ioctlsocket
(
fd
,
FIONBIO
,
&
val
);
#else
...
...
@@ -124,7 +124,7 @@ open_cloexec(const char *path_fs, int flags, int mode)
int
pipe_cloexec_nonblock
(
int
fd
[
2
])
{
#ifdef WIN32
#ifdef
_
WIN32
return
_pipe
(
fd
,
512
,
_O_BINARY
);
#else
int
ret
;
...
...
@@ -199,7 +199,7 @@ accept_cloexec_nonblock(int fd, struct sockaddr *address,
int
close_socket
(
int
fd
)
{
#ifdef WIN32
#ifdef
_
WIN32
return
closesocket
(
fd
);
#else
return
close
(
fd
);
...
...
src/system/fd_util.h
View file @
dfaf0874
...
...
@@ -41,7 +41,7 @@
#include <stdbool.h>
#include <stddef.h>
#ifndef WIN32
#ifndef
_
WIN32
#include <sys/types.h>
#endif
...
...
src/tag/Format.cxx
View file @
dfaf0874
...
...
@@ -86,7 +86,7 @@ TagGetter(const void *object, const char *name) noexcept
if
(
strcmp
(
name
,
"iso8601"
)
==
0
)
{
time_t
t
=
time
(
nullptr
);
#ifdef WIN32
#ifdef
_
WIN32
const
struct
tm
*
tm2
=
gmtime
(
&
t
);
#else
struct
tm
tm
;
...
...
@@ -96,7 +96,7 @@ TagGetter(const void *object, const char *name) noexcept
return
""
;
strftime
(
ctx
.
buffer
,
sizeof
(
ctx
.
buffer
),
#ifdef WIN32
#ifdef
_
WIN32
/* kludge: use underscore instead of colon on
Windows because colons are not allowed in
file names, and this library is mostly
...
...
src/thread/Cond.hxx
View file @
dfaf0874
...
...
@@ -30,7 +30,7 @@
#ifndef THREAD_COND_HXX
#define THREAD_COND_HXX
#ifdef WIN32
#ifdef
_
WIN32
#include "WindowsCond.hxx"
class
Cond
:
public
WindowsCond
{};
...
...
src/thread/Id.hxx
View file @
dfaf0874
...
...
@@ -22,7 +22,7 @@
#include "Compiler.h"
#ifdef WIN32
#ifdef
_
WIN32
#include <windows.h>
#else
#include <pthread.h>
...
...
@@ -34,7 +34,7 @@
* debugging code.
*/
class
ThreadId
{
#ifdef WIN32
#ifdef
_
WIN32
DWORD
id
;
#else
pthread_t
id
;
...
...
@@ -46,7 +46,7 @@ public:
*/
ThreadId
()
=
default
;
#ifdef WIN32
#ifdef
_
WIN32
constexpr
ThreadId
(
DWORD
_id
)
:
id
(
_id
)
{}
#else
constexpr
ThreadId
(
pthread_t
_id
)
:
id
(
_id
)
{}
...
...
@@ -54,7 +54,7 @@ public:
gcc_const
static
ThreadId
Null
()
noexcept
{
#ifdef WIN32
#ifdef
_
WIN32
return
0
;
#else
static
ThreadId
null
;
...
...
@@ -72,7 +72,7 @@ public:
*/
gcc_pure
static
const
ThreadId
GetCurrent
()
noexcept
{
#ifdef WIN32
#ifdef
_
WIN32
return
::
GetCurrentThreadId
();
#else
return
pthread_self
();
...
...
@@ -81,7 +81,7 @@ public:
gcc_pure
bool
operator
==
(
const
ThreadId
&
other
)
const
noexcept
{
#ifdef WIN32
#ifdef
_
WIN32
return
id
==
other
.
id
;
#else
return
pthread_equal
(
id
,
other
.
id
);
...
...
src/thread/Mutex.hxx
View file @
dfaf0874
...
...
@@ -32,7 +32,7 @@
#include <mutex>
#ifdef WIN32
#ifdef
_
WIN32
#include "CriticalSection.hxx"
class
Mutex
:
public
CriticalSection
{};
...
...
src/thread/Thread.cxx
View file @
dfaf0874
...
...
@@ -33,7 +33,7 @@ Thread::Start(void (*_f)(void *ctx), void *_ctx)
f
=
_f
;
ctx
=
_ctx
;
#ifdef WIN32
#ifdef
_
WIN32
handle
=
::
CreateThread
(
nullptr
,
0
,
ThreadProc
,
this
,
0
,
&
id
);
if
(
handle
==
nullptr
)
throw
MakeLastError
(
"Failed to create thread"
);
...
...
@@ -66,7 +66,7 @@ Thread::Join()
assert
(
IsDefined
());
assert
(
!
IsInside
());
#ifdef WIN32
#ifdef
_
WIN32
::
WaitForSingleObject
(
handle
,
INFINITE
);
::
CloseHandle
(
handle
);
handle
=
nullptr
;
...
...
@@ -76,7 +76,7 @@ Thread::Join()
#endif
}
#ifdef WIN32
#ifdef
_
WIN32
DWORD
WINAPI
Thread
::
ThreadProc
(
LPVOID
ctx
)
...
...
src/thread/Thread.hxx
View file @
dfaf0874
...
...
@@ -23,7 +23,7 @@
#include "check.h"
#include "Compiler.h"
#ifdef WIN32
#ifdef
_
WIN32
#include <windows.h>
#else
#include <pthread.h>
...
...
@@ -32,7 +32,7 @@
#include <assert.h>
class
Thread
{
#ifdef WIN32
#ifdef
_
WIN32
HANDLE
handle
=
nullptr
;
DWORD
id
;
#else
...
...
@@ -66,7 +66,7 @@ public:
#endif
bool
IsDefined
()
const
{
#ifdef WIN32
#ifdef
_
WIN32
return
handle
!=
nullptr
;
#else
return
defined
;
...
...
@@ -78,7 +78,7 @@ public:
*/
gcc_pure
bool
IsInside
()
const
noexcept
{
#ifdef WIN32
#ifdef
_
WIN32
return
GetCurrentThreadId
()
==
id
;
#else
#ifdef NDEBUG
...
...
@@ -93,7 +93,7 @@ public:
void
Join
();
private
:
#ifdef WIN32
#ifdef
_
WIN32
static
DWORD
WINAPI
ThreadProc
(
LPVOID
ctx
);
#else
static
void
*
ThreadProc
(
void
*
ctx
);
...
...
src/thread/Util.cxx
View file @
dfaf0874
...
...
@@ -34,7 +34,7 @@
#include <sched.h>
#include <sys/syscall.h>
#include <unistd.h>
#elif defined(WIN32)
#elif defined(
_
WIN32)
#include <windows.h>
#endif
...
...
@@ -71,7 +71,7 @@ SetThreadIdlePriority()
ioprio_set_idle
();
#elif defined(WIN32)
#elif defined(
_
WIN32)
SetThreadPriority
(
GetCurrentThread
(),
THREAD_PRIORITY_IDLE
);
#endif
};
...
...
src/unix/Daemon.cxx
View file @
dfaf0874
...
...
@@ -23,7 +23,7 @@
#include "fs/AllocatedPath.hxx"
#include "fs/FileSystem.hxx"
#ifndef WIN32
#ifndef
_
WIN32
#include "PidFile.hxx"
#endif
...
...
@@ -31,7 +31,7 @@
#include <unistd.h>
#include <fcntl.h>
#ifndef WIN32
#ifndef
_
WIN32
#include <sys/wait.h>
#include <signal.h>
#include <pwd.h>
...
...
@@ -42,7 +42,7 @@
#define WCOREDUMP(v) 0
#endif
#ifndef WIN32
#ifndef
_
WIN32
/** the Unix user name which MPD runs as */
static
char
*
user_name
;
...
...
src/unix/Daemon.hxx
View file @
dfaf0874
...
...
@@ -22,7 +22,7 @@
class
AllocatedPath
;
#ifndef WIN32
#ifndef
_
WIN32
void
daemonize_init
(
const
char
*
user
,
const
char
*
group
,
AllocatedPath
&&
pidfile
);
#else
...
...
@@ -31,7 +31,7 @@ daemonize_init(const char *user, const char *group, AllocatedPath &&pidfile)
{
(
void
)
user
;
(
void
)
group
;
(
void
)
pidfile
;
}
#endif
#ifndef WIN32
#ifndef
_
WIN32
void
daemonize_finish
();
#else
...
...
@@ -44,7 +44,7 @@ daemonize_finish()
* Kill the MPD which is currently running, pid determined from the
* pid file.
*/
#ifndef WIN32
#ifndef
_
WIN32
void
daemonize_kill
();
#else
...
...
@@ -59,7 +59,7 @@ daemonize_kill()
/**
* Close stdin (fd 0) and re-open it as /dev/null.
*/
#ifndef WIN32
#ifndef
_
WIN32
void
daemonize_close_stdin
();
#else
...
...
@@ -70,7 +70,7 @@ daemonize_close_stdin() {}
/**
* Change to the configured Unix user.
*/
#ifndef WIN32
#ifndef
_
WIN32
void
daemonize_set_user
();
#else
...
...
@@ -79,7 +79,7 @@ daemonize_set_user()
{
/* nop */
}
#endif
#ifndef WIN32
#ifndef
_
WIN32
void
daemonize_begin
(
bool
detach
);
#else
...
...
@@ -88,7 +88,7 @@ daemonize_begin(bool detach)
{
(
void
)
detach
;
}
#endif
#ifndef WIN32
#ifndef
_
WIN32
void
daemonize_commit
();
#else
...
...
src/unix/SignalHandlers.cxx
View file @
dfaf0874
...
...
@@ -21,7 +21,7 @@
#include "SignalHandlers.hxx"
#include "event/SignalMonitor.hxx"
#ifndef WIN32
#ifndef
_
WIN32
#include "Log.hxx"
#include "LogInit.hxx"
...
...
@@ -61,7 +61,7 @@ SignalHandlersInit(EventLoop &loop)
{
SignalMonitorInit
(
loop
);
#ifndef WIN32
#ifndef
_
WIN32
struct
sigaction
sa
;
sa
.
sa_flags
=
0
;
...
...
src/util/FormatString.cxx
View file @
dfaf0874
...
...
@@ -23,14 +23,14 @@
#include <stdio.h>
#include <stdlib.h>
#ifdef WIN32
#ifdef
_
WIN32
#include <string.h>
#endif
AllocatedString
<>
FormatStringV
(
const
char
*
fmt
,
va_list
args
)
{
#ifndef WIN32
#ifndef
_
WIN32
va_list
tmp
;
va_copy
(
tmp
,
args
);
const
int
length
=
vsnprintf
(
NULL
,
0
,
fmt
,
tmp
);
...
...
src/util/HugeAllocator.cxx
View file @
dfaf0874
...
...
@@ -96,7 +96,7 @@ HugeDiscard(void *p, size_t size) noexcept
#endif
}
#elif defined(WIN32)
#elif defined(
_
WIN32)
void
*
HugeAllocate
(
size_t
size
)
...
...
src/util/HugeAllocator.hxx
View file @
dfaf0874
...
...
@@ -65,7 +65,7 @@ HugeFree(void *p, size_t size) noexcept;
void
HugeDiscard
(
void
*
p
,
size_t
size
)
noexcept
;
#elif defined(WIN32)
#elif defined(
_
WIN32)
#include <windows.h>
gcc_malloc
...
...
src/util/StringAPI.hxx
View file @
dfaf0874
...
...
@@ -105,7 +105,7 @@ gcc_nonnull_all
static
inline
char
*
UnsafeCopyStringP
(
char
*
dest
,
const
char
*
src
)
noexcept
{
#if defined(WIN32) || defined(__BIONIC__)
#if defined(
_
WIN32) || defined(__BIONIC__)
/* emulate stpcpy() */
UnsafeCopyString
(
dest
,
src
);
return
dest
+
StringLength
(
dest
);
...
...
src/util/TimeParser.cxx
View file @
dfaf0874
...
...
@@ -35,7 +35,7 @@
#include <assert.h>
#include <time.h>
#if !defined(__GLIBC__) && !defined(WIN32)
#if !defined(__GLIBC__) && !defined(
_
WIN32)
/**
* Determine the time zone offset in a portable way.
...
...
@@ -59,7 +59,7 @@ ParseTimePoint(const char *s, const char *format)
assert
(
s
!=
nullptr
);
assert
(
format
!=
nullptr
);
#ifdef WIN32
#ifdef
_
WIN32
/* TODO: emulate strptime()? */
(
void
)
s
;
(
void
)
format
;
...
...
@@ -80,5 +80,5 @@ ParseTimePoint(const char *s, const char *format)
return
std
::
chrono
::
system_clock
::
from_time_t
(
t
);
#endif
/* !WIN32 */
#endif
/* !
_
WIN32 */
}
src/util/WStringAPI.hxx
View file @
dfaf0874
...
...
@@ -101,7 +101,7 @@ gcc_nonnull_all
static
inline
wchar_t
*
UnsafeCopyStringP
(
wchar_t
*
dest
,
const
wchar_t
*
src
)
noexcept
{
#if defined(WIN32) || defined(__BIONIC__) || defined(__OpenBSD__) || \
#if defined(
_
WIN32) || defined(__BIONIC__) || defined(__OpenBSD__) || \
defined(__NetBSD__)
/* emulate wcpcpy() */
UnsafeCopyString
(
dest
,
src
);
...
...
src/win32/Win32Main.cxx
View file @
dfaf0874
...
...
@@ -20,7 +20,7 @@
#include "config.h"
#include "Main.hxx"
#ifdef WIN32
#ifdef
_
WIN32
#include "Compiler.h"
#include "Instance.hxx"
...
...
test/ShutdownHandler.cxx
View file @
dfaf0874
...
...
@@ -20,7 +20,7 @@
#include "config.h"
#include "ShutdownHandler.hxx"
#ifndef WIN32
#ifndef
_
WIN32
#include "event/SignalMonitor.hxx"
#include "event/Loop.hxx"
...
...
test/ShutdownHandler.hxx
View file @
dfaf0874
...
...
@@ -28,7 +28,7 @@ public:
~
ShutdownHandler
();
};
#ifdef WIN32
#ifdef
_
WIN32
ShutdownHandler
::
ShutdownHandler
(
EventLoop
&
loop
)
{}
ShutdownHandler
::~
ShutdownHandler
()
{}
#endif
...
...
test/run_resolver.cxx
View file @
dfaf0874
...
...
@@ -25,7 +25,7 @@
#include <stdexcept>
#ifdef WIN32
#ifdef
_
WIN32
#include <ws2tcpip.h>
#include <winsock.h>
#else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment