From bfbd4db5e593c8cdefffbc15fca79534c0f379ab Mon Sep 17 00:00:00 2001 From: casey langen Date: Sun, 18 Jun 2017 14:11:06 -0700 Subject: [PATCH] Bumped to 0.17.2, fixed startup crashes caused non-latin usernames. --- CHANGELOG.txt | 10 ++++-- CMakeLists.txt | 2 +- src/musikbox/app/util/Version.h | 2 +- src/plugins/httpdatastream/HttpDataStream.cpp | 4 +-- .../httpdatastream/httpdatastream_plugin.cpp | 35 ++++++++++++------- src/plugins/websocket_remote/Transcoder.cpp | 6 ++-- src/plugins/websocket_remote/main.cpp | 10 ++++++ 7 files changed, 47 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d4ac1d9f0..1688d43ba 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,7 +1,11 @@ -0.17.1 +0.17.2 -win32-only release to correct startup issues on computers that do not have the -visual c++ 14 runtime installed. +user-facing: + +* fixed a bug where usernames with non-latin characters may cause the + `websocket_remote` and `httpdatastream` plugins to crash during startup. +* fixed startup issues on windows computers that do not have the visual c++ 14 + runtime installed. -------------------------------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index 421468694..76a23ba4a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ cmake_minimum_required(VERSION 3.0) project(musikbox) set (musikbox_VERSION_MAJOR 0) set (musikbox_VERSION_MINOR 17) -set (musikbox_VERSION_PATCH 1) +set (musikbox_VERSION_PATCH 2) set (musikbox_VERSION "${musikbox_VERSION_MAJOR}.${musikbox_VERSION_MINOR}.${musikbox_VERSION_PATCH}") include(CMakeToolsHelpers OPTIONAL) diff --git a/src/musikbox/app/util/Version.h b/src/musikbox/app/util/Version.h index 52f5af6b9..7a8489ae9 100644 --- a/src/musikbox/app/util/Version.h +++ b/src/musikbox/app/util/Version.h @@ -1,3 +1,3 @@ #pragma once -#define VERSION "0.17.1" +#define VERSION "0.17.2" diff --git a/src/plugins/httpdatastream/HttpDataStream.cpp b/src/plugins/httpdatastream/HttpDataStream.cpp index cdeb2bc2e..be2d86f6d 100755 --- a/src/plugins/httpdatastream/HttpDataStream.cpp +++ b/src/plugins/httpdatastream/HttpDataStream.cpp @@ -75,8 +75,8 @@ extern "C" DLLEXPORT void SetEnvironment(IEnvironment* environment) { cachePath = std::string(buffer) + "/cache/httpclient/"; boost::filesystem::path p(cachePath); - if (!boost::filesystem::exists(cachePath)) { - boost::filesystem::create_directories(cachePath); + if (!boost::filesystem::exists(p)) { + boost::filesystem::create_directories(p); } } } diff --git a/src/plugins/httpdatastream/httpdatastream_plugin.cpp b/src/plugins/httpdatastream/httpdatastream_plugin.cpp index 37b4d2429..c41112b09 100644 --- a/src/plugins/httpdatastream/httpdatastream_plugin.cpp +++ b/src/plugins/httpdatastream/httpdatastream_plugin.cpp @@ -39,6 +39,9 @@ #include #include +#include +#include + #ifdef WIN32 BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { return true; @@ -49,20 +52,28 @@ #define DLLEXPORT #endif -class HttpDataStreamPlugin : public musik::core::sdk::IPlugin { - virtual void Destroy() { delete this; }; - virtual const char* Name() { return "HTTP IDataStream"; } - virtual const char* Version() { return "0.1.0"; } - virtual const char* Author() { return "clangen"; } - virtual const char* Guid() { return "b153adad-ee98-4331-ad32-4ff7f34828cd"; } - virtual bool Configurable() { return false; } - virtual void Configure() { } - virtual void Reload() { } - virtual int SdkVersion() { return musik::core::sdk::SdkVersion; } -}; +static class HttpDataStreamPlugin : public musik::core::sdk::IPlugin { + public: + HttpDataStreamPlugin() { + /* enable utf8 filesystem (required in windows, maybe not macos/linux */ + std::locale locale = std::locale(); + std::locale utf8Locale(locale, new boost::filesystem::detail::utf8_codecvt_facet); + boost::filesystem::path::imbue(utf8Locale); + } + + virtual void Destroy() { }; + virtual const char* Name() { return "HTTP IDataStream"; } + virtual const char* Version() { return "0.1.0"; } + virtual const char* Author() { return "clangen"; } + virtual const char* Guid() { return "b153adad-ee98-4331-ad32-4ff7f34828cd"; } + virtual bool Configurable() { return false; } + virtual void Configure() { } + virtual void Reload() { } + virtual int SdkVersion() { return musik::core::sdk::SdkVersion; } +} plugin; extern "C" DLLEXPORT IPlugin* GetPlugin() { - return new HttpDataStreamPlugin(); + return &plugin; } extern "C" DLLEXPORT IDataStreamFactory* GetDataStreamFactory() { diff --git a/src/plugins/websocket_remote/Transcoder.cpp b/src/plugins/websocket_remote/Transcoder.cpp index ffc19871d..89fc3bf96 100644 --- a/src/plugins/websocket_remote/Transcoder.cpp +++ b/src/plugins/websocket_remote/Transcoder.cpp @@ -45,9 +45,9 @@ static std::string cachePath(Context& context) { char buf[4096]; context.environment->GetPath(PathType::PathData, buf, sizeof(buf)); std::string path = std::string(buf) + "/cache/transcoder/"; - - if (!exists(path)) { - create_directories(path); + boost::filesystem::path boostPath(path); + if (!exists(boostPath)) { + create_directories(boostPath); } return path; diff --git a/src/plugins/websocket_remote/main.cpp b/src/plugins/websocket_remote/main.cpp index 9f96e59d5..e9892f90a 100644 --- a/src/plugins/websocket_remote/main.cpp +++ b/src/plugins/websocket_remote/main.cpp @@ -41,6 +41,9 @@ #include #include +#include +#include + #include #ifdef WIN32 @@ -148,6 +151,13 @@ static class PlaybackRemote : public IPlaybackRemote { static class Plugin : public IPlugin { public: + Plugin() { + /* enable utf8 filesystem (required in windows, maybe not macos/linux */ + std::locale locale = std::locale(); + std::locale utf8Locale(locale, new boost::filesystem::detail::utf8_codecvt_facet); + boost::filesystem::path::imbue(utf8Locale); + } + virtual void Destroy() { } virtual const char* Name() { return "WebSockets IPlaybackRemote"; } virtual const char* Version() { return "0.6.0"; }