You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by da...@apache.org on 2007/06/29 17:17:10 UTC

svn commit: r551923 - in /apr/apr/trunk: include/apr_lib.h strings/apr_snprintf.c

Author: davi
Date: Fri Jun 29 08:17:09 2007
New Revision: 551923

URL: http://svn.apache.org/viewvc?view=rev&rev=551923
Log:
Binary size apr_vformatter as bytes, K, M, T, etc, to a four character compacted
human readable form. Based upon apr_strfsize.

Modified:
    apr/apr/trunk/include/apr_lib.h
    apr/apr/trunk/strings/apr_snprintf.c

Modified: apr/apr/trunk/include/apr_lib.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_lib.h?view=diff&rev=551923&r1=551922&r2=551923
==============================================================================
--- apr/apr/trunk/include/apr_lib.h (original)
+++ apr/apr/trunk/include/apr_lib.h Fri Jun 29 08:17:09 2007
@@ -121,6 +121,9 @@
  * %%pm takes an apr_status_t * and prints the appropriate error
  *      string (from apr_strerror) corresponding to that error code.
  * %%pp takes a void * and outputs it in hex
+ * %%pB takes a apr_uint32_t * as bytes and outputs it's apr_strfsize
+ * %%pF same as above, but takes a apr_off_t *
+ * %%pS same as above, but takes a apr_size_t *
  *
  * %%pt is only available from APR 1.2.0 onwards.
  * %%pm is only available from APR 1.3.0 onwards.

Modified: apr/apr/trunk/strings/apr_snprintf.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/strings/apr_snprintf.c?view=diff&rev=551923&r1=551922&r2=551923
==============================================================================
--- apr/apr/trunk/strings/apr_snprintf.c (original)
+++ apr/apr/trunk/strings/apr_snprintf.c Fri Jun 29 08:17:09 2007
@@ -1239,6 +1239,32 @@
 #endif
                     break;
 
+                case 'B':
+                case 'F':
+                case 'S':
+                {
+                    char buf[5];
+                    apr_off_t size = 0;
+
+                    if (*fmt == 'B') {
+                        apr_uint32_t *arg = va_arg(ap, apr_uint32_t *);
+                        size = (arg) ? *arg : 0;
+                    }
+                    else if (*fmt == 'F') {
+                        apr_off_t *arg = va_arg(ap, apr_off_t *);
+                        size = (arg) ? *arg : 0;
+                    }
+                    else {
+                        apr_size_t *arg = va_arg(ap, apr_size_t *);
+                        size = (arg) ? *arg : 0;
+                    }
+
+                    s = apr_strfsize(size, buf);
+                    s_len = strlen(s);
+                    pad_char = ' ';
+                }
+                break;
+
                 case NUL:
                     /* if %p ends the string, oh well ignore it */
                     continue;



Re: svn commit: r551923 - in /apr/apr/trunk: include/apr_lib.h

Posted by Davi Arnaut <da...@haxent.com.br>.
On 29/06/2007, at 12:27, Jim Jagielski wrote:

> davi@apache.org wrote:
>>
>> Author: davi
>> Date: Fri Jun 29 08:17:09 2007
>> New Revision: 551923
>>
>> Modified: apr/apr/trunk/include/apr_lib.h
>> URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_lib.h? 
>> view=diff&rev=551923&r1=551922&r2=551923
>> ===================================================================== 
>> =========
>> --- apr/apr/trunk/include/apr_lib.h (original)
>> +++ apr/apr/trunk/include/apr_lib.h Fri Jun 29 08:17:09 2007
>> @@ -121,6 +121,9 @@
>>   * %%pm takes an apr_status_t * and prints the appropriate error
>>   *      string (from apr_strerror) corresponding to that error code.
>>   * %%pp takes a void * and outputs it in hex
>> + * %%pB takes a apr_uint32_t * as bytes and outputs it's  
>> apr_strfsize
>> + * %%pF same as above, but takes a apr_off_t *
>> + * %%pS same as above, but takes a apr_size_t *
>>   *
>>   * %%pt is only available from APR 1.2.0 onwards.
>>   * %%pm is only available from APR 1.3.0 onwards.
>
> Should add the %%pB/%%pF/%%pS "is only available" notes here as well.
>

Yes, thanks.

--
Davi Arnaut

Re: svn commit: r551923 - in /apr/apr/trunk: include/apr_lib.h

