FreeSWITCH: Add WIN32 strerror_s() variant to custom switch_strerror_r() helper function and fix more strerror_r() users.

Convert mod_xml_cdr, mod_json_cdr and mod_conference to the new function.

Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
This commit is contained in:
Stefan Knoblich
2012-08-14 14:54:06 +02:00
parent 8bcf3b4fb8
commit eca5c0ad73
4 changed files with 16 additions and 30 deletions

View File

@@ -2985,6 +2985,12 @@ SWITCH_DECLARE(char *) switch_strerror_r(int errnum, char *buf, switch_size_t bu
}
return buf;
#endif /* STRERROR_R_CHAR_P */
#elif defined(WIN32)
/* WIN32 variant */
if (strerror_s(buf, buflen, errnum)) {
switch_snprintf(buf, buflen, "Unknown error %d", errnum);
}
return buf;
#else
/* Fallback, copy string into private buffer */
switch_copy_string(buf, strerror(errnum), buflen);