13
0

Fix SMF read/write when compiled on Windows

This commit is contained in:
Robin Gareus 2023-01-16 22:57:03 +01:00
parent c44b40afd7
commit 58594e2554
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 5 additions and 3 deletions

View File

@ -260,7 +260,7 @@ SMF::create(const std::string& path, int track, uint16_t ppqn)
{
/* put a stub file on disk */
FILE* f = g_fopen (path.c_str(), "w+");
FILE* f = g_fopen (path.c_str(), "wb+");
if (f == 0) {
return -1;
}
@ -513,7 +513,7 @@ SMF::end_write(string const & path)
return;
}
FILE* f = g_fopen (path.c_str(), "w+");
FILE* f = g_fopen (path.c_str(), "wb+");
if (f == 0) {
throw FileError (path);
}

View File

@ -20,6 +20,8 @@
#include <cstdio>
#include <cassert>
#include <iostream>
#include <glib/gstdio.h>
#include <glibmm/miscutils.h>
#include "evoral/midi_util.h"
@ -57,7 +59,7 @@ SMFReader::open(const string& filename) throw (logic_error, UnsupportedTime)
cout << "Opening SMF file " << filename << " for reading." << endl;
_fd = fopen(filename.c_str(), "r+");
_fd = g_fopen(filename.c_str(), "rb+");
if (_fd) {
// Read type (bytes 8..9)