Description: Convert boost::format log messages to strings
 Pass formatted messages as std::string instead of relying on boost::format's
 fmt formatter, whose const invocation changed in fmt 11.
Author: Aron Xu <aron@debian.org>
Bug-Debian: https://bugs.debian.org/1150298
Index: gr-limesdr-3.0.1.10.69/lib/device_handler.cc
===================================================================
--- gr-limesdr-3.0.1.10.69.orig/lib/device_handler.cc
+++ gr-limesdr-3.0.1.10.69/lib/device_handler.cc
@@ -59,8 +59,8 @@ int device_handler::open_device(std::str
     // Print device and library information only once
     if (list_read == false) {
         GR_LOG_INFO(d_logger, "##################");
-        GR_LOG_INFO(d_logger, boost::format("LimeSuite version: %s") % LMS_GetLibraryVersion());
-        GR_LOG_INFO(d_logger, boost::format("gr-limesdr version: %s") % GR_LIMESDR_VER);
+        GR_LOG_INFO(d_logger, (boost::format("LimeSuite version: %s") % LMS_GetLibraryVersion()).str());
+        GR_LOG_INFO(d_logger, (boost::format("gr-limesdr version: %s") % GR_LIMESDR_VER).str());
         GR_LOG_INFO(d_logger, "##################");
 
         device_count = LMS_GetDeviceList(list);
@@ -70,7 +70,7 @@ int device_handler::open_device(std::str
         GR_LOG_INFO(d_logger, "Device list:");
 
         for (int i = 0; i < device_count; i++) {
-            GR_LOG_INFO(d_logger, boost::format("Device %d: %s") % i % list[i]);
+            GR_LOG_INFO(d_logger, (boost::format("Device %d: %s") % i % list[i]).str());
             device_vector.push_back(device());
         }
         GR_LOG_INFO(d_logger, "##################");
@@ -118,12 +118,11 @@ int device_handler::open_device(std::str
             LMS_GetDeviceInfo(device_vector[device_number].address);
 
         GR_LOG_INFO(
-            d_logger,
-            boost::format("Using device: %s (%s) GW: %s FW: %s")
+            d_logger, (boost::format("Using device: %s (%s) GW: %s FW: %s")
                 % info->deviceName
                 % serial
                 % info->gatewareVersion
-                % info->firmwareVersion);
+                % info->firmwareVersion).str());
         GR_LOG_INFO(d_logger, "##################");
 
         ++open_devices; // Count open devices
@@ -131,9 +130,8 @@ int device_handler::open_device(std::str
     // If device is open do nothing
     else {
         GR_LOG_INFO(
-            d_logger,
-            boost::format("Previously connected device number %d from the list is used.")
-                % device_number);
+            d_logger, (boost::format("Previously connected device number %d from the list is used.")
+                % device_number).str());
         GR_LOG_INFO(d_logger, "##################");
     }
     set_limesuite_logger();
@@ -155,9 +153,8 @@ void device_handler::close_device(int de
             if (LMS_Close(this->device_vector[device_number].address) != LMS_SUCCESS)
                 error(device_number);
             GR_LOG_INFO(
-                d_logger,
-                boost::format("device_handler::close_device(): disconnected from device number %d.")
-                    % device_number);
+                d_logger, (boost::format("device_handler::close_device(): disconnected from device number %d.")
+                    % device_number).str());
             device_vector[device_number].address = NULL;
             GR_LOG_INFO(d_logger, "##################");
         }
@@ -304,10 +301,9 @@ void device_handler::enable_channels(int
                               true) != LMS_SUCCESS)
             device_handler::getInstance().error(device_number);
         GR_LOG_INFO(
-            d_logger,
-            boost::format("SISO CH%d set for device number %d.")
+            d_logger, (boost::format("SISO CH%d set for device number %d.")
                 % channel_mode
-                % device_number);
+                % device_number).str());
 
         if (direction)
             rfe_device.tx_channel = channel_mode;
@@ -330,9 +326,8 @@ void device_handler::enable_channels(int
             device_handler::getInstance().error(device_number);
 
         GR_LOG_INFO(
-            d_logger,
-            boost::format("MIMO mode set for device number %d.")
-                % device_number);
+            d_logger, (boost::format("MIMO mode set for device number %d.")
+                % device_number).str());
     }
 }
 
