add const to the return value of BIO_s_file()

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

add const to the return value of BIO_s_file()

Theo Buehler-3
This is the first trivial part of the last batch of diffs catching up
with OpenSSL's const additions.

As usual, sthen kindly ran the whole diff through a ports bulk build.

Only this small change caused some fallout, namely devel/ptlib.
Of course, I'll commit a fix for the port at the same time as this diff.

Index: lib/libcrypto/bio/bio.h
===================================================================
RCS file: /var/cvs/src/lib/libcrypto/bio/bio.h,v
retrieving revision 1.43
diff -u -p -r1.43 bio.h
--- lib/libcrypto/bio/bio.h 12 May 2018 18:51:59 -0000 1.43
+++ lib/libcrypto/bio/bio.h 28 May 2018 20:07:41 -0000
@@ -597,7 +597,7 @@ BIO_asn1_get_suffix(BIO *b, asn1_ps_func
 asn1_ps_func **psuffix_free);
 
 int BIO_get_new_index(void);
-BIO_METHOD *BIO_s_file(void );
+const BIO_METHOD *BIO_s_file(void);
 BIO *BIO_new_file(const char *filename, const char *mode);
 BIO *BIO_new_fp(FILE *stream, int close_flag);
 # define BIO_s_file_internal BIO_s_file
Index: lib/libcrypto/bio/bss_file.c
===================================================================
RCS file: /var/cvs/src/lib/libcrypto/bio/bss_file.c,v
retrieving revision 1.32
diff -u -p -r1.32 bss_file.c
--- lib/libcrypto/bio/bss_file.c 29 Jan 2017 17:49:22 -0000 1.32
+++ lib/libcrypto/bio/bss_file.c 28 May 2018 20:07:41 -0000
@@ -98,7 +98,7 @@ static long file_ctrl(BIO *h, int cmd, l
 static int file_new(BIO *h);
 static int file_free(BIO *data);
 
-static BIO_METHOD methods_filep = {
+static const BIO_METHOD methods_filep = {
  .type = BIO_TYPE_FILE,
  .name = "FILE pointer",
  .bwrite = file_write,
@@ -148,7 +148,7 @@ BIO_new_fp(FILE *stream, int close_flag)
  return (ret);
 }
 
-BIO_METHOD *
+const BIO_METHOD *
 BIO_s_file(void)
 {
  return (&methods_filep);

Reply | Threaded
Open this post in threaded view
|

Re: add const to the return value of BIO_s_file()

Brent Cook
ok bcook@

On Mon, May 28, 2018 at 3:23 PM, Theo Buehler <[hidden email]> wrote:

> This is the first trivial part of the last batch of diffs catching up
> with OpenSSL's const additions.
>
> As usual, sthen kindly ran the whole diff through a ports bulk build.
>
> Only this small change caused some fallout, namely devel/ptlib.
> Of course, I'll commit a fix for the port at the same time as this diff.
>
> Index: lib/libcrypto/bio/bio.h
> ===================================================================
> RCS file: /var/cvs/src/lib/libcrypto/bio/bio.h,v
> retrieving revision 1.43
> diff -u -p -r1.43 bio.h
> --- lib/libcrypto/bio/bio.h     12 May 2018 18:51:59 -0000      1.43
> +++ lib/libcrypto/bio/bio.h     28 May 2018 20:07:41 -0000
> @@ -597,7 +597,7 @@ BIO_asn1_get_suffix(BIO *b, asn1_ps_func
>  asn1_ps_func **psuffix_free);
>
>  int BIO_get_new_index(void);
> -BIO_METHOD *BIO_s_file(void );
> +const BIO_METHOD *BIO_s_file(void);
>  BIO *BIO_new_file(const char *filename, const char *mode);
>  BIO *BIO_new_fp(FILE *stream, int close_flag);
>  # define BIO_s_file_internal   BIO_s_file
> Index: lib/libcrypto/bio/bss_file.c
> ===================================================================
> RCS file: /var/cvs/src/lib/libcrypto/bio/bss_file.c,v
> retrieving revision 1.32
> diff -u -p -r1.32 bss_file.c
> --- lib/libcrypto/bio/bss_file.c        29 Jan 2017 17:49:22 -0000
> 1.32
> +++ lib/libcrypto/bio/bss_file.c        28 May 2018 20:07:41 -0000
> @@ -98,7 +98,7 @@ static long file_ctrl(BIO *h, int cmd, l
>  static int file_new(BIO *h);
>  static int file_free(BIO *data);
>
> -static BIO_METHOD methods_filep = {
> +static const BIO_METHOD methods_filep = {
>         .type = BIO_TYPE_FILE,
>         .name = "FILE pointer",
>         .bwrite = file_write,
> @@ -148,7 +148,7 @@ BIO_new_fp(FILE *stream, int close_flag)
>         return (ret);
>  }
>
> -BIO_METHOD *
> +const BIO_METHOD *
>  BIO_s_file(void)
>  {
>         return (&methods_filep);
>