2010-05-28 17:31 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* src/common/hbver.c
    + Fine tuned SunPro version detection.
      Patch submitted by Tamas Tevesz.

  * contrib/hbwin/win_shell.c
  * contrib/hbwin/tests/testcopy.prg
    ! WIN_SHFILEOPERATION() fixed after initial upload.
    + Added more test code.
This commit is contained in:
Viktor Szakats
2010-05-28 15:32:31 +00:00
parent ac4c537724
commit 6d74dd1da0
4 changed files with 79 additions and 91 deletions

View File

@@ -17,6 +17,16 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-05-28 17:31 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* src/common/hbver.c
+ Fine tuned SunPro version detection.
Patch submitted by Tamas Tevesz.
* contrib/hbwin/win_shell.c
* contrib/hbwin/tests/testcopy.prg
! WIN_SHFILEOPERATION() fixed after initial upload.
+ Added more test code.
2010-05-28 11:09 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/doc/xhb-diff.txt
* updated information about hash arrays and associative arrays

View File

@@ -12,18 +12,37 @@
#include "hbwin.ch"
PROCEDURE Main()
LOCAL a := {}
LOCAL lAbort
#include "simpleio.ch"
? "0x" + hb_numtohex( WIN_SHFileOperation( NIL, WIN_FO_COPY, { "testcopy.prg", "olesrv1.prg" }, "testcopy1",;
WIN_FOF_WANTMAPPINGHANDLE, @lAbort,;
a, "Harbour SHFile 1" ) )
PROCEDURE Main()
LOCAL a
LOCAL lAbort
LOCAL tmp
? "0x" + hb_numtohex( WIN_SHFileOperation( NIL, WIN_FO_COPY, { "testcopy.prg", "olesrv1.prg" }, { "testcopy1" },;
NIL, @lAbort,;
NIL, "Harbour SHFile 1" ) )
? lAbort
? "0x" + hb_numtohex( WIN_SHFileOperation( NIL, WIN_FO_COPY, "testcopy.prg" + Chr( 0 ) + "olesrv1.prg" + Chr( 0 ), "testcopy2",;
hb_MemoWrit( "rename.txt", "hello1" )
hb_MemoWrit( "rename1.txt", "hello2" )
a := {}
? "0x" + hb_numtohex( WIN_SHFileOperation( NIL, WIN_FO_RENAME, { "rename.txt" }, { "rename1.txt" },;
WIN_FOF_WANTMAPPINGHANDLE, @lAbort,;
a, "Harbour SHFile 2" ) )
? lAbort
FOR EACH tmp IN a
? tmp[ 1 ], tmp[ 2 ]
FErase( tmp[ 1 ] )
FErase( tmp[ 2 ] )
NEXT
FErase( "rename1.txt" )
? "0x" + hb_numtohex( WIN_SHFileOperation( NIL, WIN_FO_COPY, "testcopy.prg" + Chr( 0 ) + "olesrv1.prg" + Chr( 0 ), "testcopy2",;
NIL, @lAbort,;
NIL, "Harbour SHFile 3" ) )
? lAbort
RETURN

View File

@@ -128,11 +128,10 @@ typedef struct
LPSHNAMEMAPPING lpSHNameMapping;
} HANDLETOMAPPINGS;
static LPTSTR s_StringList( int iParam, DWORD * pdwIndex )
static LPTSTR s_StringList( int iParam )
{
PHB_ITEM pItem = hb_param( iParam, HB_IT_ARRAY | HB_IT_STRING ), pArrItem;
LPTSTR lpStr = NULL;
DWORD dwMaxIndex = 0;
if( pItem )
{
@@ -163,10 +162,7 @@ static LPTSTR s_StringList( int iParam, DWORD * pdwIndex )
n1 = HB_ITEMCOPYSTR( pArrItem,
lpStr + nLen, nTotal - nLen );
if( n1 )
{
nLen += n1 + 1;
dwMaxIndex++;
}
}
}
lpStr[ nLen ] = 0;
@@ -177,53 +173,13 @@ static LPTSTR s_StringList( int iParam, DWORD * pdwIndex )
nLen = HB_ITEMCOPYSTR( pItem, NULL, 0 );
if( nLen )
{
lpStr = ( LPTSTR ) hb_xgrab( ( nLen * 1 + 2 ) * sizeof( TCHAR ) );
HB_ITEMCOPYSTR( pItem, lpStr, nLen + 1 );
for( n = n1 = 0; n < nLen; ++n )
{
if( lpStr[ n ] == 0 )
{
++n1;
if( lpStr[ n + 1 ] == 0 )
break;
}
}
if( n1 == 0 )
{
HB_ITEMCOPYSTR( pItem, lpStr + nLen + 1, nLen + 1 );
lpStr[ nLen * 1 + 2 ] = 0;
dwMaxIndex = 1;
}
else
{
if( n == nLen && lpStr[ n - 1 ] != 0 )
{
lpStr[ n + 1 ] = 0;
++n1;
}
if( ( n1 & 1 ) == 0 )
dwMaxIndex = ( DWORD ) n1;
else
{
hb_xfree( lpStr );
lpStr = NULL;
}
}
lpStr = ( LPTSTR ) hb_xgrab( ( nLen + 1 ) * sizeof( TCHAR ) );
HB_ITEMCOPYSTR( pItem, lpStr, nLen );
lpStr[ nLen ] = 0;
}
}
}
if( pdwIndex )
{
if( dwMaxIndex < *pdwIndex )
*pdwIndex = dwMaxIndex;
else if( dwMaxIndex && *pdwIndex == 0 )
*pdwIndex = 1;
}
return lpStr;
}
@@ -244,8 +200,8 @@ HB_FUNC( WIN_SHFILEOPERATION )
fop.hwnd = wapi_par_HWND( 1 );
fop.wFunc = ( UINT ) hb_parni( 2 );
fop.pFrom = ( LPCTSTR ) s_StringList( 3, NULL );
fop.pTo = ( LPCTSTR ) s_StringList( 4, NULL );
fop.pFrom = ( LPCTSTR ) s_StringList( 3 );
fop.pTo = ( LPCTSTR ) s_StringList( 4 );
fop.fFlags = ( FILEOP_FLAGS ) hb_parnl( 5 );
fop.fAnyOperationsAborted = FALSE;
fop.hNameMappings = NULL;
@@ -269,41 +225,45 @@ HB_FUNC( WIN_SHFILEOPERATION )
HANDLETOMAPPINGS * hm = ( HANDLETOMAPPINGS * ) fop.hNameMappings;
PHB_ITEM pArray = hb_param( 7, HB_IT_ARRAY );
if( pArray )
hb_arraySize( pArray, 0 );
/* Process hNameMappings */
if( hm )
{
PHB_ITEM pTempItem = hb_itemNew( NULL );
UINT tmp;
LPSHNAMEMAPPING pmap = hm->lpSHNameMapping;
HB_BOOL bIsWin9x = hb_iswin9x();
for( tmp = 0; tmp < hm->uNumberOfMappings; ++tmp )
if( pArray )
{
hb_arrayNew( pTempItem, 2 );
PHB_ITEM pTempItem = hb_itemNew( NULL );
UINT tmp;
LPSHNAMEMAPPING pmap = hm->lpSHNameMapping;
HB_BOOL bIsWin9x = hb_iswin9x();
if( bIsWin9x )
hb_arraySize( pArray, hm->uNumberOfMappings );
for( tmp = 0; tmp < hm->uNumberOfMappings; ++tmp )
{
/* always returns non-UNICODE on Win9x systems */
hb_arraySetCL( pTempItem, 1, ( char * ) pmap[ tmp ].pszOldPath, pmap[ tmp ].cchOldPath );
hb_arraySetCL( pTempItem, 2, ( char * ) pmap[ tmp ].pszNewPath, pmap[ tmp ].cchNewPath );
}
else
{
/* always returns UNICODE on NT and upper systems */
HB_ARRAYSETSTRLEN( pTempItem, 1, ( LPTSTR ) pmap[ tmp ].pszOldPath, pmap[ tmp ].cchOldPath );
HB_ARRAYSETSTRLEN( pTempItem, 2, ( LPTSTR ) pmap[ tmp ].pszNewPath, pmap[ tmp ].cchNewPath );
hb_arrayNew( pTempItem, 2 );
if( bIsWin9x )
{
/* always returns non-UNICODE on Win9x systems */
hb_arraySetCL( pTempItem, 1, ( char * ) pmap[ tmp ].pszOldPath, pmap[ tmp ].cchOldPath );
hb_arraySetCL( pTempItem, 2, ( char * ) pmap[ tmp ].pszNewPath, pmap[ tmp ].cchNewPath );
}
else
{
/* always returns UNICODE on NT and upper systems */
HB_ARRAYSETSTRLEN( pTempItem, 1, ( LPTSTR ) pmap[ tmp ].pszOldPath, pmap[ tmp ].cchOldPath );
HB_ARRAYSETSTRLEN( pTempItem, 2, ( LPTSTR ) pmap[ tmp ].pszNewPath, pmap[ tmp ].cchNewPath );
}
hb_arraySetForward( pArray, ( HB_SIZE ) ( tmp + 1 ), pTempItem );
}
hb_arraySetForward( pTempItem, ( HB_SIZE ) ( tmp + 1 ), pTempItem );
hb_itemRelease( pTempItem );
}
hb_itemRelease( pTempItem );
SHFreeNameMappings( hm );
}
else if( pArray )
hb_arraySize( pArray, 0 );
}
#endif
hb_retni( iRetVal );

View File

@@ -739,30 +739,29 @@ char * hb_verCompiler( void )
#elif defined( __SUNPRO_C )
pszName = "Sun C";
#if __SUNPRO_C < 0x600
#if __SUNPRO_C < 0x1000
iVerMajor = __SUNPRO_C / 0x100;
iVerMinor = ( __SUNPRO_C & 0xff ) / 0x10;
iVerPatch = __SUNPRO_C & 0xf;
#else
/* Until someone at Sun somes up with a reliable way of identifying
Sun Studio releases >= about 11. */
iVerMajor = iVerMinor = iVerPatch = 0;
hb_snprintf( szSub, sizeof( szSub ) - 1, " (ident 0x%X)", __SUNPRO_C );
iVerMajor = __SUNPRO_C / 0x1000;
iVerMinor = __SUNPRO_C / 0x10 & 0xff;
iVerMinor = iVerMinor / 16 * 10 + iVerMinor % 16;
iVerPatch = __SUNPRO_C & 0xf;
#endif
#elif defined( __SUNPRO_CC )
pszName = "Sun C++";
#if __SUNPRO_CC < 0x600
pszName = "Sun C++";
#if __SUNPRO_CC < 0x1000
iVerMajor = __SUNPRO_CC / 0x100;
iVerMinor = ( __SUNPRO_CC & 0xff ) / 0x10;
iVerPatch = __SUNPRO_CC & 0xf;
#else
/* Until someone at Sun somes up with a reliable way of identifying
Sun Studio releases >= about 11. */
iVerMajor = iVerMinor = iVerPatch = 0;
hb_snprintf( szSub, sizeof( szSub ) - 1, " (ident 0x%X)", __SUNPRO_CC );
iVerMajor = __SUNPRO_CC / 0x1000;
iVerMinor = __SUNPRO_CC / 0x10 & 0xff;
iVerMinor = iVerMinor / 16 * 10 + iVerMinor % 16;
iVerPatch = __SUNPRO_CC & 0xf;
#endif
#else