2016-09-28 19:55 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* contrib/hbssl/hbssl.h
* contrib/hbssl/ssl_sock.c
* contrib/hbssl/ssl_inet.c
+ added new 'PHB_ITEM pSSL' parameter to hb_sockexNewSSL() and
hb_ssl_socketNew() C functions - it allows to bind harbour item
with SSL pointer which should not be released before connection
is closed. In new OpenSSL version such tricks can be replaced
by SSL_up_ref()
This modification also fixes possible GPF trap when SSL filter
socket was create dynamically from C code without SSL pointer
item on HVM stack in 2-nd parameter and removes old hack which
saved internally 2-nd HVM stack parameter.
+ allow to pass SSL_CTX instead of SSL in "ssl", "ctx" or "key" items
of hash array used to initialize SSL socket filter. Using SSL_CTX
allows to use the same hash array to set SSL socket filter for
different connections
+ allow to use codeblocks or function pointers as "ssl", "ctx" or
"key" items of hash array used to initialize SSL socket filter
* contrib/hbssl/hbssl.h
* contrib/hbssl/sslctx.c
+ added new C function:
SSL_CTX * hb_SSL_CTX_itemGet( PHB_ITEM pItem )
* contrib/hbssl/ssl_sock.c
* src/rtl/hbcom.c
* src/rtl/hbsocket.c
! fixed timeout checking in select()/poll()
* src/rtl/hbsockhb.c
! fixed possible GPF trap when socket filter refuse to create new
socket wrapper
* include/hbinit.h
* in GCC C++ builds for startup code use GCC constructor function
attribute instead of static variable initialization to avoid
warnings in new GCC versions
* src/rtl/hbntos.c
! fixed missing '-' in result of negative integer numbers - thanks
to Luigi Ferraris
* src/common/hbstr.c
+ added code to round integer part when the size of number is greater
then double precision (~16 digits).
This commit is contained in:
@@ -843,10 +843,18 @@ char * hb_dblToStr( char * szBuf, HB_SIZE nSize, double dNumber, int iMaxDec )
|
||||
szResult = szBuf;
|
||||
if( dNumber < 0 )
|
||||
{
|
||||
if( --iLen == 0 )
|
||||
return NULL;
|
||||
*szBuf++ = '-';
|
||||
dFract = modf( -dNumber, &dInt );
|
||||
if( --iLen == 0 )
|
||||
{
|
||||
if( dInt < 1 && dFract < 0.5 )
|
||||
{
|
||||
szBuf[ 0 ] = '0';
|
||||
szBuf[ 1 ] = '\0';
|
||||
return szBuf;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
*szBuf++ = '-';
|
||||
}
|
||||
else
|
||||
dFract = modf( dNumber, &dInt );
|
||||
@@ -854,18 +862,14 @@ char * hb_dblToStr( char * szBuf, HB_SIZE nSize, double dNumber, int iMaxDec )
|
||||
iPos = iLen;
|
||||
do
|
||||
{
|
||||
if( iPos == 0 )
|
||||
return NULL;
|
||||
dDig = modf( dInt / doBase + 0.01, &dInt ) * doBase;
|
||||
szBuf[ --iPos ] = '0' + ( char ) ( dDig + 0.01 );
|
||||
if( iPos == 0 )
|
||||
{
|
||||
if( dInt >= 1 )
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while( dInt >= 1 );
|
||||
if( iPos > 0 )
|
||||
memmove( szBuf, szBuf + iPos, HB_MIN( iLen - iPos, iPrec ) );
|
||||
memmove( szBuf, szBuf + iPos, HB_MIN( iLen - iPos, iPrec + 1 ) );
|
||||
iPos = iLen - iPos;
|
||||
|
||||
fFirst = iPos > 1 || szBuf[ 0 ] != '0';
|
||||
@@ -873,22 +877,36 @@ char * hb_dblToStr( char * szBuf, HB_SIZE nSize, double dNumber, int iMaxDec )
|
||||
{
|
||||
if( iPos >= iPrec )
|
||||
{
|
||||
while( iPrec < iPos )
|
||||
szBuf[ iPrec++ ] = '0';
|
||||
fFirst = iPos == iPrec ? dFract >= 0.5 : szBuf[ iPrec ] >= '5';
|
||||
if( iPrec < iPos )
|
||||
memset( szBuf + iPrec , '0', iPos - iPrec );
|
||||
if( fFirst )
|
||||
{
|
||||
for( ;; )
|
||||
{
|
||||
if( --iPrec < 0 )
|
||||
{
|
||||
if( iPos == iLen )
|
||||
return NULL;
|
||||
memmove( szBuf + 1, szBuf, iPos );
|
||||
*szBuf = '1';
|
||||
++iPos;
|
||||
break;
|
||||
}
|
||||
if( szBuf[ iPrec ] != '9' )
|
||||
{
|
||||
++szBuf[ iPrec ];
|
||||
break;
|
||||
}
|
||||
szBuf[ iPrec ] = '0';
|
||||
}
|
||||
}
|
||||
iPrec = 0;
|
||||
}
|
||||
else
|
||||
iPrec -= iPos;
|
||||
}
|
||||
|
||||
while( dInt >= 1 )
|
||||
{
|
||||
if( iPos >= iLen )
|
||||
return NULL;
|
||||
dDig = modf( dInt / doBase + 0.01, &dInt ) * doBase;
|
||||
szBuf[ iPos++ ] = iPrec-- > 0 ? '0' + ( char ) ( dDig + 0.01 ) : '0';
|
||||
}
|
||||
|
||||
if( iPrec > 0 && iLen - iPos > 1 && iMaxDec != 0 && dFract > 0 )
|
||||
{
|
||||
int iDec = iPos;
|
||||
|
||||
Reference in New Issue
Block a user