[asterisk-commits] dlee: trunk r394050 - /trunk/tests/test_voicemail_api.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jul 10 23:34:51 CDT 2013


Author: dlee
Date: Wed Jul 10 23:34:49 2013
New Revision: 394050

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=394050
Log:
test_voicemail_api: fix warning found by gcc-4.8

The voicemail_api test had code like strncmp(a, b, sizeof(a)), but a was a
char pointer, instead of a literal or char array. This meant that sizeof was
the size of the pointer, not the length of the string.

Since the string is in a stringfield and should be null terminated, I just
changed it to a plain strcmp.

Modified:
    trunk/tests/test_voicemail_api.c

Modified: trunk/tests/test_voicemail_api.c
URL: http://svnview.digium.com/svn/asterisk/trunk/tests/test_voicemail_api.c?view=diff&rev=394050&r1=394049&r2=394050
==============================================================================
--- trunk/tests/test_voicemail_api.c (original)
+++ trunk/tests/test_voicemail_api.c Wed Jul 10 23:34:49 2013
@@ -87,7 +87,7 @@
  * object is test_mbox_snapshot
  */
 #define VM_API_STRING_FIELD_VERIFY(expected, actual) do { \
-	if (strncmp((expected), (actual), sizeof((expected)))) { \
+	if (strcmp((expected), (actual))) { \
 		ast_test_status_update(test, "Test failed for parameter %s: Expected [%s], Actual [%s]\n", #actual, expected, actual); \
 		VM_API_SNAPSHOT_TEST_CLEANUP; \
 		return AST_TEST_FAIL; \




More information about the asterisk-commits mailing list