Move log dump to a function
authorLaurent Vivier <laurent@vivier.eu>
Mon, 21 Sep 2015 21:18:47 +0000 (23:18 +0200)
committerLaurent Vivier <laurent@vivier.eu>
Tue, 22 Sep 2015 08:52:33 +0000 (10:52 +0200)
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
software/scsi2sd-util/scsi2sd-util.cc

index fb1e34fc41630abbdcd52be8570863ee2a2916c5..4c312e9a4832ad89b0701a2f3e28ee43d3339203 100644 (file)
@@ -644,6 +644,18 @@ private:
                }
        }
 
+       void dumpSCSICommand(std::vector<uint8_t> buf)
+        {
+               std::stringstream msg;
+               msg << std::hex;
+               for (size_t i = 0; i < 32 && i < buf.size(); ++i)
+               {
+                       msg << std::setfill('0') << std::setw(2) <<
+                       static_cast<int>(buf[i]) << ' ';
+               }
+               wxLogMessage(this, msg.str().c_str());
+        }
+
        void logSCSI()
        {
                if (!mySCSILogChk->IsChecked() ||
@@ -656,14 +668,7 @@ private:
                        std::vector<uint8_t> info(HID::HID_PACKET_SIZE);
                        if (myHID->readSCSIDebugInfo(info))
                        {
-                               std::stringstream msg;
-                               msg << std::hex;
-                               for (size_t i = 0; i < 32 && i < info.size(); ++i)
-                               {
-                                       msg << std::setfill('0') << std::setw(2) <<
-                                               static_cast<int>(info[i]) << ' ';
-                               }
-                               wxLogMessage(this, msg.str().c_str());
+                               dumpSCSICommand(info);
                        }
                }
                catch (std::exception& e)