Posted by Davi Arnaut <da...@haxent.com.br>.
On 29/06/2007, at 12:27, Jim Jagielski wrote:

> davi@apache.org wrote:
>>
>> Author: davi
>> Date: Fri Jun 29 08:17:09 2007
>> New Revision: 551923
>>
>> Modified: apr/apr/trunk/include/apr_lib.h
>> URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_lib.h? 
>> view=diff&rev=551923&r1=551922&r2=551923
>> ===================================================================== 
>> =========
>> --- apr/apr/trunk/include/apr_lib.h (original)
>> +++ apr/apr/trunk/include/apr_lib.h Fri Jun 29 08:17:09 2007
>> @@ -121,6 +121,9 @@
>>   * %%pm takes an apr_status_t * and prints the appropriate error
>>   *      string (from apr_strerror) corresponding to that error code.
>>   * %%pp takes a void * and outputs it in hex
>> + * %%pB takes a apr_uint32_t * as bytes and outputs it's  
>> apr_strfsize
>> + * %%pF same as above, but takes a apr_off_t *
>> + * %%pS same as above, but takes a apr_size_t *
>>   *
>>   * %%pt is only available from APR 1.2.0 onwards.
>>   * %%pm is only available from APR 1.3.0 onwards.
>
> Should add the %%pB/%%pF/%%pS "is only available" notes here as well.
>

Yes, thanks.

--
Davi Arnaut

Re: svn commit: r551923 - in /apr/apr/trunk: include/apr_lib.h

Posted by Jim Jagielski <ji...@jaguNET.com>.
davi@apache.org wrote:
> 
> Author: davi
> Date: Fri Jun 29 08:17:09 2007
> New Revision: 551923
> 
> Modified: apr/apr/trunk/include/apr_lib.h
> URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_lib.h?view=diff&rev=551923&r1=551922&r2=551923
> ==============================================================================
> --- apr/apr/trunk/include/apr_lib.h (original)
> +++ apr/apr/trunk/include/apr_lib.h Fri Jun 29 08:17:09 2007
> @@ -121,6 +121,9 @@
>   * %%pm takes an apr_status_t * and prints the appropriate error
>   *      string (from apr_strerror) corresponding to that error code.
>   * %%pp takes a void * and outputs it in hex
> + * %%pB takes a apr_uint32_t * as bytes and outputs it's apr_strfsize
> + * %%pF same as above, but takes a apr_off_t *
> + * %%pS same as above, but takes a apr_size_t *
>   *
>   * %%pt is only available from APR 1.2.0 onwards.
>   * %%pm is only available from APR 1.3.0 onwards.

Should add the %%pB/%%pF/%%pS "is only available" notes here as well.

-- 
===========================================================================
   Jim Jagielski   [|]   jim@jaguNET.com   [|]   http://www.jaguNET.com/
	    "If you can dodge a wrench, you can dodge a ball."

Re: svn commit: r551923 - in /apr/apr/trunk: include/apr_lib.h

Posted by Jim Jagielski <ji...@jaguNET.com>.
davi@apache.org wrote:
> 
> Author: davi
> Date: Fri Jun 29 08:17:09 2007
> New Revision: 551923
> 
> Modified: apr/apr/trunk/include/apr_lib.h
> URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_lib.h?view=diff&rev=551923&r1=551922&r2=551923
> ==============================================================================
> --- apr/apr/trunk/include/apr_lib.h (original)
> +++ apr/apr/trunk/include/apr_lib.h Fri Jun 29 08:17:09 2007
> @@ -121,6 +121,9 @@
>   * %%pm takes an apr_status_t * and prints the appropriate error
>   *      string (from apr_strerror) corresponding to that error code.
>   * %%pp takes a void * and outputs it in hex
> + * %%pB takes a apr_uint32_t * as bytes and outputs it's apr_strfsize
> + * %%pF same as above, but takes a apr_off_t *
> + * %%pS same as above, but takes a apr_size_t *
>   *
>   * %%pt is only available from APR 1.2.0 onwards.
>   * %%pm is only available from APR 1.3.0 onwards.

Should add the %%pB/%%pF/%%pS "is only available" notes here as well.

-- 
===========================================================================
   Jim Jagielski   [|]   jim@jaguNET.com   [|]   http://www.jaguNET.com/
	    "If you can dodge a wrench, you can dodge a ball."