Skip to content

Commit

Permalink
Update to latest DPF
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <[email protected]>
  • Loading branch information
falkTX committed Oct 6, 2024
1 parent f42469d commit 1e51ad1
Show file tree
Hide file tree
Showing 19 changed files with 1,163 additions and 315 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: build

on:
push:
branches:
- '*'
pull_request:
branches:
- '*'

jobs:
linux:
Expand All @@ -10,7 +15,7 @@ jobs:
target: [linux-arm64, linux-armhf, linux-i686, linux-riscv64, linux-x86_64]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: distrho/dpf-makefile-action@v1
Expand All @@ -23,7 +28,7 @@ jobs:
target: [macos-intel, macos-universal]
runs-on: macos-11
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: distrho/dpf-makefile-action@v1
Expand All @@ -36,7 +41,7 @@ jobs:
target: [win32, win64]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: distrho/dpf-makefile-action@v1
Expand All @@ -47,7 +52,7 @@ jobs:
pluginval:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: distrho/dpf-makefile-action@v1
Expand Down
3 changes: 2 additions & 1 deletion dpf/dgl/src/pugl-upstream/.clang-tidy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020-2022 David Robillard <[email protected]>
# Copyright 2020-2024 David Robillard <[email protected]>
# SPDX-License-Identifier: 0BSD OR ISC

Checks: >
Expand All @@ -11,6 +11,7 @@ Checks: >
-clang-diagnostic-unused-macros,
-llvmlibc-*,
-misc-include-cleaner,
-readability-avoid-nested-conditional-operator,
-readability-identifier-length,
CheckOptions:
- key: hicpp-uppercase-literal-suffix.NewSuffixes
Expand Down
4 changes: 3 additions & 1 deletion dpf/dgl/src/pugl-upstream/src/.clang-tidy
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Copyright 2020-2022 David Robillard <[email protected]>
# Copyright 2020-2024 David Robillard <[email protected]>
# SPDX-License-Identifier: 0BSD OR ISC

Checks: >
-bugprone-easily-swappable-parameters,
-bugprone-multi-level-implicit-pointer-conversion,
-clang-analyzer-optin.core.EnumCastOutOfRange,
-hicpp-multiway-paths-covered,
-hicpp-signed-bitwise,
-llvm-header-guard,
Expand Down
10 changes: 5 additions & 5 deletions dpf/dgl/src/pugl-upstream/src/mac.m
Original file line number Diff line number Diff line change
Expand Up @@ -633,11 +633,11 @@ - (void)scrollWheel:(NSEvent*)event
const NSPoint wloc = [self eventLocation:event];
const NSPoint rloc = [NSEvent mouseLocation];

