[Asterisk-code-review] stasic.c: Fix printf format type mismatches with arguments. (asterisk[master])

Friendly Automation asteriskteam at digium.com
Thu Jan 3 05:38:17 CST 2019


Friendly Automation has submitted this change and it was merged. ( https://gerrit.asterisk.org/10828 )

Change subject: stasic.c: Fix printf format type mismatches with arguments.
......................................................................

stasic.c: Fix printf format type mismatches with arguments.

An int64_t is not likely the same size as a long.

* Changed the int64_t values in the statistics structs to longs so casting
is not necessary when generating the formatted CLI output.  The offending
members did not need to be int64_t anyway as they were only set by an int
type variable which was already truncating bits.

* Reordered the statistics structs to reduce potential padding bytes.

Change-Id: Ic090a070e9dc4ca650ebdb9c01ed50a581289962
---
M main/stasis.c
1 file changed, 16 insertions(+), 16 deletions(-)

Approvals:
  Corey Farrell: Looks good to me, but someone else must approve
  Joshua C. Colp: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/main/stasis.c b/main/stasis.c
index 3216e21..91813e8 100644
--- a/main/stasis.c
+++ b/main/stasis.c
@@ -339,14 +339,14 @@
 
 /*! \internal */
 struct stasis_topic_statistics {
+	/*! \brief Highest time spent dispatching messages to subscribers */
+	long highest_time_dispatched;
+	/*! \brief Lowest time spent dispatching messages to subscribers */
+	long lowest_time_dispatched;
 	/*! \brief The number of messages that were not dispatched to any subscriber */
 	int messages_not_dispatched;
 	/*! \brief The number of messages that were dispatched to at least 1 subscriber */
 	int messages_dispatched;
-	/*! \brief Highest time spent dispatching messages to subscribers */
-	int64_t highest_time_dispatched;
-	/*! \brief Lowest time spent dispatching messages to subscribers */
-	int64_t lowest_time_dispatched;
 	/*! \brief The number of subscribers to this topic */
 	int subscriber_count;
 	/*! \brief Name of the topic */
@@ -461,26 +461,26 @@
 struct stasis_subscription_statistics {
 	/*! \brief The filename where the subscription originates */
 	const char *file;
-	/*! \brief The line number where the subscription originates */
-	int lineno;
 	/*! \brief The function where the subscription originates */
 	const char *func;
+	/*! \brief Name of the topic we subscribed to */
+	char *topic;
+	/*! \brief The message type that currently took the longest to process */
+	struct stasis_message_type *highest_time_message_type;
+	/*! \brief Highest time spent invoking a message */
+	long highest_time_invoked;
+	/*! \brief Lowest time spent invoking a message */
+	long lowest_time_invoked;
 	/*! \brief The number of messages that were filtered out */
 	int messages_dropped;
 	/*! \brief The number of messages that passed filtering */
 	int messages_passed;
-	/*! \brief Highest time spent invoking a message */
-	int64_t highest_time_invoked;
-	/*! \brief The message type that currently took the longest to process */
-	struct stasis_message_type *highest_time_message_type;
-	/*! \brief Lowest time spent invoking a message */
-	int64_t lowest_time_invoked;
 	/*! \brief Using a mailbox to queue messages */
 	int uses_mailbox;
 	/*! \brief Using stasis threadpool for handling messages */
 	int uses_threadpool;
-	/*! \brief Name of the topic we subscribed to */
-	char *topic;
+	/*! \brief The line number where the subscription originates */
+	int lineno;
 	/*! \brief Unique ID of the subscription */
 	char uniqueid[0];
 };
@@ -561,7 +561,7 @@
 	int message_type_id = stasis_message_type_id(stasis_subscription_change_type());
 #ifdef AST_DEVMODE
 	struct timeval start;
-	int elapsed;
+	long elapsed;
 
 	start = ast_tvnow();
 #endif
@@ -1243,7 +1243,7 @@
 	int message_type_id = stasis_message_type_id(stasis_message_type(message));
 	struct stasis_message_type_statistics *statistics;
 	struct timeval start;
-	int elapsed;
+	long elapsed;
 #endif
 
 	ast_assert(topic != NULL);

-- 
To view, visit https://gerrit.asterisk.org/10828
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic090a070e9dc4ca650ebdb9c01ed50a581289962
Gerrit-Change-Number: 10828
Gerrit-PatchSet: 2
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Friendly Automation (1000185)
Gerrit-Reviewer: Joshua C. Colp <jcolp at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190103/d118f9da/attachment-0001.html>


More information about the asterisk-code-review mailing list