Qt: Fix the Capture File Properties dropped format.
authorGerald Combs <gerald@wireshark.org>
Sun, 22 Dec 2019 22:21:07 +0000 (14:21 -0800)
committerGerald Combs <gerald@wireshark.org>
Mon, 23 Dec 2019 18:16:17 +0000 (18:16 +0000)
Fixup the formatting for the "Dropped packets" portion of the Capture
File Properties dialog. Fix a couple of other issues flagged by clang.

Change-Id: Ia1fad4bee37525a1a0cc25849abe34a0495f1ac8
Reviewed-on: https://code.wireshark.org/review/35552
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
ui/qt/capture_file_properties_dialog.cpp

index bf0fb9d10aa093e771d36e4eba542e8a88cd0167..f3d05923894a8e1adaa4e6d17324feb47734dc17 100644 (file)
@@ -178,7 +178,7 @@ QString CaptureFilePropertiesDialog::summaryToHtml()
 
     QString format_str = wtap_file_type_subtype_string(summary.file_type);
     const char *compression_type_description = wtap_compression_type_description(summary.compression_type);
-    if (compression_type_description != NULL) {
+    if (compression_type_description != nullptr) {
         format_str += QString(" (%1)").arg(compression_type_description);
     }
     out << table_row_begin
@@ -259,7 +259,7 @@ QString CaptureFilePropertiesDialog::summaryToHtml()
     wtap_block_t shb_inf = wtap_file_get_shb(cap_file_.capFile()->provider.wth);
     char *str;
 
-    if (shb_inf != NULL) {
+    if (shb_inf != nullptr) {
       QString capture_hardware(unknown);
       if (wtap_block_get_string_option_value(shb_inf, OPT_SHB_HARDWARE, &str) == WTAP_OPTTYPE_SUCCESS) {
           if (str[0] != '\0') {
@@ -327,9 +327,9 @@ QString CaptureFilePropertiesDialog::summaryToHtml()
         /* Dropped count */
         QString interface_drops(unknown);
         if (iface.drops_known) {
-            interface_drops = QString("%1 (%2 %)").arg(iface.drops).arg(QString::number(
+            interface_drops = QString("%1 (%2%)").arg(iface.drops).arg(QString::number(
                 /* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
-                summary.packet_count ?(100.0 * (gint64)iface.drops)/summary.packet_count : 0.0f, 'g', 1));
+                summary.packet_count ? (100.0 * (gint64)iface.drops)/summary.packet_count : 0, 'f', 1));
         }
 
         /* Capture filter */
@@ -556,7 +556,7 @@ void CaptureFilePropertiesDialog::fillDetails()
 
 void CaptureFilePropertiesDialog::changeEvent(QEvent* event)
 {
-    if (0 != event)
+    if (event != nullptr)
     {
         switch (event->type())
         {