Fix if/for/while( in docs
authorFdaSilvaYY <fdasilvayy@gmail.com>
Tue, 28 Jun 2016 22:19:46 +0000 (00:19 +0200)
committerRich Salz <rsalz@openssl.org>
Wed, 20 Jul 2016 11:21:53 +0000 (07:21 -0400)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1292)

doc/crypto/BIO_f_md.pod
doc/crypto/BIO_f_ssl.pod
doc/crypto/BIO_find_type.pod
doc/crypto/BIO_s_connect.pod
doc/crypto/BIO_s_file.pod
doc/crypto/ENGINE_add.pod
doc/crypto/EVP_DigestInit.pod
doc/crypto/EVP_EncryptInit.pod
doc/ssl/SSL_CTX_set_generate_session_id.pod

index b2c1433d25b3e68724664a47f9e205f1ccd32235..32f0046751166ec160bc447113b413bdb0b66d63 100644 (file)
@@ -107,7 +107,7 @@ The next example digests data by reading through a chain instead:
  do {
         rdlen = BIO_read(bio, buf, sizeof(buf));
         /* Might want to do something with the data here */
- } while(rdlen > 0);
+ } while (rdlen > 0);
 
 This next example retrieves the message digests from a BIO chain and
 outputs them. This could be used with the examples above.
@@ -120,14 +120,14 @@ outputs them. This could be used with the examples above.
  do {
         EVP_MD *md;
         mdtmp = BIO_find_type(mdtmp, BIO_TYPE_MD);
-        if(!mdtmp) break;
+        if (!mdtmp) break;
         BIO_get_md(mdtmp, &md);
         printf("%s digest", OBJ_nid2sn(EVP_MD_type(md)));
         mdlen = BIO_gets(mdtmp, mdbuf, EVP_MAX_MD_SIZE);
-        for(i = 0; i < mdlen; i++) printf(":%02X", mdbuf[i]);
+        for (i = 0; i < mdlen; i++) printf(":%02X", mdbuf[i]);
         printf("\n");
         mdtmp = BIO_next(mdtmp);
- } while(mdtmp);
+ } while (mdtmp);
 
  BIO_free_all(bio);
 
index 318b3c8dbf60cd5bdc88aea0c819916bf9dadafe..3f9635ee6825bdd7f3dc2ab3e886d611167b55eb 100644 (file)
@@ -180,7 +180,7 @@ unencrypted example in L<BIO_s_connect(3)>.
  BIO_puts(sbio, "GET / HTTP/1.0\n\n");
  for ( ; ; ) {
      len = BIO_read(sbio, tmpbuf, 1024);
-     if(len <= 0)
+     if (len <= 0)
          break;
      BIO_write(out, tmpbuf, len);
  }
index b87e87b9fdb77ec9bc0e28cfc0d90b05cf087c89..ff7b4886092009bb08d08e2df2a5e413fcdee92c 100644 (file)
@@ -49,12 +49,12 @@ Traverse a chain looking for digest BIOs:
 
  do {
         btmp = BIO_find_type(btmp, BIO_TYPE_MD);
-        if(btmp == NULL) break; /* Not found */
+        if (btmp == NULL) break; /* Not found */
         /* btmp is a digest BIO, do something with it ...*/
         ...
 
         btmp = BIO_next(btmp);
- } while(btmp);
+ } while (btmp);
 
 
 =head1 COPYRIGHT
index 29192a6cf0c9996dff5b76b27efde566f26a4193..2143acd0992543b7d7098124941a5a2e5561128c 100644 (file)
@@ -176,7 +176,7 @@ to retrieve a page and copy the result to standard output.
  BIO_puts(cbio, "GET / HTTP/1.0\n\n");
  for ( ; ; ) {
      len = BIO_read(cbio, tmpbuf, 1024);
-     if(len <= 0)
+     if (len <= 0)
          break;
      BIO_write(out, tmpbuf, len);
  }
index b77b00f544922895b6df1864c089483b677689e5..e19d82429010f7867ab1933bf1ac186009a70b19 100644 (file)
@@ -92,15 +92,15 @@ Alternative technique:
 
  BIO *bio_out;
  bio_out = BIO_new(BIO_s_file());
- if(bio_out == NULL) /* Error ... */
- if(!BIO_set_fp(bio_out, stdout, BIO_NOCLOSE)) /* Error ... */
+ if (bio_out == NULL) /* Error ... */
+ if (!BIO_set_fp(bio_out, stdout, BIO_NOCLOSE)) /* Error ... */
  BIO_printf(bio_out, "Hello World\n");
 
 Write to a file:
 
  BIO *out;
  out = BIO_new_file("filename.txt", "w");
