[asterisk-commits] russell: branch 1.6.0 r106306 - in /branches/1.6.0: ./ main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Mar 5 18:14:32 CST 2008
Author: russell
Date: Wed Mar 5 18:14:32 2008
New Revision: 106306
URL: http://svn.digium.com/view/asterisk?view=rev&rev=106306
Log:
Merged revisions 105840 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r105840 | tilghman | 2008-03-04 17:04:29 -0600 (Tue, 04 Mar 2008) | 2 lines
Whitespace changes only
........
Modified:
branches/1.6.0/ (props changed)
branches/1.6.0/main/alaw.c
branches/1.6.0/main/app.c
branches/1.6.0/main/astobj2.c
branches/1.6.0/main/callerid.c
branches/1.6.0/main/channel.c
branches/1.6.0/main/cli.c
branches/1.6.0/main/config.c
branches/1.6.0/main/cryptostub.c
branches/1.6.0/main/dial.c
branches/1.6.0/main/dlfcn.c
branches/1.6.0/main/dns.c
branches/1.6.0/main/dsp.c
branches/1.6.0/main/enum.c
branches/1.6.0/main/features.c
branches/1.6.0/main/file.c
branches/1.6.0/main/frame.c
branches/1.6.0/main/fskmodem.c
branches/1.6.0/main/image.c
branches/1.6.0/main/jitterbuf.c
branches/1.6.0/main/loader.c
branches/1.6.0/main/logger.c
branches/1.6.0/main/manager.c
branches/1.6.0/main/netsock.c
branches/1.6.0/main/pbx.c
branches/1.6.0/main/poll.c
branches/1.6.0/main/rtp.c
branches/1.6.0/main/say.c
branches/1.6.0/main/strcompat.c
branches/1.6.0/main/tdd.c
branches/1.6.0/main/term.c
branches/1.6.0/main/translate.c
branches/1.6.0/main/utils.c
Propchange: branches/1.6.0/
------------------------------------------------------------------------------
--- trunk-merged (original)
+++ trunk-merged Wed Mar 5 18:14:32 2008
@@ -1,1 +1,1 @@
-/trunk:1-105595,105675,105677,105733-105734,105773,105785,105804,106036,106040,106139
+/trunk:1-105595,105675,105677,105733-105734,105773,105785,105804,105840,106036,106040,106139
Modified: branches/1.6.0/main/alaw.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/alaw.c?view=diff&rev=106306&r1=106305&r2=106306
==============================================================================
--- branches/1.6.0/main/alaw.c (original)
+++ branches/1.6.0/main/alaw.c Wed Mar 5 18:14:32 2008
@@ -34,31 +34,32 @@
static inline unsigned char linear2alaw(short int linear)
{
- int mask;
- int seg;
- int pcm_val;
- static int seg_end[8] =
+ int mask;
+ int seg;
+ int pcm_val;
+ static int seg_end[8] =
{
0xFF, 0x1FF, 0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF
};
-
- pcm_val = linear;
- if (pcm_val >= 0) {
- /* Sign (7th) bit = 1 */
- mask = AMI_MASK | 0x80;
- } else {
- /* Sign bit = 0 */
- mask = AMI_MASK;
- pcm_val = -pcm_val;
- }
-
- /* Convert the scaled magnitude to segment number. */
- for (seg = 0; seg < 8; seg++) {
- if (pcm_val <= seg_end[seg])
- break;
- }
- /* Combine the sign, segment, and quantization bits. */
- return ((seg << 4) | ((pcm_val >> ((seg) ? (seg + 3) : 4)) & 0x0F)) ^ mask;
+
+ pcm_val = linear;
+ if (pcm_val >= 0) {
+ /* Sign (7th) bit = 1 */
+ mask = AMI_MASK | 0x80;
+ } else {
+ /* Sign bit = 0 */
+ mask = AMI_MASK;
+ pcm_val = -pcm_val;
+ }
+
+ /* Convert the scaled magnitude to segment number. */
+ for (seg = 0; seg < 8; seg++) {
+ if (pcm_val <= seg_end[seg]) {
+ break;
+ }
+ }
+ /* Combine the sign, segment, and quantization bits. */
+ return ((seg << 4) | ((pcm_val >> ((seg) ? (seg + 3) : 4)) & 0x0F)) ^ mask;
}
#else
static unsigned char linear2alaw(short sample, int full_coding)
@@ -107,15 +108,16 @@
#ifndef G711_NEW_ALGORITHM
static inline short int alaw2linear (unsigned char alaw)
{
- int i;
- int seg;
-
- alaw ^= AMI_MASK;
- i = ((alaw & 0x0F) << 4) + 8 /* rounding error */;
- seg = (((int) alaw & 0x70) >> 4);
- if (seg)
- i = (i + 0x100) << (seg - 1);
- return (short int) ((alaw & 0x80) ? i : -i);
+ int i;
+ int seg;
+
+ alaw ^= AMI_MASK;
+ i = ((alaw & 0x0F) << 4) + 8 /* rounding error */;
+ seg = (((int) alaw & 0x70) >> 4);
+ if (seg) {
+ i = (i + 0x100) << (seg - 1);
+ }
+ return (short int) ((alaw & 0x80) ? i : -i);
}
#else
static inline short alaw2linear(unsigned char alawbyte)
Modified: branches/1.6.0/main/app.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/app.c?view=diff&rev=106306&r1=106305&r2=106306
==============================================================================
--- branches/1.6.0/main/app.c (original)
+++ branches/1.6.0/main/app.c Wed Mar 5 18:14:32 2008
@@ -78,7 +78,7 @@
if ((ts = ast_get_indication_tone(chan->zone, "dial")) && ts->data[0])
res = ast_playtones_start(chan, 0, ts->data, 0);
else
- ast_log(LOG_NOTICE,"Huh....? no dial for indications?\n");
+ ast_log(LOG_NOTICE, "Huh....? no dial for indications?\n");
for (x = strlen(collect); x < maxlen; ) {
res = ast_waitfordigit(chan, timeout);
@@ -118,7 +118,7 @@
s[0] = '\0';
if (!prompt)
- prompt="";
+ prompt = "";
filename = ast_strdupa(prompt);
while ((front = strsep(&filename, "&"))) {
@@ -274,7 +274,7 @@
if ((res = ast_safe_sleep(chan, between)))
break;
} else
- ast_log(LOG_WARNING, "Illegal DTMF character '%c' in string. (0-9*#aAbBcCdD allowed)\n",*ptr);
+ ast_log(LOG_WARNING, "Illegal DTMF character '%c' in string. (0-9*#aAbBcCdD allowed)\n", *ptr);
}
if (peer) {
@@ -312,16 +312,16 @@
short buf[2048 + AST_FRIENDLY_OFFSET / 2];
struct linear_state *ls = data;
struct ast_frame f = {
- .frametype = AST_FRAME_VOICE,
- .subclass = AST_FORMAT_SLINEAR,
- .data = buf + AST_FRIENDLY_OFFSET / 2,
+ .frametype = AST_FRAME_VOICE,
+ .subclass = AST_FORMAT_SLINEAR,
+ .data = buf + AST_FRIENDLY_OFFSET / 2,
.offset = AST_FRIENDLY_OFFSET,
- };
+ };
int res;
len = samples * 2;
if (len > sizeof(buf) - AST_FRIENDLY_OFFSET) {
- ast_log(LOG_WARNING, "Can't generate %d bytes of data!\n" ,len);
+ ast_log(LOG_WARNING, "Can't generate %d bytes of data!\n" , len);
len = sizeof(buf) - AST_FRIENDLY_OFFSET;
}
res = read(ls->fd, buf + AST_FRIENDLY_OFFSET/2, len);
@@ -430,7 +430,7 @@
res = ast_answer(chan);
if (file) {
- if ((end = strchr(file,':'))) {
+ if ((end = strchr(file, ':'))) {
if (!strcasecmp(end, ":end")) {
*end = '\0';
end++;
@@ -974,7 +974,7 @@
ast_free(gi);
}
}
- AST_RWLIST_TRAVERSE_SAFE_END;
+ AST_RWLIST_TRAVERSE_SAFE_END;
AST_RWLIST_UNLOCK(&groups);
return 0;
@@ -1161,7 +1161,7 @@
time(&start);
while ((
#ifdef SOLARIS
- (res = fcntl(pl->fd, F_SETLK, fcntl(pl->fd,F_GETFL)|O_NONBLOCK)) < 0) &&
+ (res = fcntl(pl->fd, F_SETLK, fcntl(pl->fd, F_GETFL) | O_NONBLOCK)) < 0) &&
#else
(res = flock(pl->fd, LOCK_EX | LOCK_NB)) < 0) &&
#endif
Modified: branches/1.6.0/main/astobj2.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/astobj2.c?view=diff&rev=106306&r1=106305&r2=106306
==============================================================================
--- branches/1.6.0/main/astobj2.c (original)
+++ branches/1.6.0/main/astobj2.c Wed Mar 5 18:14:32 2008
@@ -81,18 +81,18 @@
void ao2_bt(void)
{
- int c, i;
+ int c, i;
#define N1 20
- void *addresses[N1];
- char **strings;
-
- c = backtrace(addresses, N1);
- strings = backtrace_symbols(addresses,c);
- ast_verbose("backtrace returned: %d\n", c);
- for(i = 0; i < c; i++) {
- ast_verbose("%d: %p %s\n", i, addresses[i], strings[i]);
- }
- free(strings);
+ void *addresses[N1];
+ char **strings;
+
+ c = backtrace(addresses, N1);
+ strings = backtrace_symbols(addresses,c);
+ ast_verbose("backtrace returned: %d\n", c);
+ for(i = 0; i < c; i++) {
+ ast_verbose("%d: %p %s\n", i, addresses[i], strings[i]);
+ }
+ free(strings);
}
#endif
Modified: branches/1.6.0/main/callerid.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/callerid.c?view=diff&rev=106306&r1=106305&r2=106306
==============================================================================
--- branches/1.6.0/main/callerid.c (original)
+++ branches/1.6.0/main/callerid.c Wed Mar 5 18:14:32 2008
@@ -412,7 +412,7 @@
/* length */
x++;
/* number type */
- switch (cid->rawdata[x]) {
+ switch (cid->rawdata[x]) {
case 0x00: /* unknown */
case 0x01: /* international number */
case 0x02: /* domestic number */
@@ -451,8 +451,8 @@
case 'O': /* service not available */
case 'C': /* pay phone */
case 'S': /* service congested */
- cid->flags |= CID_UNKNOWN_NUMBER;
- ast_debug(2, "no cid reason:%c\n",cid->rawdata[x]);
+ cid->flags |= CID_UNKNOWN_NUMBER;
+ ast_debug(2, "no cid reason:%c\n", cid->rawdata[x]);
break ;
}
x++;
@@ -483,7 +483,7 @@
x++;
/* numbering plan octed 4 */
x++;
- /* numbering plan octed 5 */
+ /* numbering plan octed 5 */
switch (cid->rawdata[x]) {
case 0x00: /* unknown */
case 0x01: /* recommendation E.164 ISDN */
@@ -772,7 +772,7 @@
int vmwi_generate(unsigned char *buf, int active, int mdmf, int codec)
{
unsigned char msg[256];
- int len=0;
+ int len = 0;
int sum;
int x;
int bytes = 0;
@@ -834,7 +834,7 @@
int callerid_generate(unsigned char *buf, const char *number, const char *name, int flags, int callwaiting, int codec)
{
- int bytes=0;
+ int bytes = 0;
int x, sum;
int len;
@@ -881,7 +881,7 @@
*/
void ast_shrink_phone_number(char *n)
{
- int x, y=0;
+ int x, y = 0;
int bracketed = 0;
for (x = 0; n[x]; x++) {
Modified: branches/1.6.0/main/channel.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/channel.c?view=diff&rev=106306&r1=106305&r2=106306
==============================================================================
--- branches/1.6.0/main/channel.c (original)
+++ branches/1.6.0/main/channel.c Wed Mar 5 18:14:32 2008
@@ -124,7 +124,7 @@
static AST_LIST_HEAD_NOLOCK_STATIC(backends, chanlist);
/*! \brief the list of channels we have. Note that the lock for this list is used for
- both the channels list and the backends list. */
+ both the channels list and the backends list. */
static AST_RWLIST_HEAD_STATIC(channels, ast_channel);
/*! \brief map AST_CAUSE's to readable string representations
@@ -3400,8 +3400,8 @@
\brief Transfer a call to dest, if the channel supports transfer
Called by:
- \arg app_transfer
- \arg the manager interface
+ \arg app_transfer
+ \arg the manager interface
*/
int ast_transfer(struct ast_channel *chan, char *dest)
{
Modified: branches/1.6.0/main/cli.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/cli.c?view=diff&rev=106306&r1=106305&r2=106306
==============================================================================
--- branches/1.6.0/main/cli.c (original)
+++ branches/1.6.0/main/cli.c Wed Mar 5 18:14:32 2008
@@ -509,7 +509,7 @@
int printsec;
switch (cmd) {
- case CLI_INIT:
+ case CLI_INIT:
e->command = "core show uptime [seconds]";
e->usage =
"Usage: core show uptime [seconds]\n"
Modified: branches/1.6.0/main/config.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/config.c?view=diff&rev=106306&r1=106305&r2=106306
==============================================================================
--- branches/1.6.0/main/config.c (original)
+++ branches/1.6.0/main/config.c Wed Mar 5 18:14:32 2008
@@ -150,7 +150,7 @@
total += tmp; /* multiply by 3 */
total <<= 2; /* multiply by 12 */
total += tmp; /* multiply by 13 */
-
+
total += ((unsigned int)(*str));
}
if (total < 0)
@@ -242,9 +242,9 @@
struct ast_config_include *ast_include_new(struct ast_config *conf, const char *from_file, const char *included_file, int is_exec, const char *exec_file, int from_lineno, char *real_included_file_name, int real_included_file_name_size)
{
/* a file should be included ONCE. Otherwise, if one of the instances is changed,
- then all be changed. -- how do we know to include it? -- Handling modified
- instances is possible, I'd have
- to create a new master for each instance. */
+ * then all be changed. -- how do we know to include it? -- Handling modified
+ * instances is possible, I'd have
+ * to create a new master for each instance. */
struct ast_config_include *inc;
struct stat statbuf;
@@ -290,13 +290,13 @@
return;
/* the manager code allows you to read in one config file, then
- write it back out under a different name. But, the new arrangement
- ties output lines to the file name. So, before you try to write
- the config file to disk, better riffle thru the data and make sure
- the file names are changed.
- */
+ * write it back out under a different name. But, the new arrangement
+ * ties output lines to the file name. So, before you try to write
+ * the config file to disk, better riffle thru the data and make sure
+ * the file names are changed.
+ */
/* file names are on categories, includes (of course), and on variables. So,
- traverse all this and swap names */
+ * traverse all this and swap names */
for (incl = conf->includes; incl; incl=incl->next) {
if (strcmp(incl->include_location_file,from_file) == 0) {
@@ -2154,7 +2154,7 @@
* See documentation in config.h
*/
int ast_parse_arg(const char *arg, enum ast_parse_flags flags,
- void *p_result, ...)
+ void *p_result, ...)
{
va_list ap;
int error = 0;
Modified: branches/1.6.0/main/cryptostub.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/cryptostub.c?view=diff&rev=106306&r1=106305&r2=106306
==============================================================================
--- branches/1.6.0/main/cryptostub.c (original)
+++ branches/1.6.0/main/cryptostub.c Wed Mar 5 18:14:32 2008
@@ -39,22 +39,22 @@
#define build_stub(func_name,...) \
static int stub_ ## func_name(__VA_ARGS__) \
{ \
- ast_log(LOG_NOTICE, "Crypto support not loaded!\n"); \
- return -1; \
+ ast_log(LOG_NOTICE, "Crypto support not loaded!\n"); \
+ return -1; \
} \
\
int (*func_name)(__VA_ARGS__) = \
- stub_ ## func_name;
+ stub_ ## func_name;
#endif
#define build_stub(func_name,...) \
static int stub_##func_name(__VA_ARGS__) \
{ \
- ast_log(LOG_NOTICE, "Crypto support not loaded!\n"); \
- return -1; \
+ ast_log(LOG_NOTICE, "Crypto support not loaded!\n"); \
+ return -1; \
} \
\
int (*func_name)(__VA_ARGS__) = \
- stub_##func_name;
+ stub_##func_name;
struct ast_key *(*ast_key_get)(const char *key, int type) =
stub_ast_key_get;
Modified: branches/1.6.0/main/dial.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/dial.c?view=diff&rev=106306&r1=106305&r2=106306
==============================================================================
--- branches/1.6.0/main/dial.c (original)
+++ branches/1.6.0/main/dial.c Wed Mar 5 18:14:32 2008
@@ -174,12 +174,13 @@
};
/*! \brief free the buffer if allocated, and set the pointer to the second arg */
-#define S_REPLACE(s, new_val) \
- do { \
- if (s) \
- free(s); \
- s = (new_val); \
- } while (0)
+#define S_REPLACE(s, new_val) \
+ do { \
+ if (s) { \
+ free(s); \
+ } \
+ s = (new_val); \
+ } while (0)
/*! \brief Maximum number of channels we can watch at a time */
#define AST_MAX_WATCHERS 256
@@ -871,7 +872,7 @@
}
AST_LIST_TRAVERSE_SAFE_END;
AST_LIST_UNLOCK(&dial->channels);
-
+
/* Disable any enabled options globally */
for (i = 0; i < AST_DIAL_OPTION_MAX; i++) {
if (!dial->options[i])
@@ -954,7 +955,7 @@
if (channel->options[option])
return -1;
- /* Execute enable callback if it exists, if not simply make sure the value is set */
+ /* Execute enable callback if it exists, if not simply make sure the value is set */
if (option_types[option].enable)
channel->options[option] = option_types[option].enable(data);
else
@@ -970,9 +971,10 @@
*/
int ast_dial_option_global_disable(struct ast_dial *dial, enum ast_dial_option option)
{
- /* If the option is not enabled, return failure */
- if (!dial->options[option])
- return -1;
+ /* If the option is not enabled, return failure */
+ if (!dial->options[option]) {
+ return -1;
+ }
/* Execute callback of option to disable if it exists */
if (option_types[option].disable)
@@ -981,7 +983,7 @@
/* Finally disable option on the structure */
dial->options[option] = NULL;
- return 0;
+ return 0;
}
/*! \brief Disables an option per channel
Modified: branches/1.6.0/main/dlfcn.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/dlfcn.c?view=diff&rev=106306&r1=106305&r2=106306
==============================================================================
--- branches/1.6.0/main/dlfcn.c (original)
+++ branches/1.6.0/main/dlfcn.c Wed Mar 5 18:14:32 2008
@@ -1,7 +1,7 @@
/*
Copyright (c) 2002 Jorge Acereda <jacereda at users.sourceforge.net> &
Peter O'Gorman <ogorman at users.sourceforge.net>
-
+
Portions may be copyright others, see the AUTHORS file included with this
distribution.
@@ -544,10 +544,9 @@
const char *dyldfile;
const char* retStr = NULL;
NSLinkEditError(&dylder, &dylderno, &dyldfile, &dylderrstr);
- if (dylderrstr && strlen(dylderrstr))
- {
- retStr = ast_malloc(strlen(dylderrstr) +1);
- strcpy((char*)retStr,dylderrstr);
+ if (dylderrstr && strlen(dylderrstr)) {
+ retStr = ast_malloc(strlen(dylderrstr) + 1);
+ strcpy((char*)retStr, dylderrstr);
}
return retStr;
}
@@ -564,51 +563,41 @@
#endif
if (NULL == dls)
dls = RTLD_SELF;
- if ((RTLD_NEXT == dls) || (RTLD_SELF == dls))
- {
- if (dyld_NSIsSymbolNameDefinedInImage && dyld_NSLookupSymbolInImage)
- {
+ if ((RTLD_NEXT == dls) || (RTLD_SELF == dls)) {
+ if (dyld_NSIsSymbolNameDefinedInImage && dyld_NSLookupSymbolInImage) {
caller_mh = image_for_address(caller);
- if (RTLD_SELF == dls)
- {
+ if (RTLD_SELF == dls) {
/* FIXME: We should be using the NSModule api, if SELF is an MH_BUNDLE
* But it appears to work anyway, and looking at the code in dyld_libfuncs.c
* this is acceptable.
*/
- if (dyld_NSIsSymbolNameDefinedInImage(caller_mh, symbol))
- {
+ if (dyld_NSIsSymbolNameDefinedInImage(caller_mh, symbol)) {
nssym = dyld_NSLookupSymbolInImage(caller_mh,
symbol,
NSLOOKUPSYMBOLINIMAGE_OPTION_BIND |
NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
}
}
- if (!nssym)
- {
+ if (!nssym) {
if (RTLD_SELF == dls)
savedErrorStr = dyld_error_str();
nssym = search_linked_libs(caller_mh, symbol);
}
- }
- else
- {
+ } else {
if (canSetError)
error("RTLD_SELF and RTLD_NEXT are not supported");
return NULL;
}
}
- if (!nssym)
- {
-
- if (RTLD_DEFAULT == dls)
- {
+ if (!nssym) {
+
+ if (RTLD_DEFAULT == dls) {
dls = &mainStatus;
}
if (!isValidStatus(dls))
return NULL;
- if (dls->module != MAGIC_DYLIB_MOD)
- {
+ if (dls->module != MAGIC_DYLIB_MOD) {
nssym = NSLookupSymbolInModule(dls->module, symbol);
if (!nssym && NSIsSymbolNameDefined(symbol))
{
@@ -616,58 +605,43 @@
savedErrorStr = dyld_error_str();
nssym = search_linked_libs(get_mach_header_from_NSModule(dls->module), symbol);
}
- }
- else if (dls->lib && dyld_NSIsSymbolNameDefinedInImage && dyld_NSLookupSymbolInImage)
- {
- if (dyld_NSIsSymbolNameDefinedInImage(dls->lib, symbol))
- {
+ } else if (dls->lib && dyld_NSIsSymbolNameDefinedInImage && dyld_NSLookupSymbolInImage) {
+ if (dyld_NSIsSymbolNameDefinedInImage(dls->lib, symbol)) {
nssym = dyld_NSLookupSymbolInImage(dls->lib,
symbol,
NSLOOKUPSYMBOLINIMAGE_OPTION_BIND |
NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
- }
- else if (NSIsSymbolNameDefined(symbol))
- {
+ } else if (NSIsSymbolNameDefined(symbol)) {
debug("Searching dependencies");
savedErrorStr = dyld_error_str();
nssym = search_linked_libs(dls->lib, symbol);
}
- }
- else if (dls->module == MAGIC_DYLIB_MOD)
- {
+ } else if (dls->module == MAGIC_DYLIB_MOD) {
/* Global context, use NSLookupAndBindSymbol */
- if (NSIsSymbolNameDefined(symbol))
- {
+ if (NSIsSymbolNameDefined(symbol)) {
/* There doesn't seem to be a return on error option for this call???
this is potentially broken, if binding fails, it will improperly
exit the application. */
nssym = NSLookupAndBindSymbol(symbol);
- }
- else
- {
+ } else {
if (savedErrorStr)
ast_free(savedErrorStr);
savedErrorStr = ast_malloc(256);
- snprintf((char*)savedErrorStr, 256, "Symbol \"%s\" not in global context",symbol);
+ snprintf((char*)savedErrorStr, 256, "Symbol \"%s\" not in global context", symbol);
}
}
}
/* Error reporting */
- if (!nssym)
- {
- if (!savedErrorStr || !strlen(savedErrorStr))
- {
+ if (!nssym) {
+ if (!savedErrorStr || !strlen(savedErrorStr)) {
if (savedErrorStr)
ast_free(savedErrorStr);
savedErrorStr = ast_malloc(256);
- snprintf((char*)savedErrorStr, 256,"Symbol \"%s\" not found",symbol);
- }
- if (canSetError)
- {
+ snprintf((char*)savedErrorStr, 256, "Symbol \"%s\" not found", symbol);
+ }
+ if (canSetError) {
error(savedErrorStr);
- }
- else
- {
+ } else {
debug(savedErrorStr);
}
if (savedErrorStr)
@@ -688,57 +662,48 @@
const char *file;
void (*init) (void);
ofirc = NSCreateObjectFileImageFromFile(path, &ofi);
- switch (ofirc)
- {
- case NSObjectFileImageSuccess:
- break;
- case NSObjectFileImageInappropriateFile:
- if (dyld_NSAddImage && dyld_NSIsSymbolNameDefinedInImage && dyld_NSLookupSymbolInImage)
- {
- if (!isFlagSet(mode, RTLD_GLOBAL))
- {
- warning("trying to open a .dylib with RTLD_LOCAL");
- error("unable to open this file with RTLD_LOCAL");
- return NULL;
- }
- }
- else
- {
- error("opening this file is unsupported on this system");
+ switch (ofirc) {
+ case NSObjectFileImageSuccess:
+ break;
+ case NSObjectFileImageInappropriateFile:
+ if (dyld_NSAddImage && dyld_NSIsSymbolNameDefinedInImage && dyld_NSLookupSymbolInImage) {
+ if (!isFlagSet(mode, RTLD_GLOBAL)) {
+ warning("trying to open a .dylib with RTLD_LOCAL");
+ error("unable to open this file with RTLD_LOCAL");
return NULL;
}
- break;
- case NSObjectFileImageFailure:
- error("object file setup failure");
+ } else {
+ error("opening this file is unsupported on this system");
return NULL;
- case NSObjectFileImageArch:
- error("no object for this architecture");
- return NULL;
- case NSObjectFileImageFormat:
- error("bad object file format");
- return NULL;
- case NSObjectFileImageAccess:
- error("can't read object file");
- return NULL;
- default:
- error("unknown error from NSCreateObjectFileImageFromFile()");
- return NULL;
+ }
+ break;
+ case NSObjectFileImageFailure:
+ error("object file setup failure");
+ return NULL;
+ case NSObjectFileImageArch:
+ error("no object for this architecture");
+ return NULL;
+ case NSObjectFileImageFormat:
+ error("bad object file format");
+ return NULL;
+ case NSObjectFileImageAccess:
+ error("can't read object file");
+ return NULL;
+ default:
+ error("unknown error from NSCreateObjectFileImageFromFile()");
+ return NULL;
}
dls = lookupStatus(sbuf);
- if (!dls)
- {
+ if (!dls) {
dls = allocStatus();
}
- if (!dls)
- {
+ if (!dls) {
error("unable to allocate memory");
return NULL;
}
dls->lib = 0;
- if (ofirc == NSObjectFileImageInappropriateFile)
- {
- if ((dls->lib = dyld_NSAddImage(path, NSADDIMAGE_OPTION_RETURN_ON_ERROR)))
- {
+ if (ofirc == NSObjectFileImageInappropriateFile) {
+ if ((dls->lib = dyld_NSAddImage(path, NSADDIMAGE_OPTION_RETURN_ON_ERROR))) {
debug("Dynamic lib loaded at %ld", dls->lib);
ofi = MAGIC_DYLIB_OFI;
dls->module = MAGIC_DYLIB_MOD;
@@ -746,8 +711,7 @@
/* Although it is possible with a bit of work to modify this so it works and
functions with RTLD_NOW, I don't deem it necessary at the moment */
}
- if (!(dls->module))
- {
+ if (!(dls->module)) {
NSLinkEditError(&ler, &lerno, &file, &errstr);
if (!errstr || (!strlen(errstr)))
error("Can't open this file type");
@@ -759,24 +723,19 @@
}
return NULL;
}
- }
- else
- {
+ } else {
dls->module = NSLinkModule(ofi, path,
NSLINKMODULE_OPTION_RETURN_ON_ERROR |
NSLINKMODULE_OPTION_PRIVATE |
(isFlagSet(mode, RTLD_NOW) ? NSLINKMODULE_OPTION_BINDNOW : 0));
NSDestroyObjectFileImage(ofi);
- if (dls->module)
- {
+ if (dls->module) {
dls->lib = get_mach_header_from_NSModule(dls->module);
}
}
- if (!dls->module)
- {
+ if (!dls->module) {
NSLinkEditError(&ler, &lerno, &file, &errstr);
- if ((dls->flags & DL_IN_LIST) == 0)
- {
+ if ((dls->flags & DL_IN_LIST) == 0) {
ast_free(dls);
}
error(errstr);
@@ -785,8 +744,7 @@
insertStatus(dls, sbuf);
dls = reference(dls, mode);
- if ((init = dlsymIntern(dls, "__init", 0)))
- {
+ if ((init = dlsymIntern(dls, "__init", 0))) {
debug("calling _init()");
init();
}
@@ -796,8 +754,7 @@
static void dlcompat_init_func(void)
{
static int inited = 0;
- if (!inited)
- {
+ if (!inited) {
inited = 1;
_dyld_func_lookup("__dyld_NSAddImage", (unsigned long *)&dyld_NSAddImage);
_dyld_func_lookup("__dyld_NSIsSymbolNameDefinedInImage",
@@ -830,8 +787,7 @@
pthread_mutex_destroy(&dlcompat_mutex);
pthread_key_delete(dlerror_key);
next = stqueue;
- while (next && (next != &mainStatus))
- {
+ while (next && (next != &mainStatus)) {
dls = next;
next = dls->next;
ast_free(dls);
@@ -859,20 +815,18 @@
int err = 0;
struct dlthread *tss;
tss = pthread_getspecific(dlerror_key);
- if (!tss)
- {
+ if (!tss) {
tss = ast_malloc(sizeof(*tss));
tss->lockcnt = 0;
tss->errset = 0;
- if (pthread_setspecific(dlerror_key, tss))
- {
- fprintf(stderr,"dlcompat: pthread_setspecific failed\n");
+ if (pthread_setspecific(dlerror_key, tss)) {
+ fprintf(stderr, "dlcompat: pthread_setspecific failed\n");
exit(1);
}
}
if (!tss->lockcnt)
err = pthread_mutex_lock(&dlcompat_mutex);
- tss->lockcnt = tss->lockcnt +1;
+ tss->lockcnt = tss->lockcnt + 1;
if (err)
exit(err);
}
@@ -897,41 +851,36 @@
dlcompat_init_func(); /* Just in case */
dolock();
resetdlerror();
- if (!path)
- {
+ if (!path) {
dls = &mainStatus;
goto dlopenok;
}
- if (!(sbuf = findFile(path, &fullPath)))
- {
+ if (!(sbuf = findFile(path, &fullPath))) {
error("file \"%s\" not found", path);
goto dlopenerror;
}
/* Now checks that it hasn't been closed already */
- if ((dls = lookupStatus(sbuf)) && (dls->refs > 0))
- {
+ if ((dls = lookupStatus(sbuf)) && (dls->refs > 0)) {
/* debug("status found"); */
dls = reference(dls, mode);
goto dlopenok;
}
#ifdef RTLD_NOLOAD
- if (isFlagSet(mode, RTLD_NOLOAD))
- {
+ if (isFlagSet(mode, RTLD_NOLOAD)) {
error("no existing handle and RTLD_NOLOAD specified");
goto dlopenerror;
}
#endif
- if (isFlagSet(mode, RTLD_LAZY) && isFlagSet(mode, RTLD_NOW))
- {
+ if (isFlagSet(mode, RTLD_LAZY) && isFlagSet(mode, RTLD_NOW)) {
error("how can I load something both RTLD_LAZY and RTLD_NOW?");
goto dlopenerror;
}
dls = loadModule(fullPath, sbuf, mode);
- dlopenok:
+dlopenok:
dounlock();
return (void *)dls;
- dlopenerror:
+dlopenerror:
dounlock();
return NULL;
}
@@ -944,20 +893,17 @@
char *malloc_sym = NULL;
dolock();
malloc_sym = ast_malloc(sym_len + 2);
- if (malloc_sym)
- {
+ if (malloc_sym) {
sprintf(malloc_sym, "_%s", symbol);
value = dlsymIntern(handle, malloc_sym, 1);
ast_free(malloc_sym);
- }
- else
- {
+ } else {
error("Unable to allocate memory");
goto dlsymerror;
}
dounlock();
return value;
- dlsymerror:
+dlsymerror:
dounlock();
return NULL;
}
@@ -989,14 +935,11 @@
void *value = NULL;
char *malloc_sym = NULL;
malloc_sym = ast_malloc(sym_len + 2);
- if (malloc_sym)
- {
+ if (malloc_sym) {
sprintf(malloc_sym, "_%s", symbol);
value = dlsymIntern(handle, malloc_sym, 1);
ast_free(malloc_sym);
- }
- else
- {
+ } else {
error("Unable to allocate memory");
}
return value;
@@ -1038,37 +981,29 @@
struct dlstatus *dls = handle;
dolock();
resetdlerror();
- if (!isValidStatus(dls))
- {
+ if (!isValidStatus(dls)) {
goto dlcloseerror;
}
- if (dls->module == MAGIC_DYLIB_MOD)
- {
+ if (dls->module == MAGIC_DYLIB_MOD) {
const char *name;
- if (!dls->lib)
- {
+ if (!dls->lib) {
name = "global context";
- }
- else
- {
+ } else {
name = get_lib_name(dls->lib);
}
warning("trying to close a .dylib!");
error("Not closing \"%s\" - dynamic libraries cannot be closed", name);
goto dlcloseerror;
}
- if (!dls->module)
- {
+ if (!dls->module) {
error("module already closed");
goto dlcloseerror;
}
- if (dls->refs == 1)
- {
+ if (dls->refs == 1) {
unsigned long options = 0;
void (*fini) (void);
- if ((fini = dlsymIntern(dls, "__fini", 0)))
- {
+ if ((fini = dlsymIntern(dls, "__fini", 0))) {
debug("calling _fini()");
fini();
}
@@ -1083,8 +1018,7 @@
*/
if ((const struct section *)NULL !=
getsectbynamefromheader(get_mach_header_from_NSModule(dls->module),
- "__DATA", "__mod_term_func"))
- {
+ "__DATA", "__mod_term_func")) {
options |= NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED;
}
#endif
@@ -1092,8 +1026,7 @@
if (isFlagSet(dls->mode, RTLD_NODELETE))
options |= NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED;
#endif
- if (!NSUnLinkModule(dls->module, options))
- {
+ if (!NSUnLinkModule(dls->module, options)) {
error("unable to unlink module");
goto dlcloseerror;
}
@@ -1106,7 +1039,7 @@
}
dounlock();
return 0;
- dlcloseerror:
+dlcloseerror:
dounlock();
return 1;
}
@@ -1135,27 +1068,23 @@
struct mach_header *mh = 0;
struct load_command *lc = 0;
unsigned long addr = NULL;
- for (i = 0; i < count; i++)
- {
+ for (i = 0; i < count; i++) {
addr = (unsigned long)address - _dyld_get_image_vmaddr_slide(i);
mh = _dyld_get_image_header(i);
- if (mh)
- {
+ if (mh) {
lc = (struct load_command *)((char *)mh + sizeof(struct mach_header));
- for (j = 0; j < mh->ncmds; j++, lc = (struct load_command *)((char *)lc + lc->cmdsize))
- {
+ for (j = 0; j < mh->ncmds; j++, lc = (struct load_command *)((char *)lc + lc->cmdsize)) {
if (LC_SEGMENT == lc->cmd &&
addr >= ((struct segment_command *)lc)->vmaddr &&
addr <
- ((struct segment_command *)lc)->vmaddr + ((struct segment_command *)lc)->vmsize)
- {
+ ((struct segment_command *)lc)->vmaddr + ((struct segment_command *)lc)->vmsize) {
goto image_found;
}
}
}
mh = 0;
}
- image_found:
+image_found:
return mh;
}
@@ -1183,20 +1112,16 @@
/* Some of this was swiped from code posted by Douglas Davidson <ddavidso AT apple DOT com>
* to darwin-development AT lists DOT apple DOT com and slightly modified
*/
- for (i = 0; i < count; i++)
- {
+ for (i = 0; i < count; i++) {
addr = (unsigned long)p - _dyld_get_image_vmaddr_slide(i);
mh = _dyld_get_image_header(i);
- if (mh)
- {
+ if (mh) {
lc = (struct load_command *)((char *)mh + sizeof(struct mach_header));
- for (j = 0; j < mh->ncmds; j++, lc = (struct load_command *)((char *)lc + lc->cmdsize))
- {
+ for (j = 0; j < mh->ncmds; j++, lc = (struct load_command *)((char *)lc + lc->cmdsize)) {
if (LC_SEGMENT == lc->cmd &&
addr >= ((struct segment_command *)lc)->vmaddr &&
addr <
- ((struct segment_command *)lc)->vmaddr + ((struct segment_command *)lc)->vmsize)
- {
+ ((struct segment_command *)lc)->vmaddr + ((struct segment_command *)lc)->vmsize) {
info->dli_fname = _dyld_get_image_name(i);
info->dli_fbase = (void *)mh;
found = 1;
@@ -1207,16 +1132,13 @@
break;
}
}
- if (!found)
- {
+ if (!found) {
dounlock();
return 0;
}
lc = (struct load_command *)((char *)mh + sizeof(struct mach_header));
- for (j = 0; j < mh->ncmds; j++, lc = (struct load_command *)((char *)lc + lc->cmdsize))
- {
- if (LC_SEGMENT == lc->cmd)
- {
+ for (j = 0; j < mh->ncmds; j++, lc = (struct load_command *)((char *)lc + lc->cmdsize)) {
+ if (LC_SEGMENT == lc->cmd) {
if (!strcmp(((struct segment_command *)lc)->segname, "__LINKEDIT"))
break;
}
@@ -1227,10 +1149,8 @@
debug("table off %x", table_off);
lc = (struct load_command *)((char *)mh + sizeof(struct mach_header));
- for (j = 0; j < mh->ncmds; j++, lc = (struct load_command *)((char *)lc + lc->cmdsize))
- {
- if (LC_SYMTAB == lc->cmd)
- {
+ for (j = 0; j < mh->ncmds; j++, lc = (struct load_command *)((char *)lc + lc->cmdsize)) {
+ if (LC_SYMTAB == lc->cmd) {
struct nlist *symtable = (struct nlist *)(((struct symtab_command *)lc)->symoff + table_off);
unsigned long numsyms = ((struct symtab_command *)lc)->nsyms;
@@ -1238,26 +1158,22 @@
unsigned long diff = 0xffffffff;
unsigned long strtable = (unsigned long)(((struct symtab_command *)lc)->stroff + table_off);
debug("symtable %x", symtable);
- for (i = 0; i < numsyms; i++)
- {
+ for (i = 0; i < numsyms; i++) {
/* Ignore the following kinds of Symbols */
- if ((!symtable->n_value) /* Undefined */
- || (symtable->n_type >= N_PEXT) /* Debug symbol */
- || (!(symtable->n_type & N_EXT)) /* Local Symbol */
- )
- {
+ if ((!symtable->n_value) /* Undefined */
+ || (symtable->n_type >= N_PEXT) /* Debug symbol */
+ || (!(symtable->n_type & N_EXT)) /* Local Symbol */
+ ) {
symtable++;
continue;
}
- if ((addr >= symtable->n_value) && (diff >= (symtable->n_value - addr)))
- {
+ if ((addr >= symtable->n_value) && (diff >= (symtable->n_value - addr))) {
diff = (unsigned long)symtable->n_value - addr;
nearest = symtable;
}
symtable++;
}
- if (nearest)
- {
+ if (nearest) {
info->dli_saddr = nearest->n_value + ((void *)p - addr);
info->dli_sname = (char *)(strtable + nearest->n_un.n_strx);
}
Modified: branches/1.6.0/main/dns.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/dns.c?view=diff&rev=106306&r1=106305&r2=106306
==============================================================================
--- branches/1.6.0/main/dns.c (original)
+++ branches/1.6.0/main/dns.c Wed Mar 5 18:14:32 2008
@@ -274,12 +274,10 @@
if ((res = dns_parse_answer(context, class, type, answer, res, callback)) < 0) {
ast_log(LOG_WARNING, "DNS Parse error for %s\n", dname);
ret = -1;
- }
- else if (res == 0) {
+ } else if (res == 0) {
ast_debug(1, "No matches found in DNS for %s\n", dname);
ret = 0;
- }
- else
+ } else
ret = 1;
}
#ifdef HAVE_RES_NINIT
Modified: branches/1.6.0/main/dsp.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/dsp.c?view=diff&rev=106306&r1=106305&r2=106306
==============================================================================
--- branches/1.6.0/main/dsp.c (original)
+++ branches/1.6.0/main/dsp.c Wed Mar 5 18:14:32 2008
@@ -30,14 +30,14 @@
/* Some routines from tone_detect.c by Steven Underwood as published under the zapata library */
/*
tone_detect.c - General telephony tone detection, and specific
- detection of DTMF.
-
- Copyright (C) 2001 Steve Underwood <steveu at coppice.org>
-
- Despite my general liking of the GPL, I place this code in the
- public domain for the benefit of all mankind - even the slimy
- ones who might try to proprietize my work and use it to my
- detriment.
+ detection of DTMF.
+
+ Copyright (C) 2001 Steve Underwood <steveu at coppice.org>
+
+ Despite my general liking of the GPL, I place this code in the
+ public domain for the benefit of all mankind - even the slimy
+ ones who might try to proprietize my work and use it to my
+ detriment.
*/
#include "asterisk.h"
@@ -676,7 +676,7 @@
#define MF_GSIZE 120
static int mf_detect(digit_detect_state_t *s, int16_t amp[],
- int samples, int digitmode, int *writeback)
+ int samples, int digitmode, int *writeback)
{
float energy[6];
int best;
Modified: branches/1.6.0/main/enum.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/enum.c?view=diff&rev=106306&r1=106305&r2=106306
==============================================================================
--- branches/1.6.0/main/enum.c (original)
+++ branches/1.6.0/main/enum.c Wed Mar 5 18:14:32 2008
@@ -207,22 +207,22 @@
delim = regexp[0];
delim2 = strchr(regexp + 1, delim);
- if ((delim2 == NULL) || (regexp[regexp_len-1] != delim)) {
- ast_log(LOG_WARNING, "Regex delimiter error (on \"%s\").\n",regexp);
+ if ((delim2 == NULL) || (regexp[regexp_len - 1] != delim)) {
+ ast_log(LOG_WARNING, "Regex delimiter error (on \"%s\").\n", regexp);
return -1;
}
pattern = regexp + 1;
*delim2 = 0;
subst = delim2 + 1;
- regexp[regexp_len-1] = 0;
+ regexp[regexp_len - 1] = 0;
/*
* now do the regex wizardry.
*/
if (regcomp(&preg, pattern, REG_EXTENDED | REG_NEWLINE)) {
- ast_log(LOG_WARNING, "NAPTR Regex compilation error (regex = \"%s\").\n",regexp);
+ ast_log(LOG_WARNING, "NAPTR Regex compilation error (regex = \"%s\").\n", regexp);
return -1;
}
@@ -314,7 +314,7 @@
ast_copy_string(c->txt, (const char *) answer, len < c->txtlen ? len : (c->txtlen));
/* just to be safe, let's make sure c->txt is null terminated */
- c->txt[(c->txtlen)-1] = '\0';
+ c->txt[(c->txtlen) - 1] = '\0';
return 1;
}
@@ -377,7 +377,7 @@
if (!(context = ast_calloc(1, sizeof(*context))))
return -1;
- ast_copy_string(naptrinput, number[0] == 'n' ? number+1 : number, sizeof(naptrinput));
+ ast_copy_string(naptrinput, number[0] == 'n' ? number + 1 : number, sizeof(naptrinput));
context->naptrinput = naptrinput; /* The number */
context->dst = dst; /* Return string */
@@ -411,7 +411,7 @@
}
if (p1 != NULL) {
- p2 = p1+1;
+ p2 = p1 + 1;
while (p1 > number){
p1--;
tmp[newpos++] = *p1;
@@ -501,7 +501,7 @@
}
}
for (k = 0; k < context->naptr_rrs_count; k++) {
- if (context->naptr_rrs[k].sort_pos == context->position-1) {
+ if (context->naptr_rrs[k].sort_pos == context->position - 1) {
ast_copy_string(context->dst, context->naptr_rrs[k].result, dstlen);
ast_copy_string(context->tech, context->naptr_rrs[k].tech, techlen);
break;
Modified: branches/1.6.0/main/features.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/features.c?view=diff&rev=106306&r1=106305&r2=106306
==============================================================================
--- branches/1.6.0/main/features.c (original)
+++ branches/1.6.0/main/features.c Wed Mar 5 18:14:32 2008
@@ -599,7 +599,7 @@
static int builtin_parkcall(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense, void *data)
{
struct ast_channel *parker;
- struct ast_channel *parkee;
+ struct ast_channel *parkee;
int res = 0;
set_peers(&parker, &parkee, peer, chan, sense);
@@ -842,9 +842,9 @@
static int finishup(struct ast_channel *chan)
{
- ast_indicate(chan, AST_CONTROL_UNHOLD);
-
- return ast_autoservice_stop(chan);
+ ast_indicate(chan, AST_CONTROL_UNHOLD);
+
+ return ast_autoservice_stop(chan);
}
/*!
@@ -857,14 +857,17 @@
*/
static const char *real_ctx(struct ast_channel *transferer, struct ast_channel *transferee)
{
- const char *s = pbx_builtin_getvar_helper(transferer, "TRANSFER_CONTEXT");
[... 1397 lines stripped ...]
More information about the asterisk-commits
mailing list