13
0

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:
Paul Davis 2010-06-29 20:40:52 +00:00
parent 501db4747b
commit dbf3ba2d73
7 changed files with 28 additions and 17 deletions

View File

@ -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);
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 */
}
}
@ -923,7 +923,7 @@ AudioSource::truncate_peakfile ()
off_t end = lseek (_peakfile_fd, 0, SEEK_END);
if (end > _peak_byte_max) {
ftruncate (_peakfile_fd, _peak_byte_max);
(void) ftruncate (_peakfile_fd, _peak_byte_max);
}
}

View File

@ -127,7 +127,7 @@ Butler::terminate_thread ()
if (thread) {
void* status;
const char c = Request::Quit;
::write (request_pipe[1], &c, 1);
(void) ::write (request_pipe[1], &c, 1);
pthread_join (thread, &status);
}
}
@ -383,7 +383,7 @@ void
Butler::summon ()
{
char c = Request::Run;
::write (request_pipe[1], &c, 1);
(void) ::write (request_pipe[1], &c, 1);
}
void
@ -391,7 +391,7 @@ Butler::stop ()
{
Glib::Mutex::Lock lm (request_lock);
char c = Request::Pause;
::write (request_pipe[1], &c, 1);
(void) ::write (request_pipe[1], &c, 1);
paused.wait(request_lock);
}
@ -400,7 +400,7 @@ Butler::wait_until_finished ()
{
Glib::Mutex::Lock lm (request_lock);
char c = Request::Wake;
::write (request_pipe[1], &c, 1);
(void) ::write (request_pipe[1], &c, 1);
paused.wait(request_lock);
}

View File

@ -1312,7 +1312,7 @@ MidiDiskstream::set_state (const XMLNode& node, int /*version*/)
int
MidiDiskstream::use_new_write_source (uint32_t n)
{
if (!recordable()) {
if (!_session.writable() || !recordable()) {
return 1;
}
@ -1333,7 +1333,6 @@ MidiDiskstream::use_new_write_source (uint32_t n)
return -1;
}
_write_source->set_allow_remove_if_empty (true);
_write_source->mark_streaming_midi_write_started (_note_mode, _session.transport_frame());
return 0;
@ -1344,7 +1343,7 @@ MidiDiskstream::steal_write_sources()
{
list<boost::shared_ptr<Source> > ret;
ret.push_back (_write_source);
reset_write_sources (false);
use_new_write_source (0);
return ret;
}
@ -1357,9 +1356,8 @@ MidiDiskstream::reset_write_sources (bool mark_write_complete, bool /*force*/)
if (_write_source && mark_write_complete) {
_write_source->mark_streaming_write_completed ();
}
use_new_write_source (0);
}
use_new_write_source (0);
}
int

View File

@ -75,6 +75,12 @@ MidiPort::get_midi_buffer (nframes_t nframes, nframes_t offset)
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) {
_buffer->push_back (ev);
}

View File

@ -1534,14 +1534,12 @@ void
Region::drop_sources ()
{
for (SourceList::const_iterator i = _sources.begin (); i != _sources.end(); ++i) {
cerr << name() << " " << id() << " DEC DS\n";
(*i)->dec_use_count ();
}
_sources.clear ();
for (SourceList::const_iterator i = _master_sources.begin (); i != _master_sources.end(); ++i) {
cerr << name() << " " << id() << " DEC MDS \n";
(*i)->dec_use_count ();
}

View File

@ -2561,8 +2561,17 @@ Session::cleanup_sources (CleanupReport& rep)
for (set<string>::iterator i = all_sources.begin(); i != all_sources.end(); ++i) {
realpath(spath.c_str(), tmppath1);
realpath((*i).c_str(), tmppath2);
if (realpath(spath.c_str(), tmppath1) == 0) {
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) {
used = true;

View File

@ -277,8 +277,8 @@ Source::dec_use_count ()
{
#ifndef NDEBUG
gint oldval = g_atomic_int_exchange_and_add (&_use_count, -1);
cerr << "Bad use dec for " << name() << endl;
if (oldval <= 0) {
cerr << "Bad use dec for " << name() << endl;
abort ();
}
assert (oldval > 0);