[svn-commits] dvossel: branch dvossel/fixtheworld_phase1_step1 r298341 - in /team/dvossel/f...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Dec 15 17:20:59 UTC 2010


Author: dvossel
Date: Wed Dec 15 11:20:55 2010
New Revision: 298341

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=298341
Log:
clarified format cmp function results

Modified:
    team/dvossel/fixtheworld_phase1_step1/include/asterisk/format.h
    team/dvossel/fixtheworld_phase1_step1/main/format.c
    team/dvossel/fixtheworld_phase1_step1/tests/test_format_api.c

Modified: team/dvossel/fixtheworld_phase1_step1/include/asterisk/format.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step1/include/asterisk/format.h?view=diff&rev=298341&r1=298340&r2=298341
==============================================================================
--- team/dvossel/fixtheworld_phase1_step1/include/asterisk/format.h (original)
+++ team/dvossel/fixtheworld_phase1_step1/include/asterisk/format.h Wed Dec 15 11:20:55 2010
@@ -126,8 +126,11 @@
 };
 
 enum ast_format_cmp_res {
-	AST_FORMAT_CMP_IDENTICAL = 0,
-	AST_FORMAT_CMP_NO_SUBSET,
+	/*! structure 1 is identical to structure 2. */
+	AST_FORMAT_CMP_SAME = 0,
+	/*! structure 1 contains elements not in structure 2. */
+	AST_FORMAT_CMP_NOT_SUBSET,
+	/*! structure 1 is a proper subset of the elements in structure 2.*/
 	AST_FORMAT_CMP_SUBSET,
 };
 
@@ -138,9 +141,7 @@
 
     /*! \brief Determine if format_attr 1 is a subset of format_attr 2.
      *
-     * \retval AST_FORMAT_CMP_NO_SUBSET, structure 1 has capabilities not present in structure 2
-     * \retval AST_FORMAT_CMP_IDENTICAL, structures are identical sets of one another
-     * \retval AST_FORMAT_CMP_SUBSET, structure 1 is a subset of the capabilities in structure 2.
+     * \retval ast_format_cmp_res representing the result of comparing fattr1 and fattr2.
 	 */
     enum ast_format_cmp_res (* const format_attr_cmp)(struct ast_format_attr *fattr1, struct ast_format_attr *fattr2);
 
@@ -195,9 +196,7 @@
 /*!
  * \brief Compare ast_formats structures
  *
- * \retval AST_FORMAT_ATTR_NO_UNION, structure 1 has capabilities not present in structure 2
- * \retval AST_FORMAT_ATTR_IDENTICAL, structures are identical
- * \retval AST_FORMAT_ATTR_SUBSET, structure 1 is a subset of the capabilities in structure 2.
+ * \retval ast_format_cmp_res representing the result of comparing format1 and format2.
  */
 enum ast_format_cmp_res ast_format_cmp(struct ast_format *format1, struct ast_format *format2);
 

Modified: team/dvossel/fixtheworld_phase1_step1/main/format.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step1/main/format.c?view=diff&rev=298341&r1=298340&r2=298341
==============================================================================
--- team/dvossel/fixtheworld_phase1_step1/main/format.c (original)
+++ team/dvossel/fixtheworld_phase1_step1/main/format.c Wed Dec 15 11:20:55 2010
@@ -150,7 +150,7 @@
 	ao2_unlock(wrapper);
 	ao2_ref(wrapper, -1);
 
-	return (res == AST_FORMAT_CMP_NO_SUBSET) ? -1 : 0;
+	return (res == AST_FORMAT_CMP_NOT_SUBSET) ? -1 : 0;
 }
 
 int ast_format_isset(struct ast_format *format, ... )
@@ -167,7 +167,7 @@
  */
 static enum ast_format_cmp_res format_cmp_helper(struct ast_format *format1, struct ast_format *format2)
 {
-	enum ast_format_cmp_res res = AST_FORMAT_CMP_IDENTICAL;
+	enum ast_format_cmp_res res = AST_FORMAT_CMP_SAME;
 	struct interface_ao2_wrapper *wrapper;
 	struct interface_ao2_wrapper tmp_wrapper = {
 		.id = format1->id,
@@ -198,7 +198,7 @@
 enum ast_format_cmp_res ast_format_cmp(struct ast_format *format1, struct ast_format *format2)
 {
 	if (format1->id != format2->id) {
-		return AST_FORMAT_CMP_NO_SUBSET;
+		return AST_FORMAT_CMP_NOT_SUBSET;
 	}
 
 	return format_cmp_helper(format1, format2);

Modified: team/dvossel/fixtheworld_phase1_step1/tests/test_format_api.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step1/tests/test_format_api.c?view=diff&rev=298341&r1=298340&r2=298341
==============================================================================
--- team/dvossel/fixtheworld_phase1_step1/tests/test_format_api.c (original)
+++ team/dvossel/fixtheworld_phase1_step1/tests/test_format_api.c Wed Dec 15 11:20:55 2010
@@ -67,11 +67,11 @@
 
 	if ((attr1->samp_flags == attr2->samp_flags) &&
 		!(strcmp(attr1->string, attr2->string))) {
-		return AST_FORMAT_CMP_IDENTICAL;
+		return AST_FORMAT_CMP_SAME;
 	}
 	if ((attr1->samp_flags != (attr1->samp_flags & attr2->samp_flags)) ||
 		(!ast_strlen_zero(attr1->string) && strcmp(attr1->string, attr2->string))) {
-		return AST_FORMAT_CMP_NO_SUBSET;
+		return AST_FORMAT_CMP_NOT_SUBSET;
 	}
 	return AST_FORMAT_CMP_SUBSET;
 }
@@ -226,11 +226,11 @@
 	}
 
 	/* exercise compare functions */
-	if (ast_format_cmp(&format1, &format2) != AST_FORMAT_CMP_NO_SUBSET) {
+	if (ast_format_cmp(&format1, &format2) != AST_FORMAT_CMP_NOT_SUBSET) {
 		ast_test_status_update(test, "cmp 1 failed.\n");
 		return AST_TEST_FAIL;
 	}
-	if (ast_format_cmp(&format1, &format1) != AST_FORMAT_CMP_IDENTICAL) {
+	if (ast_format_cmp(&format1, &format1) != AST_FORMAT_CMP_SAME) {
 		ast_test_status_update(test, "cmp 2 failed.\n");
 		return AST_TEST_FAIL;
 	}




More information about the svn-commits mailing list