~alextee/zrythm-devel

fix some errors with strict build on windows v1 APPLIED

Alexandros Theodotou: 1
 fix some errors with strict build on windows

 13 files changed, 60 insertions(+), 135 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~alextee/zrythm-devel/patches/30840/mbox | git am -3
Learn more about email & git

[PATCH] fix some errors with strict build on windows Export this patch

---
 ext/zix/zix/sem.h          |  2 +-
 inc/audio/channel_send.h   |  2 +-
 inc/audio/position.h       | 20 ++------------------
 inc/audio/transport.h      | 26 +++++---------------------
 inc/utils/debug.h          | 10 ++++++----
 inc/utils/types.h          | 20 ++------------------
 src/audio/audio_function.c | 23 +++++++++++++----------
 src/audio/audio_region.c   | 19 +++++++++++--------
 src/audio/channel_send.c   |  7 +++----
 src/audio/encoder.c        |  3 ++-
 src/audio/graph_node.c     | 22 +---------------------
 src/audio/metronome.c      | 15 ++++++++-------
 src/audio/transport.c      | 26 +++++---------------------
 13 files changed, 60 insertions(+), 135 deletions(-)

diff --git a/ext/zix/zix/sem.h b/ext/zix/zix/sem.h
index d42fd0840..1e98dd904 100644
--- a/ext/zix/zix/sem.h
+++ b/ext/zix/zix/sem.h
@@ -152,7 +152,7 @@ struct ZixSemImpl {
static inline ZixStatus
zix_sem_init(ZixSem* sem, unsigned initial)
{
  sem->sem = CreateSemaphore(NULL, initial, LONG_MAX, NULL);
  sem->sem = CreateSemaphore(NULL, (LONG) initial, LONG_MAX, NULL);
  return (sem->sem) ? ZIX_STATUS_SUCCESS : ZIX_STATUS_ERROR;
}

diff --git a/inc/audio/channel_send.h b/inc/audio/channel_send.h
index 119e43244..a1fbf9c88 100644
--- a/inc/audio/channel_send.h
+++ b/inc/audio/channel_send.h
@@ -342,7 +342,7 @@ channel_send_prepare_process (ChannelSend * self);
void
channel_send_process (
  ChannelSend *   self,
  const long      local_offset,
  const nframes_t local_offset,
  const nframes_t nframes);

/**
diff --git a/inc/audio/position.h b/inc/audio/position.h
index 944882f9c..231da7dc7 100644
--- a/inc/audio/position.h
+++ b/inc/audio/position.h
@@ -1,21 +1,5 @@
/*
 * Copyright (C) 2018-2021 Alexandros Theodotou <alex at zrythm dot org>
 *
 * This file is part of Zrythm
 *
 * Zrythm is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Zrythm is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Zrythm.  If not, see <https://www.gnu.org/licenses/>.
 */
// SPDX-FileCopyrightText: © 2018-2021 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense

/**
 * \file
diff --git a/inc/audio/transport.h b/inc/audio/transport.h
index e40ec76b2..9e78293e5 100644
--- a/inc/audio/transport.h
+++ b/inc/audio/transport.h
@@ -1,21 +1,5 @@
/*
 * Copyright (C) 2018-2022 Alexandros Theodotou <alex at zrythm dot org>
 *
 * This file is part of Zrythm
 *
 * Zrythm is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Zrythm is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Zrythm.  If not, see <https://www.gnu.org/licenses/>.
 */
// SPDX-FileCopyrightText: © 2018-2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense

/**
 * \file
@@ -646,9 +630,9 @@ transport_frames_add_frames (
 */
void
transport_position_add_frames (
  const Transport * self,
  Position *        pos,
  const long        frames);
  const Transport *    self,
  Position *           pos,
  const signed_frame_t frames);

/**
 * Returns the PPQN (Parts/Ticks Per Quarter Note).
diff --git a/inc/utils/debug.h b/inc/utils/debug.h
index 911fc457d..6a143478e 100644
--- a/inc/utils/debug.h
+++ b/inc/utils/debug.h
@@ -31,8 +31,9 @@
  if (!(G_LIKELY (a comparator b))) \
    { \
      g_critical ( \
        "Assertion failed: %s (%ld) %s %s (%ld)", \
        #a, (long) a, #comparator, #b, (long) b); \
        "Assertion failed: %s (%" G_GINT64_FORMAT ") " \
        "%s %s (%" G_GINT64_FORMAT ")", \
        #a, (gint64) a, #comparator, #b, (gint64) b); \
      return val; \
    }

@@ -43,8 +44,9 @@
  if (!(G_LIKELY (a comparator b))) \
    { \
      g_warning ( \
        "Assertion failed: %s (%ld) %s %s (%ld)", \
        #a, (long) a, #comparator, #b, (long) b); \
        "Assertion failed: %s (%" G_GINT64_FORMAT ") " \
        "%s %s (%" G_GINT64_FORMAT ")", \
        #a, (gint64) a, #comparator, #b, (gint64) b); \
    }

/**
diff --git a/inc/utils/types.h b/inc/utils/types.h
index 2373cd45b..5c57383ce 100644
--- a/inc/utils/types.h
+++ b/inc/utils/types.h
@@ -1,21 +1,5 @@
/*
 * Copyright (C) 2019-2020 Alexandros Theodotou <alex at zrythm dot org>
 *
 * This file is part of Zrythm
 *
 * Zrythm is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Zrythm is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Zrythm.  If not, see <https://www.gnu.org/licenses/>.
 */
