提交 1e53a9fd 编写于 作者: R Richard Levitte

Add z modifier parsing to the BIO_printf et all format string

Reviewed-by: NAndy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3064)
上级 6edc7145
...@@ -4,6 +4,10 @@ ...@@ -4,6 +4,10 @@
Changes between 1.1.0e and 1.1.1 [xx XXX xxxx] Changes between 1.1.0e and 1.1.1 [xx XXX xxxx]
*) Add the z modifier parsing to BIO_printf() et al formatting string,
to be used for size_t and ssize_t (ossl_ssize_t).
[Richard Levitte]
*) Add EC_KEY_get0_engine(), which does for EC_KEY what RSA_get0_engine() *) Add EC_KEY_get0_engine(), which does for EC_KEY what RSA_get0_engine()
does for RSA, etc. does for RSA, etc.
[Richard Levitte] [Richard Levitte]
......
...@@ -89,6 +89,7 @@ static int _dopr(char **sbuffer, char **buffer, ...@@ -89,6 +89,7 @@ static int _dopr(char **sbuffer, char **buffer,
#define DP_C_LONG 2 #define DP_C_LONG 2
#define DP_C_LDOUBLE 3 #define DP_C_LDOUBLE 3
#define DP_C_LLONG 4 #define DP_C_LLONG 4
#define DP_C_SIZE 5
/* Floating point formats */ /* Floating point formats */
#define F_FORMAT 0 #define F_FORMAT 0
...@@ -214,6 +215,10 @@ _dopr(char **sbuffer, ...@@ -214,6 +215,10 @@ _dopr(char **sbuffer,
cflags = DP_C_LDOUBLE; cflags = DP_C_LDOUBLE;
ch = *format++; ch = *format++;
break; break;
case 'z':
cflags = DP_C_SIZE;
ch = *format++;
break;
default: default:
break; break;
} }
...@@ -233,6 +238,9 @@ _dopr(char **sbuffer, ...@@ -233,6 +238,9 @@ _dopr(char **sbuffer,
case DP_C_LLONG: case DP_C_LLONG:
value = va_arg(args, LLONG); value = va_arg(args, LLONG);
break; break;
case DP_C_SIZE:
value = va_arg(args, ossl_ssize_t);
break;
default: default:
value = va_arg(args, int); value = va_arg(args, int);
break; break;
...@@ -253,11 +261,14 @@ _dopr(char **sbuffer, ...@@ -253,11 +261,14 @@ _dopr(char **sbuffer,
value = (unsigned short int)va_arg(args, unsigned int); value = (unsigned short int)va_arg(args, unsigned int);
break; break;
case DP_C_LONG: case DP_C_LONG:
value = (LLONG) va_arg(args, unsigned long int); value = (LLONG)va_arg(args, unsigned long int);
break; break;
case DP_C_LLONG: case DP_C_LLONG:
value = va_arg(args, unsigned LLONG); value = va_arg(args, unsigned LLONG);
break; break;
case DP_C_SIZE:
value = (ossl_ssize_t)va_arg(args, size_t);
break;
default: default:
value = (LLONG) va_arg(args, unsigned int); value = (LLONG) va_arg(args, unsigned int);
break; break;
......
...@@ -724,10 +724,16 @@ void BIO_copy_next_retry(BIO *b); ...@@ -724,10 +724,16 @@ void BIO_copy_next_retry(BIO *b);
* long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); * long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);
*/ */
# ifdef __GNUC__ # define __bio_h__attr__(x)
# define __bio_h__attr__ __attribute__ # if defined(__GNUC__) && defined(__STDC_VERSION__)
# else /*
# define __bio_h__attr__(x) * Because we support the 'z' modifier, which made its appearance in C99,
* we can't use __attribute__ with pre C99 dialects.
*/
# if __STDC_VERSION__ >= 199901L
# undef __bio_h__attr__
# define __bio_h__attr__ __attribute__
# endif
# endif # endif
int BIO_printf(BIO *bio, const char *format, ...) int BIO_printf(BIO *bio, const char *format, ...)
__bio_h__attr__((__format__(__printf__, 2, 3))); __bio_h__attr__((__format__(__printf__, 2, 3)));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册