fix for latest zig

This commit is contained in:
Luna 2020-08-18 17:49:23 -03:00
parent 8aa65958d0
commit 353d8d6947
6 changed files with 17 additions and 21 deletions

View File

@ -97,7 +97,7 @@ pub fn temporaryName(allocator: *std.mem.Allocator) ![]u8 {
var tmp_file: std.fs.File = std.fs.cwd().openFile(
nam,
.{ .read = true, .write = false },
) catch |err| blk: {
) catch |err| {
if (err == error.FileNotFound) return nam else continue;
};
@ -321,7 +321,7 @@ pub const Image = struct {
defer self.allocator.free(sym_cstr);
var sym = c.lilv_new_string(ctx.world, sym_cstr.ptr);
const port = c.lilv_plugin_get_port_by_symbol(ctx.plugin, sym) orelse blk: {
const port = c.lilv_plugin_get_port_by_symbol(ctx.plugin, sym) orelse {
std.debug.warn("assert fail: symbol {} not found on port\n", .{param.sym});
return ImageError.InvalidSymbol;
};

View File

@ -135,8 +135,6 @@ pub const Command = struct {
.embed => Embed,
.rotate => Rotate,
else => @panic("TODO"),
};
}

View File

@ -81,20 +81,20 @@ pub fn setupPorts(ctx: *plugin.Context) ![]Port {
defer ctx.allocator.free(values);
c.lilv_plugin_get_port_ranges_float(ctx.plugin, null, null, values.ptr);
var lv2_InputPort = c.lilv_new_uri(world, LV2_CORE__InputPort.ptr);
defer std.heap.c_allocator.destroy(lv2_InputPort);
var lv2_InputPort = c.lilv_new_uri(world, LV2_CORE__InputPort.ptr).?;
//defer std.heap.c_allocator.destroy(lv2_InputPort);
var lv2_OutputPort = c.lilv_new_uri(world, LV2_CORE__OutputPort.ptr);
defer std.heap.c_allocator.destroy(lv2_OutputPort);
var lv2_OutputPort = c.lilv_new_uri(world, LV2_CORE__OutputPort.ptr).?;
//defer std.heap.c_allocator.destroy(lv2_OutputPort);
var lv2_AudioPort = c.lilv_new_uri(world, LV2_CORE__AudioPort.ptr);
defer std.heap.c_allocator.destroy(lv2_AudioPort);
var lv2_AudioPort = c.lilv_new_uri(world, LV2_CORE__AudioPort.ptr).?;
//defer std.heap.c_allocator.destroy(lv2_AudioPort);
var lv2_ControlPort = c.lilv_new_uri(world, LV2_CORE__ControlPort.ptr);
defer std.heap.c_allocator.destroy(lv2_ControlPort);
var lv2_ControlPort = c.lilv_new_uri(world, LV2_CORE__ControlPort.ptr).?;
//defer std.heap.c_allocator.destroy(lv2_ControlPort);
var lv2_connectionOptional = c.lilv_new_uri(world, LV2_CORE__connectionOptional.ptr);
defer std.heap.c_allocator.destroy(lv2_connectionOptional);
var lv2_connection_string = c.lilv_new_uri(world, LV2_CORE__connectionOptional.ptr).?;
//defer std.heap.c_allocator.destroy(lv2_connection_string);
var i: u32 = 0;
while (i < n_ports) : (i += 1) {
@ -111,7 +111,7 @@ pub fn setupPorts(ctx: *plugin.Context) ![]Port {
port.value = values[i];
}
port.optional = c.lilv_port_has_property(ctx.plugin, lport, lv2_connectionOptional);
port.optional = c.lilv_port_has_property(ctx.plugin, lport, lv2_connection_string);
if (c.lilv_port_is_a(ctx.plugin, lport, lv2_InputPort)) {
port.is_input = true;

View File

@ -104,7 +104,7 @@ pub const RunContext = struct {
switch (port.ptype) {
.Control => lv2.lilv_instance_connect_port(self.instance, p, &port.value),
.Audio => blk: {
.Audio => {
if (port.is_input) {
lv2.lilv_instance_connect_port(
self.instance,
@ -121,7 +121,7 @@ pub const RunContext = struct {
o += 1;
}
},
else => lv2.lilv_instance_connect_port(self.instance, p, null),
// else => lv2.lilv_instance_connect_port(self.instance, p, null),
}
}
}
@ -136,7 +136,7 @@ pub fn makeContext(allocator: *std.mem.Allocator, plugin_uri: []const u8) !Conte
c.lilv_world_load_all(world);
var uri: *c.LilvNode = c.lilv_new_uri(world, cstr_plugin_uri.ptr) orelse blk: {
var uri: *c.LilvNode = c.lilv_new_uri(world, cstr_plugin_uri.ptr) orelse {
std.debug.warn("Invalid plugin URI <{}>\n", .{plugin_uri});
return ImageError.InvalidPlugin;
};
@ -144,7 +144,7 @@ pub fn makeContext(allocator: *std.mem.Allocator, plugin_uri: []const u8) !Conte
const plugins: *const c.LilvPlugins = c.lilv_world_get_all_plugins(world).?;
var plugin: *const c.LilvPlugin = c.lilv_plugins_get_by_uri(plugins, uri) orelse blk: {
var plugin: *const c.LilvPlugin = c.lilv_plugins_get_by_uri(plugins, uri) orelse {
std.debug.warn("Plugin <{}> not found\n", .{plugin_uri});
return ImageError.UnknownPlugin;
};

View File

@ -27,7 +27,6 @@ fn printCommand(stream: anytype, cmd: *langs.Command, comptime tag: langs.Comman
switch (ctype) {
.lv2_command => try printCommandWithParams(stream, casted),
.custom_command => try printCommandWithParams(stream, casted),
else => @panic("TODO support command type"),
}
}

View File

@ -252,7 +252,6 @@ pub const Runner = struct {
switch (ctype) {
.lv2_command => try self.executeLV2Command(command.*),
.custom_command => try self.executeCustomCommand(command.*),
else => @panic("TODO support command type"),
}
}