Browse Source

[3736] Suppress the cppcheck passedByValue in the perfdhcp.

Marcin Siodelski 10 years ago
parent
commit
355c38737f
2 changed files with 16 additions and 4 deletions
  1. 2 2
      src/bin/perfdhcp/test_control.cc
  2. 14 2
      src/bin/perfdhcp/test_control.h

+ 2 - 2
src/bin/perfdhcp/test_control.cc

@@ -589,7 +589,7 @@ TestControl::getRequestedIpOffset() const {
 }
 }
 
 
 uint64_t
 uint64_t
-TestControl::getRcvdPacketsNum(const ExchangeType xchg_type) const {
+TestControl::getRcvdPacketsNum(ExchangeType xchg_type) const {
     uint8_t ip_version = CommandOptions::instance().getIpVersion();
     uint8_t ip_version = CommandOptions::instance().getIpVersion();
     if (ip_version == 4) {
     if (ip_version == 4) {
         return (stats_mgr4_->getRcvdPacketsNum(xchg_type));
         return (stats_mgr4_->getRcvdPacketsNum(xchg_type));
@@ -599,7 +599,7 @@ TestControl::getRcvdPacketsNum(const ExchangeType xchg_type) const {
 }
 }
 
 
 uint64_t
 uint64_t
-TestControl::getSentPacketsNum(const ExchangeType xchg_type) const {
+TestControl::getSentPacketsNum(ExchangeType xchg_type) const {
     uint8_t ip_version = CommandOptions::instance().getIpVersion();
     uint8_t ip_version = CommandOptions::instance().getIpVersion();
     if (ip_version == 4) {
     if (ip_version == 4) {
         return (stats_mgr4_->getSentPacketsNum(xchg_type));
         return (stats_mgr4_->getSentPacketsNum(xchg_type));

+ 14 - 2
src/bin/perfdhcp/test_control.h

@@ -989,18 +989,30 @@ protected:
     /// Get the number of received packets from the Statistics Manager.
     /// Get the number of received packets from the Statistics Manager.
     /// Function may throw if Statistics Manager object is not
     /// Function may throw if Statistics Manager object is not
     /// initialized.
     /// initialized.
+    ///
+    /// \note The method parameter is non-const to suppress the cppcheck
+    /// warning about the object being passed by value. However, passing
+    /// an enum by reference doesn't make much sense. At the same time,
+    /// removing the constness should be pretty safe for this function.
+    ///
     /// \param xchg_type packet exchange type.
     /// \param xchg_type packet exchange type.
     /// \return number of received packets.
     /// \return number of received packets.
-    uint64_t getRcvdPacketsNum(const ExchangeType xchg_type) const;
+    uint64_t getRcvdPacketsNum(ExchangeType xchg_type) const;
 
 
     /// \brief Get number of sent packets.
     /// \brief Get number of sent packets.
     ///
     ///
     /// Get the number of sent packets from the Statistics Manager.
     /// Get the number of sent packets from the Statistics Manager.
     /// Function may throw if Statistics Manager object is not
     /// Function may throw if Statistics Manager object is not
     /// initialized.
     /// initialized.
+    ///
+    /// \note The method parameter is non-const to suppress the cppcheck
+    /// warning about the object being passed by value. However, passing
+    /// an enum by reference doesn't make much sense. At the same time,
+    /// removing the constness should be pretty safe for this function.
+    ///
     /// \param xchg_type packet exchange type.
     /// \param xchg_type packet exchange type.
     /// \return number of sent packets.
     /// \return number of sent packets.
-    uint64_t getSentPacketsNum(const ExchangeType xchg_type) const;
+    uint64_t getSentPacketsNum(ExchangeType xchg_type) const;
 
 
     /// \brief Handle child signal.
     /// \brief Handle child signal.
     ///
     ///