freeswitch icon indicating copy to clipboard operation
freeswitch copied to clipboard

mod_spandsp_dsp.c: resolve V.18 mode and v18_init compilation errors

Open vishalk17 opened this issue 8 months ago • 1 comments

================================ Commit that Introduced Compilation Error :

https://github.com/freeswitch/spandsp/commit/d9681c3747ff4f56b1876557b9f6d894b7e6c18d#diff-348092e97708aedff108326c3f98a9ea907ee9a58b5a780e508d5f08503475fb

================================

Resolve compilation errors in mod_spandsp_dsp.c caused by SpanDSP API updates:

  1. Mode Constants: Updated deprecated mode names (e.g., V18_MODE_5BIT_4545V18_MODE_WEITBRECHT_5BIT_4545).
  2. v18_init Calls: Added missing status_handler and status_handler_user_data arguments (set to NULL).

These changes align mod_spandsp_dsp.c with the SpanDSP library’s API defined in v18.h.

================================ Explanation :

- The mode constants in mod_spandsp_dsp.c (e.g., V18_MODE_5BIT_4545) are outdated. SpanDSP's v18.h uses newer names like V18_MODE_WEITBRECHT_5BIT_4545,

- The v18_init function now requires 8 arguments (as per v18.h), but the code only passes 6.Add two NULL arguments for the missing parameters (status_handler and status_handler_user_data).

================================ for ref. Errors were:

mod_spandsp_dsp.c: In function 'get_v18_mode':
mod_spandsp_dsp.c:159:17: error: 'V18_MODE_5BIT_4545' undeclared (first use in this function)
  159 |         int r = V18_MODE_5BIT_4545;
      |                 ^~~~~~~~~~~~~~~~~~
mod_spandsp_dsp.c:159:17: note: each undeclared identifier is reported only once for each function it appears in
mod_spandsp_dsp.c:165:29: error: 'V18_MODE_5BIT_50' undeclared (first use in this function)
  165 |                         r = V18_MODE_5BIT_50;
      |                             ^~~~~~~~~~~~~~~~
mod_spandsp_dsp.c: In function 'spandsp_tdd_send_session':
mod_spandsp_dsp.c:216:21: error: too few arguments to function 'v18_init'
  216 |         tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), V18_AUTOMODING_GLOBAL, put_text_msg, NULL);
      |                     ^~~~~~~~
In file included from /usr/local/include/spandsp.h:114,
                 from mod_spandsp.h:50,
                 from mod_spandsp_dsp.c:36:
/usr/local/include/spandsp/v18.h:138:29: note: declared here
  138 | SPAN_DECLARE(v18_state_t *) v18_init(v18_state_t *s,
      |                             ^~~~~~~~
mod_spandsp_dsp.c: In function 'spandsp_tdd_encode_session':
mod_spandsp_dsp.c:263:26: error: too few arguments to function 'v18_init'
  263 |         pvt->tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), V18_AUTOMODING_GLOBAL, put_text_msg, NULL);
      |                          ^~~~~~~~
/usr/local/include/spandsp/v18.h:138:29: note: declared here
  138 | SPAN_DECLARE(v18_state_t *) v18_init(v18_state_t *s,
      |                             ^~~~~~~~
mod_spandsp_dsp.c: In function 'spandsp_tdd_decode_session':
mod_spandsp_dsp.c:341:26: error: too few arguments to function 'v18_init'
  341 |         pvt->tdd_state = v18_init(NULL, FALSE, get_v18_mode(session), V18_AUTOMODING_GLOBAL, put_text_msg, pvt);
      |                          ^~~~~~~~
/usr/local/include/spandsp/v18.h:138:29: note: declared here
  138 | SPAN_DECLARE(v18_state_t *) v18_init(v18_state_t *s,
      |                             ^~~~~~~~
make[4]: *** [Makefile:772: mod_spandsp_la-mod_spandsp_dsp.lo] Error 1

vishalk17 avatar Feb 01 '25 18:02 vishalk17