Hi,

I've attached a patch that fixed a warning about the arguments to
a printf function.  strlen() returns an size_t, so it should have
the "z" modifier.  I've also changed it from %d to %u, since it's
unsigned.

Since the BIO printf() doesn't actually support, I've also added
support for that.

I've changed the %n case too.  The standard says it's a signed
integer, so I've picked a ssize_t and not a size_t.


Kurt

Index: apps/s_server.c
===================================================================
RCS file: /home/kurt/openssl/cvs/openssl-cvs/openssl/apps/s_server.c,v
retrieving revision 1.111
diff -u -r1.111 s_server.c
--- apps/s_server.c     11 Mar 2006 12:18:10 -0000      1.111
+++ apps/s_server.c     12 Mar 2006 19:34:02 -0000
@@ -309,7 +309,7 @@
                goto out_err;
                }
        if (s_debug)
-               BIO_printf(bio_s_out,"identity_len=%d identity=%s\n",
+               BIO_printf(bio_s_out,"identity_len=%zu identity=%s\n",
                        identity ? strlen(identity) : 0, identity);
 
        /* here we could lookup the given identity e.g. from a database */
Index: crypto/bio/b_print.c
===================================================================
RCS file: /home/kurt/openssl/cvs/openssl-cvs/openssl/crypto/bio/b_print.c,v
retrieving revision 1.40
diff -u -r1.40 b_print.c
--- crypto/bio/b_print.c        26 Jul 2005 04:43:31 -0000      1.40
+++ crypto/bio/b_print.c        12 Mar 2006 20:19:05 -0000
@@ -156,10 +156,11 @@
 #define DP_F_UNSIGNED   (1 << 6)
 
 /* conversion flags */
-#define DP_C_SHORT      1
-#define DP_C_LONG       2
-#define DP_C_LDOUBLE    3
-#define DP_C_LLONG      4
+#define DP_C_SHORT      1      /* h */
+#define DP_C_LONG       2      /* l */
+#define DP_C_LDOUBLE    3      /* L */
+#define DP_C_LLONG      4      /* ll or q */
+#define DP_C_SIZE_T    5       /* z */
 
 /* some handy macros */
 #define char_to_int(p) (p - '0')
@@ -283,6 +284,10 @@
                 cflags = DP_C_LDOUBLE;
                 ch = *format++;
                 break;
+           case 'z':
+               cflags = DP_C_SIZE_T;
+               ch = *format++;
+               break;
             default:
                 break;
             }
@@ -302,6 +307,9 @@
                 case DP_C_LLONG:
                     value = va_arg(args, LLONG);
                     break;
+               case DP_C_SIZE_T:
+                   value = va_arg(args, ssize_t);
+                   break;
                 default:
                     value = va_arg(args, int);
                     break;
@@ -327,6 +335,9 @@
                 case DP_C_LLONG:
                     value = va_arg(args, unsigned LLONG);
                     break;
+                case DP_C_SIZE_T:
+                    value = (LLONG) va_arg(args, size_t);
+                    break;
                 default:
                     value = (LLONG) va_arg(args,
                         unsigned int);
@@ -393,6 +404,10 @@
                     LLONG *num;
                     num = va_arg(args, LLONG *);
                     *num = (LLONG) currlen;
+                } else if (cflags == DP_C_SIZE_T) { /* XXX */
+                    ssize_t *num;
+                    num = va_arg(args, ssize_t *);
+                    *num = (ssize_t) currlen;
                 } else {
                     int    *num;
                     num = va_arg(args, int *);

Reply via email to