[asterisk-commits] mmichelson: branch group/asterisk-cpp r168398 - in /team/group/asterisk-cpp: ...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Jan 10 18:06:06 CST 2009
Author: mmichelson
Date: Sat Jan 10 18:06:06 2009
New Revision: 168398
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=168398
Log:
Get event.c to compile
Modified:
team/group/asterisk-cpp/include/asterisk/taskprocessor.h
team/group/asterisk-cpp/main/event.c
Modified: team/group/asterisk-cpp/include/asterisk/taskprocessor.h
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/include/asterisk/taskprocessor.h?view=diff&rev=168398&r1=168397&r2=168398
==============================================================================
--- team/group/asterisk-cpp/include/asterisk/taskprocessor.h (original)
+++ team/group/asterisk-cpp/include/asterisk/taskprocessor.h Sat Jan 10 18:06:06 2009
@@ -71,7 +71,7 @@
* not already exist
* return A pointer to a reference counted taskprocessor under normal conditions, or NULL if the
* TPS_REF_IF_EXISTS reference type is specified and the taskprocessor does not exist */
-struct ast_taskprocessor *ast_taskprocessor_get(char *name, enum ast_tps_options create);
+struct ast_taskprocessor *ast_taskprocessor_get(const char *name, enum ast_tps_options create);
/*! \brief Unreference the specified taskprocessor and its reference count will decrement.
*
Modified: team/group/asterisk-cpp/main/event.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/main/event.c?view=diff&rev=168398&r1=168397&r2=168398
==============================================================================
--- team/group/asterisk-cpp/main/event.c (original)
+++ team/group/asterisk-cpp/main/event.c Sat Jan 10 18:06:06 2009
@@ -120,7 +120,7 @@
enum ast_event_type type;
const char *name;
} event_names[] = {
- { 0, "" },
+ { (enum ast_event_type) 0, "" },
{ AST_EVENT_CUSTOM, "Custom" },
{ AST_EVENT_MWI, "MWI" },
{ AST_EVENT_SUB, "Subscription" },
@@ -137,7 +137,7 @@
enum ast_event_ie_pltype ie_pltype;
const char *name;
} ie_maps[] = {
- { 0, 0, "" },
+ { (enum ast_event_ie_type) 0, (enum ast_event_ie_pltype) 0, "" },
{ AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_UINT, "NewMessages" },
{ AST_EVENT_IE_OLDMSGS, AST_EVENT_IE_PLTYPE_UINT, "OldMessages" },
{ AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, "Mailbox" },
@@ -166,7 +166,7 @@
int ast_event_str_to_event_type(const char *str, enum ast_event_type *event_type)
{
- int i;
+ size_t i;
for (i = 0; i < ARRAY_LEN(event_names); i++) {
if (strcasecmp(event_names[i].name, str))
@@ -211,7 +211,7 @@
int ast_event_str_to_ie_type(const char *str, enum ast_event_ie_type *ie_type)
{
- int i;
+ size_t i;
for (i = 0; i < ARRAY_LEN(ie_maps); i++) {
if (strcasecmp(ie_maps[i].name, str))
@@ -264,14 +264,14 @@
}
va_start(ap, type);
- for (ie_type = va_arg(ap, enum ast_event_type);
+ for (ie_type = (enum ast_event_ie_type) va_arg(ap, int);
ie_type != AST_EVENT_IE_END;
- ie_type = va_arg(ap, enum ast_event_type))
+ ie_type = (enum ast_event_ie_type) va_arg(ap, int))
{
- struct ast_event_ie_val *ie_value = alloca(sizeof(*ie_value));
+ struct ast_event_ie_val *ie_value = (struct ast_event_ie_val *) alloca(sizeof(*ie_value));
memset(ie_value, 0, sizeof(*ie_value));
ie_value->ie_type = ie_type;
- ie_value->ie_pltype = va_arg(ap, enum ast_event_ie_pltype);
+ ie_value->ie_pltype = (enum ast_event_ie_pltype) va_arg(ap, int);
if (ie_value->ie_pltype == AST_EVENT_IE_PLTYPE_UINT)
ie_value->payload.uint = va_arg(ap, uint32_t);
else if (ie_value->ie_pltype == AST_EVENT_IE_PLTYPE_STR)
@@ -424,7 +424,7 @@
{
struct ast_event *event;
struct ast_event_sub *sub;
- enum ast_event_type event_type = -1;
+ enum ast_event_type event_type = (enum ast_event_type) -1;
struct ast_event_ie_val *ie_val;
if (event_sub->type != AST_EVENT_SUB)
@@ -432,7 +432,7 @@
AST_LIST_TRAVERSE(&event_sub->ie_vals, ie_val, entry) {
if (ie_val->ie_type == AST_EVENT_IE_EVENTTYPE) {
- event_type = ie_val->payload.uint;
+ event_type = (enum ast_event_type) ie_val->payload.uint;
break;
}
}
@@ -467,7 +467,7 @@
return NULL;
}
- if (!(sub = ast_calloc(1, sizeof(*sub))))
+ if (!(sub = (struct ast_event_sub *) ast_calloc(1, sizeof(*sub))))
return NULL;
sub->type = type;
@@ -486,7 +486,7 @@
if (ie_type < 0 || ie_type > AST_EVENT_IE_MAX)
return -1;
- if (!(ie_val = ast_calloc(1, sizeof(*ie_val))))
+ if (!(ie_val = (struct ast_event_ie_val *) ast_calloc(1, sizeof(*ie_val))))
return -1;
ie_val->ie_type = ie_type;
@@ -506,7 +506,7 @@
if (ie_type < 0 || ie_type > AST_EVENT_IE_MAX)
return -1;
- if (!(ie_val = ast_calloc(1, sizeof(*ie_val))))
+ if (!(ie_val = (struct ast_event_ie_val *) ast_calloc(1, sizeof(*ie_val))))
return -1;
ie_val->ie_type = ie_type;
@@ -525,7 +525,7 @@
if (ie_type < 0 || ie_type > AST_EVENT_IE_MAX)
return -1;
- if (!(ie_val = ast_calloc(1, sizeof(*ie_val))))
+ if (!(ie_val = (struct ast_event_ie_val *) ast_calloc(1, sizeof(*ie_val))))
return -1;
ie_val->ie_type = ie_type;
@@ -549,7 +549,7 @@
if (ie_type < 0 || ie_type > AST_EVENT_IE_MAX)
return -1;
- if (!(ie_val = ast_calloc(1, sizeof(*ie_val))))
+ if (!(ie_val = (struct ast_event_ie_val *) ast_calloc(1, sizeof(*ie_val))))
return -1;
ie_val->ie_type = ie_type;
@@ -599,13 +599,13 @@
return NULL;
va_start(ap, userdata);
- for (ie_type = va_arg(ap, enum ast_event_type);
+ for (ie_type = (enum ast_event_ie_type) va_arg(ap, int);
ie_type != AST_EVENT_IE_END;
- ie_type = va_arg(ap, enum ast_event_type))
+ ie_type = (enum ast_event_ie_type) va_arg(ap, int))
{
enum ast_event_ie_pltype ie_pltype;
- ie_pltype = va_arg(ap, enum ast_event_ie_pltype);
+ ie_pltype = (enum ast_event_ie_pltype) va_arg(ap, int);
switch (ie_pltype) {
case AST_EVENT_IE_PLTYPE_UNKNOWN:
@@ -693,7 +693,7 @@
enum ast_event_ie_type ast_event_iterator_get_ie_type(struct ast_event_iterator *iterator)
{
- return ntohs(iterator->ie->ie_type);
+ return (enum ast_event_ie_type) ntohs(iterator->ie->ie_type);
}
uint32_t ast_event_iterator_get_ie_uint(struct ast_event_iterator *iterator)
@@ -713,21 +713,21 @@
enum ast_event_type ast_event_get_type(const struct ast_event *event)
{
- return ntohs(event->type);
+ return (enum ast_event_type) ntohs(event->type);
}
uint32_t ast_event_get_ie_uint(const struct ast_event *event, enum ast_event_ie_type ie_type)
{
const uint32_t *ie_val;
- ie_val = ast_event_get_ie_raw(event, ie_type);
+ ie_val = (uint32_t *) ast_event_get_ie_raw(event, ie_type);
return ie_val ? ntohl(get_unaligned_uint32(ie_val)) : 0;
}
const char *ast_event_get_ie_str(const struct ast_event *event, enum ast_event_ie_type ie_type)
{
- return ast_event_get_ie_raw(event, ie_type);
+ return (const char *) ast_event_get_ie_raw(event, ie_type);
}
const void *ast_event_get_ie_raw(const struct ast_event *event, enum ast_event_ie_type ie_type)
@@ -766,7 +766,7 @@
event_len = ntohs((*event)->event_len);
extra_len = sizeof(*ie) + data_len;
- if (!(*event = ast_realloc(*event, event_len + extra_len)))
+ if (!(*event = (struct ast_event *) ast_realloc(*event, event_len + extra_len)))
return -1;
ie = (struct ast_event_ie *) ( ((char *) *event) + event_len );
@@ -795,14 +795,14 @@
}
va_start(ap, type);
- for (ie_type = va_arg(ap, enum ast_event_type);
- ie_type != AST_EVENT_IE_END;
- ie_type = va_arg(ap, enum ast_event_type))
+ for (ie_type = (enum ast_event_type) va_arg(ap, int);
+ ie_type != (enum ast_event_type) AST_EVENT_IE_END;
+ ie_type = (enum ast_event_type) va_arg(ap, int))
{
- struct ast_event_ie_val *ie_value = alloca(sizeof(*ie_value));
+ struct ast_event_ie_val *ie_value = (struct ast_event_ie_val *) alloca(sizeof(*ie_value));
memset(ie_value, 0, sizeof(*ie_value));
- ie_value->ie_type = ie_type;
- ie_value->ie_pltype = va_arg(ap, enum ast_event_ie_pltype);
+ ie_value->ie_type = (enum ast_event_ie_type) ie_type;
+ ie_value->ie_pltype = (enum ast_event_ie_pltype) va_arg(ap, int);
if (ie_value->ie_pltype == AST_EVENT_IE_PLTYPE_UINT)
ie_value->payload.uint = va_arg(ap, uint32_t);
else if (ie_value->ie_pltype == AST_EVENT_IE_PLTYPE_STR)
@@ -818,7 +818,7 @@
}
va_end(ap);
- if (!(event = ast_calloc(1, sizeof(*event))))
+ if (!(event = (struct ast_event *) ast_calloc(1, sizeof(*event))))
return NULL;
event->type = htons(type);
@@ -863,7 +863,7 @@
event_len = ast_event_get_size(event);
- if (!(dup_event = ast_calloc(1, event_len)))
+ if (!(dup_event = (struct ast_event *) ast_calloc(1, event_len)))
return NULL;
memcpy(dup_event, event, event_len);
@@ -886,14 +886,14 @@
}
va_start(ap, type);
- for (ie_type = va_arg(ap, enum ast_event_type);
+ for (ie_type = (enum ast_event_ie_type) va_arg(ap, int);
ie_type != AST_EVENT_IE_END;
- ie_type = va_arg(ap, enum ast_event_type))
+ ie_type = (enum ast_event_ie_type) va_arg(ap, int))
{
- cache_arg = alloca(sizeof(*cache_arg));
+ cache_arg = (struct ast_event_ie_val *) alloca(sizeof(*cache_arg));
memset(cache_arg, 0, sizeof(*cache_arg));
cache_arg->ie_type = ie_type;
- cache_arg->ie_pltype = va_arg(ap, enum ast_event_ie_pltype);
+ cache_arg->ie_pltype = (enum ast_event_ie_pltype) va_arg(ap, int);
if (cache_arg->ie_pltype == AST_EVENT_IE_PLTYPE_UINT)
cache_arg->payload.uint = va_arg(ap, uint32_t);
else if (cache_arg->ie_pltype == AST_EVENT_IE_PLTYPE_STR)
@@ -942,7 +942,7 @@
if (!(dup_event = ast_event_dup(event)))
return -1;
- if (!(event_ref = ast_calloc(1, sizeof(*event_ref))))
+ if (!(event_ref = (struct ast_event_ref *) ast_calloc(1, sizeof(*event_ref))))
return -1;
event_ref->event = dup_event;
@@ -972,14 +972,14 @@
}
va_start(ap, event);
- for (ie_type = va_arg(ap, enum ast_event_type);
- ie_type != AST_EVENT_IE_END;
- ie_type = va_arg(ap, enum ast_event_type))
+ for (ie_type = (enum ast_event_type) va_arg(ap, int);
+ ie_type != (enum ast_event_type) AST_EVENT_IE_END;
+ ie_type = (enum ast_event_type) va_arg(ap, int))
{
- cache_arg = alloca(sizeof(*cache_arg));
+ cache_arg = (struct ast_event_ie_val *) alloca(sizeof(*cache_arg));
memset(cache_arg, 0, sizeof(*cache_arg));
- cache_arg->ie_type = ie_type;
- cache_arg->ie_pltype = va_arg(ap, enum ast_event_ie_pltype);
+ cache_arg->ie_type = (enum ast_event_ie_type) ie_type;
+ cache_arg->ie_pltype = (enum ast_event_ie_pltype) va_arg(ap, int);
if (cache_arg->ie_pltype == AST_EVENT_IE_PLTYPE_RAW)
cache_arg->raw_datalen = va_arg(ap, size_t);
AST_LIST_INSERT_TAIL(&cache_args, cache_arg, entry);
@@ -1013,7 +1013,7 @@
static int handle_event(void *data)
{
- struct ast_event_ref *event_ref = data;
+ struct ast_event_ref *event_ref = (struct ast_event_ref *) data;
struct ast_event_sub *sub;
uint16_t host_event_type;
@@ -1059,13 +1059,13 @@
}
/* If nobody has subscribed to this event type, throw it away now */
- if (ast_event_check_subscriber(host_event_type, AST_EVENT_IE_END)
+ if (ast_event_check_subscriber((enum ast_event_type) host_event_type, AST_EVENT_IE_END)
== AST_EVENT_SUB_NONE) {
ast_event_destroy(event);
return 0;
}
- if (!(event_ref = ast_calloc(1, sizeof(*event_ref))))
+ if (!(event_ref = (struct ast_event_ref *) ast_calloc(1, sizeof(*event_ref))))
return -1;
event_ref->event = event;
@@ -1083,5 +1083,5 @@
for (i = 0; i < AST_EVENT_TOTAL; i++)
AST_RWLIST_HEAD_INIT(&ast_event_cache[i]);
- event_dispatcher = ast_taskprocessor_get("core_event_dispatcher", 0);
-}
+ event_dispatcher = ast_taskprocessor_get("core_event_dispatcher", (enum ast_tps_options) 0);
+}
More information about the asterisk-commits
mailing list