allow zero-length SMF files on disk again; fix some gcc 4.X optimization-on compile...
authorPaul Davis <paul@linuxaudiosystems.com>
Tue, 29 Jun 2010 20:40:52 +0000 (20:40 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 29 Jun 2010 20:40:52 +0000 (20:40 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@7329 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/audiosource.cc
libs/ardour/butler.cc
libs/ardour/midi_diskstream.cc
libs/ardour/midi_port.cc
libs/ardour/region.cc
libs/ardour/session_state.cc
libs/ardour/source.cc

index a25e24ab7a4a6053559d8798c0531883eb4bfd06..f309f599c5f199ab76ffb6ae7e2e3b63e973bc9c 100644 (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);
        }
 }
 
index 1efca35196b1072615ada74ebc51dd2d97c37909..3b717942f3190b40def969d385c96ef1eb55add4 100644 (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);
 }
 
index 95e242e6714384816f432461305ab8411fd857c3..c3c5f53d5098f82f741f3a91884d50edd7452d31 100644 (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
index 40cb48f54fea229affd560232810bb27782496d1..6858fd1cbd0e9941a32d768ccf86b180a5c3e399 100644 (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);
                        }
index 076b0d129251180a0f21998535a3cc316fc00fcf..64c7d8c66a861a496a08dd5b31f5558c1f1deff3 100644 (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 ();
         }
 
index 85d6a1689b44a187fdd544b1c7b302e4d2e042c9..99a8ae2e9ea11127b0dab28c21815f11ec0d03bd 100644 (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;
index 894233f436a916539f376ac9dfaab6335c94287d..f819e6eb42cc317a8c75a4f64ec0f3d2eca25a6d 100644 (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);