#endif
#include "ftdm_cpu_monitor.h"
+#ifndef localtime_r
+struct tm *localtime_r(const time_t *clock, struct tm *result);
+#endif
+
#define FORCE_HANGUP_TIMER 3000
#define SPAN_PENDING_CHANS_QUEUE_SIZE 1000
#define SPAN_PENDING_SIGNALS_QUEUE_SIZE 1000
#endif
}
-static void write_chan_io_dump(ftdm_channel_t *fchan, ftdm_io_dump_t *dump, char *dataptr, int dlen)
+static void write_chan_io_dump(ftdm_io_dump_t *dump, char *dataptr, int dlen)
{
int windex = dump->windex;
- int avail = dump->size - windex;
+ int avail = (int)dump->size - windex;
if (!dump->buffer) {
return;
static void dump_chan_io_to_file(ftdm_channel_t *fchan, ftdm_io_dump_t *dump, FILE *file)
{
/* write the saved audio buffer */
- int rc = 0;
- int towrite = dump->size - dump->windex;
+ size_t rc = 0;
+ size_t towrite = dump->size - dump->windex;
if (dump->wrapped) {
rc = fwrite(&dump->buffer[dump->windex], 1, towrite, file);
if (rc != towrite) {
GOTO_STATUS(done, FTDM_FAIL);
}
GOTO_STATUS(done, FTDM_SUCCESS);
- ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Disabled DTMF debugging\n");
}
break;
char dfile[512];
currsec = time(NULL);
+
+#ifdef WIN32
+ _tzset();
+ _localtime64_s(&currtime, &currsec);
+#else
localtime_r(&currsec, &currtime);
+#endif
snprintf(dfile, sizeof(dfile), "dtmf-s%dc%d-20%d-%d-%d-%d:%d:%d.%s",
ftdmchan->span_id, ftdmchan->chan_id,
ftdm_log(FTDM_LOG_WARNING, "Raw output trace failed to write all of the %zd bytes\n", dlen);
}
}
- write_chan_io_dump(ftdmchan, &ftdmchan->txdump, data, dlen);
+ write_chan_io_dump(&ftdmchan->txdump, data, dlen);
return ftdmchan->fio->write(ftdmchan, data, datalen);
}
if (status == FTDM_SUCCESS) {
int dlen = (int) *datalen;
- int rc = 0;
+ size_t rc = 0;
- write_chan_io_dump(ftdmchan, &ftdmchan->rxdump, data, dlen);
+ write_chan_io_dump(&ftdmchan->rxdump, data, dlen);
/* if dtmf debug is enabled and initialized, write there too */
if (ftdmchan->dtmfdbg.file) {