提交 55b7373a authored 作者: Anthony Minessale's avatar Anthony Minessale

format code

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@727 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 e9ba607a
...@@ -146,15 +146,11 @@ static switch_status init_js(void) ...@@ -146,15 +146,11 @@ static switch_status init_js(void)
globals.gErrFile = stderr; globals.gErrFile = stderr;
globals.gOutFile = stdout; globals.gOutFile = stdout;
if (!(globals.rt = JS_NewRuntime(64L * 1024L * 1024L))) { if (!(globals.rt = JS_NewRuntime(64L * 1024L * 1024L))) {
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
static switch_status js_stream_dtmf_callback(switch_core_session *session, char *dtmf, void *buf, unsigned int buflen) static switch_status js_stream_dtmf_callback(switch_core_session *session, char *dtmf, void *buf, unsigned int buflen)
...@@ -166,7 +162,7 @@ static switch_status js_stream_dtmf_callback(switch_core_session *session, char ...@@ -166,7 +162,7 @@ static switch_status js_stream_dtmf_callback(switch_core_session *session, char
jsval rval; jsval rval;
char *ret; char *ret;
if(!jss) { if (!jss) {
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
...@@ -274,7 +270,7 @@ static switch_status js_record_dtmf_callback(switch_core_session *session, char ...@@ -274,7 +270,7 @@ static switch_status js_record_dtmf_callback(switch_core_session *session, char
jsval rval; jsval rval;
char *ret; char *ret;
if(!jss) { if (!jss) {
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
...@@ -334,7 +330,7 @@ static switch_status js_speak_dtmf_callback(switch_core_session *session, char * ...@@ -334,7 +330,7 @@ static switch_status js_speak_dtmf_callback(switch_core_session *session, char *
jsval rval; jsval rval;
char *ret; char *ret;
if(!jss) { if (!jss) {
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
...@@ -1252,7 +1248,7 @@ static JSBool js_log(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsva ...@@ -1252,7 +1248,7 @@ static JSBool js_log(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsva
{ {
char *msg; char *msg;
if((msg = JS_GetStringBytes(JS_ValueToString(cx, argv[0])))) { if ((msg = JS_GetStringBytes(JS_ValueToString(cx, argv[0])))) {
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "JS_LOG: %s", msg); switch_console_printf(SWITCH_CHANNEL_CONSOLE, "JS_LOG: %s", msg);
return JS_TRUE; return JS_TRUE;
} }
...@@ -1398,11 +1394,12 @@ static JSBool js_email(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js ...@@ -1398,11 +1394,12 @@ static JSBool js_email(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
} }
if (l > 0) if (l > 0) {
out[bytes++] = c64[((b%16)<<(6-l))%64]; out[bytes++] = c64[((b%16)<<(6-l))%64];
if (l != 0) while (l < 6) }
if (l != 0) while (l < 6) {
out[bytes++] = '=', l += 2; out[bytes++] = '=', l += 2;
}
if (write(fd, &out, bytes) != bytes) { if (write(fd, &out, bytes) != bytes) {
return -1; return -1;
} }
...@@ -1418,11 +1415,12 @@ static JSBool js_email(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js ...@@ -1418,11 +1415,12 @@ static JSBool js_email(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
} }
} }
if (fd) if (fd) {
close(fd); close(fd);
if (ifd) }
if (ifd) {
close(ifd); close(ifd);
}
snprintf(buf, B64BUFFLEN, "/bin/cat %s | /usr/sbin/sendmail -tf \"%s\" %s", filename, from, to); snprintf(buf, B64BUFFLEN, "/bin/cat %s | /usr/sbin/sendmail -tf \"%s\" %s", filename, from, to);
system(buf); system(buf);
unlink(filename); unlink(filename);
...@@ -1714,7 +1712,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul ...@@ -1714,7 +1712,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
{ {
switch_status status; switch_status status;
if((status = init_js()) != SWITCH_STATUS_SUCCESS) { if ((status = init_js()) != SWITCH_STATUS_SUCCESS) {
return status; return status;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论