fixed an error in storing macs with zeroes.
authorIlkka Tengvall <ilkka.tengvall@iki.fi>
Wed, 20 Oct 2010 18:16:21 +0000 (21:16 +0300)
committerIlkka Tengvall <ilkka.tengvall@iki.fi>
Wed, 20 Oct 2010 19:22:23 +0000 (22:22 +0300)
There was an error in Host Editor MAC string handling, all the zeroes
got removed thus causing the MAC to be incorrect.

woller.cpp
woller.h

index ba596e2..d78162c 100644 (file)
@@ -389,7 +389,7 @@ HostWidget::HostWidget(QWidget *parent, host_s *host)
             tr("HW address of target, e.g. 00:01:02:AA:BB:CC. "
                "Hint, in Linux/Unix: \"ifconfig\","
                "in Windows \"ipconfig /all\""));
-    mac->setInputMask("HH:HH:HH:HH:HH:HH;0");
+    mac->setInputMask("HH:HH:HH:HH:HH:HH;_");
     mac_row->addWidget(mac_lbl);
     mac_row->addWidget(mac);
     vlayout->addLayout(mac_row);
@@ -442,11 +442,13 @@ void HostWidget::ok_sig()
         msgBox.exec();
         return;
     }
-    new_host->mac= this->mac->text();
-    if (new_host->mac.isEmpty())
+
+    new_host->mac = this->mac->text();
+    if (new_host->mac.length() != MAX_MAC_STR_LEN)
     {
         QMessageBox msgBox;
-        msgBox.setText("You must set mac!");
+        msgBox.setText("You must set mac to full 12 digits!\n" \
+                       "E.g. 00:11:22:33:44:55:66");
         msgBox.exec();
         return;
     }
index 8963279..902866b 100644 (file)
--- a/woller.h
+++ b/woller.h
@@ -142,6 +142,8 @@ private:
 
 
 #define MAX_MAC_LEN 12
+#define MAC_COLON_CNT 5
+#define MAX_MAC_STR_LEN (MAX_MAC_LEN + MAC_COLON_CNT)
 #define MAX_IP_LEN 15