add windows build for mod_xml_cdr. This probably also fixes the build on several non-linux systems.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4309 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris
2007-02-17 06:55:43 +00:00
parent 7b4e100b31
commit 4ae10379f2
4 changed files with 27 additions and 11 deletions
+6
View File
@@ -146,6 +146,12 @@ typedef unsigned long in_addr_t;
#define SWITCH_MOD_DECLARE(type) __declspec(dllimport) type __cdecl
#endif
#define SIGHUP SIGTERM
#ifndef S_IRUSR
#define S_IRUSR _S_IREAD
#endif
#ifndef S_IWUSR
#define S_IWUSR _S_IWRITE
#endif
#else //not win32
#define SWITCH_DECLARE(type) type
#define SWITCH_DECLARE_NONSTD(type) type
+7 -3
View File
@@ -29,9 +29,9 @@
* mod_xml_cdr.c -- XML CDR Module
*
*/
#include <sys/stat.h>
#include <switch.h>
static const char modname[] = "mod_xml_cdr";
static switch_status_t my_on_hangup(switch_core_session_t *session)
@@ -55,13 +55,17 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
if ((path = switch_mprintf("%s/xml_cdr/%s.cdr.xml", logdir, uuid_str))) {
if ((xml_text = switch_xml_toxml(cdr))) {
if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
write(fd, header, strlen(header));
write(fd, xml_text, strlen(xml_text));
write(fd, header, (unsigned)strlen(header));
write(fd, xml_text, (unsigned)strlen(xml_text));
close(fd);
fd = -1;
} else {
char ebuf[512] = {0};
#ifdef WIN32
strerror_s(ebuf, sizeof(ebuf), errno);
#else
strerror_r(errno, ebuf, sizeof(ebuf));
#endif
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error![%s]\n", ebuf);
}
free(xml_text);
-8
View File
@@ -59,14 +59,6 @@
#ifdef HAVE_MMAP
#include <sys/mman.h>
#endif
#ifdef WIN32
#ifndef S_IRUSR
#define S_IRUSR _S_IREAD
#endif
#ifndef S_IWUSR
#define S_IWUSR _S_IWRITE
#endif
#endif
#define SWITCH_XML_WS "\t\r\n " // whitespace
#define SWITCH_XML_ERRL 128 // maximum error string length