- if(!out) /* Error occurred */
+ if (!out) /* Error occurred */
  BIO_printf(out, "Hello World\n");
  BIO_free(out);
 
@@ -108,8 +108,8 @@ Alternative technique:
 
  BIO *out;
  out = BIO_new(BIO_s_file());
- if(out == NULL) /* Error ... */
- if(!BIO_write_filename(out, "filename.txt")) /* Error ... */
+ if (out == NULL) /* Error ... */
+ if (!BIO_write_filename(out, "filename.txt")) /* Error ... */
  BIO_printf(out, "Hello World\n");
  BIO_free(out);
 
index da86532ad9864d13921776032bb1f92d832511ec..37384f69b5ab2ec024f8ec985aeb2b99627813f9 100644 (file)
@@ -472,8 +472,8 @@ boolean success or failure.
                             const char **post_cmds, int post_num)
  {
      ENGINE *e = ENGINE_by_id(engine_id);
-     if(!e) return 0;
-     while(pre_num--) {
+     if (!e) return 0;
+     while (pre_num--) {
          if(!ENGINE_ctrl_cmd_string(e, pre_cmds[0], pre_cmds[1], 0)) {
              fprintf(stderr, "Failed command (%s - %s:%s)\n", engine_id,
                  pre_cmds[0], pre_cmds[1] ? pre_cmds[1] : "(NULL)");
@@ -482,7 +482,7 @@ boolean success or failure.
          }
          pre_cmds += 2;
      }
-     if(!ENGINE_init(e)) {
+     if (!ENGINE_init(e)) {
          fprintf(stderr, "Failed initialisation\n");
          ENGINE_free(e);
          return 0;
index 1f2da05a7639f9f958fbea7cbe014548bdfd9cd5..d615b31b87fe5f11f3993fd3e7a20ade2c552436 100644 (file)
@@ -223,7 +223,7 @@ digest name passed on the command line.
  EVP_MD_CTX_free(mdctx);
 
  printf("Digest is: ");
- for(i = 0; i < md_len; i++)
+ for (i = 0; i < md_len; i++)
         printf("%02x", md_value[i]);
  printf("\n");
 
index bffe72b73abbbc23cd1f5fbe3bf95e939233b10d..8286a717e99dd38a39b8622725ab6317a28fc09f 100644 (file)
@@ -603,7 +603,7 @@ with a 128-bit key:
         for(;;)
                 {
                 inlen = fread(inbuf, 1, 1024, in);
-                if(inlen <= 0) break;
+                if (inlen <= 0) break;
                 if(!EVP_CipherUpdate(ctx, outbuf, &outlen, inbuf, inlen))
                         {
                         /* Error */
index 95b7e9e1cad38080a6036bbce47a702eba6f0ef3..515fd251d2e28fd7ab8518fcc0e1c8a00fb0786e 100644 (file)
@@ -90,25 +90,27 @@ server id given, and will fill the rest with pseudo random bytes:
  #define MAX_SESSION_ID_ATTEMPTS 10
  static int generate_session_id(const SSL *ssl, unsigned char *id,
                               unsigned int *id_len)
     {
+ {
       unsigned int count = 0;
-      do      {
-              RAND_pseudo_bytes(id, *id_len);
-              /* Prefix the session_id with the required prefix. NB: If our
-               * prefix is too long, clip it - but there will be worse effects
-               * anyway, eg. the server could only possibly create 1 session
-               * ID (ie. the prefix!) so all future session negotiations will
-               * fail due to conflicts. */
-              memcpy(id, session_id_prefix,
-                      (strlen(session_id_prefix) < *id_len) ?
-                      strlen(session_id_prefix) : *id_len);
-              }
-      while(SSL_has_matching_session_id(ssl, id, *id_len) &&
+      do {
+          RAND_pseudo_bytes(id, *id_len);
+          /*
+           * Prefix the session_id with the required prefix. NB: If our
+           * prefix is too long, clip it - but there will be worse effects
+           * anyway, eg. the server could only possibly create 1 session
+           * ID (ie. the prefix!) so all future session negotiations will
+           * fail due to conflicts.
+           */
+          memcpy(id, session_id_prefix,
+                 (strlen(session_id_prefix) < *id_len) ?
+                    strlen(session_id_prefix) : *id_len);
+      }
+      while (SSL_has_matching_session_id(ssl, id, *id_len) &&
               (++count < MAX_SESSION_ID_ATTEMPTS));
-      if(count >= MAX_SESSION_ID_ATTEMPTS)
+      if (count >= MAX_SESSION_ID_ATTEMPTS)
               return 0;
       return 1;
-      }
+  }
 
 
 =head1 RETURN VALUES