double dx = -[event scrollingDeltaX];
double dy = [event scrollingDeltaY];
if (![event hasPreciseScrollingDeltas]) {
dx *= 10.0;
dy *= 10.0;
double dx = -[event scrollingDeltaX] / 2.0;
double dy = [event scrollingDeltaY] / 2.0;
if ([event hasPreciseScrollingDeltas]) {
dx /= 10.0;
dy /= 10.0;
}

const PuglScrollDirection dir =
Expand Down
4 changes: 4 additions & 0 deletions dpf/distrho/DistrhoUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@

#include "src/DistrhoDefines.h"

#ifndef __STDC_LIMIT_MACROS
# define __STDC_LIMIT_MACROS
#endif

#include <cstdarg>
#include <cstdio>
#include <cstdlib>
Expand Down
80 changes: 74 additions & 6 deletions dpf/distrho/extra/Base64.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2016 Filipe Coelho <[email protected]>
* Copyright (C) 2012-2024 Filipe Coelho <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
Expand All @@ -19,7 +19,6 @@

#include "../DistrhoUtils.hpp"

#include <cctype>
#include <vector>

// -----------------------------------------------------------------------
Expand Down Expand Up @@ -55,15 +54,15 @@
#ifndef DOXYGEN
namespace DistrhoBase64Helpers {

static const char* const kBase64Chars =
static constexpr const char* const kBase64Chars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789+/";

static inline
uint8_t findBase64CharIndex(const char c)
{
static const uint8_t kBase64CharsLen(static_cast<uint8_t>(std::strlen(kBase64Chars)));
static const uint8_t kBase64CharsLen = static_cast<uint8_t>(std::strlen(kBase64Chars));

for (uint8_t i=0; i<kBase64CharsLen; ++i)
{
Expand All @@ -75,10 +74,79 @@ uint8_t findBase64CharIndex(const char c)
return 0;
}

static inline
static constexpr inline
bool isBase64Char(const char c)
{
return (std::isalnum(c) || (c == '+') || (c == '/'));
switch (c)
{
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
case 'H':
case 'I':
case 'J':
case 'K':
case 'L':
case 'M':
case 'N':
case 'O':
case 'P':
case 'Q':
case 'R':
case 'S':
case 'T':
case 'U':
case 'V':
case 'W':
case 'X':
case 'Y':
case 'Z':
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
case 'g':
case 'h':
case 'i':
case 'j':
case 'k':
case 'l':
case 'm':
case 'n':
case 'o':
case 'p':
case 'q':
case 'r':
case 's':
case 't':
case 'u':
case 'v':
case 'w':
case 'x':
case 'y':
case 'z':
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case '+':
case '/':
return true;
default:
return false;
}
}

} // namespace DistrhoBase64Helpers
Expand Down
30 changes: 24 additions & 6 deletions dpf/distrho/extra/ChildProcess.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
// SPDX-FileCopyrightText: 2023-2024 MOD Audio UG
// SPDX-License-Identifier: AGPL-3.0-or-later
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2024 Filipe Coelho <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
* permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
* TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

#pragma once

Expand All @@ -24,13 +37,18 @@ START_NAMESPACE_DISTRHO
class ChildProcess
{
#ifdef _WIN32
PROCESS_INFORMATION pinfo = { INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, 0, 0 };
PROCESS_INFORMATION pinfo;
#else
pid_t pid = -1;
pid_t pid;
#endif

public:
ChildProcess()
#ifdef _WIN32
: pinfo(CPP_AGGREGATE_INIT(PROCESS_INFORMATION){ INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, 0, 0 })
#else
: pid(-1)
#endif
{
}

Expand Down Expand Up @@ -120,7 +138,7 @@ class ChildProcess
return;

const PROCESS_INFORMATION opinfo = pinfo;
pinfo = { INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, 0, 0 };
pinfo = (PROCESS_INFORMATION){ INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, 0, 0 };

for (DWORD exitCode;;)
{
Expand Down Expand Up @@ -226,7 +244,7 @@ class ChildProcess
WaitForSingleObject(pinfo.hProcess, 0) != WAIT_TIMEOUT)
{
const PROCESS_INFORMATION opinfo = pinfo;
pinfo = { INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, 0, 0 };
pinfo = (PROCESS_INFORMATION){ INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, 0, 0 };
CloseHandle(opinfo.hThread);
CloseHandle(opinfo.hProcess);
return false;
Expand Down
6 changes: 3 additions & 3 deletions dpf/distrho/extra/ExternalWindow.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2021 Filipe Coelho <[email protected]>
* Copyright (C) 2012-2024 Filipe Coelho <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
Expand Down Expand Up @@ -78,13 +78,13 @@ class ExternalWindow
Constructor.
*/
explicit ExternalWindow()
: pData() {}
: pData() {}

/**
Constructor for DPF internal use.
*/
explicit ExternalWindow(const PrivateData& data)
: pData(data) {}
: pData(data) {}

/**
Destructor.
Expand Down
10 changes: 6 additions & 4 deletions dpf/distrho/extra/FileBrowserDialogImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -691,17 +691,17 @@ bool fileBrowserIdle(const FileBrowserHandle handle)
while (dbus_connection_dispatch(dbuscon) == DBUS_DISPATCH_DATA_REMAINS) {}
dbus_connection_read_write_dispatch(dbuscon, 0);

if (DBusMessage* const message = dbus_connection_pop_message(dbuscon))
if (DBusMessage* const msg = dbus_connection_pop_message(dbuscon))
{
const char* const interface = dbus_message_get_interface(message);
const char* const member = dbus_message_get_member(message);
const char* const interface = dbus_message_get_interface(msg);
const char* const member = dbus_message_get_member(msg);

if (interface != nullptr && std::strcmp(interface, "org.freedesktop.portal.Request") == 0
&& member != nullptr && std::strcmp(member, "Response") == 0)
{
do {
DBusMessageIter iter;
dbus_message_iter_init(message, &iter);
dbus_message_iter_init(msg, &iter);

// starts with uint32 for return/exit code
DISTRHO_SAFE_ASSERT_BREAK(dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_UINT32);
Expand Down Expand Up @@ -813,6 +813,8 @@ bool fileBrowserIdle(const FileBrowserHandle handle)
if (handle->selectedFile == nullptr)
handle->selectedFile = kSelectedFileCancelled;
}

dbus_message_unref(msg);
}
}
#endif
Expand Down
22 changes: 3 additions & 19 deletions dpf/distrho/extra/RingBuffer.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2021 Filipe Coelho <[email protected]>
* Copyright (C) 2012-2024 Filipe Coelho <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
Expand Down Expand Up @@ -119,14 +119,6 @@ struct HugeStackBuffer {
uint8_t buf[size];
};

#ifdef DISTRHO_PROPER_CPP11_SUPPORT
# define HeapBuffer_INIT {0, 0, 0, 0, false, nullptr}
# define StackBuffer_INIT {0, 0, 0, false, {0}}
#else
# define HeapBuffer_INIT
# define StackBuffer_INIT
#endif

// -----------------------------------------------------------------------
// RingBufferControl templated class

Expand Down Expand Up @@ -799,12 +791,7 @@ class HeapRingBuffer : public RingBufferControl<HeapBuffer>
public:
/** Constructor. */
HeapRingBuffer() noexcept
: heapBuffer(HeapBuffer_INIT)
{
#ifndef DISTRHO_PROPER_CPP11_SUPPORT
std::memset(&heapBuffer, 0, sizeof(heapBuffer));
#endif
}
: heapBuffer(CPP_AGGREGATE_INIT(HeapBuffer){0, 0, 0, 0, false, nullptr}) {}

/** Destructor. */
~HeapRingBuffer() noexcept override
Expand Down Expand Up @@ -874,11 +861,8 @@ class SmallStackRingBuffer : public RingBufferControl<SmallStackBuffer>
public:
/** Constructor. */
SmallStackRingBuffer() noexcept
: stackBuffer(StackBuffer_INIT)
: stackBuffer(CPP_AGGREGATE_INIT(SmallStackBuffer){0, 0, 0, false, {0}})
{
#ifndef DISTRHO_PROPER_CPP11_SUPPORT
std::memset(&stackBuffer, 0, sizeof(stackBuffer));
#endif
setRingBuffer(&stackBuffer, true);
}

Expand Down
Loading

0 comments on commit 1e51ad1

Please sign in to comment.