Merge branch 'v0.20.x'
This commit is contained in:
commit
6246d36fe6
@ -773,6 +773,7 @@ libneighbor_a_SOURCES = \
|
|||||||
src/neighbor/NeighborPlugin.hxx
|
src/neighbor/NeighborPlugin.hxx
|
||||||
|
|
||||||
libneighbor_a_CPPFLAGS = $(AM_CPPFLAGS) \
|
libneighbor_a_CPPFLAGS = $(AM_CPPFLAGS) \
|
||||||
|
$(UPNP_CFLAGS) \
|
||||||
$(SMBCLIENT_CFLAGS)
|
$(SMBCLIENT_CFLAGS)
|
||||||
|
|
||||||
if ENABLE_SMBCLIENT
|
if ENABLE_SMBCLIENT
|
||||||
@ -822,6 +823,8 @@ libdb_plugins_a_SOURCES = \
|
|||||||
src/db/plugins/simple/PrefixedLightSong.hxx \
|
src/db/plugins/simple/PrefixedLightSong.hxx \
|
||||||
src/db/plugins/simple/SimpleDatabasePlugin.cxx \
|
src/db/plugins/simple/SimpleDatabasePlugin.cxx \
|
||||||
src/db/plugins/simple/SimpleDatabasePlugin.hxx
|
src/db/plugins/simple/SimpleDatabasePlugin.hxx
|
||||||
|
libdb_plugins_a_CPPFLAGS = $(AM_CPPFLAGS) \
|
||||||
|
$(UPNP_CFLAGS)
|
||||||
|
|
||||||
if ENABLE_LIBMPDCLIENT
|
if ENABLE_LIBMPDCLIENT
|
||||||
libdb_plugins_a_SOURCES += \
|
libdb_plugins_a_SOURCES += \
|
||||||
@ -2422,6 +2425,7 @@ EXTRA_DIST = $(doc_DATA) autogen.sh \
|
|||||||
$(man_MANS) $(DOCBOOK_FILES) doc/mpdconf.example doc/doxygen.conf \
|
$(man_MANS) $(DOCBOOK_FILES) doc/mpdconf.example doc/doxygen.conf \
|
||||||
$(wildcard $(srcdir)/doc/include/*.xml) \
|
$(wildcard $(srcdir)/doc/include/*.xml) \
|
||||||
systemd/system/mpd.socket \
|
systemd/system/mpd.socket \
|
||||||
|
$(wildcard $(srcdir)/python/build/*.py) \
|
||||||
android/AndroidManifest.xml \
|
android/AndroidManifest.xml \
|
||||||
android/build.py \
|
android/build.py \
|
||||||
android/custom_rules.xml \
|
android/custom_rules.xml \
|
||||||
@ -2429,5 +2433,6 @@ EXTRA_DIST = $(doc_DATA) autogen.sh \
|
|||||||
android/src/Bridge.java \
|
android/src/Bridge.java \
|
||||||
android/src/Loader.java \
|
android/src/Loader.java \
|
||||||
android/src/Main.java \
|
android/src/Main.java \
|
||||||
|
win32/build.py \
|
||||||
win32/res/mpd.rc.in win32/res/mpd.ico \
|
win32/res/mpd.rc.in win32/res/mpd.ico \
|
||||||
src/haiku/App_MusicPD
|
src/haiku/App_MusicPD
|
||||||
|
4
NEWS
4
NEWS
@ -16,11 +16,15 @@ ver 0.21 (not yet released)
|
|||||||
- sndio: new mixer plugin
|
- sndio: new mixer plugin
|
||||||
|
|
||||||
ver 0.20.13 (not yet released)
|
ver 0.20.13 (not yet released)
|
||||||
|
* output
|
||||||
|
- osx: set up ring buffer to hold at least 100ms
|
||||||
* database
|
* database
|
||||||
- simple: don't purge mount points on update/rescan
|
- simple: don't purge mount points on update/rescan
|
||||||
- simple: fix "mount" bug caused by bad compiler optimization
|
- simple: fix "mount" bug caused by bad compiler optimization
|
||||||
- upnp: work around libupnp 1.6.24 API breakage
|
- upnp: work around libupnp 1.6.24 API breakage
|
||||||
* queue: fix spuriously misplaced prioritized songs
|
* 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)
|
ver 0.20.12 (2017/11/25)
|
||||||
* database
|
* database
|
||||||
|
@ -46,13 +46,14 @@ class AndroidNdkToolchain:
|
|||||||
|
|
||||||
self.ndk_arch = 'arm'
|
self.ndk_arch = 'arm'
|
||||||
android_abi = 'armeabi-v7a'
|
android_abi = 'armeabi-v7a'
|
||||||
ndk_platform = 'android-14'
|
ndk_platform = 'android-21'
|
||||||
|
|
||||||
# select the NDK compiler
|
# select the NDK compiler
|
||||||
gcc_version = '4.9'
|
gcc_version = '4.9'
|
||||||
|
|
||||||
ndk_platform_path = os.path.join(ndk_path, 'platforms', ndk_platform)
|
ndk_platform_path = os.path.join(ndk_path, 'platforms', ndk_platform)
|
||||||
sysroot = os.path.join(ndk_platform_path, 'arch-' + self.ndk_arch)
|
sysroot = os.path.join(ndk_path, 'sysroot')
|
||||||
|
target_root = os.path.join(ndk_platform_path, 'arch-' + self.ndk_arch)
|
||||||
|
|
||||||
install_prefix = os.path.join(arch_path, 'root')
|
install_prefix = os.path.join(arch_path, 'root')
|
||||||
|
|
||||||
@ -79,8 +80,15 @@ class AndroidNdkToolchain:
|
|||||||
|
|
||||||
self.cflags = '-Os -g ' + common_flags
|
self.cflags = '-Os -g ' + common_flags
|
||||||
self.cxxflags = '-Os -g ' + common_flags
|
self.cxxflags = '-Os -g ' + common_flags
|
||||||
self.cppflags = '--sysroot=' + self.sysroot + ' -isystem ' + os.path.join(install_prefix, 'include')
|
self.cppflags = '--sysroot=' + sysroot + \
|
||||||
self.ldflags = '--sysroot=' + self.sysroot + ' ' + common_flags + ' -L' + os.path.join(install_prefix, 'lib')
|
' -isystem ' + os.path.join(install_prefix, 'include') + \
|
||||||
|
' -isystem ' + os.path.join(sysroot, 'usr', 'include', arch) + \
|
||||||
|
' -D__ANDROID_API__=21'
|
||||||
|
self.ldflags = '--sysroot=' + sysroot + \
|
||||||
|
' -L' + os.path.join(install_prefix, 'lib') + \
|
||||||
|
' -L' + os.path.join(target_root, 'usr', 'lib') + \
|
||||||
|
' -B' + os.path.join(target_root, 'usr', 'lib') + \
|
||||||
|
' ' + common_flags
|
||||||
self.libs = ''
|
self.libs = ''
|
||||||
|
|
||||||
self.is_arm = self.ndk_arch == 'arm'
|
self.is_arm = self.ndk_arch == 'arm'
|
||||||
|
@ -492,7 +492,7 @@ if test x$enable_ipv6 = xyes; then
|
|||||||
AC_EGREP_CPP([AP_maGiC_VALUE],
|
AC_EGREP_CPP([AP_maGiC_VALUE],
|
||||||
[
|
[
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
@ -69,8 +69,8 @@ liblame = AutotoolsProject(
|
|||||||
)
|
)
|
||||||
|
|
||||||
ffmpeg = FfmpegProject(
|
ffmpeg = FfmpegProject(
|
||||||
'http://ffmpeg.org/releases/ffmpeg-3.3.3.tar.xz',
|
'http://ffmpeg.org/releases/ffmpeg-3.4.1.tar.xz',
|
||||||
'd2a9002cdc6b533b59728827186c044ad02ba64841f1b7cd6c21779875453a1e',
|
'5a77278a63741efa74e26bf197b9bb09ac6381b9757391b922407210f0f991c0',
|
||||||
'lib/libavcodec.a',
|
'lib/libavcodec.a',
|
||||||
[
|
[
|
||||||
'--disable-shared', '--enable-static',
|
'--disable-shared', '--enable-static',
|
||||||
@ -84,17 +84,26 @@ ffmpeg = FfmpegProject(
|
|||||||
'--disable-swscale',
|
'--disable-swscale',
|
||||||
'--disable-postproc',
|
'--disable-postproc',
|
||||||
'--disable-avfilter',
|
'--disable-avfilter',
|
||||||
|
'--disable-lzo',
|
||||||
|
'--disable-faan',
|
||||||
|
'--disable-pixelutils',
|
||||||
'--disable-network',
|
'--disable-network',
|
||||||
'--disable-encoders',
|
'--disable-encoders',
|
||||||
'--disable-protocols',
|
'--disable-protocols',
|
||||||
'--disable-outdevs',
|
'--disable-devices',
|
||||||
'--disable-filters',
|
'--disable-filters',
|
||||||
|
'--disable-v4l2_m2m',
|
||||||
|
|
||||||
|
# clang misinterprets the "B0" in hevc_mvs.c as binary
|
||||||
|
# literal, which breaks the build; but we don't need that
|
||||||
|
# video codec anyway
|
||||||
|
'--disable-decoder=hevc',
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
curl = AutotoolsProject(
|
curl = AutotoolsProject(
|
||||||
'http://curl.haxx.se/download/curl-7.55.1.tar.xz',
|
'http://curl.haxx.se/download/curl-7.57.0.tar.xz',
|
||||||
'3eafca6e84ecb4af5f35795dee84e643d5428287e88c041122bb8dac18676bb7',
|
'f5f6fd3c72b7b8389969f4fb671ed8532fa9b5bb7a5cae7ca89bc1cea45c7878',
|
||||||
'lib/libcurl.a',
|
'lib/libcurl.a',
|
||||||
[
|
[
|
||||||
'--disable-shared', '--enable-static',
|
'--disable-shared', '--enable-static',
|
||||||
@ -114,7 +123,7 @@ curl = AutotoolsProject(
|
|||||||
)
|
)
|
||||||
|
|
||||||
boost = BoostProject(
|
boost = BoostProject(
|
||||||
'http://downloads.sourceforge.net/project/boost/boost/1.65.0/boost_1_65_0.tar.bz2',
|
'http://downloads.sourceforge.net/project/boost/boost/1.65.1/boost_1_65_1.tar.bz2',
|
||||||
'ea26712742e2fb079c2a566a31f3266973b76e38222b9f88b387e3c8b2f9902c',
|
'9807a5d16566c57fd74fb522764e0b134a8bbe6b6e8967b83afefd30dcd3be81',
|
||||||
'include/boost/version.hpp',
|
'include/boost/version.hpp',
|
||||||
)
|
)
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#define CONFIG_FILE_LOCATION PATH_LITERAL("mpd\\mpd.conf")
|
#define CONFIG_FILE_LOCATION PATH_LITERAL("mpd\\mpd.conf")
|
||||||
#define APP_CONFIG_FILE_LOCATION PATH_LITERAL("conf\\mpd.conf")
|
#define APP_CONFIG_FILE_LOCATION PATH_LITERAL("conf\\mpd.conf")
|
||||||
#else
|
#else
|
||||||
@ -389,7 +389,7 @@ ParseCommandLine(int argc, char **argv, struct options *options)
|
|||||||
ConfigLoader loader;
|
ConfigLoader loader;
|
||||||
|
|
||||||
bool found =
|
bool found =
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
loader.TryFile(GetUserConfigDir(), CONFIG_FILE_LOCATION) ||
|
loader.TryFile(GetUserConfigDir(), CONFIG_FILE_LOCATION) ||
|
||||||
loader.TryFile(GetSystemConfigDir(), CONFIG_FILE_LOCATION) ||
|
loader.TryFile(GetSystemConfigDir(), CONFIG_FILE_LOCATION) ||
|
||||||
loader.TryFile(GetAppBaseDir(), APP_CONFIG_FILE_LOCATION);
|
loader.TryFile(GetAppBaseDir(), APP_CONFIG_FILE_LOCATION);
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include "Compiler.h"
|
#include "Compiler.h"
|
||||||
#include "fs/AllocatedPath.hxx"
|
#include "fs/AllocatedPath.hxx"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
/* damn you, windows.h! */
|
/* damn you, windows.h! */
|
||||||
#ifdef ABSOLUTE
|
#ifdef ABSOLUTE
|
||||||
|
@ -164,7 +164,7 @@ FileLog(const Domain &domain, const char *message) noexcept
|
|||||||
domain.GetName(),
|
domain.GetName(),
|
||||||
chomp_length(message), message);
|
chomp_length(message), message);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
/* force-flush the log file, because setvbuf() does not seem
|
/* force-flush the log file, because setvbuf() does not seem
|
||||||
to have an effect on WIN32 */
|
to have an effect on WIN32 */
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
@ -72,7 +72,7 @@ log_init_file(int line)
|
|||||||
|
|
||||||
out_fd = open_log_file();
|
out_fd = open_log_file();
|
||||||
if (out_fd < 0) {
|
if (out_fd < 0) {
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
const std::string out_path_utf8 = out_path.ToUTF8();
|
const std::string out_path_utf8 = out_path.ToUTF8();
|
||||||
throw FormatRuntimeError("failed to open log file \"%s\" (config line %d)",
|
throw FormatRuntimeError("failed to open log file \"%s\" (config line %d)",
|
||||||
out_path_utf8.c_str(), line);
|
out_path_utf8.c_str(), line);
|
||||||
@ -182,7 +182,7 @@ void setup_log_output()
|
|||||||
fflush(nullptr);
|
fflush(nullptr);
|
||||||
|
|
||||||
if (out_fd < 0) {
|
if (out_fd < 0) {
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return;
|
return;
|
||||||
#else
|
#else
|
||||||
out_fd = open("/dev/null", O_WRONLY);
|
out_fd = open("/dev/null", O_WRONLY);
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#ifndef MPD_LOG_LEVEL_HXX
|
#ifndef MPD_LOG_LEVEL_HXX
|
||||||
#define MPD_LOG_LEVEL_HXX
|
#define MPD_LOG_LEVEL_HXX
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
/* damn you, windows.h! */
|
/* damn you, windows.h! */
|
||||||
#ifdef ERROR
|
#ifdef ERROR
|
||||||
|
12
src/Main.cxx
12
src/Main.cxx
@ -105,7 +105,7 @@
|
|||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
#endif
|
#endif
|
||||||
@ -290,7 +290,7 @@ glue_state_file_init()
|
|||||||
*/
|
*/
|
||||||
static void winsock_init(void)
|
static void winsock_init(void)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
WSADATA sockinfo;
|
WSADATA sockinfo;
|
||||||
|
|
||||||
int retval = WSAStartup(MAKEWORD(2, 2), &sockinfo);
|
int retval = WSAStartup(MAKEWORD(2, 2), &sockinfo);
|
||||||
@ -421,7 +421,7 @@ Instance::OnIdle(unsigned flags)
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return win32_main(argc, argv);
|
return win32_main(argc, argv);
|
||||||
#else
|
#else
|
||||||
return mpd_main(argc, argv);
|
return mpd_main(argc, argv);
|
||||||
@ -622,7 +622,7 @@ try {
|
|||||||
for (auto &partition : instance->partitions)
|
for (auto &partition : instance->partitions)
|
||||||
partition.pc.LockUpdateAudio();
|
partition.pc.LockUpdateAudio();
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
win32_app_started();
|
win32_app_started();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -637,7 +637,7 @@ try {
|
|||||||
/* run the main loop */
|
/* run the main loop */
|
||||||
instance->event_loop.Run();
|
instance->event_loop.Run();
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
win32_app_stopping();
|
win32_app_stopping();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -711,7 +711,7 @@ try {
|
|||||||
daemonize_finish();
|
daemonize_finish();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ int mpd_main(int argc, char *argv[]);
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If program is run as windows service performs nessesary initialization
|
* If program is run as windows service performs nessesary initialization
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
/**
|
/**
|
||||||
* The monotonic time stamp when MPD was started. It is used to
|
* The monotonic time stamp when MPD was started. It is used to
|
||||||
* calculate the uptime.
|
* calculate the uptime.
|
||||||
@ -115,7 +115,7 @@ stats_print(Response &r, const Partition &partition)
|
|||||||
{
|
{
|
||||||
r.Format("uptime: %u\n"
|
r.Format("uptime: %u\n"
|
||||||
"playtime: %lu\n",
|
"playtime: %lu\n",
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
GetProcessUptimeS(),
|
GetProcessUptimeS(),
|
||||||
#else
|
#else
|
||||||
(unsigned)std::chrono::duration_cast<std::chrono::seconds>(std::chrono::steady_clock::now() - start_time).count(),
|
(unsigned)std::chrono::duration_cast<std::chrono::seconds>(std::chrono::steady_clock::now() - start_time).count(),
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
void
|
void
|
||||||
time_print(Response &r, const char *name, time_t t)
|
time_print(Response &r, const char *name, time_t t)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
const struct tm *tm2 = gmtime(&t);
|
const struct tm *tm2 = gmtime(&t);
|
||||||
#else
|
#else
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
@ -35,7 +35,7 @@ time_print(Response &r, const char *name, time_t t)
|
|||||||
|
|
||||||
char buffer[32];
|
char buffer[32];
|
||||||
strftime(buffer, sizeof(buffer),
|
strftime(buffer, sizeof(buffer),
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
"%Y-%m-%dT%H:%M:%SZ",
|
"%Y-%m-%dT%H:%M:%SZ",
|
||||||
#else
|
#else
|
||||||
"%FT%TZ",
|
"%FT%TZ",
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
void
|
void
|
||||||
Client::AllowFile(Path path_fs) const
|
Client::AllowFile(Path path_fs) const
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
(void)path_fs;
|
(void)path_fs;
|
||||||
|
|
||||||
throw ProtocolError(ACK_ERROR_PERMISSION, "Access denied");
|
throw ProtocolError(ACK_ERROR_PERMISSION, "Access denied");
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
/* fuck WIN32! */
|
/* fuck WIN32! */
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#undef GetMessage
|
#undef GetMessage
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "Log.hxx"
|
#include "Log.hxx"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#ifndef MPD_COMMAND_RESULT_HXX
|
#ifndef MPD_COMMAND_RESULT_HXX
|
||||||
#define MPD_COMMAND_RESULT_HXX
|
#define MPD_COMMAND_RESULT_HXX
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
/* damn you, windows.h! */
|
/* damn you, windows.h! */
|
||||||
#ifdef ERROR
|
#ifdef ERROR
|
||||||
|
@ -61,7 +61,7 @@ skip_path(Path name_fs) noexcept
|
|||||||
return name_fs.HasNewline();
|
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 */
|
/* PRIu64 causes bogus compiler warning */
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wformat"
|
#pragma GCC diagnostic ignored "-Wformat"
|
||||||
@ -104,7 +104,7 @@ handle_listfiles_local(Response &r, Path path_fs)
|
|||||||
return CommandResult::OK;
|
return CommandResult::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(WIN32) && GCC_CHECK_VERSION(4,6)
|
#if defined(_WIN32) && GCC_CHECK_VERSION(4,6)
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ skip_path(const char *name_utf8) noexcept
|
|||||||
return strchr(name_utf8, '\n') != nullptr;
|
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 */
|
/* PRIu64 causes bogus compiler warning */
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wformat"
|
#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
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "Compiler.h"
|
#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 */
|
/* "INPUT" is declared by winuser.h */
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wshadow"
|
#pragma GCC diagnostic ignored "-Wshadow"
|
||||||
@ -93,7 +93,7 @@ enum class ConfigBlockOption {
|
|||||||
MAX
|
MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(WIN32) && CLANG_OR_GCC_VERSION(4,7)
|
#if defined(_WIN32) && CLANG_OR_GCC_VERSION(4,7)
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -79,7 +79,7 @@ ParsePath(const char *path)
|
|||||||
{
|
{
|
||||||
assert(path != nullptr);
|
assert(path != nullptr);
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
if (path[0] == '~') {
|
if (path[0] == '~') {
|
||||||
++path;
|
++path;
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ ParsePath(const char *path)
|
|||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
return AllocatedPath::FromUTF8Throw(path);
|
return AllocatedPath::FromUTF8Throw(path);
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ SimpleDatabase::Check() const
|
|||||||
path_utf8 + "\" because the "
|
path_utf8 + "\" because the "
|
||||||
"parent path is not a directory");
|
"parent path is not a directory");
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
/* Check if we can write to the directory */
|
/* Check if we can write to the directory */
|
||||||
if (!CheckAccess(dirPath, X_OK | W_OK)) {
|
if (!CheckAccess(dirPath, X_OK | W_OK)) {
|
||||||
const int e = errno;
|
const int e = errno;
|
||||||
@ -135,7 +135,7 @@ SimpleDatabase::Check() const
|
|||||||
if (!fi.IsRegular())
|
if (!fi.IsRegular())
|
||||||
throw std::runtime_error("db file \"" + path_utf8 + "\" is not a regular file");
|
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 */
|
/* And check that we can write to it */
|
||||||
if (!CheckAccess(path, R_OK | W_OK))
|
if (!CheckAccess(path, R_OK | W_OK))
|
||||||
throw FormatErrno("Can't open db file \"%s\" for reading/writing",
|
throw FormatErrno("Can't open db file \"%s\" for reading/writing",
|
||||||
|
@ -91,7 +91,7 @@ bool
|
|||||||
directory_child_access(Storage &storage, const Directory &directory,
|
directory_child_access(Storage &storage, const Directory &directory,
|
||||||
const char *name, int mode) noexcept
|
const char *name, int mode) noexcept
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
/* CheckAccess() is useless on WIN32 */
|
/* CheckAccess() is useless on WIN32 */
|
||||||
(void)storage;
|
(void)storage;
|
||||||
(void)directory;
|
(void)directory;
|
||||||
|
@ -55,7 +55,7 @@ UpdateWalk::UpdateWalk(EventLoop &_loop, DatabaseListener &_listener,
|
|||||||
storage(_storage),
|
storage(_storage),
|
||||||
editor(_loop, _listener)
|
editor(_loop, _listener)
|
||||||
{
|
{
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
follow_inside_symlinks =
|
follow_inside_symlinks =
|
||||||
config_get_bool(ConfigOption::FOLLOW_INSIDE_SYMLINKS,
|
config_get_bool(ConfigOption::FOLLOW_INSIDE_SYMLINKS,
|
||||||
DEFAULT_FOLLOW_INSIDE_SYMLINKS);
|
DEFAULT_FOLLOW_INSIDE_SYMLINKS);
|
||||||
@ -133,7 +133,7 @@ UpdateWalk::PurgeDeletedFromDirectory(Directory &directory)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
static bool
|
static bool
|
||||||
update_directory_stat(Storage &storage, Directory &directory)
|
update_directory_stat(Storage &storage, Directory &directory)
|
||||||
{
|
{
|
||||||
@ -156,7 +156,7 @@ static int
|
|||||||
FindAncestorLoop(Storage &storage, Directory *parent,
|
FindAncestorLoop(Storage &storage, Directory *parent,
|
||||||
unsigned inode, unsigned device)
|
unsigned inode, unsigned device)
|
||||||
{
|
{
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
if (device == 0 && inode == 0)
|
if (device == 0 && inode == 0)
|
||||||
/* can't detect loops if the Storage does not support
|
/* can't detect loops if the Storage does not support
|
||||||
these numbers */
|
these numbers */
|
||||||
@ -258,7 +258,7 @@ bool
|
|||||||
UpdateWalk::SkipSymlink(const Directory *directory,
|
UpdateWalk::SkipSymlink(const Directory *directory,
|
||||||
const char *utf8_name) const noexcept
|
const char *utf8_name) const noexcept
|
||||||
{
|
{
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
const auto path_fs = storage.MapChildFS(directory->GetPath(),
|
const auto path_fs = storage.MapChildFS(directory->GetPath(),
|
||||||
utf8_name);
|
utf8_name);
|
||||||
if (path_fs.IsNull())
|
if (path_fs.IsNull())
|
||||||
|
@ -36,7 +36,7 @@ class UpdateWalk final {
|
|||||||
friend class UpdateArchiveVisitor;
|
friend class UpdateArchiveVisitor;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
static constexpr bool DEFAULT_FOLLOW_INSIDE_SYMLINKS = true;
|
static constexpr bool DEFAULT_FOLLOW_INSIDE_SYMLINKS = true;
|
||||||
static constexpr bool DEFAULT_FOLLOW_OUTSIDE_SYMLINKS = true;
|
static constexpr bool DEFAULT_FOLLOW_OUTSIDE_SYMLINKS = true;
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ FlacIORead(void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle)
|
|||||||
|
|
||||||
p += nbytes;
|
p += nbytes;
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
} catch (const std::system_error &e) {
|
} catch (const std::system_error &e) {
|
||||||
errno = e.code().category() == ErrnoCategory()
|
errno = e.code().category() == ErrnoCategory()
|
||||||
? e.code().value()
|
? e.code().value()
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ MultiSocketMonitor::ClearSocketList() noexcept
|
|||||||
fds.clear();
|
fds.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
|
|
||||||
void
|
void
|
||||||
MultiSocketMonitor::ReplaceSocketList(pollfd *pfds, unsigned n) noexcept
|
MultiSocketMonitor::ReplaceSocketList(pollfd *pfds, unsigned n) noexcept
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
struct pollfd;
|
struct pollfd;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
/**
|
/**
|
||||||
* Replace the socket list with the given file descriptors.
|
* Replace the socket list with the given file descriptors.
|
||||||
* The given pollfd array will be modified by this method.
|
* The given pollfd array will be modified by this method.
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
#include <winsock.h>
|
#include <winsock.h>
|
||||||
#else
|
#else
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "SignalMonitor.hxx"
|
#include "SignalMonitor.hxx"
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
|
|
||||||
#include "SocketMonitor.hxx"
|
#include "SocketMonitor.hxx"
|
||||||
#include "util/Manual.hxx"
|
#include "util/Manual.hxx"
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
class EventLoop;
|
class EventLoop;
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
|
|
||||||
#include "util/BindMethod.hxx"
|
#include "util/BindMethod.hxx"
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
@ -31,7 +31,7 @@ AllocatedPath::~AllocatedPath() {}
|
|||||||
AllocatedPath
|
AllocatedPath
|
||||||
AllocatedPath::FromUTF8(const char *path_utf8) noexcept
|
AllocatedPath::FromUTF8(const char *path_utf8) noexcept
|
||||||
{
|
{
|
||||||
#if defined(HAVE_FS_CHARSET) || defined(WIN32)
|
#if defined(HAVE_FS_CHARSET) || defined(_WIN32)
|
||||||
try {
|
try {
|
||||||
return AllocatedPath(::PathFromUTF8(path_utf8));
|
return AllocatedPath(::PathFromUTF8(path_utf8));
|
||||||
} catch (const std::runtime_error &) {
|
} catch (const std::runtime_error &) {
|
||||||
@ -45,7 +45,7 @@ AllocatedPath::FromUTF8(const char *path_utf8) noexcept
|
|||||||
AllocatedPath
|
AllocatedPath
|
||||||
AllocatedPath::FromUTF8Throw(const char *path_utf8)
|
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));
|
return AllocatedPath(::PathFromUTF8(path_utf8));
|
||||||
#else
|
#else
|
||||||
return FromFS(path_utf8);
|
return FromFS(path_utf8);
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include "lib/icu/Converter.hxx"
|
#include "lib/icu/Converter.hxx"
|
||||||
#include "util/AllocatedString.hxx"
|
#include "util/AllocatedString.hxx"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include "lib/icu/Win32.hxx"
|
#include "lib/icu/Win32.hxx"
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
@ -70,7 +70,7 @@ GetFSCharset() noexcept
|
|||||||
{
|
{
|
||||||
#ifdef HAVE_FS_CHARSET
|
#ifdef HAVE_FS_CHARSET
|
||||||
return fs_charset.empty() ? "UTF-8" : fs_charset.c_str();
|
return fs_charset.empty() ? "UTF-8" : fs_charset.c_str();
|
||||||
#elif defined(WIN32)
|
#elif defined(_WIN32)
|
||||||
return "ACP";
|
return "ACP";
|
||||||
#else
|
#else
|
||||||
return "UTF-8";
|
return "UTF-8";
|
||||||
@ -100,7 +100,7 @@ PathToUTF8(PathTraitsFS::const_pointer_type path_fs)
|
|||||||
assert(path_fs != nullptr);
|
assert(path_fs != nullptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
const auto buffer = WideCharToMultiByte(CP_UTF8, path_fs);
|
const auto buffer = WideCharToMultiByte(CP_UTF8, path_fs);
|
||||||
return FixSeparators(PathTraitsUTF8::string(buffer.c_str()));
|
return FixSeparators(PathTraitsUTF8::string(buffer.c_str()));
|
||||||
#else
|
#else
|
||||||
@ -116,7 +116,7 @@ PathToUTF8(PathTraitsFS::const_pointer_type path_fs)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_FS_CHARSET) || defined(WIN32)
|
#if defined(HAVE_FS_CHARSET) || defined(_WIN32)
|
||||||
|
|
||||||
PathTraitsFS::string
|
PathTraitsFS::string
|
||||||
PathFromUTF8(PathTraitsUTF8::const_pointer_type path_utf8)
|
PathFromUTF8(PathTraitsUTF8::const_pointer_type path_utf8)
|
||||||
@ -126,7 +126,7 @@ PathFromUTF8(PathTraitsUTF8::const_pointer_type path_utf8)
|
|||||||
assert(path_utf8 != nullptr);
|
assert(path_utf8 != nullptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
const auto buffer = MultiByteToWideChar(CP_UTF8, path_utf8);
|
const auto buffer = MultiByteToWideChar(CP_UTF8, path_utf8);
|
||||||
return PathTraitsFS::string(buffer.c_str());
|
return PathTraitsFS::string(buffer.c_str());
|
||||||
#else
|
#else
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include "Compiler.h"
|
#include "Compiler.h"
|
||||||
#include "Traits.hxx"
|
#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
|
#define HAVE_FS_CHARSET
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ try {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
try {
|
try {
|
||||||
const auto x = AllocatedPath::Build(path_fs,
|
const auto x = AllocatedPath::Build(path_fs,
|
||||||
PathTraitsFS::CURRENT_DIRECTORY);
|
PathTraitsFS::CURRENT_DIRECTORY);
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "DirectoryReader.hxx"
|
#include "DirectoryReader.hxx"
|
||||||
#include "system/Error.hxx"
|
#include "system/Error.hxx"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
DirectoryReader::DirectoryReader(Path dir)
|
DirectoryReader::DirectoryReader(Path dir)
|
||||||
:handle(FindFirstFile(MakeWildcardPath(dir.c_str()), &data))
|
:handle(FindFirstFile(MakeWildcardPath(dir.c_str()), &data))
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "check.h"
|
#include "check.h"
|
||||||
#include "Path.hxx"
|
#include "Path.hxx"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include "Path.hxx"
|
#include "Path.hxx"
|
||||||
#include "system/Error.hxx"
|
#include "system/Error.hxx"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <fileapi.h>
|
#include <fileapi.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
static inline constexpr uint64_t
|
static inline constexpr uint64_t
|
||||||
ConstructUint64(DWORD lo, DWORD hi)
|
ConstructUint64(DWORD lo, DWORD hi)
|
||||||
@ -63,7 +63,7 @@ class FileInfo {
|
|||||||
bool follow_symlinks);
|
bool follow_symlinks);
|
||||||
friend class FileReader;
|
friend class FileReader;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
WIN32_FILE_ATTRIBUTE_DATA data;
|
WIN32_FILE_ATTRIBUTE_DATA data;
|
||||||
#else
|
#else
|
||||||
struct stat st;
|
struct stat st;
|
||||||
@ -74,7 +74,7 @@ public:
|
|||||||
|
|
||||||
FileInfo(Path path, bool follow_symlinks=true) {
|
FileInfo(Path path, bool follow_symlinks=true) {
|
||||||
if (!GetFileInfo(path, *this, follow_symlinks)) {
|
if (!GetFileInfo(path, *this, follow_symlinks)) {
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
throw FormatLastError("Failed to access %s",
|
throw FormatLastError("Failed to access %s",
|
||||||
path.ToUTF8().c_str());
|
path.ToUTF8().c_str());
|
||||||
#else
|
#else
|
||||||
@ -85,7 +85,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool IsRegular() const {
|
bool IsRegular() const {
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return (data.dwFileAttributes &
|
return (data.dwFileAttributes &
|
||||||
(FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_DEVICE)) == 0;
|
(FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_DEVICE)) == 0;
|
||||||
#else
|
#else
|
||||||
@ -94,7 +94,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool IsDirectory() const {
|
bool IsDirectory() const {
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
|
return data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
|
||||||
#else
|
#else
|
||||||
return S_ISDIR(st.st_mode);
|
return S_ISDIR(st.st_mode);
|
||||||
@ -102,7 +102,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint64_t GetSize() const {
|
uint64_t GetSize() const {
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return ConstructUint64(data.nFileSizeLow, data.nFileSizeHigh);
|
return ConstructUint64(data.nFileSizeLow, data.nFileSizeHigh);
|
||||||
#else
|
#else
|
||||||
return st.st_size;
|
return st.st_size;
|
||||||
@ -110,14 +110,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::chrono::system_clock::time_point GetModificationTime() const {
|
std::chrono::system_clock::time_point GetModificationTime() const {
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return FileTimeToChrono(data.ftLastWriteTime);
|
return FileTimeToChrono(data.ftLastWriteTime);
|
||||||
#else
|
#else
|
||||||
return std::chrono::system_clock::from_time_t(st.st_mtime);
|
return std::chrono::system_clock::from_time_t(st.st_mtime);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
uid_t GetUid() const {
|
uid_t GetUid() const {
|
||||||
return st.st_uid;
|
return st.st_uid;
|
||||||
}
|
}
|
||||||
@ -139,7 +139,7 @@ public:
|
|||||||
inline bool
|
inline bool
|
||||||
GetFileInfo(Path path, FileInfo &info, bool follow_symlinks=true)
|
GetFileInfo(Path path, FileInfo &info, bool follow_symlinks=true)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
(void)follow_symlinks;
|
(void)follow_symlinks;
|
||||||
return GetFileAttributesEx(path.c_str(), GetFileExInfoStandard,
|
return GetFileAttributesEx(path.c_str(), GetFileExInfoStandard,
|
||||||
&info.data);
|
&info.data);
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
void
|
void
|
||||||
RenameFile(Path oldpath, Path newpath)
|
RenameFile(Path oldpath, Path newpath)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
if (!MoveFileEx(oldpath.c_str(), newpath.c_str(),
|
if (!MoveFileEx(oldpath.c_str(), newpath.c_str(),
|
||||||
MOVEFILE_REPLACE_EXISTING))
|
MOVEFILE_REPLACE_EXISTING))
|
||||||
throw MakeLastError("Failed to rename file");
|
throw MakeLastError("Failed to rename file");
|
||||||
@ -42,7 +42,7 @@ RenameFile(Path oldpath, Path newpath)
|
|||||||
AllocatedPath
|
AllocatedPath
|
||||||
ReadLink(Path path)
|
ReadLink(Path path)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
(void)path;
|
(void)path;
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return AllocatedPath::Null();
|
return AllocatedPath::Null();
|
||||||
@ -63,7 +63,7 @@ ReadLink(Path path)
|
|||||||
void
|
void
|
||||||
TruncateFile(Path path)
|
TruncateFile(Path path)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
HANDLE h = CreateFile(path.c_str(), GENERIC_WRITE, 0, nullptr,
|
HANDLE h = CreateFile(path.c_str(), GENERIC_WRITE, 0, nullptr,
|
||||||
TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL,
|
TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL,
|
||||||
nullptr);
|
nullptr);
|
||||||
@ -81,7 +81,7 @@ TruncateFile(Path path)
|
|||||||
void
|
void
|
||||||
RemoveFile(Path path)
|
RemoveFile(Path path)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
if (!DeleteFile(path.c_str()))
|
if (!DeleteFile(path.c_str()))
|
||||||
throw FormatLastError("Failed to delete %s", path.c_str());
|
throw FormatLastError("Failed to delete %s", path.c_str());
|
||||||
#else
|
#else
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include "Path.hxx"
|
#include "Path.hxx"
|
||||||
#include "system/UniqueFileDescriptor.hxx"
|
#include "system/UniqueFileDescriptor.hxx"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <fileapi.h>
|
#include <fileapi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ class AllocatedPath;
|
|||||||
static inline FILE *
|
static inline FILE *
|
||||||
FOpen(Path file, PathTraitsFS::const_pointer_type mode)
|
FOpen(Path file, PathTraitsFS::const_pointer_type mode)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return _tfopen(file.c_str(), mode);
|
return _tfopen(file.c_str(), mode);
|
||||||
#else
|
#else
|
||||||
return fopen(file.c_str(), mode);
|
return fopen(file.c_str(), mode);
|
||||||
@ -68,7 +68,7 @@ OpenFile(Path file, int flags, int mode)
|
|||||||
void
|
void
|
||||||
RenameFile(Path oldpath, Path newpath);
|
RenameFile(Path oldpath, Path newpath);
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper for stat() that uses #Path names.
|
* Wrapper for stat() that uses #Path names.
|
||||||
@ -104,7 +104,7 @@ RemoveFile(Path path);
|
|||||||
AllocatedPath
|
AllocatedPath
|
||||||
ReadLink(Path path);
|
ReadLink(Path path);
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
MakeFifo(Path path, mode_t mode)
|
MakeFifo(Path path, mode_t mode)
|
||||||
@ -129,7 +129,7 @@ CheckAccess(Path path, int mode)
|
|||||||
static inline bool
|
static inline bool
|
||||||
FileExists(Path path, bool follow_symlinks = true)
|
FileExists(Path path, bool follow_symlinks = true)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
(void)follow_symlinks;
|
(void)follow_symlinks;
|
||||||
|
|
||||||
const auto a = GetFileAttributes(path.c_str());
|
const auto a = GetFileAttributes(path.c_str());
|
||||||
@ -147,7 +147,7 @@ FileExists(Path path, bool follow_symlinks = true)
|
|||||||
static inline bool
|
static inline bool
|
||||||
DirectoryExists(Path path, bool follow_symlinks = true)
|
DirectoryExists(Path path, bool follow_symlinks = true)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
(void)follow_symlinks;
|
(void)follow_symlinks;
|
||||||
|
|
||||||
const auto a = GetFileAttributes(path.c_str());
|
const auto a = GetFileAttributes(path.c_str());
|
||||||
@ -164,7 +164,7 @@ DirectoryExists(Path path, bool follow_symlinks = true)
|
|||||||
static inline bool
|
static inline bool
|
||||||
PathExists(Path path)
|
PathExists(Path path)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return GetFileAttributes(path.c_str()) != INVALID_FILE_ATTRIBUTES;
|
return GetFileAttributes(path.c_str()) != INVALID_FILE_ATTRIBUTES;
|
||||||
#else
|
#else
|
||||||
return CheckAccess(path, F_OK);
|
return CheckAccess(path, F_OK);
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#define HAVE_CLASS_GLOB
|
#define HAVE_CLASS_GLOB
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnmatch.h>
|
#include <fnmatch.h>
|
||||||
#elif defined(WIN32)
|
#elif defined(_WIN32)
|
||||||
#define HAVE_CLASS_GLOB
|
#define HAVE_CLASS_GLOB
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <shlwapi.h>
|
#include <shlwapi.h>
|
||||||
@ -40,12 +40,12 @@
|
|||||||
* (asterisk and question mark).
|
* (asterisk and question mark).
|
||||||
*/
|
*/
|
||||||
class Glob {
|
class Glob {
|
||||||
#if defined(HAVE_FNMATCH) || defined(WIN32)
|
#if defined(HAVE_FNMATCH) || defined(_WIN32)
|
||||||
std::string pattern;
|
std::string pattern;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
#if defined(HAVE_FNMATCH) || defined(WIN32)
|
#if defined(HAVE_FNMATCH) || defined(_WIN32)
|
||||||
explicit Glob(const char *_pattern)
|
explicit Glob(const char *_pattern)
|
||||||
:pattern(_pattern) {}
|
:pattern(_pattern) {}
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ public:
|
|||||||
bool Check(const char *name_fs) const noexcept {
|
bool Check(const char *name_fs) const noexcept {
|
||||||
#ifdef HAVE_FNMATCH
|
#ifdef HAVE_FNMATCH
|
||||||
return fnmatch(pattern.c_str(), name_fs, 0) == 0;
|
return fnmatch(pattern.c_str(), name_fs, 0) == 0;
|
||||||
#elif defined(WIN32)
|
#elif defined(_WIN32)
|
||||||
return PathMatchSpecA(name_fs, pattern.c_str());
|
return PathMatchSpecA(name_fs, pattern.c_str());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
static constexpr size_t MPD_PATH_MAX = 260;
|
static constexpr size_t MPD_PATH_MAX = 260;
|
||||||
#elif defined(MAXPATHLEN)
|
#elif defined(MAXPATHLEN)
|
||||||
static constexpr size_t MPD_PATH_MAX = MAXPATHLEN;
|
static constexpr size_t MPD_PATH_MAX = MAXPATHLEN;
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
// Use X Desktop guidelines where applicable
|
// Use X Desktop guidelines where applicable
|
||||||
#if !defined(__APPLE__) && !defined(WIN32) && !defined(ANDROID)
|
#if !defined(__APPLE__) && !defined(_WIN32) && !defined(ANDROID)
|
||||||
#define USE_XDG
|
#define USE_XDG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#else
|
#else
|
||||||
@ -53,7 +53,7 @@
|
|||||||
#include "Main.hxx"
|
#include "Main.hxx"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(WIN32) && !defined(ANDROID)
|
#if !defined(_WIN32) && !defined(ANDROID)
|
||||||
class PasswdEntry
|
class PasswdEntry
|
||||||
{
|
{
|
||||||
#if defined(HAVE_GETPWNAM_R) || defined(HAVE_GETPWUID_R)
|
#if defined(HAVE_GETPWNAM_R) || defined(HAVE_GETPWUID_R)
|
||||||
@ -113,7 +113,7 @@ SafePathFromFS(PathTraitsFS::const_pointer_type dir)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
static AllocatedPath GetStandardDir(int folder_id)
|
static AllocatedPath GetStandardDir(int folder_id)
|
||||||
{
|
{
|
||||||
std::array<PathTraitsFS::value_type, MAX_PATH> dir;
|
std::array<PathTraitsFS::value_type, MAX_PATH> dir;
|
||||||
@ -226,7 +226,7 @@ try {
|
|||||||
AllocatedPath
|
AllocatedPath
|
||||||
GetUserConfigDir() noexcept
|
GetUserConfigDir() noexcept
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
return GetStandardDir(CSIDL_LOCAL_APPDATA);
|
return GetStandardDir(CSIDL_LOCAL_APPDATA);
|
||||||
#elif defined(USE_XDG)
|
#elif defined(USE_XDG)
|
||||||
// Check for $XDG_CONFIG_HOME
|
// Check for $XDG_CONFIG_HOME
|
||||||
@ -251,7 +251,7 @@ GetUserConfigDir() noexcept
|
|||||||
AllocatedPath
|
AllocatedPath
|
||||||
GetUserMusicDir() noexcept
|
GetUserMusicDir() noexcept
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
return GetStandardDir(CSIDL_MYMUSIC);
|
return GetStandardDir(CSIDL_MYMUSIC);
|
||||||
#elif defined(USE_XDG)
|
#elif defined(USE_XDG)
|
||||||
return GetUserDir("XDG_MUSIC_DIR");
|
return GetUserDir("XDG_MUSIC_DIR");
|
||||||
@ -287,7 +287,7 @@ GetUserCacheDir() noexcept
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
AllocatedPath
|
AllocatedPath
|
||||||
GetSystemConfigDir() noexcept
|
GetSystemConfigDir() noexcept
|
||||||
|
@ -42,7 +42,7 @@ gcc_pure
|
|||||||
AllocatedPath
|
AllocatedPath
|
||||||
GetUserCacheDir() noexcept;
|
GetUserCacheDir() noexcept;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtains system configuration directory.
|
* Obtains system configuration directory.
|
||||||
|
@ -78,7 +78,7 @@ GetParentPathImpl(typename Traits::const_pointer_type p)
|
|||||||
return typename Traits::string(Traits::CURRENT_DIRECTORY);
|
return typename Traits::string(Traits::CURRENT_DIRECTORY);
|
||||||
if (sep == p)
|
if (sep == p)
|
||||||
return typename Traits::string(p, p + 1);
|
return typename Traits::string(p, p + 1);
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
if (Traits::IsDrive(p) && sep == p + 2)
|
if (Traits::IsDrive(p) && sep == p + 2)
|
||||||
return typename Traits::string(p, p + 3);
|
return typename Traits::string(p, p + 3);
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include "util/StringPointer.hxx"
|
#include "util/StringPointer.hxx"
|
||||||
#include "util/StringAPI.hxx"
|
#include "util/StringAPI.hxx"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include "util/CharUtil.hxx"
|
#include "util/CharUtil.hxx"
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
#endif
|
#endif
|
||||||
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#define PATH_LITERAL(s) _T(s)
|
#define PATH_LITERAL(s) _T(s)
|
||||||
#else
|
#else
|
||||||
#define PATH_LITERAL(s) (s)
|
#define PATH_LITERAL(s) (s)
|
||||||
@ -44,7 +44,7 @@
|
|||||||
* This class describes the nature of a native filesystem path.
|
* This class describes the nature of a native filesystem path.
|
||||||
*/
|
*/
|
||||||
struct PathTraitsFS {
|
struct PathTraitsFS {
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
typedef std::wstring string;
|
typedef std::wstring string;
|
||||||
#else
|
#else
|
||||||
typedef std::string string;
|
typedef std::string string;
|
||||||
@ -55,7 +55,7 @@ struct PathTraitsFS {
|
|||||||
typedef Pointer::pointer_type pointer_type;
|
typedef Pointer::pointer_type pointer_type;
|
||||||
typedef Pointer::const_pointer_type const_pointer_type;
|
typedef Pointer::const_pointer_type const_pointer_type;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
static constexpr value_type SEPARATOR = '\\';
|
static constexpr value_type SEPARATOR = '\\';
|
||||||
#else
|
#else
|
||||||
static constexpr value_type SEPARATOR = '/';
|
static constexpr value_type SEPARATOR = '/';
|
||||||
@ -65,7 +65,7 @@ struct PathTraitsFS {
|
|||||||
|
|
||||||
static constexpr bool IsSeparator(value_type ch) noexcept {
|
static constexpr bool IsSeparator(value_type ch) noexcept {
|
||||||
return
|
return
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
ch == '/' ||
|
ch == '/' ||
|
||||||
#endif
|
#endif
|
||||||
ch == SEPARATOR;
|
ch == SEPARATOR;
|
||||||
@ -78,7 +78,7 @@ struct PathTraitsFS {
|
|||||||
assert(p != nullptr);
|
assert(p != nullptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
const_pointer_type pos = p + GetLength(p);
|
const_pointer_type pos = p + GetLength(p);
|
||||||
while (p != pos && !IsSeparator(*pos))
|
while (p != pos && !IsSeparator(*pos))
|
||||||
--pos;
|
--pos;
|
||||||
@ -88,7 +88,7 @@ struct PathTraitsFS {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
gcc_pure gcc_nonnull_all
|
gcc_pure gcc_nonnull_all
|
||||||
static constexpr bool IsDrive(const_pointer_type p) noexcept {
|
static constexpr bool IsDrive(const_pointer_type p) noexcept {
|
||||||
return IsAlphaASCII(p[0]) && p[1] == ':';
|
return IsAlphaASCII(p[0]) && p[1] == ':';
|
||||||
@ -102,7 +102,7 @@ struct PathTraitsFS {
|
|||||||
assert(p != nullptr);
|
assert(p != nullptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
if (IsDrive(p) && IsSeparator(p[2]))
|
if (IsDrive(p) && IsSeparator(p[2]))
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
@ -188,7 +188,7 @@ struct PathTraitsUTF8 {
|
|||||||
return strrchr(p, SEPARATOR);
|
return strrchr(p, SEPARATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
gcc_pure gcc_nonnull_all
|
gcc_pure gcc_nonnull_all
|
||||||
static constexpr bool IsDrive(const_pointer_type p) noexcept {
|
static constexpr bool IsDrive(const_pointer_type p) noexcept {
|
||||||
return IsAlphaASCII(p[0]) && p[1] == ':';
|
return IsAlphaASCII(p[0]) && p[1] == ':';
|
||||||
@ -202,7 +202,7 @@ struct PathTraitsUTF8 {
|
|||||||
assert(p != nullptr);
|
assert(p != nullptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
if (IsDrive(p) && IsSeparator(p[2]))
|
if (IsDrive(p) && IsSeparator(p[2]))
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
@ -43,7 +43,7 @@ FileOutputStream::FileOutputStream(Path _path, Mode _mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
FileOutputStream::OpenCreate(gcc_unused bool visible)
|
FileOutputStream::OpenCreate(gcc_unused bool visible)
|
||||||
@ -223,7 +223,7 @@ FileOutputStream::Commit()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!Close()) {
|
if (!Close()) {
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
throw FormatLastError("Failed to commit %s",
|
throw FormatLastError("Failed to commit %s",
|
||||||
path.ToUTF8().c_str());
|
path.ToUTF8().c_str());
|
||||||
#else
|
#else
|
||||||
|
@ -25,14 +25,14 @@
|
|||||||
#include "fs/AllocatedPath.hxx"
|
#include "fs/AllocatedPath.hxx"
|
||||||
#include "Compiler.h"
|
#include "Compiler.h"
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
#include "system/FileDescriptor.hxx"
|
#include "system/FileDescriptor.hxx"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ class Path;
|
|||||||
class FileOutputStream final : public OutputStream {
|
class FileOutputStream final : public OutputStream {
|
||||||
const AllocatedPath path;
|
const AllocatedPath path;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
HANDLE handle = INVALID_HANDLE_VALUE;
|
HANDLE handle = INVALID_HANDLE_VALUE;
|
||||||
#else
|
#else
|
||||||
FileDescriptor fd = FileDescriptor::Undefined();
|
FileDescriptor fd = FileDescriptor::Undefined();
|
||||||
@ -116,7 +116,7 @@ private:
|
|||||||
bool Close() {
|
bool Close() {
|
||||||
assert(IsDefined());
|
assert(IsDefined());
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
CloseHandle(handle);
|
CloseHandle(handle);
|
||||||
handle = INVALID_HANDLE_VALUE;
|
handle = INVALID_HANDLE_VALUE;
|
||||||
return true;
|
return true;
|
||||||
@ -125,7 +125,7 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
bool SeekEOF() {
|
bool SeekEOF() {
|
||||||
return SetFilePointer(handle, 0, nullptr,
|
return SetFilePointer(handle, 0, nullptr,
|
||||||
FILE_END) != 0xffffffff;
|
FILE_END) != 0xffffffff;
|
||||||
@ -133,7 +133,7 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool IsDefined() const {
|
bool IsDefined() const {
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return handle != INVALID_HANDLE_VALUE;
|
return handle != INVALID_HANDLE_VALUE;
|
||||||
#else
|
#else
|
||||||
return fd.IsDefined();
|
return fd.IsDefined();
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
FileReader::FileReader(Path _path)
|
FileReader::FileReader(Path _path)
|
||||||
:path(_path),
|
:path(_path),
|
||||||
|
@ -25,11 +25,11 @@
|
|||||||
#include "fs/AllocatedPath.hxx"
|
#include "fs/AllocatedPath.hxx"
|
||||||
#include "Compiler.h"
|
#include "Compiler.h"
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
#include "system/FileDescriptor.hxx"
|
#include "system/FileDescriptor.hxx"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ class FileInfo;
|
|||||||
class FileReader final : public Reader {
|
class FileReader final : public Reader {
|
||||||
AllocatedPath path;
|
AllocatedPath path;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
HANDLE handle;
|
HANDLE handle;
|
||||||
#else
|
#else
|
||||||
FileDescriptor fd;
|
FileDescriptor fd;
|
||||||
@ -48,7 +48,7 @@ class FileReader final : public Reader {
|
|||||||
public:
|
public:
|
||||||
explicit FileReader(Path _path);
|
explicit FileReader(Path _path);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
FileReader(FileReader &&other)
|
FileReader(FileReader &&other)
|
||||||
:path(std::move(other.path)),
|
:path(std::move(other.path)),
|
||||||
handle(other.handle) {
|
handle(other.handle) {
|
||||||
@ -70,7 +70,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool IsDefined() const {
|
bool IsDefined() const {
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return handle != INVALID_HANDLE_VALUE;
|
return handle != INVALID_HANDLE_VALUE;
|
||||||
#else
|
#else
|
||||||
return fd.IsDefined();
|
return fd.IsDefined();
|
||||||
@ -78,7 +78,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
FileDescriptor GetFD() const {
|
FileDescriptor GetFD() const {
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ public:
|
|||||||
|
|
||||||
gcc_pure
|
gcc_pure
|
||||||
uint64_t GetSize() const noexcept {
|
uint64_t GetSize() const noexcept {
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
LARGE_INTEGER size;
|
LARGE_INTEGER size;
|
||||||
return GetFileSizeEx(handle, &size)
|
return GetFileSizeEx(handle, &size)
|
||||||
? size.QuadPart
|
? size.QuadPart
|
||||||
@ -102,7 +102,7 @@ public:
|
|||||||
|
|
||||||
gcc_pure
|
gcc_pure
|
||||||
uint64_t GetPosition() const noexcept {
|
uint64_t GetPosition() const noexcept {
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
LARGE_INTEGER zero;
|
LARGE_INTEGER zero;
|
||||||
zero.QuadPart = 0;
|
zero.QuadPart = 0;
|
||||||
LARGE_INTEGER position;
|
LARGE_INTEGER position;
|
||||||
|
@ -230,7 +230,7 @@ CurlInputStream::OnHeaders(unsigned status,
|
|||||||
|
|
||||||
if (i != headers.end()) {
|
if (i != headers.end()) {
|
||||||
size_t icy_metaint = ParseUint64(i->second.c_str());
|
size_t icy_metaint = ParseUint64(i->second.c_str());
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
/* Windows doesn't know "%z" */
|
/* Windows doesn't know "%z" */
|
||||||
FormatDebug(curl_domain, "icy-metaint=%zu", icy_metaint);
|
FormatDebug(curl_domain, "icy-metaint=%zu", icy_metaint);
|
||||||
#endif
|
#endif
|
||||||
@ -407,7 +407,7 @@ CurlInputStream::SeekInternal(offset_type new_offset)
|
|||||||
|
|
||||||
if (offset > 0) {
|
if (offset > 0) {
|
||||||
char range[32];
|
char range[32];
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
// TODO: what can we use on Windows to format 64 bit?
|
// TODO: what can we use on Windows to format 64 bit?
|
||||||
sprintf(range, "%lu-", (long)offset);
|
sprintf(range, "%lu-", (long)offset);
|
||||||
#else
|
#else
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include "Win32.hxx"
|
#include "Win32.hxx"
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
@ -73,7 +73,7 @@ try {
|
|||||||
folded.SetSize(folded_length);
|
folded.SetSize(folded_length);
|
||||||
return UCharToUTF8({folded.begin(), folded.size()});
|
return UCharToUTF8({folded.begin(), folded.size()});
|
||||||
|
|
||||||
#elif defined(WIN32)
|
#elif defined(_WIN32)
|
||||||
const auto u = MultiByteToWideChar(CP_UTF8, src);
|
const auto u = MultiByteToWideChar(CP_UTF8, src);
|
||||||
|
|
||||||
const int size = LCMapStringEx(LOCALE_NAME_INVARIANT,
|
const int size = LCMapStringEx(LOCALE_NAME_INVARIANT,
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include "Win32.hxx"
|
#include "Win32.hxx"
|
||||||
#include "util/AllocatedString.hxx"
|
#include "util/AllocatedString.hxx"
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@ -103,7 +103,7 @@ IcuCollate(const char *a, const char *b) noexcept
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif defined(WIN32)
|
#elif defined(_WIN32)
|
||||||
AllocatedString<wchar_t> wa = nullptr, wb = nullptr;
|
AllocatedString<wchar_t> wa = nullptr, wb = nullptr;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "Compiler.h"
|
#include "Compiler.h"
|
||||||
|
|
||||||
#include <upnp/upnptools.h>
|
#include <upnptools.h>
|
||||||
|
|
||||||
static inline constexpr unsigned
|
static inline constexpr unsigned
|
||||||
CountNameValuePairs() noexcept
|
CountNameValuePairs() noexcept
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#ifndef MPD_UPNP_CALLBACK_HXX
|
#ifndef MPD_UPNP_CALLBACK_HXX
|
||||||
#define MPD_UPNP_CALLBACK_HXX
|
#define MPD_UPNP_CALLBACK_HXX
|
||||||
|
|
||||||
#include <upnp/upnp.h>
|
#include <upnp.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class that is supposed to be used for libupnp asynchronous
|
* A class that is supposed to be used for libupnp asynchronous
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include "thread/Mutex.hxx"
|
#include "thread/Mutex.hxx"
|
||||||
#include "util/RuntimeError.hxx"
|
#include "util/RuntimeError.hxx"
|
||||||
|
|
||||||
#include <upnp/upnptools.h>
|
#include <upnptools.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "check.h"
|
#include "check.h"
|
||||||
|
|
||||||
#include <upnp/upnp.h>
|
#include <upnp.h>
|
||||||
|
|
||||||
void
|
void
|
||||||
UpnpClientGlobalInit(UpnpClient_Handle &handle);
|
UpnpClientGlobalInit(UpnpClient_Handle &handle);
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#ifndef MPD_UPNP_COMPAT_HXX
|
#ifndef MPD_UPNP_COMPAT_HXX
|
||||||
#define MPD_UPNP_COMPAT_HXX
|
#define MPD_UPNP_COMPAT_HXX
|
||||||
|
|
||||||
#include <upnp/upnp.h>
|
#include <upnp.h>
|
||||||
|
|
||||||
#if UPNP_VERSION < 10800
|
#if UPNP_VERSION < 10800
|
||||||
/* emulate the libupnp 1.8 API with older versions */
|
/* emulate the libupnp 1.8 API with older versions */
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "Compiler.h"
|
#include "Compiler.h"
|
||||||
|
|
||||||
#include <upnp/upnp.h>
|
#include <upnp.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "util/ScopeExit.hxx"
|
#include "util/ScopeExit.hxx"
|
||||||
#include "util/RuntimeError.hxx"
|
#include "util/RuntimeError.hxx"
|
||||||
|
|
||||||
#include <upnp/upnptools.h>
|
#include <upnptools.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include "event/DeferEvent.hxx"
|
#include "event/DeferEvent.hxx"
|
||||||
#include "Compiler.h"
|
#include "Compiler.h"
|
||||||
|
|
||||||
#include <upnp/upnp.h>
|
#include <upnp.h>
|
||||||
|
|
||||||
#include <boost/intrusive/list.hpp>
|
#include <boost/intrusive/list.hpp>
|
||||||
|
|
||||||
|
@ -22,9 +22,9 @@
|
|||||||
#include "thread/Mutex.hxx"
|
#include "thread/Mutex.hxx"
|
||||||
#include "util/RuntimeError.hxx"
|
#include "util/RuntimeError.hxx"
|
||||||
|
|
||||||
#include <upnp/upnp.h>
|
#include <upnp.h>
|
||||||
#include <upnp/upnptools.h>
|
#include <upnptools.h>
|
||||||
#include <upnp/ixml.h>
|
#include <ixml.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#ifndef MPD_UPNP_UNIQUE_XML_HXX
|
#ifndef MPD_UPNP_UNIQUE_XML_HXX
|
||||||
#define MPD_UPNP_UNIQUE_XML_HXX
|
#define MPD_UPNP_UNIQUE_XML_HXX
|
||||||
|
|
||||||
#include <upnp/ixml.h>
|
#include <ixml.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#ifndef _IXMLWRAP_H_INCLUDED_
|
#ifndef _IXMLWRAP_H_INCLUDED_
|
||||||
#define _IXMLWRAP_H_INCLUDED_
|
#define _IXMLWRAP_H_INCLUDED_
|
||||||
|
|
||||||
#include <upnp/ixml.h>
|
#include <ixml.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_TCP
|
#ifdef HAVE_TCP
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
#else
|
#else
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef HAVE_TCP
|
#ifdef HAVE_TCP
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
#else
|
#else
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
@ -46,7 +46,7 @@
|
|||||||
*/
|
*/
|
||||||
class SocketAddress {
|
class SocketAddress {
|
||||||
public:
|
public:
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
typedef int size_type;
|
typedef int size_type;
|
||||||
#else
|
#else
|
||||||
typedef socklen_t size_type;
|
typedef socklen_t size_type;
|
||||||
|
@ -108,7 +108,7 @@ SocketDescriptor::Connect(SocketAddress address)
|
|||||||
bool
|
bool
|
||||||
SocketDescriptor::Create(int domain, int type, int protocol)
|
SocketDescriptor::Create(int domain, int type, int protocol)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
static bool initialised = false;
|
static bool initialised = false;
|
||||||
if (!initialised) {
|
if (!initialised) {
|
||||||
WSADATA data;
|
WSADATA data;
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
SocketErrorMessage::SocketErrorMessage(socket_error_t code) noexcept
|
SocketErrorMessage::SocketErrorMessage(socket_error_t code) noexcept
|
||||||
{
|
{
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "Compiler.h"
|
#include "Compiler.h"
|
||||||
#include "system/Error.hxx"
|
#include "system/Error.hxx"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
typedef DWORD socket_error_t;
|
typedef DWORD socket_error_t;
|
||||||
#else
|
#else
|
||||||
@ -35,7 +35,7 @@ gcc_pure
|
|||||||
static inline socket_error_t
|
static inline socket_error_t
|
||||||
GetSocketError() noexcept
|
GetSocketError() noexcept
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return WSAGetLastError();
|
return WSAGetLastError();
|
||||||
#else
|
#else
|
||||||
return errno;
|
return errno;
|
||||||
@ -46,7 +46,7 @@ gcc_const
|
|||||||
static inline bool
|
static inline bool
|
||||||
IsSocketErrorAgain(socket_error_t code) noexcept
|
IsSocketErrorAgain(socket_error_t code) noexcept
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return code == WSAEINPROGRESS;
|
return code == WSAEINPROGRESS;
|
||||||
#else
|
#else
|
||||||
return code == EAGAIN;
|
return code == EAGAIN;
|
||||||
@ -57,7 +57,7 @@ gcc_const
|
|||||||
static inline bool
|
static inline bool
|
||||||
IsSocketErrorInterruped(socket_error_t code) noexcept
|
IsSocketErrorInterruped(socket_error_t code) noexcept
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return code == WSAEINTR;
|
return code == WSAEINTR;
|
||||||
#else
|
#else
|
||||||
return code == EINTR;
|
return code == EINTR;
|
||||||
@ -68,7 +68,7 @@ gcc_const
|
|||||||
static inline bool
|
static inline bool
|
||||||
IsSocketErrorClosed(socket_error_t code) noexcept
|
IsSocketErrorClosed(socket_error_t code) noexcept
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return code == WSAECONNRESET;
|
return code == WSAECONNRESET;
|
||||||
#else
|
#else
|
||||||
return code == EPIPE || code == ECONNRESET;
|
return code == EPIPE || code == ECONNRESET;
|
||||||
@ -81,7 +81,7 @@ IsSocketErrorClosed(socket_error_t code) noexcept
|
|||||||
* and this class hosts the buffer.
|
* and this class hosts the buffer.
|
||||||
*/
|
*/
|
||||||
class SocketErrorMessage {
|
class SocketErrorMessage {
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
char msg[256];
|
char msg[256];
|
||||||
#else
|
#else
|
||||||
const char *const msg;
|
const char *const msg;
|
||||||
@ -99,7 +99,7 @@ gcc_const
|
|||||||
static inline std::system_error
|
static inline std::system_error
|
||||||
MakeSocketError(socket_error_t code, const char *msg) noexcept
|
MakeSocketError(socket_error_t code, const char *msg) noexcept
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return MakeLastError(code, msg);
|
return MakeLastError(code, msg);
|
||||||
#else
|
#else
|
||||||
return MakeErrno(code, msg);
|
return MakeErrno(code, msg);
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef HAVE_TCP
|
#ifdef HAVE_TCP
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
#else
|
#else
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
#else
|
#else
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
@ -36,6 +36,8 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
static constexpr unsigned MPD_OSX_BUFFER_TIME_MS = 100;
|
||||||
|
|
||||||
struct OSXOutput final : AudioOutput {
|
struct OSXOutput final : AudioOutput {
|
||||||
/* configuration settings */
|
/* configuration settings */
|
||||||
OSType component_subtype;
|
OSType component_subtype;
|
||||||
@ -686,7 +688,9 @@ OSXOutput::Open(AudioFormat &audio_format)
|
|||||||
errormsg);
|
errormsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
ring_buffer = new boost::lockfree::spsc_queue<uint8_t>(buffer_frame_size);
|
size_t ring_buffer_size = std::max<size_t>(buffer_frame_size,
|
||||||
|
MPD_OSX_BUFFER_TIME_MS * audio_format.GetFrameSize() * audio_format.sample_rate / 1000);
|
||||||
|
ring_buffer = new boost::lockfree::spsc_queue<uint8_t>(ring_buffer_size);
|
||||||
|
|
||||||
status = AudioOutputUnitStart(au);
|
status = AudioOutputUnitStart(au);
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
@ -708,7 +712,7 @@ OSXOutput::Delay() const noexcept
|
|||||||
{
|
{
|
||||||
return ring_buffer->write_available()
|
return ring_buffer->write_available()
|
||||||
? std::chrono::steady_clock::duration::zero()
|
? std::chrono::steady_clock::duration::zero()
|
||||||
: std::chrono::milliseconds(25);
|
: std::chrono::milliseconds(MPD_OSX_BUFFER_TIME_MS / 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#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 */
|
/* on WIN32, "FLOAT" is already defined, and this triggers -Wshadow */
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wshadow"
|
#pragma GCC diagnostic ignored "-Wshadow"
|
||||||
@ -57,7 +57,7 @@ enum class SampleFormat : uint8_t {
|
|||||||
DSD,
|
DSD,
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(WIN32) && GCC_CHECK_VERSION(4,6)
|
#if defined(_WIN32) && GCC_CHECK_VERSION(4,6)
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ Stat(Path path, bool follow)
|
|||||||
|
|
||||||
info.size = src.GetSize();
|
info.size = src.GetSize();
|
||||||
info.mtime = src.GetModificationTime();
|
info.mtime = src.GetModificationTime();
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
info.device = info.inode = 0;
|
info.device = info.inode = 0;
|
||||||
#else
|
#else
|
||||||
info.device = src.GetDevice();
|
info.device = src.GetDevice();
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include "Clock.hxx"
|
#include "Clock.hxx"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
gcc_const
|
gcc_const
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "Compiler.h"
|
#include "Compiler.h"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the uptime of the current process in seconds.
|
* Returns the uptime of the current process in seconds.
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "EPollFD.hxx"
|
#include "EPollFD.hxx"
|
||||||
#include "Error.hxx"
|
#include "Error.hxx"
|
||||||
|
|
||||||
#ifdef __BIONIC__
|
#if defined(__BIONIC__) && __ANDROID_API__ < 21
|
||||||
|
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -47,7 +47,7 @@ FormatSystemError(std::error_code code, const char *fmt,
|
|||||||
return std::system_error(code, buffer);
|
return std::system_error(code, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ FormatLastError(const char *fmt, Args&&... args) noexcept
|
|||||||
std::forward<Args>(args)...);
|
std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -106,7 +106,7 @@ FormatLastError(const char *fmt, Args&&... args) noexcept
|
|||||||
static inline const std::error_category &
|
static inline const std::error_category &
|
||||||
ErrnoCategory() noexcept
|
ErrnoCategory() noexcept
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
/* on Windows, the generic_category() is used for errno
|
/* on Windows, the generic_category() is used for errno
|
||||||
values */
|
values */
|
||||||
return std::generic_category();
|
return std::generic_category();
|
||||||
@ -151,7 +151,7 @@ gcc_pure
|
|||||||
static inline bool
|
static inline bool
|
||||||
IsFileNotFound(const std::system_error &e) noexcept
|
IsFileNotFound(const std::system_error &e) noexcept
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return e.code().category() == std::system_category() &&
|
return e.code().category() == std::system_category() &&
|
||||||
e.code().value() == ERROR_FILE_NOT_FOUND;
|
e.code().value() == ERROR_FILE_NOT_FOUND;
|
||||||
#else
|
#else
|
||||||
@ -164,7 +164,7 @@ gcc_pure
|
|||||||
static inline bool
|
static inline bool
|
||||||
IsPathNotFound(const std::system_error &e) noexcept
|
IsPathNotFound(const std::system_error &e) noexcept
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return e.code().category() == std::system_category() &&
|
return e.code().category() == std::system_category() &&
|
||||||
e.code().value() == ERROR_PATH_NOT_FOUND;
|
e.code().value() == ERROR_PATH_NOT_FOUND;
|
||||||
#else
|
#else
|
||||||
@ -177,7 +177,7 @@ gcc_pure
|
|||||||
static inline bool
|
static inline bool
|
||||||
IsAccessDenied(const std::system_error &e) noexcept
|
IsAccessDenied(const std::system_error &e) noexcept
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return e.code().category() == std::system_category() &&
|
return e.code().category() == std::system_category() &&
|
||||||
e.code().value() == ERROR_ACCESS_DENIED;
|
e.code().value() == ERROR_ACCESS_DENIED;
|
||||||
#else
|
#else
|
||||||
|
@ -27,20 +27,20 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include "net/IPv4Address.hxx"
|
#include "net/IPv4Address.hxx"
|
||||||
#include "net/StaticSocketAddress.hxx"
|
#include "net/StaticSocketAddress.hxx"
|
||||||
#include "net/UniqueSocketDescriptor.hxx"
|
#include "net/UniqueSocketDescriptor.hxx"
|
||||||
#include "net/SocketError.hxx"
|
#include "net/SocketError.hxx"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
static void PoorSocketPair(int fd[2]);
|
static void PoorSocketPair(int fd[2]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EventPipe::EventPipe()
|
EventPipe::EventPipe()
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
PoorSocketPair(fds);
|
PoorSocketPair(fds);
|
||||||
#else
|
#else
|
||||||
FileDescriptor r, w;
|
FileDescriptor r, w;
|
||||||
@ -54,7 +54,7 @@ EventPipe::EventPipe()
|
|||||||
|
|
||||||
EventPipe::~EventPipe()
|
EventPipe::~EventPipe()
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
closesocket(fds[0]);
|
closesocket(fds[0]);
|
||||||
closesocket(fds[1]);
|
closesocket(fds[1]);
|
||||||
#else
|
#else
|
||||||
@ -70,7 +70,7 @@ EventPipe::Read()
|
|||||||
assert(fds[1] >= 0);
|
assert(fds[1] >= 0);
|
||||||
|
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return recv(fds[0], buffer, sizeof(buffer), 0) > 0;
|
return recv(fds[0], buffer, sizeof(buffer), 0) > 0;
|
||||||
#else
|
#else
|
||||||
return read(fds[0], buffer, sizeof(buffer)) > 0;
|
return read(fds[0], buffer, sizeof(buffer)) > 0;
|
||||||
@ -83,14 +83,14 @@ EventPipe::Write()
|
|||||||
assert(fds[0] >= 0);
|
assert(fds[0] >= 0);
|
||||||
assert(fds[1] >= 0);
|
assert(fds[1] >= 0);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
send(fds[1], "", 1, 0);
|
send(fds[1], "", 1, 0);
|
||||||
#else
|
#else
|
||||||
gcc_unused ssize_t nbytes = write(fds[1], "", 1);
|
gcc_unused ssize_t nbytes = write(fds[1], "", 1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
/* Our poor man's socketpair() implementation
|
/* Our poor man's socketpair() implementation
|
||||||
* Due to limited protocol/address family support
|
* Due to limited protocol/address family support
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#else
|
#else
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -61,7 +61,7 @@ FormatFatalError(const char *fmt, ...)
|
|||||||
Abort();
|
Abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
void
|
void
|
||||||
FatalSystemError(const char *msg, DWORD code)
|
FatalSystemError(const char *msg, DWORD code)
|
||||||
@ -79,7 +79,7 @@ FatalSystemError(const char *msg, DWORD code)
|
|||||||
void
|
void
|
||||||
FatalSystemError(const char *msg)
|
FatalSystemError(const char *msg)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
FatalSystemError(msg, GetLastError());
|
FatalSystemError(msg, GetLastError());
|
||||||
#else
|
#else
|
||||||
const char *system_error = strerror(errno);
|
const char *system_error = strerror(errno);
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "check.h"
|
#include "check.h"
|
||||||
#include "Compiler.h"
|
#include "Compiler.h"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <windef.h>
|
#include <windef.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ gcc_noreturn
|
|||||||
void
|
void
|
||||||
FatalSystemError(const char *msg);
|
FatalSystemError(const char *msg);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
gcc_noreturn
|
gcc_noreturn
|
||||||
void
|
void
|
||||||
|
@ -87,7 +87,7 @@ TagGetter(const void *object, const char *name) noexcept
|
|||||||
|
|
||||||
if (strcmp(name, "iso8601") == 0) {
|
if (strcmp(name, "iso8601") == 0) {
|
||||||
time_t t = time(nullptr);
|
time_t t = time(nullptr);
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
const struct tm *tm2 = gmtime(&t);
|
const struct tm *tm2 = gmtime(&t);
|
||||||
#else
|
#else
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
@ -97,7 +97,7 @@ TagGetter(const void *object, const char *name) noexcept
|
|||||||
return "";
|
return "";
|
||||||
|
|
||||||
strftime(ctx.buffer, sizeof(ctx.buffer),
|
strftime(ctx.buffer, sizeof(ctx.buffer),
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
/* kludge: use underscore instead of colon on
|
/* kludge: use underscore instead of colon on
|
||||||
Windows because colons are not allowed in
|
Windows because colons are not allowed in
|
||||||
file names, and this library is mostly
|
file names, and this library is mostly
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#ifndef THREAD_COND_HXX
|
#ifndef THREAD_COND_HXX
|
||||||
#define THREAD_COND_HXX
|
#define THREAD_COND_HXX
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
#include "WindowsCond.hxx"
|
#include "WindowsCond.hxx"
|
||||||
class Cond : public WindowsCond {};
|
class Cond : public WindowsCond {};
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "Compiler.h"
|
#include "Compiler.h"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#else
|
#else
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
@ -34,7 +34,7 @@
|
|||||||
* debugging code.
|
* debugging code.
|
||||||
*/
|
*/
|
||||||
class ThreadId {
|
class ThreadId {
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
DWORD id;
|
DWORD id;
|
||||||
#else
|
#else
|
||||||
pthread_t id;
|
pthread_t id;
|
||||||
@ -46,7 +46,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
ThreadId() noexcept = default;
|
ThreadId() noexcept = default;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
constexpr ThreadId(DWORD _id) noexcept:id(_id) {}
|
constexpr ThreadId(DWORD _id) noexcept:id(_id) {}
|
||||||
#else
|
#else
|
||||||
constexpr ThreadId(pthread_t _id) noexcept:id(_id) {}
|
constexpr ThreadId(pthread_t _id) noexcept:id(_id) {}
|
||||||
@ -54,7 +54,7 @@ public:
|
|||||||
|
|
||||||
gcc_const
|
gcc_const
|
||||||
static ThreadId Null() noexcept {
|
static ThreadId Null() noexcept {
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
static ThreadId null;
|
static ThreadId null;
|
||||||
@ -72,7 +72,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
gcc_pure
|
gcc_pure
|
||||||
static const ThreadId GetCurrent() noexcept {
|
static const ThreadId GetCurrent() noexcept {
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return ::GetCurrentThreadId();
|
return ::GetCurrentThreadId();
|
||||||
#else
|
#else
|
||||||
return pthread_self();
|
return pthread_self();
|
||||||
@ -81,7 +81,7 @@ public:
|
|||||||
|
|
||||||
gcc_pure
|
gcc_pure
|
||||||
bool operator==(const ThreadId &other) const noexcept {
|
bool operator==(const ThreadId &other) const noexcept {
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return id == other.id;
|
return id == other.id;
|
||||||
#else
|
#else
|
||||||
return pthread_equal(id, other.id);
|
return pthread_equal(id, other.id);
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
#include "CriticalSection.hxx"
|
#include "CriticalSection.hxx"
|
||||||
class Mutex : public CriticalSection {};
|
class Mutex : public CriticalSection {};
|
||||||
|
@ -30,7 +30,7 @@ Thread::Start()
|
|||||||
{
|
{
|
||||||
assert(!IsDefined());
|
assert(!IsDefined());
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
handle = ::CreateThread(nullptr, 0, ThreadProc, this, 0, &id);
|
handle = ::CreateThread(nullptr, 0, ThreadProc, this, 0, &id);
|
||||||
if (handle == nullptr)
|
if (handle == nullptr)
|
||||||
throw MakeLastError("Failed to create thread");
|
throw MakeLastError("Failed to create thread");
|
||||||
@ -61,7 +61,7 @@ Thread::Join() noexcept
|
|||||||
assert(IsDefined());
|
assert(IsDefined());
|
||||||
assert(!IsInside());
|
assert(!IsInside());
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
::WaitForSingleObject(handle, INFINITE);
|
::WaitForSingleObject(handle, INFINITE);
|
||||||
::CloseHandle(handle);
|
::CloseHandle(handle);
|
||||||
handle = nullptr;
|
handle = nullptr;
|
||||||
@ -74,7 +74,7 @@ Thread::Join() noexcept
|
|||||||
inline void
|
inline void
|
||||||
Thread::Run() noexcept
|
Thread::Run() noexcept
|
||||||
{
|
{
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
/* this works around a race condition that causes an assertion
|
/* this works around a race condition that causes an assertion
|
||||||
failure due to IsInside() spuriously returning false right
|
failure due to IsInside() spuriously returning false right
|
||||||
@ -91,7 +91,7 @@ Thread::Run() noexcept
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
DWORD WINAPI
|
DWORD WINAPI
|
||||||
Thread::ThreadProc(LPVOID ctx) noexcept
|
Thread::ThreadProc(LPVOID ctx) noexcept
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include "util/BindMethod.hxx"
|
#include "util/BindMethod.hxx"
|
||||||
#include "Compiler.h"
|
#include "Compiler.h"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#else
|
#else
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
@ -36,7 +36,7 @@ class Thread {
|
|||||||
typedef BoundMethod<void()> Function;
|
typedef BoundMethod<void()> Function;
|
||||||
const Function f;
|
const Function f;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
HANDLE handle = nullptr;
|
HANDLE handle = nullptr;
|
||||||
DWORD id;
|
DWORD id;
|
||||||
#else
|
#else
|
||||||
@ -67,7 +67,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool IsDefined() const noexcept {
|
bool IsDefined() const noexcept {
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return handle != nullptr;
|
return handle != nullptr;
|
||||||
#else
|
#else
|
||||||
return defined;
|
return defined;
|
||||||
@ -79,7 +79,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
gcc_pure
|
gcc_pure
|
||||||
bool IsInside() const noexcept {
|
bool IsInside() const noexcept {
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return GetCurrentThreadId() == id;
|
return GetCurrentThreadId() == id;
|
||||||
#else
|
#else
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
@ -96,7 +96,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
void Run() noexcept;
|
void Run() noexcept;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
static DWORD WINAPI ThreadProc(LPVOID ctx) noexcept;
|
static DWORD WINAPI ThreadProc(LPVOID ctx) noexcept;
|
||||||
#else
|
#else
|
||||||
static void *ThreadProc(void *ctx) noexcept;
|
static void *ThreadProc(void *ctx) noexcept;
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#elif defined(WIN32)
|
#elif defined(_WIN32)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ SetThreadIdlePriority() noexcept
|
|||||||
|
|
||||||
ioprio_set_idle();
|
ioprio_set_idle();
|
||||||
|
|
||||||
#elif defined(WIN32)
|
#elif defined(_WIN32)
|
||||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_IDLE);
|
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_IDLE);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "fs/AllocatedPath.hxx"
|
#include "fs/AllocatedPath.hxx"
|
||||||
#include "fs/FileSystem.hxx"
|
#include "fs/FileSystem.hxx"
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
#include "PidFile.hxx"
|
#include "PidFile.hxx"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
@ -42,7 +42,7 @@
|
|||||||
#define WCOREDUMP(v) 0
|
#define WCOREDUMP(v) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
|
|
||||||
/** the Unix user name which MPD runs as */
|
/** the Unix user name which MPD runs as */
|
||||||
static char *user_name;
|
static char *user_name;
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
class AllocatedPath;
|
class AllocatedPath;
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
void
|
void
|
||||||
daemonize_init(const char *user, const char *group, AllocatedPath &&pidfile);
|
daemonize_init(const char *user, const char *group, AllocatedPath &&pidfile);
|
||||||
#else
|
#else
|
||||||
@ -31,7 +31,7 @@ daemonize_init(const char *user, const char *group, AllocatedPath &&pidfile)
|
|||||||
{ (void)user; (void)group; (void)pidfile; }
|
{ (void)user; (void)group; (void)pidfile; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
void
|
void
|
||||||
daemonize_finish();
|
daemonize_finish();
|
||||||
#else
|
#else
|
||||||
@ -44,7 +44,7 @@ daemonize_finish()
|
|||||||
* Kill the MPD which is currently running, pid determined from the
|
* Kill the MPD which is currently running, pid determined from the
|
||||||
* pid file.
|
* pid file.
|
||||||
*/
|
*/
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
void
|
void
|
||||||
daemonize_kill();
|
daemonize_kill();
|
||||||
#else
|
#else
|
||||||
@ -59,7 +59,7 @@ daemonize_kill()
|
|||||||
/**
|
/**
|
||||||
* Close stdin (fd 0) and re-open it as /dev/null.
|
* Close stdin (fd 0) and re-open it as /dev/null.
|
||||||
*/
|
*/
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
void
|
void
|
||||||
daemonize_close_stdin();
|
daemonize_close_stdin();
|
||||||
#else
|
#else
|
||||||
@ -70,7 +70,7 @@ daemonize_close_stdin() {}
|
|||||||
/**
|
/**
|
||||||
* Change to the configured Unix user.
|
* Change to the configured Unix user.
|
||||||
*/
|
*/
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
void
|
void
|
||||||
daemonize_set_user();
|
daemonize_set_user();
|
||||||
#else
|
#else
|
||||||
@ -79,7 +79,7 @@ daemonize_set_user()
|
|||||||
{ /* nop */ }
|
{ /* nop */ }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
void
|
void
|
||||||
daemonize_begin(bool detach);
|
daemonize_begin(bool detach);
|
||||||
#else
|
#else
|
||||||
@ -88,7 +88,7 @@ daemonize_begin(bool detach)
|
|||||||
{ (void)detach; }
|
{ (void)detach; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
void
|
void
|
||||||
daemonize_commit();
|
daemonize_commit();
|
||||||
#else
|
#else
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "SignalHandlers.hxx"
|
#include "SignalHandlers.hxx"
|
||||||
#include "event/SignalMonitor.hxx"
|
#include "event/SignalMonitor.hxx"
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
|
|
||||||
#include "Log.hxx"
|
#include "Log.hxx"
|
||||||
#include "LogInit.hxx"
|
#include "LogInit.hxx"
|
||||||
@ -61,7 +61,7 @@ SignalHandlersInit(EventLoop &loop)
|
|||||||
{
|
{
|
||||||
SignalMonitorInit(loop);
|
SignalMonitorInit(loop);
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
|
|
||||||
sa.sa_flags = 0;
|
sa.sa_flags = 0;
|
||||||
|
@ -23,14 +23,14 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AllocatedString<>
|
AllocatedString<>
|
||||||
FormatStringV(const char *fmt, va_list args) noexcept
|
FormatStringV(const char *fmt, va_list args) noexcept
|
||||||
{
|
{
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
va_list tmp;
|
va_list tmp;
|
||||||
va_copy(tmp, args);
|
va_copy(tmp, args);
|
||||||
const int length = vsnprintf(NULL, 0, fmt, tmp);
|
const int length = vsnprintf(NULL, 0, fmt, tmp);
|
||||||
|
@ -99,7 +99,7 @@ HugeDiscard(void *p, size_t size) noexcept
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(WIN32)
|
#elif defined(_WIN32)
|
||||||
|
|
||||||
WritableBuffer<void>
|
WritableBuffer<void>
|
||||||
HugeAllocate(size_t size)
|
HugeAllocate(size_t size)
|
||||||
|
@ -78,7 +78,7 @@ HugeForkCow(void *p, size_t size, bool enable) noexcept;
|
|||||||
void
|
void
|
||||||
HugeDiscard(void *p, size_t size) noexcept;
|
HugeDiscard(void *p, size_t size) noexcept;
|
||||||
|
|
||||||
#elif defined(WIN32)
|
#elif defined(_WIN32)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
WritableBuffer<void>
|
WritableBuffer<void>
|
||||||
|
@ -111,7 +111,7 @@ gcc_nonnull_all
|
|||||||
static inline char *
|
static inline char *
|
||||||
UnsafeCopyStringP(char *dest, const char *src) noexcept
|
UnsafeCopyStringP(char *dest, const char *src) noexcept
|
||||||
{
|
{
|
||||||
#if defined(WIN32) || defined(__BIONIC__)
|
#if defined(_WIN32) || defined(__BIONIC__)
|
||||||
/* emulate stpcpy() */
|
/* emulate stpcpy() */
|
||||||
UnsafeCopyString(dest, src);
|
UnsafeCopyString(dest, src);
|
||||||
return dest + StringLength(dest);
|
return dest + StringLength(dest);
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#if !defined(__GLIBC__) && !defined(WIN32)
|
#if !defined(__GLIBC__) && !defined(_WIN32)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the time zone offset in a portable way.
|
* Determine the time zone offset in a portable way.
|
||||||
@ -59,7 +59,7 @@ ParseTimePoint(const char *s, const char *format)
|
|||||||
assert(s != nullptr);
|
assert(s != nullptr);
|
||||||
assert(format != nullptr);
|
assert(format != nullptr);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
/* TODO: emulate strptime()? */
|
/* TODO: emulate strptime()? */
|
||||||
(void)s;
|
(void)s;
|
||||||
(void)format;
|
(void)format;
|
||||||
@ -80,5 +80,5 @@ ParseTimePoint(const char *s, const char *format)
|
|||||||
|
|
||||||
return std::chrono::system_clock::from_time_t(t);
|
return std::chrono::system_clock::from_time_t(t);
|
||||||
|
|
||||||
#endif /* !WIN32 */
|
#endif /* !_WIN32 */
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user