Revert "use sf_open_fd"

This reverts commit 6e66850d90.
This commit is contained in:
Luna 2019-10-22 19:08:38 -03:00
parent 6e66850d90
commit 1c6ef1d4d5
2 changed files with 3 additions and 6 deletions

View file

@ -1,3 +1,3 @@
load :0; load :0;
embed 3 1 file.mp3 embed 3 1 ./file.mp3
quicksave; quicksave;

View file

@ -31,17 +31,14 @@ pub fn sopen(
var cstr_path = try std.cstr.addNullByte(allocator, path); var cstr_path = try std.cstr.addNullByte(allocator, path);
defer allocator.free(cstr_path); defer allocator.free(cstr_path);
var fs_file = try std.fs.File.openRead(path); var file = c.sf_open(cstr_path.ptr, mode, fmt);
var file = c.sf_open_fd(fs_file.handle, mode, fmt, 1);
const st: i32 = c.sf_error(file); const st: i32 = c.sf_error(file);
if (st != 0) { if (st != 0) {
var msg = c.sf_error_number(st);
std.debug.warn( std.debug.warn(
"Failed to open {} ({})\n", "Failed to open {} ({})\n",
path, path,
msg[0..std.mem.len(u8, msg)], c.sf_error_number(st),
); );
return ImageError.OpenFail; return ImageError.OpenFail;