@@ -353,8 +348,7 @@ void device_handler::set_samp_rate(int d
         device_handler::getInstance().error(device_number);
 
     GR_LOG_INFO(
-        d_logger,
-        boost::format("Set sampling rate: %f MS/s.") % (host_value / 1e6));
+        d_logger, (boost::format("Set sampling rate: %f MS/s.") % (host_value / 1e6)).str());
     rate = host_value; // Get the real rate back
 }
 
@@ -378,8 +372,7 @@ void device_handler::set_oversampling(in
             device_handler::getInstance().error(device_number);
 
         GR_LOG_INFO(
-            d_logger,
-            boost::format("Set oversampling: %d.") % oversample);
+            d_logger, (boost::format("Set oversampling: %d.") % oversample).str());
     } else {
         close_all_devices();
         throw std::invalid_argument(
@@ -411,10 +404,9 @@ device_handler::set_rf_freq(int device_n
 
         std::string s_dir[2] = { "RX", "TX" };
         GR_LOG_INFO(
-            d_logger,
-            boost::format("RF frequency set [%s]: %f MHz.")
+            d_logger, (boost::format("RF frequency set [%s]: %f MHz.")
                 % s_dir[direction]
-                % (value / 1e6));
+                % (value / 1e6)).str());
     }
 
     return value;
@@ -471,11 +463,10 @@ void device_handler::set_antenna(int dev
                                     { "Auto(NONE)", "BAND1", "BAND2", "NONE" } };
     std::string s_dir[2] = { "RX", "TX" };
     GR_LOG_INFO(
-        d_logger,
-        boost::format("CH%d antenna set [%s]: %s.")
+        d_logger, (boost::format("CH%d antenna set [%s]: %s.")
             % channel
             % s_dir[direction]
-            % s_antenna[direction][antenna_value]);
+            % s_antenna[direction][antenna_value]).str());
 }
 
 double device_handler::set_analog_filter(int device_number,
@@ -531,14 +522,12 @@ double device_handler::set_digital_filte
                 % s_dir[direction]);
 
             if (enable) {
-                GR_LOG_INFO(d_logger,
-                    boost::format("%s set: %f")
+                GR_LOG_INFO(d_logger, (boost::format("%s set: %f")
                         % msg_start
-                        % (digital_bandw / 1e6));
+                        % (digital_bandw / 1e6)).str());
             } else {
-                GR_LOG_INFO(d_logger,
-                    boost::format("%s disabled.")
-                        % msg_start);
+                GR_LOG_INFO(d_logger, (boost::format("%s disabled.")
+                        % msg_start).str());
             }
         } else {
             close_all_devices();
@@ -574,11 +563,10 @@ device_handler::set_gain(int device_numb
                       channel,
                       &gain_value);
         GR_LOG_INFO(
-            d_logger,
-            boost::format("CH%d gain set [%s]: %s.")
+            d_logger, (boost::format("CH%d gain set [%s]: %s.")
                 % channel
                 % s_dir[direction]
-                % gain_value);
+                % gain_value).str());
     } else {
         close_all_devices();
         throw std::invalid_argument("device_handler::set_gain(): valid range [0, 73]");
@@ -601,10 +589,9 @@ void device_handler::set_nco(int device_
                         -1,
                         0);
         GR_LOG_INFO(
-            d_logger,
-            boost::format("NCO [%s] CH%d gain disabled.")
+            d_logger, (boost::format("NCO [%s] CH%d gain disabled.")
                 % s_dir[direction]
-                % channel);
+                % channel).str());
     } else {
         double freq_value_in[16] = { nco_freq };
         int cmix_mode;
@@ -635,13 +622,12 @@ void device_handler::set_nco(int device_
                             freq_value_out,
                             pho_value_out);
         GR_LOG_INFO(
-            d_logger,
-            boost::format("NCO [%s] CH%d: %f MHz (%f deg.)(%s).")
+            d_logger, (boost::format("NCO [%s] CH%d: %f MHz (%f deg.)(%s).")
                 % s_dir[direction]
                 % channel
                 % (freq_value_out[0] / 1e6)
                 % pho_value_out[0]
-                % s_cmix[cmix_mode]);
+                % s_cmix[cmix_mode]).str());
     }
 }
 
