[asterisk-commits] russell: branch russell/indications r174841 - in /team/russell/indications: i...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Feb 10 21:14:21 CST 2009


Author: russell
Date: Tue Feb 10 21:14:21 2009
New Revision: 174841

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=174841
Log:
Simplify code per Mark M.'s review.  Thanks Mark!

Modified:
    team/russell/indications/include/asterisk/indications.h
    team/russell/indications/main/indications.c
    team/russell/indications/res/snmp/agent.c

Modified: team/russell/indications/include/asterisk/indications.h
URL: http://svn.digium.com/svn-view/asterisk/team/russell/indications/include/asterisk/indications.h?view=diff&rev=174841&r1=174840&r2=174841
==============================================================================
--- team/russell/indications/include/asterisk/indications.h (original)
+++ team/russell/indications/include/asterisk/indications.h Tue Feb 10 21:14:21 2009
@@ -126,9 +126,9 @@
 /*!
  * \brief locate ast_tone_zone
  *
- * \param county country to find.  If NULL is provided, get the default.
- *
- * \return a pointer to the specified country if found or NULL if not found
+ * \param country country to find.  If NULL is provided, get the default.
+ *
+ * \return a reference to the specified country if found or NULL if not found
  */
 struct ast_tone_zone *ast_get_indication_zone(const char *country);
 
@@ -163,6 +163,13 @@
 void ast_playtones_stop(struct ast_channel *chan);
 
 /*!
+ * \brief Get the number of registered tone zones
+ *
+ * \return the total number of registered tone zones
+ */
+int ast_tone_zone_count(void);
+
+/*!
  * \brief Get an iterator for the available tone zones
  *
  * Use ao2_iterator_next() to iterate the tone zones.

Modified: team/russell/indications/main/indications.c
URL: http://svn.digium.com/svn-view/asterisk/team/russell/indications/main/indications.c?view=diff&rev=174841&r1=174840&r2=174841
==============================================================================
--- team/russell/indications/main/indications.c (original)
+++ team/russell/indications/main/indications.c Tue Feb 10 21:14:21 2009
@@ -187,7 +187,7 @@
 		ps->oldnpos = ps->npos;
 	}
 
-	for (x = 0; x < len / 2; x++) {
+	for (x = 0; x < samples; x++) {
 		ps->v1_1 = ps->v2_1;
 		ps->v2_1 = ps->v3_1;
 		ps->v3_1 = (pi->fac1 * ps->v2_1 >> 15) - ps->v1_1;
@@ -388,6 +388,11 @@
 	ast_deactivate_generator(chan);
 }
 
+int ast_tone_zone_count(void)
+{
+	return ao2_container_count(ast_tone_zones);
+}
+
 struct ao2_iterator ast_tone_zone_iterator_init(void)
 {
 	return ao2_iterator_init(ast_tone_zones, 0);

Modified: team/russell/indications/res/snmp/agent.c
URL: http://svn.digium.com/svn-view/asterisk/team/russell/indications/res/snmp/agent.c?view=diff&rev=174841&r1=174840&r2=174841
==============================================================================
--- team/russell/indications/res/snmp/agent.c (original)
+++ team/russell/indications/res/snmp/agent.c Tue Feb 10 21:14:21 2009
@@ -668,11 +668,8 @@
 	case ASTINDCURRENT:
 		tz = ast_get_indication_zone(NULL);
 		if (tz) {
-			*var_len = strlen(tz->country);
-			if (*var_len >= sizeof(ret_buf)) {
-				*var_len = sizeof(ret_buf) - 1;
-			}
 			ast_copy_string(ret_buf, tz->country, sizeof(ret_buf));
+			*var_len = strlen(ret_buf);
 			tz = ast_tone_zone_unref(tz);
 			return (u_char *) ret_buf;
 		}




More information about the asterisk-commits mailing list