summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yml42
-rw-r--r--abaddon.cpp11
-rw-r--r--discord/snowflake.cpp11
-rw-r--r--discord/snowflake.hpp2
-rw-r--r--platform.cpp4
m---------thirdparty/IXWebSocket0
-rw-r--r--util.cpp9
7 files changed, 65 insertions, 14 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7db575b..a1f74fb 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -3,6 +3,48 @@ name: Abaddon CI
on: [push, pull_request]
jobs:
+ msys2:
+ name: msys2-mingw64
+ runs-on: windows-latest
+ strategy:
+ matrix:
+ buildtype: [Debug, RelWithDebInfo, MinSizeRel]
+ defaults:
+ run:
+ shell: msys2 {0}
+ steps:
+ - uses: actions/checkout@v1
+ with:
+ submodules: true
+
+ - name: Setup MSYS2
+ uses: msys2/setup-msys2@v2
+ with:
+ msystem: mingw64
+ update: true
+ install: >-
+ git
+ make
+ mingw-w64-x86_64-toolchain
+ mingw-w64-x86_64-cmake
+ mingw-w64-x86_64-ninja
+ mingw-w64-x86_64-sqlite3
+ mingw-w64-x86_64-nlohmann-json
+ mingw-w64-x86_64-curl
+ mingw-w64-x86_64-zlib
+ mingw-w64-x86_64-gtkmm3
+
+ - name: Build
+ run: |
+ cmake -GNinja -Bbuild -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }}
+ cmake --build build
+
+ - name: Upload build
+ uses: actions/upload-artifact@v2
+ with:
+ name: build-windows-msys2-${{ matrix.buildtype }}
+ path: ${{ runner.workspace }}/build
+
windows:
name: windows-${{ matrix.buildtype }}
runs-on: windows-latest
diff --git a/abaddon.cpp b/abaddon.cpp
index 1f51221..a0c83d7 100644
--- a/abaddon.cpp
+++ b/abaddon.cpp
@@ -727,6 +727,17 @@ EmojiResource &Abaddon::GetEmojis() {
int main(int argc, char **argv) {
if (std::getenv("ABADDON_NO_FC") == nullptr)
Platform::SetupFonts();
+
+ char *systemLocale = std::setlocale(LC_ALL, "");
+ try {
+ std::locale::global(std::locale(systemLocale));
+ } catch (...) {
+ try {
+ std::locale::global(std::locale::classic());
+ std::setlocale(LC_ALL, systemLocale);
+ } catch (...) {}
+ }
+
#if defined(_WIN32) && defined(_MSC_VER)
TCHAR buf[2] { 0 };
GetEnvironmentVariableA("GTK_CSD", buf, sizeof(buf));
diff --git a/discord/snowflake.cpp b/discord/snowflake.cpp
index cea9153..6909a15 100644
--- a/discord/snowflake.cpp
+++ b/discord/snowflake.cpp
@@ -2,6 +2,7 @@
#include <ctime>
#include <iomanip>
#include <chrono>
+#include <glibmm.h>
constexpr static uint64_t DiscordEpochSeconds = 1420070400;
@@ -42,14 +43,12 @@ bool Snowflake::IsValid() const {
return m_num != Invalid;
}
-std::string Snowflake::GetLocalTimestamp() const {
+Glib::ustring Snowflake::GetLocalTimestamp() const {
const time_t secs_since_epoch = (m_num / SecondsInterval) + DiscordEpochSeconds;
const std::tm tm = *localtime(&secs_since_epoch);
- std::stringstream ss;
- const static std::locale locale("");
- ss.imbue(locale);
- ss << std::put_time(&tm, "%X %x");
- return ss.str();
+ std::array<char, 256> tmp;
+ std::strftime(tmp.data(), sizeof(tmp), "%X %x", &tm);
+ return tmp.data();
}
void from_json(const nlohmann::json &j, Snowflake &s) {
diff --git a/discord/snowflake.hpp b/discord/snowflake.hpp
index 0b79723..1cabf3d 100644
--- a/discord/snowflake.hpp
+++ b/discord/snowflake.hpp
@@ -12,7 +12,7 @@ struct Snowflake {
static Snowflake FromNow(); // not thread safe
bool IsValid() const;
- std::string GetLocalTimestamp() const;
+ Glib::ustring GetLocalTimestamp() const;
bool operator==(const Snowflake &s) const noexcept {
return m_num == s.m_num;
diff --git a/platform.cpp b/platform.cpp
index ce744d7..dfbea3b 100644
--- a/platform.cpp
+++ b/platform.cpp
@@ -7,10 +7,10 @@
using namespace std::literals::string_literals;
-#if defined(_WIN32) && defined(_MSC_VER)
+#if defined(_WIN32)
#include <Windows.h>
#include <Shlwapi.h>
- #include <ShlObj_core.h>
+ #include <ShlObj.h>
#include <pango/pangocairo.h>
#include <pango/pangofc-fontmap.h>
#pragma comment(lib, "Shlwapi.lib")
diff --git a/thirdparty/IXWebSocket b/thirdparty/IXWebSocket
-Subproject 2fac4bd9ef58c3be3e370222410b8694a4ef0d2
+Subproject 97aa1f956a550ad366bf0d4d11b209a88535a31
diff --git a/util.cpp b/util.cpp
index 34ca6d4..1a7182d 100644
--- a/util.cpp
+++ b/util.cpp
@@ -1,5 +1,6 @@
#include "util.hpp"
#include <filesystem>
+#include <array>
Semaphore::Semaphore(int count)
: m_count(count) {}
@@ -93,11 +94,9 @@ std::string FormatISO8601(const std::string &in, int extra_offset, const std::st
int offset = GetTimezoneOffset();
tm.tm_sec += offset + extra_offset;
mktime(&tm);
- std::stringstream ss;
- const static std::locale locale("");
- ss.imbue(locale);
- ss << std::put_time(&tm, fmt.c_str());
- return ss.str();
+ std::array<char, 512> tmp;
+ std::strftime(tmp.data(), sizeof(tmp), fmt.c_str(), &tm);
+ return tmp.data();
}
void ScrollListBoxToSelected(Gtk::ListBox &list) {