From a64ccf16a60401650b3577de08ef1f0e03f4d25c Mon Sep 17 00:00:00 2001 From: casey Date: Fri, 27 May 2016 18:10:41 -0700 Subject: [PATCH] Fixed clangen/cmakeosx to compile and run against Windows. --- .../taglib_plugin/TaglibMetadataReader.cpp | 45 +++++++++++++------ .../taglib_plugin/TaglibMetadataReader.h | 30 ++++++------- src/core/sdk/config.h | 1 + src/core/support/Common.cpp | 3 ++ src/musikbox/app/util/SystemInfo.cpp | 2 +- src/musikbox/app/util/Text.cpp | 2 +- src/musikbox/app/window/CommandWindow.cpp | 2 +- src/musikbox/cursespp/ListWindow.cpp | 2 +- src/musikbox/cursespp/MultiLineEntry.cpp | 2 +- src/musikbox/musikbox.vcxproj | 4 +- 10 files changed, 57 insertions(+), 36 deletions(-) diff --git a/src/contrib/taglib_plugin/TaglibMetadataReader.cpp b/src/contrib/taglib_plugin/TaglibMetadataReader.cpp index b2475f3fd..a158d9c4e 100644 --- a/src/contrib/taglib_plugin/TaglibMetadataReader.cpp +++ b/src/contrib/taglib_plugin/TaglibMetadataReader.cpp @@ -36,20 +36,37 @@ #include "TaglibMetadataReader.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#ifdef WIN32 + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#else + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#endif #include #include diff --git a/src/contrib/taglib_plugin/TaglibMetadataReader.h b/src/contrib/taglib_plugin/TaglibMetadataReader.h index 891ff5457..ece69bc33 100644 --- a/src/contrib/taglib_plugin/TaglibMetadataReader.h +++ b/src/contrib/taglib_plugin/TaglibMetadataReader.h @@ -38,21 +38,21 @@ #include "stdafx.h" -#ifndef _HAVE_TAGLIB -#include -#include -#include -#include -#include -#include -#else //_HAVE_TAGLIB -#include -#include -#include -#include -#include -#include -#endif //_HAVE_TAGLIB +#ifdef WIN32 + #include + #include + #include + #include + #include + #include +#else + #include + #include + #include + #include + #include + #include +#endif #include #include diff --git a/src/core/sdk/config.h b/src/core/sdk/config.h index a747b4641..bded3ec64 100755 --- a/src/core/sdk/config.h +++ b/src/core/sdk/config.h @@ -40,6 +40,7 @@ #define WIN32_LEAN_AND_MEAN #define WINVER 0x0501 #define _WIN32_WINNT 0x0501 + #define NOMINMAX #include #include diff --git a/src/core/support/Common.cpp b/src/core/support/Common.cpp index 37303979f..0e3778e2b 100644 --- a/src/core/support/Common.cpp +++ b/src/core/support/Common.cpp @@ -40,7 +40,10 @@ #include #include #include + +#ifdef __APPLE__ #include +#endif std::string musik::core::GetPluginDirectory() { std::string path(GetApplicationDirectory()); diff --git a/src/musikbox/app/util/SystemInfo.cpp b/src/musikbox/app/util/SystemInfo.cpp index b70421c73..2d072ea65 100755 --- a/src/musikbox/app/util/SystemInfo.cpp +++ b/src/musikbox/app/util/SystemInfo.cpp @@ -139,7 +139,7 @@ double WindowsSystemInfo::GetCpuUsage() { (double) (user.QuadPart - lastUserCpu.QuadPart); ULONGLONG diff = now.QuadPart - lastCpu.QuadPart; - diff = max(1, diff); + diff = std::max((ULONGLONG) 1, diff); percent /= diff; percent /= processorCount; diff --git a/src/musikbox/app/util/Text.cpp b/src/musikbox/app/util/Text.cpp index de1ae3dc0..1af1b66e5 100755 --- a/src/musikbox/app/util/Text.cpp +++ b/src/musikbox/app/util/Text.cpp @@ -20,9 +20,9 @@ namespace musik { } catch (...) { /* invalid encoding, just treat as a single char */ + ++it; } - ++it; ++c; } diff --git a/src/musikbox/app/window/CommandWindow.cpp b/src/musikbox/app/window/CommandWindow.cpp index a9fcdc89a..4f38719b1 100755 --- a/src/musikbox/app/window/CommandWindow.cpp +++ b/src/musikbox/app/window/CommandWindow.cpp @@ -73,7 +73,7 @@ void removeUtf8Char(std::string& value) { } void CommandWindow::Write(const std::string& key) { - if (key == "KEY_BACKSPACE" || key == "^?") { /* backspace */ + if (key == "^H" || key == "^?") { /* backspace */ removeUtf8Char(this->buffer); } else if (key == "^J") { /* return */ diff --git a/src/musikbox/cursespp/ListWindow.cpp b/src/musikbox/cursespp/ListWindow.cpp index 3ea1c341c..5621d4ba1 100755 --- a/src/musikbox/cursespp/ListWindow.cpp +++ b/src/musikbox/cursespp/ListWindow.cpp @@ -25,7 +25,7 @@ void ListWindow::ScrollToTop() { void ListWindow::ScrollToBottom() { IScrollAdapter& adapter = this->GetScrollAdapter(); - this->SetSelectedIndex(std::max(0UL, adapter.GetEntryCount() - 1)); + this->SetSelectedIndex(std::max((size_t) 0, adapter.GetEntryCount() - 1)); adapter.DrawPage(this->GetContent(), selectedIndex, &scrollPosition); this->Repaint(); } diff --git a/src/musikbox/cursespp/MultiLineEntry.cpp b/src/musikbox/cursespp/MultiLineEntry.cpp index 66d439a83..1cd483e14 100755 --- a/src/musikbox/cursespp/MultiLineEntry.cpp +++ b/src/musikbox/cursespp/MultiLineEntry.cpp @@ -14,7 +14,7 @@ MultiLineEntry::MultiLineEntry(const std::string& value, int64 attrs) { } size_t MultiLineEntry::GetLineCount() { - return std::max(1UL, this->lines.size()); + return std::max((size_t) 1, this->lines.size()); } std::string MultiLineEntry::GetLine(size_t n) { diff --git a/src/musikbox/musikbox.vcxproj b/src/musikbox/musikbox.vcxproj index 0a09d9774..1688de794 100755 --- a/src/musikbox/musikbox.vcxproj +++ b/src/musikbox/musikbox.vcxproj @@ -59,7 +59,7 @@ Disabled - ./;../;../3rdparty/include;../../../boost_1_60_0;%(AdditionalIncludeDirectories) + ./;../;../3rdparty/include;../3rdparty/win32_include;../../../boost_1_60_0;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks @@ -88,7 +88,7 @@ - ./;../;../3rdparty/include;../../../boost_1_60_0;%(AdditionalIncludeDirectories) + ./;../;../3rdparty/include;../3rdparty/win32_include;../../../boost_1_60_0;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreaded Use