From: Richard Mudgett Date: Wed, 19 Dec 2018 19:02:35 +0000 (-0600) Subject: stasic.c: Fix printf format type mismatches with arguments. X-Git-Tag: 16.2.0-rc1~31^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f19607870526952d27e6a806e35535e00c0f5f2a;p=thirdparty%2Fasterisk.git 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 --- diff --git a/main/stasis.c b/main/stasis.c index 3216e21739..91813e807d 100644 --- a/main/stasis.c +++ b/main/stasis.c @@ -339,14 +339,14 @@ static AST_VECTOR(, struct stasis_message_type_statistics) message_type_statisti /*! \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 @@ size_t stasis_topic_subscribers(const struct stasis_topic *topic) 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 @@ static void subscription_invoke(struct stasis_subscription *sub, 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 @@ static void publish_msg(struct stasis_topic *topic, 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);