// SPDX-FileCopyrightText: © 2019-2020 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense

/**
 * \file
diff --git a/src/audio/audio_function.c b/src/audio/audio_function.c
index 2db1eaa26..4a49808e4 100644
--- a/src/audio/audio_function.c
+++ b/src/audio/audio_function.c
@@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: © 2020-2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense

#include <inttypes.h>

#include "audio/audio_function.h"
#include "audio/audio_region.h"
#include "audio/engine.h"
@@ -252,8 +254,8 @@ apply_plugin (
      lilv_instance_run (pl->lv2->instance, step);
      for (size_t j = 0; j < step; j++)
        {
          long actual_j =
            (long) (i + j) - (long) latency;
          signed_frame_t actual_j =
            (signed_frame_t) (i + j) - (signed_frame_t) latency;
          if (actual_j < 0)
            continue;
#if 0
@@ -264,9 +266,9 @@ apply_plugin (
#endif
          g_return_val_if_fail (l_out, -1);
          g_return_val_if_fail (r_out, -1);
          frames[actual_j * channels] =
          frames[actual_j * (signed_frame_t) channels] =
            l_out->buf[j];
          frames[actual_j * channels + 1] =
          frames[actual_j * (signed_frame_t) channels + 1] =
            r_out->buf[j];
        }
      if (i > latency)
@@ -294,9 +296,9 @@ apply_plugin (
      lilv_instance_run (pl->lv2->instance, step);
      for (size_t j = 0; j < step; j++)
        {
          long actual_j =
            (long) (i + j + num_frames)
            - (long) latency;
          signed_frame_t actual_j =
            (signed_frame_t) (i + j + num_frames)
            - (signed_frame_t) latency;
          g_return_val_if_fail (actual_j >= 0, -1);
#if 0
          g_message (
@@ -306,9 +308,9 @@ apply_plugin (
#endif
          g_return_val_if_fail (l_out, -1);
          g_return_val_if_fail (r_out, -1);
          frames[actual_j * channels] =
          frames[actual_j * (signed_frame_t) channels] =
            l_out->buf[j];
          frames[actual_j * channels + 1] =
          frames[actual_j * (signed_frame_t) channels + 1] =
            r_out->buf[j];
        }
      i += step;
@@ -410,7 +412,8 @@ audio_function_apply (
  unsigned_frame_t num_frames_excl_nudge;

  g_debug (
    "num frames %lu, nudge_frames %lu", num_frames,
    "num frames %" PRIu64 ", "
    "nudge_frames %" PRIu64, num_frames,
    nudge_frames);
  z_return_val_if_fail_cmp (nudge_frames, >, 0, -1);

diff --git a/src/audio/audio_region.c b/src/audio/audio_region.c
index cc4c7a931..b0e318426 100644
--- a/src/audio/audio_region.c
+++ b/src/audio/audio_region.c
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: © 2018-2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
/*
 * Copyright (C) 2018-2022 Alexandros Theodotou <alex at zrythm dot org>
 */

#include <inttypes.h>

