2014-09-14 20:48 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* contrib/hbmysql/tmysql.prg
    * added support for nFlags in TMySQLServer constructor as
      suggested by Fernando Athayde

  * src/rtl/gtcgi/gtcgi.c
    % replaced hb_cdpnDup() with hb_cdpnDup3() to eliminate unnecessary
      memory block duplicating when translation is not activated.

  * src/vm/itemapi.c
    * removed old ugly hack used to mark infinite or undefined double
      value using double item length field. The code which created such
      item have been eliminated many years ago.
    * use HB_DEFAULT_WIDTH instead of hardcoded 99 to force numeric value
      length recalculation.
This commit is contained in:
Przemysław Czerpak
2014-09-14 20:48:14 +02:00
parent f4b50145f4
commit 001939d5db
4 changed files with 35 additions and 14 deletions

View File

@@ -10,6 +10,22 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2014-09-14 20:48 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* contrib/hbmysql/tmysql.prg
* added support for nFlags in TMySQLServer constructor as
suggested by Fernando Athayde
* src/rtl/gtcgi/gtcgi.c
% replaced hb_cdpnDup() with hb_cdpnDup3() to eliminate unnecessary
memory block duplicating when translation is not activated.
* src/vm/itemapi.c
* removed old ugly hack used to mark infinite or undefined double
value using double item length field. The code which created such
item have been eliminated many years ago.
* use HB_DEFAULT_WIDTH instead of hardcoded 99 to force numeric value
length recalculation.
2014-09-12 22:08 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* src/vm/estack.c
* always set NIL in item allocated by hb_stackAllocItem() when it's

View File

@@ -1231,7 +1231,7 @@ CREATE CLASS TMySQLServer
VAR lError // .T. if occurred an error
VAR cCreateQuery
METHOD New( cServer, cUser, cPassword, nPort ) // Opens connection to a server, returns a server object
METHOD New( cServer, cUser, cPassword, nPort, nFlags ) // Opens connection to a server, returns a server object
METHOD Destroy() // Closes connection to server
METHOD SelectDB( cDBName ) // Which data base I will use for subsequent queries
@@ -1259,13 +1259,13 @@ CREATE CLASS TMySQLServer
ENDCLASS
METHOD New( cServer, cUser, cPassword, nPort ) CLASS TMySQLServer
METHOD New( cServer, cUser, cPassword, nPort, nFlags ) CLASS TMySQLServer
::cServer := cServer
::nPort := nPort
::cUser := cUser
::cPassword := cPassword
::nSocket := mysql_real_connect( cServer, cUser, cPassword, nPort )
::nSocket := mysql_real_connect( cServer, cUser, cPassword, nPort, nFlags )
::lError := .F.
IF Empty( ::nSocket )

View File

@@ -262,10 +262,15 @@ static void hb_gt_cgi_conOut( PHB_GT pGT, const char * szText, HB_SIZE nLength,
if( cdpTerm && cdpHost && cdpTerm != cdpHost )
{
HB_SIZE nLen = nLength;
char * buffer = hb_cdpnDup( szText, &nLen, cdpHost, cdpTerm );
HB_SIZE nLen = nLength, nBufSize = 0;
char * pBuf = NULL;
const char * buffer = hb_cdpnDup3( szText, nLen,
NULL, &nLen,
&pBuf, &nBufSize,
cdpHost, cdpTerm );
hb_gt_cgi_termOut( pGTCGI, buffer, nLen );
hb_xfree( buffer );
if( pBuf )
hb_xfree( pBuf );
}
else
hb_gt_cgi_termOut( pGTCGI, szText, nLength );

View File

@@ -1145,7 +1145,7 @@ PHB_ITEM hb_itemPutNLen( PHB_ITEM pItem, double dNumber, int iWidth, int iDec )
if( ( double ) nNumber == dNumber )
{
if( iWidth <= 0 || iWidth > 99 )
if( iWidth <= 0 || iWidth >= HB_DEFAULT_WIDTH )
iWidth = HB_DBL_LENGTH( dNumber );
return hb_itemPutNIntLen( pItem, nNumber, iWidth );
@@ -1167,7 +1167,7 @@ PHB_ITEM hb_itemPutNDLen( PHB_ITEM pItem, double dNumber, int iWidth, int iDec )
else
pItem = hb_itemNew( NULL );
if( iWidth <= 0 || iWidth > 99 )
if( iWidth <= 0 || iWidth >= HB_DEFAULT_WIDTH )
iWidth = HB_DBL_LENGTH( dNumber );
if( iDec < 0 )
@@ -1251,7 +1251,7 @@ PHB_ITEM hb_itemPutNILen( PHB_ITEM pItem, int iNumber, int iWidth )
else
pItem = hb_itemNew( NULL );
if( iWidth <= 0 || iWidth > 99 )
if( iWidth <= 0 || iWidth >= HB_DEFAULT_WIDTH )
iWidth = HB_INT_LENGTH( iNumber );
pItem->type = HB_IT_INTEGER;
@@ -1274,14 +1274,14 @@ PHB_ITEM hb_itemPutNLLen( PHB_ITEM pItem, long lNumber, int iWidth )
pItem = hb_itemNew( NULL );
#if HB_VMINT_MAX == LONG_MAX
if( iWidth <= 0 || iWidth > 99 )
if( iWidth <= 0 || iWidth >= HB_DEFAULT_WIDTH )
iWidth = HB_INT_LENGTH( lNumber );
pItem->type = HB_IT_INTEGER;
pItem->item.asInteger.value = ( int ) lNumber;
pItem->item.asInteger.length = ( HB_USHORT ) iWidth;
#else
if( iWidth <= 0 || iWidth > 99 )
if( iWidth <= 0 || iWidth >= HB_DEFAULT_WIDTH )
iWidth = HB_LONG_LENGTH( lNumber );
pItem->type = HB_IT_LONG;
@@ -1306,7 +1306,7 @@ PHB_ITEM hb_itemPutNLLLen( PHB_ITEM pItem, HB_LONGLONG llNumber, int iWidth )
pItem = hb_itemNew( NULL );
#if HB_VMLONG_MAX >= LONGLONG_MAX
if( iWidth <= 0 || iWidth > 99 )
if( iWidth <= 0 || iWidth >= HB_DEFAULT_WIDTH )
iWidth = HB_LONG_LENGTH( llNumber );
pItem->type = HB_IT_LONG;
@@ -1315,7 +1315,7 @@ PHB_ITEM hb_itemPutNLLLen( PHB_ITEM pItem, HB_LONGLONG llNumber, int iWidth )
#else
pItem->type = HB_IT_DOUBLE;
pItem->item.asDouble.value = ( double ) llNumber;
if( iWidth <= 0 || iWidth > 99 )
if( iWidth <= 0 || iWidth >= HB_DEFAULT_WIDTH )
iWidth = HB_LONG_LENGTH( pItem->item.asDouble.value );
pItem->item.asDouble.length = iWidth;
pItem->item.asDouble.decimal = 0;
@@ -2411,7 +2411,7 @@ HB_BOOL hb_itemStrBuf( char * szResult, PHB_ITEM pNumber, int iSize, int iDec )
{
double dNumber = hb_itemGetND( pNumber );
if( pNumber->item.asDouble.length == 99 || ! hb_isfinite( dNumber ) )
if( ! hb_isfinite( dNumber ) )
{
/* Numeric overflow */
iPos = -1;