Skip to content

Commit

Permalink
Merge branch '2.3' of [email protected]:mixxxdj/mixxx.git into main
Browse files Browse the repository at this point in the history
# Conflicts:
#	CMakeLists.txt
#	src/network/jsonwebtask.cpp
#	src/util/logging.cpp
  • Loading branch information
uklotzde committed Nov 28, 2020
2 parents aeb86a6 + 04f39ec commit f972563
Show file tree
Hide file tree
Showing 18 changed files with 150 additions and 50 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,21 @@ jobs:
security list-keychains -s Mixxx.keychain
# Prevent keychain access from timing out
security set-keychain-settings Mixxx.keychain
echo "CMAKE_ARGS_EXTRA=${CMAKE_ARGS_EXTRA} -DAPPLE_CODESIGN_IDENTITY=${APPLE_CODESIGN_IDENTITY}" >> "${GITHUB_ENV}"
CMAKE_ARGS="-DAPPLE_CODESIGN_IDENTITY=${APPLE_CODESIGN_IDENTITY}"
echo "::set-output name=cmake_args::${CMAKE_ARGS}"
- name: "[Windows] Set up Windows code signing"
env:
WINDOWS_CODESIGN_CERTIFICATE_PATH: ${{ github.workspace }}\build\certificates\windows_sectigo_codesign_certificate.pfx
WINDOWS_CODESIGN_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CODESIGN_CERTIFICATE_PASSWORD }}
WINDOWS_CODESIGN_SECURE_FILE_SALT: ${{ secrets.WINDOWS_CODESIGN_SECURE_FILE_SALT }}
WINDOWS_CODESIGN_SECURE_FILE_SECRET: ${{ secrets.WINDOWS_CODESIGN_SECURE_FILE_SECRET }}
if: runner.os == 'Windows' && env.WINDOWS_CODESIGN_SECURE_FILE_SALT != null && env.WINDOWS_CODESIGN_SECURE_FILE_SECRET != null
run: |
iex ((New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/appveyor/secure-file/master/install.ps1'))
appveyor-tools/secure-file -decrypt "$Env:WINDOWS_CODESIGN_CERTIFICATE_PATH.enc" -secret "$Env:WINDOWS_CODESIGN_SECURE_FILE_SECRET" -salt "$Env:WINDOWS_CODESIGN_SECURE_FILE_SALT"
Add-Content -Path "$Env:GITHUB_ENV" -Value "WINDOWS_CODESIGN_CERTIFICATE_PATH=$Env:WINDOWS_CODESIGN_CERTIFICATE_PATH"
Add-Content -Path "$Env:GITHUB_ENV" -Value "WINDOWS_CODESIGN_CERTIFICATE_PASSWORD=$Env:WINDOWS_CODESIGN_CERTIFICATE_PASSWORD"
Add-Content -Path "$Env:GITHUB_ENV" -Value "CMAKE_ARGS_EXTRA=-DWINDOWS_CODESIGN=ON"
- name: "Set up build environment"
id: buildenv
Expand Down Expand Up @@ -179,7 +191,7 @@ jobs:
-DCMAKE_BUILD_TYPE=Release
"-DCMAKE_PREFIX_PATH=${{ env.CMAKE_PREFIX_PATH }}"
-DDEBUG_ASSERTIONS_FATAL=ON
-DQt5_DIR=${{ env.QT_PATH }} ${{ matrix.cmake_args }} ${{ steps.apple_codesign.outputs.cmake_args }}
-DQt5_DIR=${{ env.QT_PATH }} ${{ matrix.cmake_args }} ${{ env.CMAKE_ARGS_EXTRA }}
-DBATTERY=ON
-DBROADCAST=ON
-DBULK=ON
Expand Down Expand Up @@ -243,6 +255,11 @@ jobs:
run: codesign --verbose=4 --options runtime --sign "${APPLE_CODESIGN_IDENTITY}" --entitlements ../build/osx/entitlements.plist *.dmg
working-directory: cmake_build

- name: "[Windows] Sign Package"
if: runner.os == 'Windows' && env.WINDOWS_CODESIGN_CERTIFICATE_PATH != null && env.WINDOWS_CODESIGN_CERTIFICATE_PASSWORD != null
run: signtool sign /f $Env:WINDOWS_CODESIGN_CERTIFICATE_PATH /p $Env:WINDOWS_CODESIGN_CERTIFICATE_PASSWORD *.msi
working-directory: cmake_build

- name: "[macOS] Upload build to downloads.mixxx.org"
# skip deploying Ubuntu builds to downloads.mixxx.org because these are deployed to the PPA
if: runner.os == 'macOS' && env.DOWNLOADS_HOSTGATOR_DOT_MIXXX_DOT_ORG_KEY_PASSWORD != null
Expand Down
91 changes: 79 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,17 @@ if(GNU_GCC OR LLVM_CLANG)
APPEND_STRING
PROPERTY COMPILE_OPTIONS -Wno-unused-parameter -Wno-switch
)
elseif(MSVC)
set_property(
SOURCE src/library/rekordbox/rekordbox_anlz.cpp
APPEND_STRING
PROPERTY COMPILE_OPTIONS /w
)
set_property(
SOURCE src/library/rekordbox/rekordbox_pdb.cpp
APPEND_STRING
PROPERTY COMPILE_OPTIONS /w
)
endif()

option(WARNINGS_PEDANTIC "Let the compiler show even more warnings" OFF)
Expand All @@ -958,6 +969,7 @@ if(MSVC)
target_compile_options(mixxx-lib PUBLIC /W4)
else()
target_compile_options(mixxx-lib PUBLIC /W3)
target_compile_definitions(mixxx-lib PUBLIC _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING _CRT_SECURE_NO_WARNINGS)
endif()
else()
target_compile_options(mixxx-lib PUBLIC -Wall -Wextra -Woverloaded-virtual -Wfloat-conversion)
Expand Down Expand Up @@ -1096,17 +1108,72 @@ if (APPLE)
)
endif()
else()
include(InstallRequiredSystemLibraries)
install(
FILES
${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
DESTINATION
"${MIXXX_INSTALL_BINDIR}"
COMPONENT
Libraries
include(InstallRequiredSystemLibraries)
install(
FILES
${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
DESTINATION
"${MIXXX_INSTALL_BINDIR}"
COMPONENT
Libraries
)
endif()

if(WIN32)
option(WINDOWS_CODESIGN "Sign Windows executables and libraries with digital certificate" OFF)
mark_as_advanced(WINDOWS_CODESIGN)
if(WINDOWS_CODESIGN)
set(WINDOWS_CODESIGN_CERTIFICATE_PATH "$ENV{WINDOWS_CODESIGN_CERTIFICATE_PATH}" CACHE STRING "Path to signtool certificate")
set(WINDOWS_CODESIGN_CERTIFICATE_PASSWORD "$ENV{WINDOWS_CODESIGN_CERTIFICATE_PASSWORD}" CACHE STRING "Password of signtool certificate")
if("${WINDOWS_CODESIGN_CERTIFICATE_PATH}" STREQUAL "" AND "${WINDOWS_CODESIGN_CERTIFICATE_PASSWORD}" STREQUAL "")
set(WINDOWS_CODESIGN_ARGS /a /t http://timestamp.verisign.com/scripts/timstamp.dll CACHE STRING "parameters for signtool (list)")
else()
set(WINDOWS_CODESIGN_ARGS /f ${WINDOWS_CODESIGN_CERTIFICATE_PATH} /p ${WINDOWS_CODESIGN_CERTIFICATE_PASSWORD} CACHE STRING "parameters for signtool (list)")
endif()
find_program(SIGNTOOL_EXECUTABLE signtool)
if(NOT SIGNTOOL_EXECUTABLE)
message(FATAL_ERROR "signtool is not found. Signing executables not possible")
endif()
message(STATUS "Found signtool: ${SIGNTOOL_EXECUTABLE}")

# Check if we're able to sign an executable
if(NOT DEFINED WINDOWS_CODESIGN_OK)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/testsign.c "int main(){return 0;}")
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/testsign)
try_compile(
RESULT ${CMAKE_CURRENT_BINARY_DIR}/testsign ${CMAKE_CURRENT_BINARY_DIR}/testsign.c
COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/testsign.exe
)
execute_process(
COMMAND ${SIGNTOOL_EXECUTABLE} sign ${WINDOWS_CODESIGN_ARGS} ${CMAKE_CURRENT_BINARY_DIR}/testsign.exe
RESULT_VARIABLE ERR OUTPUT_QUIET
)
if(ERR EQUAL 0)
message(STATUS "Windows codesigning via signtool is working")
set(WINDOWS_CODESIGN_OK 1 CACHE INTERNAL "Can sign executables")
else()
message(FATAL_ERROR "Could NOT codesign test sample (signtool failed)")
set(WINDOWS_CODESIGN_OK 0 CACHE INTERNAL "Invalid or missing certificate")
endif()
endif()
mark_as_advanced(SIGNTOOL_EXECUTABLE SIGNTOOL_ARGS)
endif()

macro(windows_codesign_target CODESIGN_TARGET)
add_custom_command(
TARGET "${CODESIGN_TARGET}" POST_BUILD
COMMAND ${SIGNTOOL_EXECUTABLE} sign ${WINDOWS_CODESIGN_ARGS} $<TARGET_FILE:${CODESIGN_TARGET}>
COMMENT "Signining target ${CODESIGN_TARGET}"
VERBATIM
)
endmacro()

if(WINDOWS_CODESIGN)
windows_codesign_target(mixxx)
endif()
endif()


install(
TARGETS
mixxx
Expand Down Expand Up @@ -1724,7 +1791,7 @@ target_link_libraries(mixxx-lib PUBLIC mixxx-proto)

# Rigtorp SPSC Queue
# https://github.com/rigtorp/SPSCQueue
target_include_directories(mixxx-lib PUBLIC lib/rigtorp/SPSCQueue/include)
target_include_directories(mixxx-lib SYSTEM PUBLIC lib/rigtorp/SPSCQueue/include)

# Qt
find_package(Qt5
Expand Down Expand Up @@ -2250,7 +2317,7 @@ if(BROADCAST)
# Fall back to internal libraray in the lib tree
message(STATUS "Using internal libshout")
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/lib/libshout")
target_include_directories(mixxx-lib PUBLIC lib/libshout/include)
target_include_directories(mixxx-lib SYSTEM PUBLIC lib/libshout/include)
target_link_libraries(mixxx-lib PUBLIC shout_mixxx)
else()
target_link_libraries(mixxx-lib PUBLIC Shout::Shout)
Expand Down Expand Up @@ -2379,7 +2446,7 @@ if(QTKEYCHAIN)
endif()
target_compile_definitions(mixxx-lib PUBLIC __QTKEYCHAIN__)
target_link_libraries(mixxx-lib PUBLIC ${QTKEYCHAIN_LIBRARIES})
target_include_directories(mixxx-lib PUBLIC ${QTKEYCHAIN_INCLUDE_DIRS})
target_include_directories(mixxx-lib SYSTEM PUBLIC ${QTKEYCHAIN_INCLUDE_DIRS})
endif()

# USB HID or/and Bulk controller support
Expand Down Expand Up @@ -2475,7 +2542,7 @@ if(VINYLCONTROL)
else()
target_sources(mixxx-xwax PRIVATE lib/xwax/timecoder.c lib/xwax/lut.c)
endif()
target_include_directories(mixxx-xwax PUBLIC lib/xwax)
target_include_directories(mixxx-xwax SYSTEM PUBLIC lib/xwax)
target_link_libraries(mixxx-lib PUBLIC mixxx-xwax)
endif()

Expand Down
4 changes: 2 additions & 2 deletions src/analyzer/plugins/analyzerqueenmarybeats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ bool AnalyzerQueenMaryBeats::processSamples(const CSAMPLE* pIn, const int iLen)
bool AnalyzerQueenMaryBeats::finalize() {
m_helper.finalize();

int nonZeroCount = m_detectionResults.size();
int nonZeroCount = static_cast<int>(m_detectionResults.size());
while (nonZeroCount > 0 && m_detectionResults.at(nonZeroCount - 1) <= 0.0) {
--nonZeroCount;
}
Expand All @@ -103,7 +103,7 @@ bool AnalyzerQueenMaryBeats::finalize() {
std::vector<double> beats;
tt.calculateBeats(df, beatPeriod, beats);

m_resultBeats.reserve(beats.size());
m_resultBeats.reserve(static_cast<int>(beats.size()));
for (size_t i = 0; i < beats.size(); ++i) {
double result = (beats.at(i) * m_stepSize) - m_stepSize / 2;
m_resultBeats.push_back(result);
Expand Down
6 changes: 3 additions & 3 deletions src/analyzer/trackanalysisscheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void TrackAnalysisScheduler::emitProgressOrFinished() {
DEBUG_ASSERT(m_pendingTrackIds.size() <=
static_cast<size_t>(m_dequeuedTracksCount));
const int finishedTracksCount =
m_dequeuedTracksCount - m_pendingTrackIds.size();
m_dequeuedTracksCount - static_cast<int>(m_pendingTrackIds.size());

AnalyzerProgress workerProgressSum = 0;
int workerProgressCount = 0;
Expand Down Expand Up @@ -164,7 +164,7 @@ void TrackAnalysisScheduler::emitProgressOrFinished() {
}
}
const int totalTracksCount =
m_dequeuedTracksCount + m_queuedTrackIds.size();
m_dequeuedTracksCount + static_cast<int>(m_queuedTrackIds.size());
DEBUG_ASSERT(m_currentTrackNumber <= m_dequeuedTracksCount);
DEBUG_ASSERT(m_dequeuedTracksCount <= totalTracksCount);
emit progress(
Expand Down Expand Up @@ -331,7 +331,7 @@ void TrackAnalysisScheduler::stop() {

QList<TrackId> TrackAnalysisScheduler::stopAndCollectScheduledTrackIds() {
QList<TrackId> scheduledTrackIds;
scheduledTrackIds.reserve(m_queuedTrackIds.size() + m_pendingTrackIds.size());
scheduledTrackIds.reserve(static_cast<int>(m_queuedTrackIds.size() + m_pendingTrackIds.size()));
for (auto queuedTrackId: m_queuedTrackIds) {
scheduledTrackIds.append(std::move(queuedTrackId));
}
Expand Down
3 changes: 2 additions & 1 deletion src/controllers/controllerdebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class ControllerDebug {
public:
// Any debug statement starting with this prefix bypasses the --logLevel
// command line flags.
static constexpr const char* kLogMessagePrefix = "CDBG";
static constexpr const char kLogMessagePrefix[] = "CDBG";
static constexpr int kLogMessagePrefixLength = sizeof(kLogMessagePrefix) - 1;

static bool enabled();

Expand Down
10 changes: 6 additions & 4 deletions src/encoder/encodermp3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,16 @@ void EncoderMp3::flush() {
// `lame_get_lametag_frame` returns the number of bytes copied into buffer,
// or the required buffer size, if the provided buffer is too small.
// Function failed, if the return value is larger than `m_bufferOutSize`!
size_t numBytes = lame_get_lametag_frame(m_lameFlags, m_bufferOut, m_bufferOutSize);
if (numBytes > static_cast<size_t>(m_bufferOutSize)) {
int numBytes = static_cast<int>(
lame_get_lametag_frame(m_lameFlags, m_bufferOut, m_bufferOutSize));
if (numBytes > m_bufferOutSize) {
bufferOutGrow(numBytes);
numBytes = lame_get_lametag_frame(m_lameFlags, m_bufferOut, m_bufferOutSize);
numBytes = static_cast<int>(lame_get_lametag_frame(
m_lameFlags, m_bufferOut, m_bufferOutSize));
}
// Write the lame/xing header.
m_pCallback->seek(0);
m_pCallback->write(nullptr, m_bufferOut, 0, static_cast<int>(numBytes));
m_pCallback->write(nullptr, m_bufferOut, 0, numBytes);
}

void EncoderMp3::encodeBuffer(const CSAMPLE *samples, const int size) {
Expand Down
3 changes: 2 additions & 1 deletion src/library/rekordbox/rekordboxfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ inline bool instanceof (const T* ptr) {
}

QString toUnicode(const std::string& toConvert) {
return QTextCodec::codecForName("UTF-16BE")->toUnicode(QByteArray(toConvert.c_str(), toConvert.length()));
return QTextCodec::codecForName("UTF-16BE")
->toUnicode(toConvert.data(), static_cast<int>(toConvert.length()));
}

// Functions getText and parseDeviceDB are roughly based on the following Java file:
Expand Down
8 changes: 6 additions & 2 deletions src/network/jsonwebtask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,12 @@ bool readJsonContent(
QNetworkRequest newRequest(
const QUrl& url) {
QNetworkRequest request(url);
request.setHeader(QNetworkRequest::ContentTypeHeader, JSON_CONTENT_TYPE);
request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
request.setHeader(
QNetworkRequest::ContentTypeHeader,
JSON_CONTENT_TYPE);
request.setAttribute(
QNetworkRequest::RedirectPolicyAttribute,
QNetworkRequest::NoLessSafeRedirectPolicy);
return request;
}

Expand Down
2 changes: 1 addition & 1 deletion src/track/beatgrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ QByteArray BeatGrid::toByteArray() const {
QMutexLocker locker(&m_mutex);
std::string output;
m_grid.SerializeToString(&output);
return QByteArray(output.data(), output.length());
return QByteArray(output.data(), static_cast<int>(output.length()));
}

BeatsPointer BeatGrid::clone() const {
Expand Down
2 changes: 1 addition & 1 deletion src/track/beatmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ QByteArray BeatMap::toByteArray() const {

std::string output;
map.SerializeToString(&output);
return QByteArray(output.data(), output.length());
return QByteArray(output.data(), static_cast<int>(output.length()));
}

BeatsPointer BeatMap::clone() const {
Expand Down
2 changes: 1 addition & 1 deletion src/track/keys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Keys::Keys(const KeyMap& keyMap)
QByteArray Keys::toByteArray() const {
std::string output;
m_keyMap.SerializeToString(&output);
return QByteArray(output.data(), output.length());
return QByteArray(output.data(), static_cast<int>(output.length()));
}

const QString& Keys::getSubVersion() const {
Expand Down
2 changes: 1 addition & 1 deletion src/util/logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ inline void writeToStdErr(
.toLocal8Bit();

QMutexLocker locked(&s_mutexStdErr);
const size_t written = fwrite(
const std::size_t written = fwrite(
formattedMessage.constData(), sizeof(char), formattedMessage.size(), stderr);
Q_UNUSED(written);
DEBUG_ASSERT(written == static_cast<size_t>(formattedMessage.size()));
Expand Down
15 changes: 8 additions & 7 deletions src/util/movinginterquartilemean.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,15 @@ double MovingInterquartileMean::mean() {
}

m_bChanged = false;
if (m_list.size() <= 4) {
const int listSize = size();
if (listSize <= 4) {
double d_sum = 0;
foreach (double d, m_list) {
d_sum += d;
}
m_dMean = d_sum / m_list.size();
} else if (m_list.size() % 4 == 0) {
int quartileSize = m_list.size() / 4;
m_dMean = d_sum / listSize;
} else if (listSize % 4 == 0) {
int quartileSize = listSize / 4;
double interQuartileRange = 2 * quartileSize;
double d_sum = 0;
std::list<double>::iterator it = m_list.begin();
Expand All @@ -68,9 +69,9 @@ double MovingInterquartileMean::mean() {
m_dMean = d_sum / interQuartileRange;
} else {
// http://en.wikipedia.org/wiki/Interquartile_mean#Dataset_not_divisible_by_four
double quartileSize = m_list.size() / 4.0;
double quartileSize = listSize / 4.0;
double interQuartileRange = 2 * quartileSize;
int nFullValues = m_list.size() - 2*static_cast<int>(quartileSize) - 2;
int nFullValues = listSize - 2 * static_cast<int>(quartileSize) - 2;
double quartileWeight = (interQuartileRange - nFullValues) / 2;
std::list<double>::iterator it = m_list.begin();
std::advance(it, static_cast<int>(quartileSize));
Expand All @@ -86,7 +87,7 @@ double MovingInterquartileMean::mean() {
}

int MovingInterquartileMean::size() const {
return m_list.size();
return static_cast<int>(m_list.size());
}

int MovingInterquartileMean::listMaxSize() const {
Expand Down
2 changes: 1 addition & 1 deletion src/waveform/waveform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ QByteArray Waveform::toByteArray() const {

std::string output;
waveform.SerializeToString(&output);
return QByteArray(output.data(), output.length());
return QByteArray(output.data(), static_cast<int>(output.length()));
}

void Waveform::readByteArray(const QByteArray& data) {
Expand Down
Loading

0 comments on commit f972563

Please sign in to comment.