mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 11:46:25 +01:00
allow zero-length SMF files on disk again; fix some gcc 4.X optimization-on compile warnings
git-svn-id: svn://localhost/ardour2/branches/3.0@7329 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
501db4747b
commit
dbf3ba2d73
7 changed files with 28 additions and 17 deletions
|
|
@ -880,7 +880,7 @@ AudioSource::compute_and_write_peaks (Sample* buf, framepos_t first_frame, frame
|
||||||
off_t target_length = blocksize * ((first_peak_byte + blocksize + 1) / blocksize);
|
off_t target_length = blocksize * ((first_peak_byte + blocksize + 1) / blocksize);
|
||||||
|
|
||||||
if (endpos < target_length) {
|
if (endpos < target_length) {
|
||||||
ftruncate (_peakfile_fd, target_length);
|
(void) ftruncate (_peakfile_fd, target_length);
|
||||||
/* error doesn't actually matter though, so continue on without testing */
|
/* error doesn't actually matter though, so continue on without testing */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -923,7 +923,7 @@ AudioSource::truncate_peakfile ()
|
||||||
off_t end = lseek (_peakfile_fd, 0, SEEK_END);
|
off_t end = lseek (_peakfile_fd, 0, SEEK_END);
|
||||||
|
|
||||||
if (end > _peak_byte_max) {
|
if (end > _peak_byte_max) {
|
||||||
ftruncate (_peakfile_fd, _peak_byte_max);
|
(void) ftruncate (_peakfile_fd, _peak_byte_max);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ Butler::terminate_thread ()
|
||||||
if (thread) {
|
if (thread) {
|
||||||
void* status;
|
void* status;
|
||||||
const char c = Request::Quit;
|
const char c = Request::Quit;
|
||||||
::write (request_pipe[1], &c, 1);
|
(void) ::write (request_pipe[1], &c, 1);
|
||||||
pthread_join (thread, &status);
|
pthread_join (thread, &status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -383,7 +383,7 @@ void
|
||||||
Butler::summon ()
|
Butler::summon ()
|
||||||
{
|
{
|
||||||
char c = Request::Run;
|
char c = Request::Run;
|
||||||
::write (request_pipe[1], &c, 1);
|
(void) ::write (request_pipe[1], &c, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -391,7 +391,7 @@ Butler::stop ()
|
||||||
{
|
{
|
||||||
Glib::Mutex::Lock lm (request_lock);
|
Glib::Mutex::Lock lm (request_lock);
|
||||||
char c = Request::Pause;
|
char c = Request::Pause;
|
||||||
::write (request_pipe[1], &c, 1);
|
(void) ::write (request_pipe[1], &c, 1);
|
||||||
paused.wait(request_lock);
|
paused.wait(request_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -400,7 +400,7 @@ Butler::wait_until_finished ()
|
||||||
{
|
{
|
||||||
Glib::Mutex::Lock lm (request_lock);
|
Glib::Mutex::Lock lm (request_lock);
|
||||||
char c = Request::Wake;
|
char c = Request::Wake;
|
||||||
::write (request_pipe[1], &c, 1);
|
(void) ::write (request_pipe[1], &c, 1);
|
||||||
paused.wait(request_lock);
|
paused.wait(request_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1312,7 +1312,7 @@ MidiDiskstream::set_state (const XMLNode& node, int /*version*/)
|
||||||
int
|
int
|
||||||
MidiDiskstream::use_new_write_source (uint32_t n)
|
MidiDiskstream::use_new_write_source (uint32_t n)
|
||||||
{
|
{
|
||||||
if (!recordable()) {
|
if (!_session.writable() || !recordable()) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1333,7 +1333,6 @@ MidiDiskstream::use_new_write_source (uint32_t n)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
_write_source->set_allow_remove_if_empty (true);
|
|
||||||
_write_source->mark_streaming_midi_write_started (_note_mode, _session.transport_frame());
|
_write_source->mark_streaming_midi_write_started (_note_mode, _session.transport_frame());
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -1344,7 +1343,7 @@ MidiDiskstream::steal_write_sources()
|
||||||
{
|
{
|
||||||
list<boost::shared_ptr<Source> > ret;
|
list<boost::shared_ptr<Source> > ret;
|
||||||
ret.push_back (_write_source);
|
ret.push_back (_write_source);
|
||||||
reset_write_sources (false);
|
use_new_write_source (0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1357,9 +1356,8 @@ MidiDiskstream::reset_write_sources (bool mark_write_complete, bool /*force*/)
|
||||||
|
|
||||||
if (_write_source && mark_write_complete) {
|
if (_write_source && mark_write_complete) {
|
||||||
_write_source->mark_streaming_write_completed ();
|
_write_source->mark_streaming_write_completed ();
|
||||||
}
|
}
|
||||||
|
use_new_write_source (0);
|
||||||
use_new_write_source (0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,12 @@ MidiPort::get_midi_buffer (nframes_t nframes, nframes_t offset)
|
||||||
|
|
||||||
jack_midi_event_get (&ev, jack_buffer, i);
|
jack_midi_event_get (&ev, jack_buffer, i);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
if (ev.buffer[0] == 0xfe) {
|
||||||
|
/* throw away active sensing */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (ev.time > off && ev.time < off+nframes) {
|
if (ev.time > off && ev.time < off+nframes) {
|
||||||
_buffer->push_back (ev);
|
_buffer->push_back (ev);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1534,14 +1534,12 @@ void
|
||||||
Region::drop_sources ()
|
Region::drop_sources ()
|
||||||
{
|
{
|
||||||
for (SourceList::const_iterator i = _sources.begin (); i != _sources.end(); ++i) {
|
for (SourceList::const_iterator i = _sources.begin (); i != _sources.end(); ++i) {
|
||||||
cerr << name() << " " << id() << " DEC DS\n";
|
|
||||||
(*i)->dec_use_count ();
|
(*i)->dec_use_count ();
|
||||||
}
|
}
|
||||||
|
|
||||||
_sources.clear ();
|
_sources.clear ();
|
||||||
|
|
||||||
for (SourceList::const_iterator i = _master_sources.begin (); i != _master_sources.end(); ++i) {
|
for (SourceList::const_iterator i = _master_sources.begin (); i != _master_sources.end(); ++i) {
|
||||||
cerr << name() << " " << id() << " DEC MDS \n";
|
|
||||||
(*i)->dec_use_count ();
|
(*i)->dec_use_count ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2561,8 +2561,17 @@ Session::cleanup_sources (CleanupReport& rep)
|
||||||
|
|
||||||
for (set<string>::iterator i = all_sources.begin(); i != all_sources.end(); ++i) {
|
for (set<string>::iterator i = all_sources.begin(); i != all_sources.end(); ++i) {
|
||||||
|
|
||||||
realpath(spath.c_str(), tmppath1);
|
if (realpath(spath.c_str(), tmppath1) == 0) {
|
||||||
realpath((*i).c_str(), tmppath2);
|
error << string_compose (_("Cannot expand path %1 (%2)"),
|
||||||
|
spath, strerror (errno)) << endmsg;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (realpath((*i).c_str(), tmppath2) == 0) {
|
||||||
|
error << string_compose (_("Cannot expand path %1 (%2)"),
|
||||||
|
(*i), strerror (errno)) << endmsg;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (strcmp(tmppath1, tmppath2) == 0) {
|
if (strcmp(tmppath1, tmppath2) == 0) {
|
||||||
used = true;
|
used = true;
|
||||||
|
|
|
||||||
|
|
@ -277,8 +277,8 @@ Source::dec_use_count ()
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
gint oldval = g_atomic_int_exchange_and_add (&_use_count, -1);
|
gint oldval = g_atomic_int_exchange_and_add (&_use_count, -1);
|
||||||
cerr << "Bad use dec for " << name() << endl;
|
|
||||||
if (oldval <= 0) {
|
if (oldval <= 0) {
|
||||||
|
cerr << "Bad use dec for " << name() << endl;
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
assert (oldval > 0);
|
assert (oldval > 0);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue