2009-08-09 10:14 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbxbp/tests/demoxbp.prg
* Added hb_DirBase() to local file references, to make these
work when no run from its own directory.
! Using test.dbf in tests.
- contrib/hbxbp/tests/test.dbf
- Deleted duplicated test.dbf.
* contrib/hbtip/client.prg
* HAVE_OPENSSL -> HAS_OPENSSL
* contrib/hbwin/olecore.c
* source/rtl/cdpapi.c
* Minor formatting.
This commit is contained in:
@@ -17,12 +17,28 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2009-08-09 10:14 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/hbxbp/tests/demoxbp.prg
|
||||
* Added hb_DirBase() to local file references, to make these
|
||||
work when no run from its own directory.
|
||||
! Using test.dbf in tests.
|
||||
|
||||
- contrib/hbxbp/tests/test.dbf
|
||||
- Deleted duplicated test.dbf.
|
||||
|
||||
* contrib/hbtip/client.prg
|
||||
* HAVE_OPENSSL -> HAS_OPENSSL
|
||||
|
||||
* contrib/hbwin/olecore.c
|
||||
* source/rtl/cdpapi.c
|
||||
* Minor formatting.
|
||||
|
||||
2009-08-08 17:01 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
|
||||
* contrib/hbxbp/xbpbrowse.prg
|
||||
+ Implemented ::vScroll | ::hScroll | ::cursorMode
|
||||
Xbase++ documentation suggests that changing these instance variables
|
||||
required ::configure() be called explictly, but I have implemented that
|
||||
the next stablization loop automatically take care of it.
|
||||
+ Implemented ::vScroll | ::hScroll | ::cursorMode
|
||||
Xbase++ documentation suggests that changing these instance variables
|
||||
required ::configure() be called explictly, but I have implemented that
|
||||
the next stablization loop automatically take care of it.
|
||||
Suggestions ?
|
||||
|
||||
* contrib/hbxbp/xbpstatic.prg
|
||||
@@ -31,7 +47,7 @@
|
||||
|
||||
* contrib/hbxbp/tests/demoxbp.prg
|
||||
+ Rearrangeements of objects in tab pages. As the need for more space was growing
|
||||
tab-pages now occupy the whole ::drawingarea and rest of the controls are
|
||||
tab-pages now occupy the whole ::drawingarea and rest of the controls are
|
||||
now children of them.
|
||||
! Demonstrated new instance variables implementation of XbpBrowse().
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
#include "simpleio.ch"
|
||||
#endif
|
||||
|
||||
#if defined( HAVE_OPENSSL )
|
||||
#if defined( HAS_OPENSSL )
|
||||
#include "hbssl.ch"
|
||||
#endif
|
||||
|
||||
@@ -123,7 +123,7 @@ CREATE CLASS tIPClient
|
||||
VAR exGauge /* Gauge control; it can be a codeblock or a function pointer. */
|
||||
|
||||
VAR lTLS INIT .F.
|
||||
#if defined( HAVE_OPENSSL )
|
||||
#if defined( HAS_OPENSSL )
|
||||
VAR ssl_ctx
|
||||
VAR ssl
|
||||
VAR nSSLError INIT 0
|
||||
@@ -187,7 +187,7 @@ METHOD New( oUrl, bTrace, oCredentials ) CLASS tIPClient
|
||||
|
||||
IF ! ::bInitSocks
|
||||
hb_inetInit()
|
||||
#if defined( HAVE_OPENSSL )
|
||||
#if defined( HAS_OPENSSL )
|
||||
SSL_init()
|
||||
RAND_seed( Time() + hb_username() + DToS( Date() ) + hb_DirBase() + NetName() )
|
||||
#endif
|
||||
@@ -198,7 +198,7 @@ METHOD New( oUrl, bTrace, oCredentials ) CLASS tIPClient
|
||||
oUrl := tUrl():New( oUrl )
|
||||
ENDIF
|
||||
|
||||
#if defined( HAVE_OPENSSL )
|
||||
#if defined( HAS_OPENSSL )
|
||||
IF oURL:cProto == "ftps" .OR. ;
|
||||
oURL:cProto == "https" .OR. ;
|
||||
oURL:cProto == "pops" .OR. ;
|
||||
@@ -279,7 +279,7 @@ METHOD EnableTLS( lEnable ) CLASS tIPClient
|
||||
RETURN .T.
|
||||
ENDIF
|
||||
|
||||
#if defined( HAVE_OPENSSL )
|
||||
#if defined( HAS_OPENSSL )
|
||||
IF lEnable
|
||||
::ssl_ctx := SSL_CTX_new()
|
||||
::ssl := SSL_new( ::ssl_ctx )
|
||||
@@ -363,7 +363,7 @@ METHOD Close() CLASS tIPClient
|
||||
|
||||
nRet := hb_inetClose( ::SocketCon )
|
||||
|
||||
#if defined( HAVE_OPENSSL )
|
||||
#if defined( HAS_OPENSSL )
|
||||
IF ::lTLS
|
||||
SSL_shutdown( ::ssl )
|
||||
::ssl := NIL
|
||||
@@ -418,7 +418,7 @@ METHOD Read( nLen ) CLASS tIPClient
|
||||
cStr0 := Space( nLen )
|
||||
|
||||
IF ::lTLS
|
||||
#if defined( HAVE_OPENSSL )
|
||||
#if defined( HAS_OPENSSL )
|
||||
/* Getting around implementing the hack used in non-SSL branch for now.
|
||||
IMO the proper fix would have been done to hb_inetRecvAll(). [vszakats] */
|
||||
::nLastRead := ::InetRecvAll( ::SocketCon, @cStr0, nLen )
|
||||
@@ -582,7 +582,7 @@ METHOD InetSendAll( SocketCon, cData, nLen ) CLASS tIPClient
|
||||
ENDIF
|
||||
|
||||
IF ::lTLS
|
||||
#if defined( HAVE_OPENSSL )
|
||||
#if defined( HAS_OPENSSL )
|
||||
#if defined( _SSL_DEBUG_TEMP )
|
||||
? "SSL_WRITE()", cData
|
||||
#endif
|
||||
@@ -614,7 +614,7 @@ METHOD InetRecv( SocketCon, cStr1, len ) CLASS tIPClient
|
||||
LOCAL nRet
|
||||
|
||||
IF ::lTLS
|
||||
#if defined( HAVE_OPENSSL )
|
||||
#if defined( HAS_OPENSSL )
|
||||
#if defined( _SSL_DEBUG_TEMP )
|
||||
? "SSL_READ()"
|
||||
#endif
|
||||
@@ -637,7 +637,7 @@ METHOD InetRecvLine( SocketCon, nRet, size ) CLASS tIPClient
|
||||
LOCAL cRet
|
||||
|
||||
IF ::lTLS
|
||||
#if defined( HAVE_OPENSSL )
|
||||
#if defined( HAS_OPENSSL )
|
||||
nRet := hb_SSL_read_line( ::ssl, @cRet, size, ::nConnTimeout )
|
||||
#if defined( _SSL_DEBUG_TEMP )
|
||||
? "HB_SSL_READ_LINE()", cRet
|
||||
@@ -664,7 +664,7 @@ METHOD InetRecvAll( SocketCon, cRet, size ) CLASS tIPClient
|
||||
LOCAL nRet
|
||||
|
||||
IF ::lTLS
|
||||
#if defined( HAVE_OPENSSL )
|
||||
#if defined( HAS_OPENSSL )
|
||||
nRet := hb_SSL_read_all( ::ssl, @cRet, size, ::nConnTimeout )
|
||||
#if defined( _SSL_DEBUG_TEMP )
|
||||
? "HB_SSL_READ_ALL()", cRet
|
||||
@@ -691,7 +691,7 @@ METHOD InetErrorCode( SocketCon ) CLASS tIPClient
|
||||
LOCAL nRet
|
||||
|
||||
IF ::lTLS
|
||||
#if defined( HAVE_OPENSSL )
|
||||
#if defined( HAS_OPENSSL )
|
||||
nRet := iif( ::nSSLError == 0, 0, SSL_get_error( ::ssl, ::nSSLError ) )
|
||||
#else
|
||||
nRet := 0
|
||||
@@ -715,7 +715,7 @@ METHOD InetErrorDesc( SocketCon ) CLASS tIPClient
|
||||
|
||||
IF ! Empty( SocketCon )
|
||||
IF ::lTLS
|
||||
#if defined( HAVE_OPENSSL )
|
||||
#if defined( HAS_OPENSSL )
|
||||
IF ::nSSLError != 0
|
||||
cMsg := ERR_error_string( SSL_get_error( ::ssl, ::nSSLError ) )
|
||||
ENDIF
|
||||
@@ -740,7 +740,7 @@ METHOD InetConnect( cServer, nPort, SocketCon ) CLASS tIPClient
|
||||
::InetRcvBufSize( SocketCon, ::nDefaultRcvBuffSize )
|
||||
ENDIF
|
||||
|
||||
#if defined( HAVE_OPENSSL )
|
||||
#if defined( HAS_OPENSSL )
|
||||
IF ::lTLS
|
||||
SSL_set_mode( ::ssl, HB_SSL_MODE_AUTO_RETRY )
|
||||
SSL_set_fd( ::ssl, hb_inetFD( SocketCon ) )
|
||||
|
||||
@@ -459,7 +459,7 @@ static void PutParams( DISPPARAMS * dispparam )
|
||||
{
|
||||
PHB_ITEM pItem = hb_itemNew( NULL );
|
||||
|
||||
hb_oleVariantToItem( pItem, & dispparam->rgvarg[ uiArg ] );
|
||||
hb_oleVariantToItem( pItem, &dispparam->rgvarg[ uiArg ] );
|
||||
|
||||
hb_itemParamStoreForward( ( USHORT ) uiArg + 1, pItem );
|
||||
}
|
||||
|
||||
@@ -405,10 +405,10 @@ FUNCTION Build_ToolBar( oDA )
|
||||
|
||||
/* Harbour does not support resource IDs so giving bitmap files */
|
||||
#ifdef __HARBOUR__
|
||||
oTBar:addItem( "Save" , "new.png" , , , , , "1" )
|
||||
oTBar:addItem( "Open" , "open.png", , , , , "2" )
|
||||
oTBar:addItem( "Font Dialog", "copy.png", , , , , "3" )
|
||||
oTBar:addItem( "Print Dialog", "print.png", , , , , "4" )
|
||||
oTBar:addItem( "Save" , hb_DirBase() + "new.png" , , , , , "1" )
|
||||
oTBar:addItem( "Open" , hb_DirBase() + "open.png" , , , , , "2" )
|
||||
oTBar:addItem( "Font Dialog" , hb_DirBase() + "copy.png" , , , , , "3" )
|
||||
oTBar:addItem( "Print Dialog", hb_DirBase() + "print.png", , , , , "4" )
|
||||
|
||||
#else
|
||||
oTBar:addItem( "Save" )//, 100 )
|
||||
@@ -454,7 +454,7 @@ FUNCTION Build_StatusBar( oWnd )
|
||||
#ifdef __XPP__
|
||||
oSBar:setPointer( , XBPSTATIC_SYSICON_SIZEWE, XBPWINDOW_POINTERTYPE_SYSPOINTER )
|
||||
#else
|
||||
oSBar:setPointer( , 'vr.png', XBPWINDOW_POINTERTYPE_ICON )
|
||||
oSBar:setPointer( , hb_DirBase() + "vr.png", XBPWINDOW_POINTERTYPE_ICON )
|
||||
#endif
|
||||
|
||||
RETURN nil
|
||||
@@ -684,7 +684,7 @@ STATIC FUNCTION Build_ComboBox( oWnd )
|
||||
oCombo:addItem( aDays[ i ] )
|
||||
#ifdef __HARBOUR__
|
||||
/* the command below is not Xbase++ compatible - will be documented while extended */
|
||||
oCombo:setIcon( i, aPNG[ i ]+".png" )
|
||||
oCombo:setIcon( i, hb_DirBase() + aPNG[ i ] + ".png" )
|
||||
#endif
|
||||
NEXT
|
||||
|
||||
@@ -705,7 +705,7 @@ FUNCTION Build_PushButton( oDA )
|
||||
oXbp:setColorBG( GraMakeRGBColor( {0,0,255} ) )
|
||||
|
||||
oXbp := XbpPushButton():new( oDA )
|
||||
oXbp:caption := "new.png"
|
||||
oXbp:caption := hb_DirBase() + "new.png"
|
||||
oXbp:create( , , {290,200}, {90,40} )
|
||||
oXbp:activate:= {|| MsgBox( "Pushbutton B" ) }
|
||||
/* Harbour supports presentation colors */
|
||||
@@ -876,7 +876,7 @@ PROCEDURE WorkAreaInfo( oTree, iIndex )
|
||||
|
||||
oArea:addItem( oStatus )
|
||||
#ifdef __HARBOUR__
|
||||
oArea:setImage( "copy.png" )
|
||||
oArea:setImage( hb_DirBase() + "copy.png" )
|
||||
#endif
|
||||
|
||||
// Create XbpTreeViewItem implicitly (2nd possibility)
|
||||
@@ -940,7 +940,7 @@ FUNCTION Build_Statics( oWnd )
|
||||
oGrp:setColorFG( GraMakeRGBColor( { 0,255,255 } ) )
|
||||
oGrp:setColorBG( GraMakeRGBColor( { 134,128,220 } ) )
|
||||
#ifdef __HARBOUR__
|
||||
oGrp:setPointer( , 'abs3.png', XBPWINDOW_POINTERTYPE_ICON )
|
||||
oGrp:setPointer( , hb_DirBase() + "abs3.png", XBPWINDOW_POINTERTYPE_ICON )
|
||||
#endif
|
||||
|
||||
oLbl := XbpStatic():new( oWnd, , {10,10}, {240,30} )
|
||||
@@ -1034,7 +1034,7 @@ FUNCTION Build_Statics( oWnd )
|
||||
oBox:type := XBPSTATIC_TYPE_BITMAP
|
||||
oBox:options := XBPSTATIC_BITMAP_SCALED
|
||||
oBmp := XbpBitmap():new():create()
|
||||
oBmp:loadFile( 'paste.png' )
|
||||
oBmp:loadFile( hb_DirBase() + "paste.png" )
|
||||
oBox:caption := oBmp
|
||||
oBox:create()
|
||||
oBox:setColorBG( GraMakeRGBColor( { 0,100,100 } ) )
|
||||
@@ -1043,10 +1043,10 @@ FUNCTION Build_Statics( oWnd )
|
||||
oBox:type := XBPSTATIC_TYPE_BITMAP
|
||||
oBox:options := XBPSTATIC_BITMAP_TILED
|
||||
#ifdef __HARBOUR__
|
||||
oBox:caption := 'cut.png'
|
||||
oBox:caption := hb_DirBase() + "cut.png"
|
||||
#else
|
||||
oBmp1 := XbpBitmap():new():create()
|
||||
oBmp1:loadFile( 'paste.png' )
|
||||
oBmp1:loadFile( hb_DirBase() + "paste.png" )
|
||||
oBox:caption := oBmp1
|
||||
#endif
|
||||
oBox:create()
|
||||
@@ -1056,7 +1056,7 @@ FUNCTION Build_Statics( oWnd )
|
||||
#ifdef __HARBOUR__ /* Differes from Xbase++ by Disk File | Resource Name, ID */
|
||||
oBox := XbpStatic():new( oGrp, , {nC4,nT+(nH+nG)*3}, {nW,nH} )
|
||||
oBox:type := XBPSTATIC_TYPE_ICON
|
||||
oBox:caption := "vr.png"
|
||||
oBox:caption := hb_DirBase() + "vr.png"
|
||||
oBox:create()
|
||||
oBox:setColorBG( GraMakeRGBColor( { 255,255,187 } ) )
|
||||
#endif
|
||||
@@ -1400,7 +1400,7 @@ STATIC FUNCTION RtfInsertImage( oRtf )
|
||||
// Proivide a selection dialog
|
||||
cFile := GetAnImageFile( oRtf, 'Select Image to be Inserted' )
|
||||
IF empty( cFile )
|
||||
oRtf:insertImage( "abs3.png" )
|
||||
oRtf:insertImage( hb_DirBase() + "abs3.png" )
|
||||
ELSE
|
||||
oRtf:insertImage( cFile )
|
||||
ENDIF
|
||||
@@ -1469,7 +1469,8 @@ FUNCTION Build_Browse( oWnd )
|
||||
|
||||
Set( _SET_DATEFORMAT, "MM/DD/YYYY" )
|
||||
|
||||
USE "test.dbf" NEW SHARED VIA 'DBFCDX'
|
||||
USE ( ".." + hb_osPathSeparator() + ".." + hb_osPathSeparator() + ".." + hb_osPathSeparator() + "tests" + hb_osPathSeparator() +;
|
||||
"test.dbf" ) NEW SHARED VIA 'DBFCDX'
|
||||
DbGotop()
|
||||
|
||||
oXbpBrowse := XbpBrowse():new():create( oWnd, , { 10,10 }, { oWnd:currentSize()[1]-25,oWnd:currentSize()[2]-45 } )
|
||||
@@ -1665,4 +1666,3 @@ STATIC FUNCTION TBPrev()
|
||||
RETURN lMoved
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
Binary file not shown.
@@ -120,10 +120,8 @@ static int utf8Size( USHORT uc )
|
||||
{
|
||||
if( uc < 0x0080 )
|
||||
return 1;
|
||||
|
||||
else if( uc < 0x0800 )
|
||||
return 2;
|
||||
|
||||
else /* if( uc <= 0xffff ) */
|
||||
return 3;
|
||||
}
|
||||
@@ -237,7 +235,7 @@ static int utf8tou16( const char * szUTF8, USHORT * uc )
|
||||
u32 &= 0x01;
|
||||
m = 6;
|
||||
}
|
||||
while( n < m && ( ( UCHAR ) szUTF8[n] & 0xc0 ) == 0x80 )
|
||||
while( n < m && ( ( UCHAR ) szUTF8[ n ] & 0xc0 ) == 0x80 )
|
||||
{
|
||||
u32 = ( u32 << 6 ) | ( ( UCHAR ) szUTF8[n++] & 0x3f );
|
||||
}
|
||||
@@ -262,7 +260,7 @@ static ULONG utf8pos( const char * szUTF8, ULONG ulLen, ULONG ulUTF8Pos )
|
||||
|
||||
for( ul = ul2 = 0; ul < ulLen; ++ul )
|
||||
{
|
||||
if( utf8tou16nextchar( ( UCHAR ) szUTF8[ul], &n, &uc ) )
|
||||
if( utf8tou16nextchar( ( UCHAR ) szUTF8[ ul ], &n, &uc ) )
|
||||
{
|
||||
if( n == 0 )
|
||||
{
|
||||
@@ -335,8 +333,8 @@ BOOL hb_cdpRegister( PHB_CODEPAGE cdpage )
|
||||
|
||||
for( i = 0; i < 256; i++ )
|
||||
{
|
||||
cdpage->s_upper[i] = ( char ) HB_TOUPPER( ( UCHAR ) i );
|
||||
cdpage->s_lower[i] = ( char ) HB_TOLOWER( ( UCHAR ) i );
|
||||
cdpage->s_upper[ i ] = ( char ) HB_TOUPPER( ( UCHAR ) i );
|
||||
cdpage->s_lower[ i ] = ( char ) HB_TOLOWER( ( UCHAR ) i );
|
||||
}
|
||||
if( strpbrk( cdpage->CharsUpper, "~." ) != NULL )
|
||||
{
|
||||
@@ -402,13 +400,13 @@ BOOL hb_cdpRegister( PHB_CODEPAGE cdpage )
|
||||
{
|
||||
for( i = 91; i <= 96; i++ )
|
||||
{
|
||||
if( !cdpage->s_chars[i] )
|
||||
cdpage->s_chars[i] = ( char ) ( cdpage->nChars + ( i - 90 ) );
|
||||
if( !cdpage->s_chars[ i ] )
|
||||
cdpage->s_chars[ i ] = ( char ) ( cdpage->nChars + ( i - 90 ) );
|
||||
}
|
||||
for( i = 123; i < 256; i++ )
|
||||
{
|
||||
if( !cdpage->s_chars[i] )
|
||||
cdpage->s_chars[i] = ( char ) ( cdpage->nChars + nAddLower + ( i - 122 ) );
|
||||
if( !cdpage->s_chars[ i ] )
|
||||
cdpage->s_chars[ i ] = ( char ) ( cdpage->nChars + nAddLower + ( i - 122 ) );
|
||||
}
|
||||
}
|
||||
/*
|
||||
@@ -422,8 +420,8 @@ BOOL hb_cdpRegister( PHB_CODEPAGE cdpage )
|
||||
{
|
||||
printf( "\n" );
|
||||
for( i=0; i<nMulti; i++ )
|
||||
printf( "\n %c%c %c%c %d",multi[i].cFirst[0],
|
||||
multi[i].cFirst[1],multi[i].cLast[0],multi[i].cLast[1],multi[i].nCode );
|
||||
printf( "\n %c%c %c%c %d",multi[ i ].cFirst[0],
|
||||
multi[ i ].cFirst[1],multi[ i ].cLast[0],multi[ i ].cLast[1],multi[ i ].nCode );
|
||||
}
|
||||
*/
|
||||
if( nMulti )
|
||||
@@ -481,7 +479,7 @@ const char * hb_cdpID( void )
|
||||
|
||||
const char * hb_cdpSelectID( const char *pszID )
|
||||
{
|
||||
const char *pszIDOld;
|
||||
const char * pszIDOld;
|
||||
|
||||
HB_TRACE( HB_TR_DEBUG, ( "hb_cdpSelectID(%s)", pszID ) );
|
||||
|
||||
@@ -528,7 +526,7 @@ void hb_cdpTranslate( char *psz, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut )
|
||||
{
|
||||
n--;
|
||||
*psz = ( n >= ( cdpOut->nChars + nAddLower ) ) ?
|
||||
cdpOut->CharsLower[n - cdpOut->nChars - nAddLower] : cdpOut->CharsUpper[n];
|
||||
cdpOut->CharsLower[ n - cdpOut->nChars - nAddLower ] : cdpOut->CharsUpper[ n ];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -572,7 +570,7 @@ void hb_cdpnTranslate( char *psz, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut, ULONG
|
||||
{
|
||||
n--;
|
||||
*psz = ( n >= ( cdpOut->nChars + nAddLower ) ) ?
|
||||
cdpOut->CharsLower[n - cdpOut->nChars - nAddLower] : cdpOut->CharsUpper[n];
|
||||
cdpOut->CharsLower[n - cdpOut->nChars - nAddLower] : cdpOut->CharsUpper[ n ];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -581,18 +579,11 @@ void hb_cdpnTranslate( char *psz, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut, ULONG
|
||||
|
||||
USHORT hb_cdpGetU16( PHB_CODEPAGE cdp, BOOL fCtrl, UCHAR ch )
|
||||
{
|
||||
USHORT u;
|
||||
|
||||
if( ( fCtrl || ch >= 32 ) && cdp && cdp->uniTable &&
|
||||
cdp->uniTable->uniCodes && ch < cdp->uniTable->nChars )
|
||||
{
|
||||
u = cdp->uniTable->uniCodes[ch];
|
||||
}
|
||||
return cdp->uniTable->uniCodes[ ch ];
|
||||
else
|
||||
{
|
||||
u = ch;
|
||||
}
|
||||
return u;
|
||||
return ch;
|
||||
}
|
||||
|
||||
UCHAR hb_cdpGetChar( PHB_CODEPAGE cdp, BOOL fCtrl, USHORT uc )
|
||||
@@ -603,7 +594,7 @@ UCHAR hb_cdpGetChar( PHB_CODEPAGE cdp, BOOL fCtrl, USHORT uc )
|
||||
|
||||
for( i = fCtrl ? 0 : 32; i < cdp->uniTable->nChars; i++ )
|
||||
{
|
||||
if( cdp->uniTable->uniCodes[i] == uc )
|
||||
if( cdp->uniTable->uniCodes[ i ] == uc )
|
||||
{
|
||||
uc = ( USHORT ) i;
|
||||
break;
|
||||
@@ -627,7 +618,7 @@ char *hb_cdpUTF8StringSubstr( const char * pSrc, ULONG ulLen,
|
||||
n = 0;
|
||||
for( ul = 0; ul < ulLen && ulFrom; ++ul )
|
||||
{
|
||||
if( utf8tou16nextchar( pSrc[ul], &n, &uc ) )
|
||||
if( utf8tou16nextchar( pSrc[ ul ], &n, &uc ) )
|
||||
{
|
||||
if( n == 0 )
|
||||
--ulFrom;
|
||||
@@ -641,7 +632,7 @@ char *hb_cdpUTF8StringSubstr( const char * pSrc, ULONG ulLen,
|
||||
n = 0;
|
||||
do
|
||||
{
|
||||
if( utf8tou16nextchar( pSrc[ul], &n, &uc ) )
|
||||
if( utf8tou16nextchar( pSrc[ ul ], &n, &uc ) )
|
||||
{
|
||||
if( n == 0 )
|
||||
--ulCnt;
|
||||
@@ -651,7 +642,7 @@ char *hb_cdpUTF8StringSubstr( const char * pSrc, ULONG ulLen,
|
||||
|
||||
ulDst = ul - ulFrom;
|
||||
pDst = ( char * ) hb_xgrab( ulDst + 1 );
|
||||
memcpy( pDst, &pSrc[ulFrom], ulDst );
|
||||
memcpy( pDst, &pSrc[ ulFrom ], ulDst );
|
||||
pDst[ ulDst ] = '\0';
|
||||
}
|
||||
}
|
||||
@@ -672,7 +663,7 @@ ULONG hb_cdpUTF8StringPeek( const char * pSrc, ULONG ulLen, ULONG ulPos )
|
||||
|
||||
for( ul = 0; ul < ulLen && ulPos; ++ul )
|
||||
{
|
||||
if( utf8tou16nextchar( ( UCHAR ) pSrc[ul], &n, &uc ) )
|
||||
if( utf8tou16nextchar( ( UCHAR ) pSrc[ ul ], &n, &uc ) )
|
||||
{
|
||||
if( n == 0 )
|
||||
--ulPos;
|
||||
@@ -684,7 +675,7 @@ ULONG hb_cdpUTF8StringPeek( const char * pSrc, ULONG ulLen, ULONG ulPos )
|
||||
n = 0;
|
||||
do
|
||||
{
|
||||
if( utf8tou16nextchar( ( UCHAR ) pSrc[ul], &n, &uc ) )
|
||||
if( utf8tou16nextchar( ( UCHAR ) pSrc[ ul ], &n, &uc ) )
|
||||
{
|
||||
if( n == 0 )
|
||||
return uc;
|
||||
@@ -705,7 +696,7 @@ ULONG hb_cdpUTF8StringLength( const char * pSrc, ULONG ulLen )
|
||||
|
||||
for( ul = ulDst = 0; ul < ulLen; ++ul )
|
||||
{
|
||||
if( utf8tou16nextchar( ( UCHAR ) pSrc[ul], &n, &uc ) )
|
||||
if( utf8tou16nextchar( ( UCHAR ) pSrc[ ul ], &n, &uc ) )
|
||||
{
|
||||
if( n == 0 )
|
||||
++ulDst;
|
||||
@@ -722,7 +713,7 @@ ULONG hb_cdpStringInUTF8Length( PHB_CODEPAGE cdp, BOOL fCtrl,
|
||||
|
||||
for( ul = ulDst = 0; ul < ulLen; ++ul )
|
||||
{
|
||||
ulDst += utf8Size( hb_cdpGetU16( cdp, fCtrl, ( UCHAR ) pSrc[ul] ) );
|
||||
ulDst += utf8Size( hb_cdpGetU16( cdp, fCtrl, ( UCHAR ) pSrc[ ul ] ) );
|
||||
}
|
||||
|
||||
return ulDst;
|
||||
@@ -750,7 +741,7 @@ ULONG hb_cdpUTF8ToStrn( PHB_CODEPAGE cdp, BOOL fCtrl,
|
||||
|
||||
for( i = fCtrl ? 0 : 32; i < cdp->uniTable->nChars; i++ )
|
||||
{
|
||||
if( cdp->uniTable->uniCodes[i] == uc )
|
||||
if( cdp->uniTable->uniCodes[ i ] == uc )
|
||||
{
|
||||
uc = ( USHORT ) i;
|
||||
break;
|
||||
@@ -781,7 +772,7 @@ BOOL hb_cdpGetFromUTF8( PHB_CODEPAGE cdp, BOOL fCtrl, UCHAR ch,
|
||||
|
||||
for( i = fCtrl ? 0 : 32; i < cdp->uniTable->nChars; i++ )
|
||||
{
|
||||
if( cdp->uniTable->uniCodes[i] == *uc )
|
||||
if( cdp->uniTable->uniCodes[ i ] == *uc )
|
||||
{
|
||||
*uc = ( USHORT ) i;
|
||||
break;
|
||||
@@ -808,8 +799,8 @@ ULONG hb_cdpStrnToUTF8( PHB_CODEPAGE cdp, BOOL fCtrl,
|
||||
*/
|
||||
for( i = 0, n = 0; i < ulLen; i++ )
|
||||
{
|
||||
u = hb_cdpGetU16( cdp, fCtrl, ( UCHAR ) pSrc[i] );
|
||||
n += u16toutf8( &pDst[n], u );
|
||||
u = hb_cdpGetU16( cdp, fCtrl, ( UCHAR ) pSrc[ i ] );
|
||||
n += u16toutf8( &pDst[ n ], u );
|
||||
}
|
||||
return n;
|
||||
}
|
||||
@@ -827,12 +818,12 @@ ULONG hb_cdpStrnToUTF8( PHB_CODEPAGE cdp, BOOL fCtrl,
|
||||
|
||||
for( i = 0, n = 0; i < ulLen; i++ )
|
||||
{
|
||||
u = ( UCHAR ) pSrc[i];
|
||||
u = ( UCHAR ) pSrc[ i ];
|
||||
if( uniCodes && u < nChars && ( fCtrl || u >= 32 ) )
|
||||
u = uniCodes[u];
|
||||
n += u16toutf8( &pDst[n], u );
|
||||
u = uniCodes[ u ];
|
||||
n += u16toutf8( &pDst[ n ], u );
|
||||
}
|
||||
pDst[n] = '\0';
|
||||
pDst[ n ] = '\0';
|
||||
|
||||
return n;
|
||||
}
|
||||
@@ -852,7 +843,7 @@ ULONG hb_cdpStrnToU16( PHB_CODEPAGE cdp, BOOL fCtrl,
|
||||
*/
|
||||
for( i = 0; i < ulLen; i++, pDst += 2 )
|
||||
{
|
||||
u = hb_cdpGetU16( cdp, fCtrl, ( UCHAR ) pSrc[i] );
|
||||
u = hb_cdpGetU16( cdp, fCtrl, ( UCHAR ) pSrc[ i ] );
|
||||
HB_PUT_BE_UINT16( pDst, u );
|
||||
}
|
||||
return i << 1;
|
||||
@@ -871,9 +862,9 @@ ULONG hb_cdpStrnToU16( PHB_CODEPAGE cdp, BOOL fCtrl,
|
||||
|
||||
for( i = 0; i < ulLen; i++, pDst += 2 )
|
||||
{
|
||||
u = ( UCHAR ) pSrc[i];
|
||||
u = ( UCHAR ) pSrc[ i ];
|
||||
if( uniCodes && u < nChars && ( fCtrl || u >= 32 ) )
|
||||
u = uniCodes[u];
|
||||
u = uniCodes[ u ];
|
||||
HB_PUT_BE_UINT16( pDst, u );
|
||||
}
|
||||
return i << 1;
|
||||
@@ -886,8 +877,8 @@ int hb_cdpchrcmp( char cFirst, char cSecond, PHB_CODEPAGE cdpage )
|
||||
if( cFirst == cSecond )
|
||||
return 0;
|
||||
|
||||
if( ( n1 = ( int ) cdpage->s_chars[( UCHAR ) cFirst] ) != 0 &&
|
||||
( n2 = ( int ) cdpage->s_chars[( UCHAR ) cSecond] ) != 0 )
|
||||
if( ( n1 = ( int ) cdpage->s_chars[ ( UCHAR ) cFirst ] ) != 0 &&
|
||||
( n2 = ( int ) cdpage->s_chars[ ( UCHAR ) cSecond ] ) != 0 )
|
||||
return ( n1 < n2 ) ? -1 : 1;
|
||||
|
||||
return ( ( UCHAR ) cFirst < ( UCHAR ) cSecond ) ? -1 : 1;
|
||||
@@ -939,8 +930,8 @@ int hb_cdpcmp( const char *szFirst, ULONG ulLenFirst,
|
||||
{
|
||||
if( nd1 == nd2 )
|
||||
{
|
||||
nd1 = ( UCHAR ) cdpage->s_chars[( UCHAR ) * szFirst];
|
||||
nd2 = ( UCHAR ) cdpage->s_chars[( UCHAR ) * szSecond];
|
||||
nd1 = ( UCHAR ) cdpage->s_chars[ ( UCHAR ) * szFirst ];
|
||||
nd2 = ( UCHAR ) cdpage->s_chars[ ( UCHAR ) * szSecond ];
|
||||
if( nd1 == nd2 || !nd1 || !nd2 )
|
||||
{
|
||||
nd1 = ( UCHAR ) * szFirst;
|
||||
@@ -967,8 +958,8 @@ int hb_cdpcmp( const char *szFirst, ULONG ulLenFirst,
|
||||
{
|
||||
if( nd1 == nd2 )
|
||||
{
|
||||
nd1 = ( UCHAR ) cdpage->s_chars[( UCHAR ) * szFirst];
|
||||
nd2 = ( UCHAR ) cdpage->s_chars[( UCHAR ) * szSecond];
|
||||
nd1 = ( UCHAR ) cdpage->s_chars[ ( UCHAR ) * szFirst ];
|
||||
nd2 = ( UCHAR ) cdpage->s_chars[ ( UCHAR ) * szSecond ];
|
||||
if( nd1 == nd2 || !nd1 || !nd2 )
|
||||
{
|
||||
nd1 = ( UCHAR ) * szFirst;
|
||||
@@ -989,8 +980,8 @@ int hb_cdpcmp( const char *szFirst, ULONG ulLenFirst,
|
||||
}
|
||||
}
|
||||
|
||||
if( ( n1 = ( UCHAR ) cdpage->s_chars[( UCHAR ) * szFirst] ) == 0 ||
|
||||
( n2 = ( UCHAR ) cdpage->s_chars[( UCHAR ) * szSecond] ) == 0 )
|
||||
if( ( n1 = ( UCHAR ) cdpage->s_chars[ ( UCHAR ) * szFirst ] ) == 0 ||
|
||||
( n2 = ( UCHAR ) cdpage->s_chars[ ( UCHAR ) * szSecond ] ) == 0 )
|
||||
{
|
||||
/* One of characters doesn't belong to the national characters */
|
||||
iRet = ( ( UCHAR ) * szFirst < ( UCHAR ) * szSecond ) ? -1 : 1;
|
||||
@@ -1001,8 +992,8 @@ int hb_cdpcmp( const char *szFirst, ULONG ulLenFirst,
|
||||
if( iAcc == 0 && ( fExact || ( ulLenFirst == ulLenSecond && cdpage->lAccInterleave ) ) )
|
||||
{
|
||||
if( cdpage->lAccInterleave )
|
||||
iAcc = ( cdpage->s_accent[( UCHAR ) * szFirst] <
|
||||
cdpage->s_accent[( UCHAR ) * szSecond] ) ? -1 : 1;
|
||||
iAcc = ( cdpage->s_accent[ ( UCHAR ) * szFirst ] <
|
||||
cdpage->s_accent[ ( UCHAR ) * szSecond ] ) ? -1 : 1;
|
||||
else
|
||||
iAcc = ( ( UCHAR ) * szFirst < ( UCHAR ) * szSecond ) ? -1 : 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user