2009-01-27 15:31 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/common/hbprintf.c
    ! fixed two bugs in conversions
This commit is contained in:
Przemyslaw Czerpak
2009-01-27 14:27:10 +00:00
parent da65eb8526
commit 2c113e3365
2 changed files with 20 additions and 5 deletions

View File

@@ -8,6 +8,10 @@
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2009-01-27 15:31 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/common/hbprintf.c
! fixed two bugs in conversions
2009-01-27 10:14 UTC+0100 Francesco Saverio Giudice (info/at/fsgiudice.com)
* harbour/contrib/examples/uhttpd/uhttpd.prg
* Fixed APP_NAME that causes wrong ini file name and than error

View File

@@ -725,12 +725,12 @@ static size_t put_hex( char *buffer, size_t bufsize, size_t size,
width -= 2;
width -= nums;
if( ( flags & _F_LEFTADJUSTED ) == 0 )
if( ( flags & ( _F_LEFTADJUSTED | _F_ZEROPADED ) ) == 0 )
{
while( width > 0 )
{
if( size < bufsize )
buffer[ size ] = ( flags & _F_ZEROPADED ) ? '0' : ' ';
buffer[ size ] = ' ';
++size;
--width;
}
@@ -744,6 +744,16 @@ static size_t put_hex( char *buffer, size_t bufsize, size_t size,
buffer[ size ] = upper ? 'X' : 'x';
++size;
}
if( ( flags & _F_LEFTADJUSTED ) == 0 )
{
while( width > 0 )
{
if( size < bufsize )
buffer[ size ] = ( flags & _F_ZEROPADED ) ? '0' : ' ';
++size;
--width;
}
}
if( nums )
{
n = nums;
@@ -1054,10 +1064,11 @@ int hb_snprintf_c( char * buffer, size_t bufsize, const char * format, ... )
argval.value.as_x_intmax_t = va_arg_n( args, _x_ptrdiff_t, param );
else
argval.value.as_x_intmax_t = va_arg_n( args, _x_int, param );
argval.value.as_x_uintmax_t = argval.value.as_x_intmax_t < 0
? -argval.value.as_x_intmax_t : argval.value.as_x_intmax_t;
value = argval.value.as_x_intmax_t < 0;
argval.value.as_x_uintmax_t = value ? -argval.value.as_x_intmax_t :
argval.value.as_x_intmax_t;
size = put_dec( buffer, bufsize, size, argval.value.as_x_uintmax_t,
flags, width, precision, argval.value.as_x_intmax_t < 0 );
flags, width, precision, value );
continue;
case 'o': /* unsigned int octal conversion */
case 'u': /* unsigned int decimal conversion */