summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/examples/curlx.c28
-rw-r--r--docs/examples/externalsocket.c11
-rw-r--r--docs/examples/rtsp.c10
3 files changed, 30 insertions, 19 deletions
diff --git a/docs/examples/curlx.c b/docs/examples/curlx.c
index 3b11ef737..cd1677af3 100644
--- a/docs/examples/curlx.c
+++ b/docs/examples/curlx.c
@@ -200,7 +200,8 @@ static int ssl_app_verify_callback(X509_STORE_CTX *ctx, void *arg)
if(p->verbose > 1)
X509_print_ex(p->errorbio, ctx->cert, 0, 0);
- if(accessinfo = my_get_ext(ctx->cert, p->accesstype, NID_sinfo_access)) {
+ accessinfo = my_get_ext(ctx->cert, p->accesstype, NID_sinfo_access);
+ if(accessinfo) {
if(p->verbose)
BIO_printf(p->errorbio, "Setting URL from SIA to: %s\n", accessinfo);
@@ -355,7 +356,8 @@ int main(int argc, char **argv)
}
else if(strcmp(*args, "-accesstype") == 0) {
if(args[1]) {
- if((p.accesstype = OBJ_obj2nid(OBJ_txt2obj(*++args, 0))) == 0)
+ p.accesstype = OBJ_obj2nid(OBJ_txt2obj(*++args, 0));
+ if(p.accesstype == 0)
badarg=1;
}
else
@@ -410,16 +412,19 @@ int main(int argc, char **argv)
p.errorbio = BIO_new_fp(stderr, BIO_NOCLOSE);
- if(!(p.curl = curl_easy_init())) {
+ p.curl = curl_easy_init();
+ if(!p.curl) {
BIO_printf(p.errorbio, "Cannot init curl lib\n");
goto err;
}
- if(!(p12bio = BIO_new_file(p.p12file, "rb"))) {
+ p12bio = BIO_new_file(p.p12file, "rb");
+ if(!p12bio) {
BIO_printf(p.errorbio, "Error opening P12 file %s\n", p.p12file);
goto err;
}
- if(!(p.p12 = d2i_PKCS12_bio(p12bio, NULL))) {
+ p.p12 = d2i_PKCS12_bio(p12bio, NULL);
+ if(!p.p12) {
BIO_printf(p.errorbio, "Cannot decode P12 structure %s\n", p.p12file);
goto err;
}
@@ -447,16 +452,19 @@ int main(int argc, char **argv)
}
else if(p.accesstype != 0) { /* see whether we can find an AIA or SIA for a
given access type */
- if(!(serverurl = my_get_ext(p.usercert, p.accesstype, NID_info_access))) {
+ serverurl = my_get_ext(p.usercert, p.accesstype, NID_info_access);
+ if(!serverurl) {
int j=0;
BIO_printf(p.errorbio, "no service URL in user cert "
"cherching in others certificats\n");
for(j=0; j<sk_X509_num(p.ca); j++) {
- if((serverurl = my_get_ext(sk_X509_value(p.ca, j), p.accesstype,
- NID_info_access)))
+ serverurl = my_get_ext(sk_X509_value(p.ca, j), p.accesstype,
+ NID_info_access);
+ if(serverurl)
break;
- if((serverurl = my_get_ext(sk_X509_value(p.ca, j), p.accesstype,
- NID_sinfo_access)))
+ serverurl = my_get_ext(sk_X509_value(p.ca, j), p.accesstype,
+ NID_sinfo_access);
+ if(serverurl)
break;
}
}
diff --git a/docs/examples/externalsocket.c b/docs/examples/externalsocket.c
index 9b144b42d..918f08218 100644
--- a/docs/examples/externalsocket.c
+++ b/docs/examples/externalsocket.c
@@ -90,9 +90,8 @@ int main(void)
#ifdef WIN32
WSADATA wsaData;
- int initwsa;
-
- if((initwsa = WSAStartup(MAKEWORD(2, 0), &wsaData)) != 0) {
+ int initwsa = WSAStartup(MAKEWORD(2, 0), &wsaData);
+ if(initwsa != 0) {
printf("WSAStartup failed: %d\n", initwsa);
return 1;
}
@@ -107,7 +106,8 @@ int main(void)
curl_easy_setopt(curl, CURLOPT_URL, "http://99.99.99.99:9999");
/* Create the socket "manually" */
- if((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == CURL_SOCKET_BAD) {
+ sockfd = socket(AF_INET, SOCK_STREAM, 0);
+ if(sockfd == CURL_SOCKET_BAD) {
printf("Error creating listening socket.\n");
return 3;
}
@@ -116,7 +116,8 @@ int main(void)
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(PORTNUM);
- if(INADDR_NONE == (servaddr.sin_addr.s_addr = inet_addr(IPADDR)))
+ servaddr.sin_addr.s_addr = inet_addr(IPADDR);
+ if(INADDR_NONE == servaddr.sin_addr.s_addr)
return 2;
if(connect(sockfd, (struct sockaddr *) &servaddr, sizeof(servaddr)) ==
diff --git a/docs/examples/rtsp.c b/docs/examples/rtsp.c
index bdab39542..5c66aa6e5 100644
--- a/docs/examples/rtsp.c
+++ b/docs/examples/rtsp.c
@@ -61,13 +61,15 @@ static int _getch(void)
#define VERSION_STR "V1.0"
/* error handling macros */
-#define my_curl_easy_setopt(A, B, C) \
- if((res = curl_easy_setopt((A), (B), (C))) != CURLE_OK) \
+#define my_curl_easy_setopt(A, B, C) \
+ res = curl_easy_setopt((A), (B), (C)); \
+ if(!res) \
fprintf(stderr, "curl_easy_setopt(%s, %s, %s) failed: %d\n", \
#A, #B, #C, res);
-#define my_curl_easy_perform(A) \
- if((res = curl_easy_perform((A))) != CURLE_OK) \
+#define my_curl_easy_perform(A) \
+ res = curl_easy_perform(A); \
+ if(!res) \
fprintf(stderr, "curl_easy_perform(%s) failed: %d\n", #A, res);