@@ -668,7 +654,7 @@ void device_handler::set_tcxo_dac(int de
                              &dac_value,
                              NULL);
 
-    GR_LOG_INFO(d_logger, boost::format("VCTCXO DAC value set: %u") % dac_value);
+    GR_LOG_INFO(d_logger, (boost::format("VCTCXO DAC value set: %u") % dac_value).str());
 }
 
 void device_handler::set_rfe_device(rfe_dev_t* rfe_dev) { rfe_device.rfe_dev = rfe_dev; }
@@ -682,10 +668,9 @@ void device_handler::update_rfe_channels
             throw std::runtime_error("Failed to assign SDR channels");
         }
         GR_LOG_INFO(
-            d_logger,
-            boost::format("RFE RX channel: %d TX channel: %d")
+            d_logger, (boost::format("RFE RX channel: %d TX channel: %d")
                 % rfe_device.rx_channel
-                % rfe_device.tx_channel);
+                % rfe_device.tx_channel).str());
     } else {
         throw std::runtime_error("device_handler::update_rfe_channels(): no assigned RFE device");
     }
Index: gr-limesdr-3.0.1.10.69/lib/rfe_impl.cc
===================================================================
--- gr-limesdr-3.0.1.10.69.orig/lib/rfe_impl.cc
+++ gr-limesdr-3.0.1.10.69/lib/rfe_impl.cc
@@ -111,11 +111,11 @@ rfe::rfe(int comm_type,
     {
         // Not using device handler so print the version
         GR_LOG_INFO(d_logger, "##################");
-        GR_LOG_INFO(d_logger, boost::format("LimeSuite version: %s") % LMS_GetLibraryVersion());
-        GR_LOG_INFO(d_logger, boost::format("gr-limesdr version: %s") % GR_LIMESDR_VER);
+        GR_LOG_INFO(d_logger, (boost::format("LimeSuite version: %s") % LMS_GetLibraryVersion()).str());
+        GR_LOG_INFO(d_logger, (boost::format("gr-limesdr version: %s") % GR_LIMESDR_VER).str());
         GR_LOG_INFO(d_logger, "##################");
 
-        GR_LOG_INFO(d_logger, boost::format("Opening %s") % device);
+        GR_LOG_INFO(d_logger, (boost::format("Opening %s") % device).str());
         rfe_dev = RFE_Open(device.c_str(), nullptr);
         if (!rfe_dev) {
             throw std::runtime_error("LimeRFE: failed to open " + device);
@@ -127,7 +127,7 @@ rfe::rfe(int comm_type,
     if ((error = RFE_GetInfo(rfe_dev, info)) != 0) {
         throw std::runtime_error("LimeRFE: failed to get device info.");
     }
-    GR_LOG_INFO(d_logger, boost::format("FW: %d HW: %d") % (int)info[0] % (int)info[1]);
+    GR_LOG_INFO(d_logger, (boost::format("FW: %d HW: %d") % (int)info[0] % (int)info[1]).str());
 
     if (config_file.empty()) {
         if ((error = RFE_ConfigureState(rfe_dev, boardState)) != 0) {
@@ -167,14 +167,14 @@ int rfe::change_mode(int mode)
         }
         int error = 0;
         if (mode > 3 || mode < 0) {
-            GR_LOG_ERROR(d_logger, boost::format("Invalid mode %d") % mode);
+            GR_LOG_ERROR(d_logger, (boost::format("Invalid mode %d") % mode).str());
             return -1;
         }
         std::string mode_str[4] = { "RX", "TX", "NONE", "RX+TX" };
-        GR_LOG_INFO(d_logger, boost::format("Changing mode to %s") % mode_str);
+        GR_LOG_INFO(d_logger, (boost::format("Changing mode to %s") % mode_str).str());
 
         if ((error = RFE_Mode(rfe_dev, mode)) != 0) {
-            GR_LOG_ERROR(d_logger, boost::format("Failed to change mode: %s") % this->strerror(error));
+            GR_LOG_ERROR(d_logger, (boost::format("Failed to change mode: %s") % this->strerror(error)).str());
         }
         boardState.mode = mode;
         return error;
@@ -187,10 +187,10 @@ int rfe::set_fan(int enable)
 {
     if (rfe_dev) {
         std::string enable_str[2] = { "Disabling", "Enabling" };
-        GR_LOG_INFO(d_logger, boost::format("%s fan") % enable_str[enable]);
+        GR_LOG_INFO(d_logger, (boost::format("%s fan") % enable_str[enable]).str());
         int error = 0;
         if ((error = RFE_Fan(rfe_dev, enable)) != 0) {
-            GR_LOG_ERROR(d_logger, boost::format("Failed to change mode: %s") % this->strerror(error));
+            GR_LOG_ERROR(d_logger, (boost::format("Failed to change mode: %s") % this->strerror(error)).str());
         }
         return error;
     }
@@ -206,11 +206,11 @@ int rfe::set_attenuation(int attenuation
             GR_LOG_ERROR(d_logger, "Attenuation value too high, valid range [0, 7]");
             return -1;
         }
-        GR_LOG_INFO(d_logger, boost::format("Changing attenuation value to: %d") % attenuation);
+        GR_LOG_INFO(d_logger, (boost::format("Changing attenuation value to: %d") % attenuation).str());
 
         boardState.attValue = attenuation;
         if ((error = RFE_ConfigureState(rfe_dev, boardState)) != 0) {
-            GR_LOG_ERROR(d_logger, boost::format("Failed to change attenuation: %s") % this->strerror(error));
+            GR_LOG_ERROR(d_logger, (boost::format("Failed to change attenuation: %s") % this->strerror(error)).str());
         }
         return error;
     }
@@ -229,9 +229,9 @@ int rfe::set_notch(int enable)
         int error = 0; //! TODO: might need renaming
         boardState.notchOnOff = enable;
         std::string en_dis[2] = { "Disabling", "Enabling" };
-        GR_LOG_INFO(d_logger, boost::format("%s notch filter") % en_dis[enable]);
+        GR_LOG_INFO(d_logger, (boost::format("%s notch filter") % en_dis[enable]).str());
         if ((error = RFE_ConfigureState(rfe_dev, boardState)) != 0) {
-            GR_LOG_ERROR(d_logger, boost::format("Failed to change attenuation: %s") % this->strerror(error));
+            GR_LOG_ERROR(d_logger, (boost::format("Failed to change attenuation: %s") % this->strerror(error)).str());
         }
         return error;
     }
@@ -274,15 +274,15 @@ void rfe::get_board_state()
         return;
     }
 
-    GR_LOG_INFO(d_logger, boost::format("LimeRFE: RX channel: %d") % (int)currentState.channelIDRX);
-    GR_LOG_INFO(d_logger, boost::format("LimeRFE: TX channel: %d") % (int)currentState.channelIDTX);
-    GR_LOG_INFO(d_logger, boost::format("LimeRFE: PortRX: %d") % (int)currentState.selPortRX);
-    GR_LOG_INFO(d_logger, boost::format("LimeRFE: PortTx: %d") % (int)currentState.selPortTX);
-    GR_LOG_INFO(d_logger, boost::format("LimeRFE: Mode: %d") % (int)currentState.mode);
-    GR_LOG_INFO(d_logger, boost::format("LimeRFE: Notch: %d") % (int)currentState.notchOnOff);
-    GR_LOG_INFO(d_logger, boost::format("LimeRFE: Attenuation: %d") % (int)currentState.attValue);
-    GR_LOG_INFO(d_logger, boost::format("LimeRFE: Enable SWR: %d") % (int)currentState.enableSWR);
-    GR_LOG_INFO(d_logger, boost::format("LimeRFE: SourceSWR: %d") % (int)currentState.sourceSWR);
+    GR_LOG_INFO(d_logger, (boost::format("LimeRFE: RX channel: %d") % (int)currentState.channelIDRX).str());
+    GR_LOG_INFO(d_logger, (boost::format("LimeRFE: TX channel: %d") % (int)currentState.channelIDTX).str());
+    GR_LOG_INFO(d_logger, (boost::format("LimeRFE: PortRX: %d") % (int)currentState.selPortRX).str());
+    GR_LOG_INFO(d_logger, (boost::format("LimeRFE: PortTx: %d") % (int)currentState.selPortTX).str());
+    GR_LOG_INFO(d_logger, (boost::format("LimeRFE: Mode: %d") % (int)currentState.mode).str());
+    GR_LOG_INFO(d_logger, (boost::format("LimeRFE: Notch: %d") % (int)currentState.notchOnOff).str());
+    GR_LOG_INFO(d_logger, (boost::format("LimeRFE: Attenuation: %d") % (int)currentState.attValue).str());
+    GR_LOG_INFO(d_logger, (boost::format("LimeRFE: Enable SWR: %d") % (int)currentState.enableSWR).str());
+    GR_LOG_INFO(d_logger, (boost::format("LimeRFE: SourceSWR: %d") % (int)currentState.sourceSWR).str());
 }
 
 } // namespace limesdr
Index: gr-limesdr-3.0.1.10.69/lib/sink_impl.cc
===================================================================
--- gr-limesdr-3.0.1.10.69.orig/lib/sink_impl.cc
+++ gr-limesdr-3.0.1.10.69/lib/sink_impl.cc
@@ -260,11 +260,10 @@ void sink_impl::print_stream_stats(int c
         LMS_GetStreamStatus(&streamId[channel], &status);
         GR_LOG_INFO(d_logger, "---------------------------------------------------------------");
         GR_LOG_INFO(
-            d_logger,
-            boost::format("TX |rate: %f MB/s |dropped packets: %d |FIFO: %d%")
+            d_logger, (boost::format("TX |rate: %f MB/s |dropped packets: %d |FIFO: %d%")
                 % (status.linkRate / 1e6)
                 % status.droppedPackets
-                % (100 * (status.fifoFilledCount / status.fifoSize)));
+                % (100 * (status.fifoFilledCount / status.fifoSize))).str());
         GR_LOG_INFO(d_logger, "---------------------------------------------------------------");
         t1 = t2;
     }