#include "audio/audio_region.h"
#include "audio/channel.h"
@@ -256,9 +256,10 @@ timestretch_buf (
  unsigned_frame_t in_frames_to_process =
    (unsigned_frame_t) (frames_to_process * timestretch_ratio);
  g_message (
    "%s: in frame offset %ld, out frame offset %lu, "
    "in frames to process %lu, "
    "out frames to process %ld",
    "%s: in frame offset %" PRIu64 ", "
    "out frame offset %" PRIu64 ", "
    "in frames to process %" PRIu64 ", "
    "out frames to process %" PRIu64,
    __func__, in_frame_offset, out_frame_offset,
    in_frames_to_process, frames_to_process);
  g_return_if_fail (
@@ -401,8 +402,10 @@ audio_region_fill_stereo_ports (
        || j > AUDIO_ENGINE->block_length)
        {
          g_critical (
            "invalid r_local_pos %ld, j %lu, "
            "g_start_frames %lu, nframes %u",
            "invalid r_local_pos %" PRId64
            ", j %" PRIu64 ", "
            "g_start_frames %" PRIu64
            ", nframes %u",
            r_local_pos, j, time_nfo->g_start_frame,
            time_nfo->nframes);
          return;
diff --git a/src/audio/channel_send.c b/src/audio/channel_send.c
index 007475b08..ecbba1e05 100644
--- a/src/audio/channel_send.c
+++ b/src/audio/channel_send.c
@@ -1,7 +1,5 @@
// SPDX-FileCopyrightText: © 2020-2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
/*
 * Copyright (C) 2020-2022 Alexandros Theodotou <alex at zrythm dot org>
 */

#include "audio/channel_send.h"
#include "audio/control_port.h"
@@ -195,13 +193,14 @@ channel_send_prepare_process (ChannelSend * self)
void
channel_send_process (
  ChannelSend *   self,
  const long      local_offset,
  const nframes_t local_offset,
  const nframes_t nframes)
{
  if (channel_send_is_empty (self))
    return;

  Track * track = channel_send_get_track (self);
  g_return_if_fail (track);
  if (track->out_signal_type == TYPE_AUDIO)
    {
      if (math_floats_equal_epsilon (
diff --git a/src/audio/encoder.c b/src/audio/encoder.c
index 4df34a96a..527ad1964 100644
--- a/src/audio/encoder.c
+++ b/src/audio/encoder.c
@@ -5,6 +5,7 @@

#include "zrythm-config.h"

#include <inttypes.h>
#include <math.h>
#include <stdlib.h>

@@ -87,7 +88,7 @@ audio_encoder_decode (
  self->num_out_frames =
    (unsigned_frame_t) num_out_frames;
  g_message (
    "num out frames %lu", self->num_out_frames);
    "num out frames %" PRIu64, self->num_out_frames);
  self->channels = self->nfo.channels;
  audec_close (self->audec_handle);
  g_message ("--audio decoding end--");
diff --git a/src/audio/graph_node.c b/src/audio/graph_node.c
index eea2e8cd9..3ae86ec82 100644
--- a/src/audio/graph_node.c
+++ b/src/audio/graph_node.c
@@ -1,25 +1,5 @@
// SPDX-FileCopyrightText: © 2019-2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
/*
 * Copyright (C) 2019-2022 Alexandros Theodotou <alex at zrythm dot org>
 *
 * This file incorporates work covered by the following copyright and
 * permission notice:
 *
 * Copyright (C) 2017, 2019 Robin Gareus <robin@gareus.org>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

#include <inttypes.h>
#include <stdlib.h>
diff --git a/src/audio/metronome.c b/src/audio/metronome.c
index 06e37e7cd..6dfb24eb1 100644
--- a/src/audio/metronome.c
+++ b/src/audio/metronome.c
@@ -5,6 +5,7 @@

#include "zrythm-config.h"

#include <inttypes.h>
#include <stdlib.h>

#include "audio/encoder.h"
@@ -177,7 +178,7 @@ find_and_queue_metronome (
        &bar_pos, num_bars_before + i + 1);

      /* offset of bar pos from start pos */
      long bar_offset_long =
      signed_frame_t bar_offset_long =
        bar_pos.frames - start_pos->frames;
      if (bar_offset_long < 0)
        {
@@ -186,14 +187,14 @@ find_and_queue_metronome (
          g_message ("start pos:");
          position_print (start_pos);
          g_critical (
            "bar offset long (%ld) is < 0",
            "bar offset long (%" PRId64 ") is < 0",
            bar_offset_long);
          return;
        }

      /* add local offset */
      long metronome_offset_long =
        bar_offset_long + loffset;
      signed_frame_t metronome_offset_long =
        bar_offset_long + (signed_frame_t) loffset;
      z_return_if_fail_cmp (
        metronome_offset_long, >=, 0);
      nframes_t metronome_offset =
@@ -235,13 +236,13 @@ find_and_queue_metronome (
            }

          /* offset of beat pos from start pos */
          long beat_offset_long =
          signed_frame_t beat_offset_long =
            beat_pos.frames - start_pos->frames;
          g_return_if_fail (beat_offset_long >= 0);

          /* add local offset */
          long metronome_offset_long =
            beat_offset_long + loffset;
          signed_frame_t metronome_offset_long =
            beat_offset_long + (signed_frame_t) loffset;
          g_return_if_fail (
            metronome_offset_long >= 0);

diff --git a/src/audio/transport.c b/src/audio/transport.c
index f90b8cb53..b0cd22248 100644
--- a/src/audio/transport.c
+++ b/src/audio/transport.c
@@ -1,21 +1,5 @@
/*
 * Copyright (C) 2018-2022 Alexandros Theodotou <alex at zrythm dot org>
 *
 * This file is part of Zrythm
 *
 * Zrythm is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Zrythm is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Zrythm.  If not, see <https://www.gnu.org/licenses/>.
 */
// SPDX-FileCopyrightText: © 2018-2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense

#include "zrythm-config.h"

@@ -990,9 +974,9 @@ transport_frames_add_frames (
 */
void
transport_position_add_frames (
  const Transport * self,
  Position *        pos,
  const long        frames)
  const Transport *    self,
  Position *           pos,
  const signed_frame_t frames)
{
  Position pos_before_adding = *pos;
  position_add_frames (pos, frames);
-- 
2.35.1