[Home]

Summary:ASTERISK-03151: asterisk/channels/chan_phone.c v1.39 does not compile
Reporter:capetro (capetro)Labels:
Date Opened:2005-01-01 17:37:13.000-0600Date Closed:2008-01-15 15:19:20.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:recent changes to this file included C++-style mid-function local declarations.  this won't compile (at least not with the cc options in the Makefile in CVS).  diff to move local declarations to top of functions in additional information below.

since this prevents compilation, it doesn't fit into any of the severity categories.  i picked minor for lack of anything applicable.

do i really need to disclaim a two-line patch?

****** ADDITIONAL INFORMATION ******

Index: channels/chan_phone.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_phone.c,v
retrieving revision 1.39
diff -u -r1.39 chan_phone.c
--- channels/chan_phone.c       31 Dec 2004 00:16:30 -0000      1.39
+++ channels/chan_phone.c       1 Jan 2005 23:33:28 -0000
@@ -181,6 +181,7 @@
       PHONE_CID cid;
       time_t UtcTime;
       struct tm tm;
+       int start;

       time(&UtcTime);
       localtime_r(&UtcTime,&tm);
@@ -210,7 +211,7 @@
       if (option_debug)
               ast_log(LOG_DEBUG, "Ringing %s on %s (%d)\n", dest, ast->name, ast->fds[0]);

-       int start = IXJ_PHONE_RING_START(cid);
+       start = IXJ_PHONE_RING_START(cid);
       if (start == -1)
               return -1;

@@ -708,13 +709,13 @@
static struct ast_channel *phone_new(struct phone_pvt *i, int state, char *context)
{
       struct ast_channel *tmp;
+       struct phone_codec_data codec;
       tmp = ast_channel_alloc(1);
       if (tmp) {
               snprintf(tmp->name, sizeof(tmp->name), "Phone/%s", i->dev + 5);
               tmp->type = type;
               tmp->fds[0] = i->fd;
               /* XXX Switching formats silently causes kernel panics XXX */
-               struct phone_codec_data codec;
               if (i->mode == MODE_FXS &&
                   ioctl(i->fd, PHONE_QUERY_CODEC, &codec) == 0) {
                       if (codec.type == LINEAR16)
Comments:By: capetro (capetro) 2005-01-01 17:42:50.000-0600

Ah.  This client has old gcc 2.95 on a lame debian box, which doesn't have c99 support, so this is more of a "doesn't work on gcc 2.95" problem.  Since the rest of the source compiles fine on it, I assume the intent is to keep it working on 2.95.

By: Mark Spencer (markster) 2005-01-01 17:52:04.000-0600

Fixed in CVS head, thanks!  No need for a disclaimer for this one/two liner.

By: Digium Subversion (svnbot) 2008-01-15 15:19:20.000-0600

Repository: asterisk
Revision: 4630

U   trunk/channels/chan_phone.c

------------------------------------------------------------------------
r4630 | markster | 2008-01-15 15:19:19 -0600 (Tue, 15 Jan 2008) | 2 lines

Fix chan_phone for pre-gcc 3.0 (bug ASTERISK-3151)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=4630