@@ -284,10 +283,9 @@ void sink_impl::init_stream(int device_n
         device_handler::getInstance().error(device_number);
 
     GR_LOG_INFO(
-        d_logger,
-        boost::format("init_stream: sink channel %d (device nr. %d) stream setup done.")
+        d_logger, (boost::format("init_stream: sink channel %d (device nr. %d) stream setup done.")
             % channel
-            % device_number);
+            % device_number).str());
 }
 
 void sink_impl::release_stream(int device_number, lms_stream_t* stream)
Index: gr-limesdr-3.0.1.10.69/lib/source_impl.cc
===================================================================
--- gr-limesdr-3.0.1.10.69.orig/lib/source_impl.cc
+++ gr-limesdr-3.0.1.10.69/lib/source_impl.cc
@@ -244,10 +244,9 @@ void source_impl::init_stream(int device
         device_handler::getInstance().error(stored.device_number);
 
     GR_LOG_INFO(
-        d_logger,
-        boost::format("init_stream: source channel %d (device nr. %d) stream setup done.")
+        d_logger, (boost::format("init_stream: source channel %d (device nr. %d) stream setup done.")
             % channel
-            % device_number);
+            % device_number).str());
 }
 
 void source_impl::release_stream(int device_number, lms_stream_t* stream)
@@ -268,11 +267,10 @@ void source_impl::print_stream_stats(lms
     if (timePeriod >= 1000) {
         GR_LOG_INFO(d_logger, "---------------------------------------------------------------");
         GR_LOG_INFO(
-            d_logger,
-            boost::format("RX |rate: %f MB/s |dropped packets: %d |FIFO: %d%")
+            d_logger, (boost::format("RX |rate: %f MB/s |dropped packets: %d |FIFO: %d%")
                 % (status.linkRate / 1e6)
                 % pktLoss
-                % (100 * (status.fifoFilledCount / status.fifoSize)));
+                % (100 * (status.fifoFilledCount / status.fifoSize))).str());
         GR_LOG_INFO(d_logger, "---------------------------------------------------------------");
         pktLoss = 0;
         t1 = t2;
