Fix some too-large inlines.
authorbruceperens <bruceperens@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 25 Mar 2014 05:16:38 +0000 (05:16 +0000)
committerbruceperens <bruceperens@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 25 Mar 2014 05:16:38 +0000 (05:16 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@1479 01035d8c-6547-0410-b346-abe4f91aad63

freedv-server/source/drivers.h
freedv-server/source/fifo.cpp
freedv-server/source/interfaces.cpp
freedv-server/source/platform/linux/audio_in_alsa.cpp
freedv-server/source/platform/linux/audio_out_alsa.cpp

index ac3b205e6e532f83b829cc70dbda698313d0eff9..1494608892439c7e9c04394cb64cd67050f41cd2 100644 (file)
@@ -120,29 +120,18 @@ public:
     /// \param length The amount of data requested. This must be smaller
     /// than or equal to the amount returned by get_available().
     /// \return The address of the data to be read.
-    inline const uint8_t *
-    get(std::size_t length) {
-        assert(length % 2 == 0);
-        if ( length > (std::size_t)(in - out) )
-            get_overrun();
-        return out;
-    }
+    const uint8_t *
+    get(std::size_t length);
 
     /// Finish the I/O after get().
     /// \param length The amount of data, in bytes, actually read.
     /// This must be smaller than or equal to the amount passed to
     /// get().
-    inline void                get_done(std::size_t length) {
-        assert(length % 2 == 0);
-        out += length;
-        assert(out >= buffer && out <= buffer_end);
-        if ( out == in )
-            out = in = buffer;
-    }
+    void               get_done(std::size_t length);
 
     /// Returns the amount of space available for incoming data.
     /// \return The amount of space, in bytes, available for incoming data.
-    inline std::size_t put_space() const {
+    std::size_t        put_space() const {
         return (buffer_end) - in + (out - buffer);
     }
 
@@ -155,24 +144,12 @@ public:
     /// to the length passed to put().
     /// \param length The size of buffer in chars requested.
     /// \return The address of the buffer for incoming data.
-    inline uint8_t *   put(std::size_t length) {
-        assert(length % 2 == 0);
-        const uint8_t * io_end = in + length;
-
-        if ( io_end > buffer_end )
-            return reorder(length);
-        else
-            return in;
-    }
+    uint8_t *  put(std::size_t length);
 
     /// Complete the I/O after put().
     /// \param length The amount of data actually written. This must be
     /// smaller than or equal to the length passed to put().
-    inline void                put_done(std::size_t length) {
-        assert(length % 2 == 0);
-        in += length;
-        assert(in >= buffer && in <= buffer_end);
-    }
+    void               put_done(std::size_t length);
 
     /// Discard any buffered data.
     ///
@@ -650,18 +627,11 @@ public:
 class Interfaces {
 private:
     // Copy constructor and operator=() disabled.
-    Interfaces(const Interfaces &);
-    Interfaces & operator=(const Interfaces &);
+               Interfaces(const Interfaces &);
+               Interfaces & operator=(const Interfaces &);
 public:
-    Interfaces() : codec(0),
-        framer(0), keying_output(0), loudspeaker(0),
-        microphone(0), modem(0), ptt_input_digital(0),
-        ptt_input_ssb(0), receiver(0), text_input(0),
-        transmitter(0), user_interface(0)
-    {
-    }
-
-    virtual            ~Interfaces() final;
+               Interfaces();
+    virtual    ~Interfaces() final;
 
     /// The voice codec in use.
     ///
index b136ecfec315850074b407864e33a968d250c18d..5ade19b12384376d9ed24c130e958fca5b890d54 100644 (file)
@@ -20,12 +20,47 @@ namespace FreeDV {
     delete buffer;
   }
 
+  const uint8_t *
+  FIFO::get(std::size_t length) {
+      assert(length % 2 == 0);
+      if ( length > (std::size_t)(in - out) )
+          get_overrun();
+      return out;
+  }
+
+  void
+  FIFO::get_done(std::size_t length) {
+      assert(length % 2 == 0);
+      out += length;
+      assert(out >= buffer && out <= buffer_end);
+      if ( out == in )
+          out = in = buffer;
+  }
+
   void
   FIFO::get_overrun() const
   {
     throw std::runtime_error("FIFO outgoing data overrun.");
   }
 
+  uint8_t *
+  FIFO::put(std::size_t length) {
+    assert(length % 2 == 0);
+    const uint8_t * io_end = in + length;
+
+    if ( io_end > buffer_end )
+      return reorder(length);
+    else
+      return in;
+  }
+
+  void
+  FIFO::put_done(std::size_t length) {
+    assert(length % 2 == 0);
+    in += length;
+    assert(in >= buffer && in <= buffer_end);
+  }
+
   uint8_t *
   FIFO::reorder(std::size_t size)
   {
index f93f063225177556acf3bb3e159aa67c8d6bd4c6..f730365ddd7852e13eb91425b486c269053157a2 100644 (file)
 static const char empty[1] = { '\0' };
 
 namespace FreeDV {
+  Interfaces::Interfaces()
+   : codec(0),
+   framer(0), keying_output(0), loudspeaker(0),
+   microphone(0), modem(0), ptt_input_digital(0),
+   ptt_input_ssb(0), receiver(0), text_input(0),
+   transmitter(0), user_interface(0)
+  {
+  }
+
   Interfaces::~Interfaces()
   {
   }
index 4d2ff48cee3c93e8efea422761604ba35db4f9ba..78abee62b32d578c94273196514e5d9dda8d50c1 100644 (file)
@@ -34,16 +34,7 @@ namespace FreeDV {
     AudioInALSA & operator=(const AudioInALSA &);
 
     NORETURN void
-    do_throw(const int error, const char * message = 0)
-    {
-      std::ostringstream str;
-
-      str << "Error on ALSA audio input \"" << parameters << "\": ";
-       if ( message )
-         str << message << ": ";
-       str << snd_strerror(error) << '.';
-      throw std::runtime_error(str.str().c_str());
-    }
+    do_throw(const int error, const char * message = 0);
   public:
 
        /// Instantiate the audio input.
@@ -96,6 +87,18 @@ namespace FreeDV {
     free(parameters);
   }
 
+  NORETURN void
+  AudioInALSA::do_throw(const int error, const char * message)
+  {
+    std::ostringstream str;
+
+    str << "Error on ALSA audio input \"" << parameters << "\": ";
+     if ( message )
+       str << message << ": ";
+     str << snd_strerror(error) << '.';
+    throw std::runtime_error(str.str().c_str());
+  }
+
   // Read audio into the "short" type.
   std::size_t
   AudioInALSA::read16(std::int16_t * array, std::size_t length)
index 8f7d4a60224df8b93166c5c6e93309005a22e740..b22607fced37deea6efd66afbfa3b9ed2401ad75 100644 (file)
@@ -33,16 +33,7 @@ namespace FreeDV {
     AudioOutALSA & operator=(const AudioOutALSA &);
 
     NORETURN void
-    do_throw(const int error, const char * message = 0)
-    {
-      std::ostringstream str;
-
-      str << "Error on ALSA audio output \"" << parameters << "\": ";
-       if ( message )
-         str << message << ": ";
-       str << snd_strerror(error) << '.';
-      throw std::runtime_error(str.str().c_str());
-    }
+    do_throw(const int error, const char * message = 0);
   public:
 
        /// Instantiate the audio output.
@@ -93,6 +84,18 @@ namespace FreeDV {
     free(parameters);
   }
 
+  NORETURN void
+  AudioOutALSA::do_throw(const int error, const char * message)
+  {
+    std::ostringstream str;
+
+    str << "Error on ALSA audio output \"" << parameters << "\": ";
+     if ( message )
+       str << message << ": ";
+     str << snd_strerror(error) << '.';
+    throw std::runtime_error(str.str().c_str());
+  }
+
   // Write audio into the "short" type.
   std::size_t
   AudioOutALSA::write16(const std::int16_t * array, std::size_t length)
@@ -201,5 +204,5 @@ namespace FreeDV {
      AudioOutALSAEnumerator);
     return true;
   }
-  static const bool initialized = initializer();
+  static const bool UNUSED initialized = initializer();
 }