Author: gmaruzz Date: Sun Feb 8 06:38:59 2009 New Revision: 11686 Log: skypiax: cleaning skypiax_protocol.c Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c ============================================================================== --- freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c (original) +++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c Sun Feb 8 06:38:59 2009 @@ -7,7 +7,7 @@ extern char *skypiax_console_active; #else /* FREESWITCH */ #define skypiax_sleep switch_sleep -#define skypiax_file_write switch_file_write +//#define skypiax_file_write switch_file_write #define skypiax_file_read switch_file_read extern switch_memory_pool_t *skypiax_module_pool; extern switch_endpoint_interface_t *skypiax_endpoint_interface; @@ -23,6 +23,18 @@ #endif /* WIN32 */ /*************************************/ +#if defined(WIN32) && !defined(__CYGWIN__) +int skypiax_file_write(switch_file_t *pipe, short *buf, int howmany){ + switch_file_write(pipe, buf, &howmany); + return howmany; +} +#else /* WIN32 */ +int skypiax_file_write(int pipe, short *buf, int howmany){ + howmany = write(pipe, buf, howmany); + return howmany; +} +#endif /* WIN32 */ + void * skypiax_do_tcp_srv_thread_func(void *obj) { private_t *tech_pvt = obj; @@ -127,11 +139,7 @@ howmany = len; -#if defined(WIN32) && !defined(__CYGWIN__) - skypiax_file_write(tech_pvt->audiopipe[1], totalbuf, &howmany); -#else /* WIN32 */ - howmany = write(tech_pvt->audiopipe[1], totalbuf, howmany); -#endif /* WIN32 */ + howmany = skypiax_file_write(tech_pvt->audiopipe[1], totalbuf, howmany); tech_pvt->audiobuf_is_loaded = 0; } @@ -161,11 +169,7 @@ i++; } -#if defined(WIN32) && !defined(__CYGWIN__) - skypiax_file_write(tech_pvt->audiopipe[1], totalbuf, &howmany); -#else /* WIN32 */ - howmany = write(tech_pvt->audiopipe[1], totalbuf, howmany); -#endif /* WIN32 */ + howmany = skypiax_file_write(tech_pvt->audiopipe[1], totalbuf, howmany); tech_pvt->audiobuf_is_loaded = 0; } } else if (len == 0) {