Skip to content

Commit 85c20ce

Browse files
committed
Build - compile on Windows and i686 again, and read the sources as UTF-8 under Debian's C locale
1 parent a427770 commit 85c20ce

3 files changed

Lines changed: 15 additions & 8 deletions

File tree

‎app/api/include/api/audio/node_tree_order.hpp‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#ifndef SONIC_PI_NODE_TREE_ORDER_HPP
1515
#define SONIC_PI_NODE_TREE_ORDER_HPP
1616

17+
#include <cstddef>
1718
#include <cstdint>
1819
#include <unordered_map>
1920
#include <unordered_set>
@@ -63,9 +64,9 @@ inline OrderedTree order_children(const std::vector<OrderNode>& nodes)
6364
{
6465
OrderedTree out;
6566

66-
std::unordered_map<int32_t, size_t> index; // id -> position in `nodes`
67+
std::unordered_map<int32_t, std::size_t> index; // id -> position in `nodes`
6768
index.reserve(nodes.size() * 2);
68-
for (size_t i = 0; i < nodes.size(); ++i)
69+
for (std::size_t i = 0; i < nodes.size(); ++i)
6970
index[nodes[i].id] = i;
7071

7172
std::unordered_set<int32_t> placed;
@@ -77,7 +78,7 @@ inline OrderedTree order_children(const std::vector<OrderNode>& nodes)
7778
if (!n.is_group)
7879
continue;
7980
int32_t childId = n.head;
80-
for (size_t guard = 0;
81+
for (std::size_t guard = 0;
8182
childId >= 0 && index.count(childId) && guard <= nodes.size();
8283
++guard)
8384
{

‎app/gui/platform/recorder_audio_mix.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ constexpr uint32_t kRecordedChannelsMax = 2;
3030

3131
inline uint32_t recordedChannels(uint32_t tapChannels)
3232
{
33-
return std::min(tapChannels, kRecordedChannelsMax);
33+
return (std::min)(tapChannels, kRecordedChannelsMax); // parenthesised: windows.h's min macro
3434
}
3535

3636
// Copies the recorded channels of `frames` interleaved tap frames into `out`

‎app/server/ruby/test/test_engine_forwards.rb‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,18 @@ class EngineForwardsTester < Minitest::Test
2525
OSC_HANDLER = File.join(ROOT, "app/api/src/osc/osc_handler.cpp")
2626
SPIDER = File.join(ROOT, "app/server/ruby/bin/spider-server.rb")
2727

28+
# The sources are UTF-8 whatever the locale says: Debian's build runs
29+
# under C, where a plain read stops at the first non-ASCII byte.
30+
def source(path)
31+
File.read(path, encoding: "UTF-8")
32+
end
33+
2834
def gui_handled
29-
File.read(OSC_HANDLER).scan(%r{match\("(/clockwork/[^"]+)"\)}).flatten.uniq
35+
source(OSC_HANDLER).scan(%r{match\("(/clockwork/[^"]+)"\)}).flatten.uniq
3036
end
3137

3238
def sent_to_gui_by_spider
33-
File.read(SPIDER).scan(%r{gui\.send\("(/clockwork/[^"]+)"}).flatten.uniq
39+
source(SPIDER).scan(%r{gui\.send\("(/clockwork/[^"]+)"}).flatten.uniq
3440
end
3541

3642
def test_the_gui_handlers_are_found
@@ -67,7 +73,7 @@ def test_the_gui_never_asks_the_engine_directly_what_the_daemon_relays
6773
sources = Dir[File.join(ROOT, "app/gui/**/*.{cpp,h}")] +
6874
Dir[File.join(ROOT, "app/api/src/**/*.{cpp,h}")]
6975
direct = GUI_TO_ENGINE_REQUESTS.values.flat_map do |request|
70-
sources.select { |f| File.read(f).include?("\"#{request}\"") }
76+
sources.select { |f| source(f).include?("\"#{request}\"") }
7177
.map { |f| "#{request} in #{f.delete_prefix(ROOT + '/')}" }
7278
end
7379
assert_empty direct, "answers to these are discarded: ask through the daemon"
@@ -85,7 +91,7 @@ def test_the_gui_hears_every_setup
8591
end
8692

8793
def test_the_daemon_forwards_every_setup_unfiltered
88-
daemon = File.read(File.join(__dir__, "../bin/daemon.rb"))
94+
daemon = source(File.join(__dir__, "../bin/daemon.rb"))
8995
refute_match(/SetupGenerations|rebuild\?/, daemon)
9096
end
9197
end

0 commit comments

Comments
 (0)