Fix compile with MSVC
This commit is contained in:
@@ -1179,6 +1179,9 @@ endif()
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(strawberry_lib PRIVATE dsound dwmapi)
|
||||
if(MSVC)
|
||||
target_link_libraries(strawberry_lib PRIVATE sqlite3)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <cmath>
|
||||
|
||||
#include <QVector>
|
||||
#include <QtMath>
|
||||
|
||||
FHT::FHT(int n) : num_((n < 3) ? 0 : 1 << n), exp2_((n < 3) ? -1 : n) {
|
||||
|
||||
|
||||
@@ -22,7 +22,9 @@
|
||||
#include "version.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <getopt.h>
|
||||
#ifndef _MSC_VER
|
||||
# include <getopt.h>
|
||||
#endif
|
||||
#include <iostream>
|
||||
#include <type_traits>
|
||||
|
||||
@@ -119,6 +121,7 @@ void CommandlineOptions::RemoveArg(const QString &starts_with, int count) {
|
||||
|
||||
bool CommandlineOptions::Parse() {
|
||||
|
||||
#ifndef _MSC_VER // TODO: Consider QCommandLineOption.
|
||||
static const struct option kOptions[] = {
|
||||
{"help", no_argument, nullptr, 'h'},
|
||||
{"play", no_argument, nullptr, 'p'},
|
||||
@@ -319,6 +322,8 @@ bool CommandlineOptions::Parse() {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _MSC_VER
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@@ -613,8 +613,8 @@ void SongLoader::ErrorMessageReceived(GstMessage *msg) {
|
||||
gchar *debugs = nullptr;
|
||||
|
||||
gst_message_parse_error(msg, &error, &debugs);
|
||||
qLog(Error) << __PRETTY_FUNCTION__ << error->message;
|
||||
qLog(Error) << __PRETTY_FUNCTION__ << debugs;
|
||||
qLog(Error) << error->message;
|
||||
qLog(Error) << debugs;
|
||||
|
||||
QString message_str = error->message;
|
||||
|
||||
|
||||
@@ -697,7 +697,7 @@ QString GetEnv(const QString &key) {
|
||||
void SetEnv(const char *key, const QString &value) {
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
putenv(QString("%1=%2").arg(key, value).toLocal8Bit().constData());
|
||||
_putenv(QString("%1=%2").arg(key, value).toLocal8Bit().constData());
|
||||
#else
|
||||
setenv(key, value.toLocal8Bit().constData(), 1);
|
||||
#endif
|
||||
@@ -785,7 +785,19 @@ QString DesktopEnvironment() {
|
||||
|
||||
}
|
||||
|
||||
QString UnicodeToAscii(const QString &unicode) {
|
||||
QString UnicodeToAscii(QString unicode) {
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
return unicode
|
||||
.replace(QChar(229), "a")
|
||||
.replace(QChar(197), 'A')
|
||||
.replace(QChar(230), "ae")
|
||||
.replace(QChar(198), "AE")
|
||||
.replace(QChar(248), 'o')
|
||||
.replace(QChar(216), 'O');
|
||||
|
||||
#else
|
||||
|
||||
#ifdef LC_ALL
|
||||
setlocale(LC_ALL, "");
|
||||
@@ -816,6 +828,8 @@ QString UnicodeToAscii(const QString &unicode) {
|
||||
|
||||
return ret;
|
||||
|
||||
#endif // _MSC_VER
|
||||
|
||||
}
|
||||
|
||||
QString MacAddress() {
|
||||
|
||||
@@ -132,7 +132,7 @@ QString GetRandomString(const int len, const QString &UseCharacters);
|
||||
|
||||
QString DesktopEnvironment();
|
||||
|
||||
QString UnicodeToAscii(const QString &unicode);
|
||||
QString UnicodeToAscii(QString unicode);
|
||||
|
||||
QString MacAddress();
|
||||
|
||||
|
||||
@@ -40,10 +40,12 @@ class DirectSoundDeviceFinder : public DeviceFinder {
|
||||
QList<Device> devices;
|
||||
};
|
||||
|
||||
static BOOL EnumerateCallback(LPGUID guid,
|
||||
LPCSTR description,
|
||||
LPCSTR module,
|
||||
LPVOID state_voidptr) __attribute__((stdcall));
|
||||
static BOOL EnumerateCallback(LPGUID guid, LPCSTR description, LPCSTR module, LPVOID state_voidptr)
|
||||
#ifdef _MSC_VER
|
||||
;
|
||||
#else
|
||||
__attribute__((stdcall));
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // DIRECTSOUNDDEVICEFINDER_H
|
||||
|
||||
@@ -875,7 +875,7 @@ void GstEngine::UpdateScope(const int chunk_length) {
|
||||
sample_type *dest = scope_.data();
|
||||
source += (chunk_size / sizeof(sample_type)) * scope_chunk_;
|
||||
|
||||
int bytes = 0;
|
||||
size_t bytes = 0;
|
||||
|
||||
// Make sure we don't go beyond the end of the buffer
|
||||
if (scope_chunk_ == scope_chunks_ - 1) {
|
||||
|
||||
@@ -22,7 +22,11 @@
|
||||
#include <windows.h>
|
||||
#include <initguid.h>
|
||||
#include <devpkey.h>
|
||||
#include <functiondiscoverykeys_devpkey.h>
|
||||
#ifdef _MSC_VER
|
||||
# include <functiondiscoverykeys.h>
|
||||
#else
|
||||
# include <functiondiscoverykeys_devpkey.h>
|
||||
#endif
|
||||
#include <mmdeviceapi.h>
|
||||
|
||||
#include <QList>
|
||||
@@ -32,6 +36,11 @@
|
||||
#include "mmdevicefinder.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
DEFINE_GUID(IID_IMMDeviceEnumerator, 0xa95664d2, 0x9614, 0x4f35, 0xa7, 0x46, 0xde, 0x8d, 0xb6, 0x36, 0x17, 0xe6);
|
||||
DEFINE_GUID(CLSID_MMDeviceEnumerator, 0xbcde0395, 0xe52f, 0x467c, 0x8e, 0x3d, 0xc4, 0x57, 0x92, 0x91, 0x69, 0x2e);
|
||||
#endif
|
||||
|
||||
MMDeviceFinder::MMDeviceFinder() : DeviceFinder("mmdevice", { "wasapisink" }) {}
|
||||
|
||||
QList<DeviceFinder::Device> MMDeviceFinder::ListDevices() {
|
||||
|
||||
@@ -2164,13 +2164,13 @@ void Playlist::RemoveDeletedSongs() {
|
||||
namespace {
|
||||
|
||||
struct SongSimilarHash {
|
||||
long operator() (const Song &song) const {
|
||||
size_t operator() (const Song &song) const {
|
||||
return HashSimilar(song);
|
||||
}
|
||||
};
|
||||
|
||||
struct SongSimilarEqual {
|
||||
long operator()(const Song &song1, const Song &song2) const {
|
||||
size_t operator()(const Song &song1, const Song &song2) const {
|
||||
return song1.IsSimilar(song2);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user