Reformat C source files

This commit is contained in:
Shuanglei Tao
2016-12-21 22:50:23 +08:00
parent dcacbd25af
commit 085f6d54db
3 changed files with 26 additions and 26 deletions

View File

@@ -82,7 +82,7 @@ callback_http(struct lws *wsi, enum lws_callback_reasons reason, void *user, voi
p = buffer + LWS_PRE;
end = p + sizeof(buffer) - LWS_PRE;
if (!strncmp((const char *)in, "/auth_token.js", 14)) {
if (!strncmp((const char *) in, "/auth_token.js", 14)) {
size_t n = server->credential != NULL ? sprintf(buf, "var tty_auth_token = '%s';", server->credential) : 0;
if (lws_add_http_header_status(wsi, HTTP_STATUS_OK, &p, end))
@@ -128,10 +128,10 @@ callback_http(struct lws *wsi, enum lws_callback_reasons reason, void *user, voi
return 1;
goto try_to_reuse;
case LWS_CALLBACK_OPENSSL_PERFORM_CLIENT_CERT_VERIFICATION:
if (!len || (SSL_get_verify_result((SSL*)in) != X509_V_OK)) {
int err = X509_STORE_CTX_get_error((X509_STORE_CTX*)user);
int depth = X509_STORE_CTX_get_error_depth((X509_STORE_CTX*)user);
const char* msg = X509_verify_cert_error_string(err);
if (!len || (SSL_get_verify_result((SSL *) in) != X509_V_OK)) {
int err = X509_STORE_CTX_get_error((X509_STORE_CTX *) user);
int depth = X509_STORE_CTX_get_error_depth((X509_STORE_CTX *) user);
const char *msg = X509_verify_cert_error_string(err);
lwsl_err("client certificate verification error: %s (%d), depth: %d\n", msg, err, depth);
return 1;
}

View File

@@ -255,7 +255,7 @@ callback_tty(struct lws *wsi, enum lws_callback_reasons reason,
t_free(frame->data);
t_free(frame);
if(lws_partial_buffered(wsi)){
if (lws_partial_buffered(wsi)) {
lws_callback_on_writable(wsi);
break;
}

View File

@@ -279,8 +279,8 @@ main(int argc, char **argv) {
break;
case 't':
optind--;
for(;optind < start && *argv[optind] != '-'; optind++){
char *option =strdup(optarg);
for (; optind < start && *argv[optind] != '-'; optind++) {
char *option = strdup(optarg);
char *key = strsep(&option, "=");
if (key == NULL) {
fprintf(stderr, "ttyd: invalid client option: %s, format: key=value\n", optarg);