[asterisk-commits] seanbright: branch group/asterisk-cpp r168434 - /team/group/asterisk-cpp/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Jan 10 22:55:13 CST 2009


Author: seanbright
Date: Sat Jan 10 22:55:12 2009
New Revision: 168434

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=168434
Log:
hashtab.c and dial.c

Modified:
    team/group/asterisk-cpp/main/dial.c
    team/group/asterisk-cpp/main/hashtab.c

Modified: team/group/asterisk-cpp/main/dial.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/main/dial.c?view=diff&rev=168434&r1=168433&r2=168434
==============================================================================
--- team/group/asterisk-cpp/main/dial.c (original)
+++ team/group/asterisk-cpp/main/dial.c Sat Jan 10 22:55:12 2009
@@ -87,7 +87,7 @@
 		return NULL;
 
 	/* Create new data structure */
-	if (!(answer_exec = ast_calloc(1, sizeof(*answer_exec))))
+	if (!(answer_exec = (struct answer_exec_struct *) ast_calloc(1, sizeof(*answer_exec))))
 		return NULL;
 	
 	/* Parse out application and arguments */
@@ -105,7 +105,7 @@
 /*! \brief Disable function for 'ANSWER_EXEC' option */
 static int answer_exec_disable(void *data)
 {
-	struct answer_exec_struct *answer_exec = data;
+	struct answer_exec_struct *answer_exec = (struct answer_exec_struct *) data;
 
 	/* Make sure we have a value */
 	if (!answer_exec)
@@ -123,7 +123,7 @@
 
 static void *music_enable(void *data)
 {
-	return ast_strdup(data);
+	return ast_strdup((const char *) data);
 }
 
 static int music_disable(void *data)
@@ -200,7 +200,7 @@
 	struct ast_dial *dial = NULL;
 
 	/* Allocate new memory for structure */
-	if (!(dial = ast_calloc(1, sizeof(*dial))))
+	if (!(dial = (struct ast_dial *) ast_calloc(1, sizeof(*dial))))
 		return NULL;
 
 	/* Initialize list of channels */
@@ -232,7 +232,7 @@
 		return -1;
 
 	/* Allocate new memory for dialed channel structure */
-	if (!(channel = ast_calloc(1, sizeof(*channel))))
+	if (!(channel = (struct ast_dial_channel *) ast_calloc(1, sizeof(*channel))))
 		return -1;
 
 	/* Record technology and device for when we actually dial */
@@ -329,7 +329,8 @@
 {
 	struct ast_channel *original = channel->owner;
 	char *tmp = ast_strdupa(channel->owner->call_forward);
-	char *tech = "Local", *device = tmp, *stuff;
+	const char *tech = "Local";
+    char *device = tmp, *stuff;
 
 	/* If call forwarding is disabled just drop the original channel and don't attempt to dial the new one */
 	if (FIND_RELATIVE_OPTION(dial, channel, AST_DIAL_OPTION_DISABLE_CALL_FORWARDING)) {
@@ -548,11 +549,11 @@
 		if (chan)
 			ast_indicate(chan, AST_CONTROL_RINGING);
 	} else if (chan && dial->options[AST_DIAL_OPTION_MUSIC] && 
-		!ast_strlen_zero(dial->options[AST_DIAL_OPTION_MUSIC])) {
-		char *original_moh = ast_strdupa(chan->musicclass);
+               !ast_strlen_zero((const char *) dial->options[AST_DIAL_OPTION_MUSIC])) {
+		char *original_moh = (char *) ast_strdupa(chan->musicclass);
 		ast_indicate(chan, -1);
-		ast_string_field_set(chan, musicclass, dial->options[AST_DIAL_OPTION_MUSIC]);
-		ast_moh_start(chan, dial->options[AST_DIAL_OPTION_MUSIC], NULL);
+		ast_string_field_set(chan, musicclass, (const char *) dial->options[AST_DIAL_OPTION_MUSIC]);
+		ast_moh_start(chan, (const char *) dial->options[AST_DIAL_OPTION_MUSIC], NULL);
 		ast_string_field_set(chan, musicclass, original_moh);
 	}
 
@@ -653,14 +654,15 @@
 		}
 		AST_LIST_UNLOCK(&dial->channels);
 		/* If ANSWER_EXEC is enabled as an option, execute application on answered channel */
-		if ((channel = find_relative_dial_channel(dial, who)) && (answer_exec = FIND_RELATIVE_OPTION(dial, channel, AST_DIAL_OPTION_ANSWER_EXEC))) {
+		if ((channel = find_relative_dial_channel(dial, who)) &&
+            (answer_exec = (struct answer_exec_struct *) FIND_RELATIVE_OPTION(dial, channel, AST_DIAL_OPTION_ANSWER_EXEC))) {
 			channel->is_running_app = 1;
 			answer_exec_run(dial, channel, answer_exec->app, answer_exec->args);
 			channel->is_running_app = 0;
 		}
 
 		if (chan && dial->options[AST_DIAL_OPTION_MUSIC] && 
-			!ast_strlen_zero(dial->options[AST_DIAL_OPTION_MUSIC])) {
+			!ast_strlen_zero((const char *) dial->options[AST_DIAL_OPTION_MUSIC])) {
 			ast_moh_stop(chan);
 		}
 	} else if (dial->state == AST_DIAL_RESULT_HANGUP) {
@@ -683,7 +685,7 @@
 /*! \brief Dial async thread function */
 static void *async_dial(void *data)
 {
-	struct ast_dial *dial = data;
+	struct ast_dial *dial = (struct ast_dial *) data;
 
 	/* This is really really simple... we basically pass monitor_dial a NULL owner and it changes it's behavior */
 	monitor_dial(dial, NULL);

Modified: team/group/asterisk-cpp/main/hashtab.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/main/hashtab.c?view=diff&rev=168434&r1=168433&r2=168434
==============================================================================
--- team/group/asterisk-cpp/main/hashtab.c (original)
+++ team/group/asterisk-cpp/main/hashtab.c Sat Jan 10 22:55:12 2009
@@ -45,12 +45,12 @@
 
 int ast_hashtab_compare_strings(const void *a, const void *b)
 {
-	return strcmp(a, b);
+	return strcmp((const char *) a, (const char *) b);
 }
 
 int ast_hashtab_compare_strings_nocase(const void *a, const void *b)
 {
-	return strcasecmp(a, b);
+	return strcasecmp((const char *) a, (const char *) b);
 }
 
 int ast_hashtab_compare_ints(const void *a, const void *b)
@@ -165,7 +165,7 @@
 
 unsigned int ast_hashtab_hash_string_sax(const void *obj) /* from Josh */
 {
-	const unsigned char *str = obj;
+	const unsigned char *str = (const unsigned char *) obj;
 	unsigned int total = 0, c = 0;
 
 	while ((c = *str++))
@@ -176,7 +176,7 @@
 
 unsigned int ast_hashtab_hash_string_nocase(const void *obj)
 {
-	const unsigned char *str = obj;
+	const unsigned char *str = (unsigned char *) obj;
 	unsigned int total;
 
 	for (total = 0; *str; str++) {
@@ -229,9 +229,9 @@
 	struct ast_hashtab *ht;
 
 #if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
-	if (!(ht = __ast_calloc(1, sizeof(*ht), file, lineno, function)))
+	if (!(ht = (struct ast_hashtab *) __ast_calloc(1, sizeof(*ht), file, lineno, function)))
 #else
-	if (!(ht = ast_calloc(1, sizeof(*ht))))
+    if (!(ht = (struct ast_hashtab *) ast_calloc(1, sizeof(*ht))))
 #endif
 		return NULL;
 
@@ -239,9 +239,9 @@
 		initial_buckets++;
 
 #if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
-	if (!(ht->array = __ast_calloc(initial_buckets, sizeof(*(ht->array)), file, lineno, function))) {
+	if (!(ht->array = (struct ast_hashtab_bucket **) __ast_calloc(initial_buckets, sizeof(*(ht->array)), file, lineno, function))) {
 #else
-	if (!(ht->array = ast_calloc(initial_buckets, sizeof(*(ht->array))))) {
+    if (!(ht->array = (struct ast_hashtab_bucket **) ast_calloc(initial_buckets, sizeof(*(ht->array))))) {
 #endif
 		free(ht);
 		return NULL;
@@ -269,12 +269,11 @@
 struct ast_hashtab *ast_hashtab_dup(struct ast_hashtab *tab, void *(*obj_dup_func)(const void *obj))
 {
 	struct ast_hashtab *ht;
-	unsigned int i;
-
-	if (!(ht = ast_calloc(1, sizeof(*ht))))
+
+	if (!(ht = (struct ast_hashtab *) ast_calloc(1, sizeof(*ht))))
 		return NULL;
 
-	if (!(ht->array = ast_calloc(tab->hash_tab_size, sizeof(*(ht->array))))) {
+	if (!(ht->array = (struct ast_hashtab_bucket **) ast_calloc(tab->hash_tab_size, sizeof(*(ht->array))))) {
 		free(ht);
 		return NULL;
 	}
@@ -292,7 +291,7 @@
 	/* now, dup the objects in the buckets and get them into the table */
 	/* the fast way is to use the existing array index, and not have to hash
 	   the objects again */
-	for (i = 0; i < ht->hash_tab_size; i++) {
+	for (int i = 0; i < ht->hash_tab_size; i++) {
 		struct ast_hashtab_bucket *b = tab->array[i];
 		while (b) {
 			void *newobj = (*obj_dup_func)(b->object);
@@ -434,7 +433,7 @@
 	if (c + 1 > tab->largest_bucket_size)
 		tab->largest_bucket_size = c + 1;
 
-	if (!(b = ast_calloc(1, sizeof(*b))))
+	if (!(b = (ast_hashtab_bucket *) ast_calloc(1, sizeof(*b))))
 		return 0;
 
 	b->object = obj;
@@ -604,7 +603,7 @@
 		tab->array[i] = 0; /* erase old ptrs */
 	}
 	free(tab->array);
-	if (!(tab->array = ast_calloc(newsize, sizeof(*(tab->array)))))
+	if (!(tab->array = (struct ast_hashtab_bucket **) ast_calloc(newsize, sizeof(*(tab->array)))))
 		return;
 
 	/* now sort the buckets into their rightful new slots */
@@ -635,7 +634,7 @@
 	/* returns an iterator */
 	struct ast_hashtab_iter *it;
 	
-	if (!(it = ast_calloc(1, sizeof(*it))))
+	if (!(it = (struct ast_hashtab_iter *) ast_calloc(1, sizeof(*it))))
 		return NULL;
 
 	it->next = tab->tlist;
@@ -652,7 +651,7 @@
 	/* returns an iterator */
 	struct ast_hashtab_iter *it;
 	
-	if (!(it = ast_calloc(1, sizeof(*it))))
+	if (!(it = (struct ast_hashtab_iter *) ast_calloc(1, sizeof(*it))))
 		return NULL;
 
 	it->next = tab->tlist;
@@ -699,7 +698,7 @@
 	tlist_del_item(&(tab->tlist), b);
 	
 	obj2 = b->object;
-	b->object = b->next = (void*)2;
+    b->object = b->next = (ast_hashtab_bucket *) 2;
 	free(b); /* free up the hashbucket */
 	tab->hash_tab_elements--;
 #ifdef DEBUG




More information about the asterisk-commits mailing list