2010-03-05 13:19 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbrddnsx.h
* harbour/src/rdd/dbfnsx/dbfnsx1.c
* harbour/include/hbrddntx.h
* harbour/src/rdd/dbfntx/dbfntx1.c
* harbour/src/rdd/hsx/hsx.c
* harbour/src/rdd/usrrdd/usrrdd.c
* harbour/src/rtl/hbsocket.c
! fixed casting for compilers which needs strict aliasing rules
* harbour/harbour.spec
! fixed typo in hbxpp library name
! fixed to work with SDDSQLT3 library
* harbour/contrib/hbwin/olecore.c
! fixed buffer overflow caused by wrongly used sizeof() instead of
HB_SIZEOFARRAY()
* harbour/contrib/rddsql/sddodbc/sddodbc.c
! fixed wrongly used & operator
* harbour/src/rtl/hbsocket.c
! fixed to compile with OpenWatcom Linux builds
This commit is contained in:
@@ -17,6 +17,30 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2010-03-05 13:19 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/include/hbrddnsx.h
|
||||
* harbour/src/rdd/dbfnsx/dbfnsx1.c
|
||||
* harbour/include/hbrddntx.h
|
||||
* harbour/src/rdd/dbfntx/dbfntx1.c
|
||||
* harbour/src/rdd/hsx/hsx.c
|
||||
* harbour/src/rdd/usrrdd/usrrdd.c
|
||||
* harbour/src/rtl/hbsocket.c
|
||||
! fixed casting for compilers which needs strict aliasing rules
|
||||
|
||||
* harbour/harbour.spec
|
||||
! fixed typo in hbxpp library name
|
||||
! fixed to work with SDDSQLT3 library
|
||||
|
||||
* harbour/contrib/hbwin/olecore.c
|
||||
! fixed buffer overflow caused by wrongly used sizeof() instead of
|
||||
HB_SIZEOFARRAY()
|
||||
|
||||
* harbour/contrib/rddsql/sddodbc/sddodbc.c
|
||||
! fixed wrongly used & operator
|
||||
|
||||
* harbour/src/rtl/hbsocket.c
|
||||
! fixed to compile with OpenWatcom Linux builds
|
||||
|
||||
2010-03-05 11:11 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/rddsql/sddoci/sddoci.c
|
||||
! Fixed OCILIB initalization to make OCI_GetLastError() work.
|
||||
|
||||
@@ -1370,7 +1370,7 @@ HB_FUNC( WIN_OLEAUTO___ONERROR )
|
||||
return;
|
||||
|
||||
szMethod = hb_itemGetSymbol( hb_stackBaseItem() )->szName;
|
||||
AnsiToWideBuffer( szMethod, szMethodWide, ( int ) sizeof( szMethodWide ) );
|
||||
AnsiToWideBuffer( szMethod, szMethodWide, ( int ) HB_SIZEOFARRAY( szMethodWide ) );
|
||||
|
||||
/* Try property put */
|
||||
|
||||
|
||||
@@ -590,7 +590,7 @@ static HB_ERRCODE odbcGoTo( SQLBASEAREAP pArea, HB_ULONG ulRecNo )
|
||||
iTargetType = SQL_C_CHAR;
|
||||
#endif
|
||||
|
||||
if( SQL_SUCCEEDED( res = SQLGetData( hStmt, ui, iTargetType, &buffer, 0, &iLen ) ) )
|
||||
if( SQL_SUCCEEDED( res = SQLGetData( hStmt, ui, iTargetType, buffer, 0, &iLen ) ) )
|
||||
{
|
||||
if( iLen > 0 )
|
||||
{
|
||||
|
||||
@@ -629,15 +629,16 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_libdir}/%{name}/libhbtip*.a
|
||||
%{_libdir}/%{name}/libhbfoxpro.a
|
||||
%{_libdir}/%{name}/libhbfship.a
|
||||
%{_libdir}/%{name}/libhbpp.a
|
||||
%{_libdir}/%{name}/libhbxpp.a
|
||||
%{_libdir}/%{name}/libxhb.a
|
||||
%{_libdir}/%{name}/libhbhpdf.a
|
||||
%{_libdir}/%{name}/libhbgt.a
|
||||
%{_libdir}/%{name}/librddbmcdx.a
|
||||
%{_libdir}/%{name}/libhbclipsm.a
|
||||
%{_libdir}/%{name}/librddsql.a
|
||||
%{_libdir}/%{name}/libhbtpathy.a
|
||||
%{_libdir}/%{name}/libhbziparc.a
|
||||
%{_libdir}/%{name}/librddbmcdx.a
|
||||
%{_libdir}/%{name}/librddsql.a
|
||||
%{_libdir}/%{name}/libsddsqlt3.a
|
||||
|
||||
%{?_with_ads:%files ads}
|
||||
%{?_with_ads:%defattr(644,root,root,755)}
|
||||
|
||||
@@ -294,6 +294,13 @@ typedef struct _NSXTAGHEADER
|
||||
} NSXTAGHEADER;
|
||||
typedef NSXTAGHEADER * LPNSXTAGHEADER;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HB_UCHAR Signature[ 1 ]; /* "i" = 0x69 */
|
||||
HB_UCHAR TagFlags[ 1 ]; /* update flags: NSX_TAG_* */
|
||||
HB_UCHAR RootPage[ 4 ]; /* offset of tag root page */
|
||||
} NSXTAGHEADERUPDT;
|
||||
|
||||
typedef struct _NSXBRANCHPAGE
|
||||
{
|
||||
HB_UCHAR NodeID[ 1 ]; /* NSX_BRANCHPAGE | ( lRoot ? NSX_ROOTPAGE : 0 ) */
|
||||
@@ -383,13 +390,29 @@ typedef struct _HB_PAGEINFO
|
||||
struct _HB_PAGEINFO * pNext;
|
||||
struct _HB_PAGEINFO * pPrev;
|
||||
#ifdef HB_NSX_EXTERNAL_PAGEBUFFER
|
||||
HB_UCHAR * buffer;
|
||||
union
|
||||
{
|
||||
HB_UCHAR * buffer;
|
||||
LPNSXROOTHEADER rootHeader;
|
||||
LPNSXTAGHEADER tagHeader;
|
||||
} data;
|
||||
#else
|
||||
HB_UCHAR buffer[ NSX_PAGELEN ];
|
||||
union
|
||||
{
|
||||
HB_UCHAR buffer[ NSX_PAGELEN ];
|
||||
NSXROOTHEADER rootHeader;
|
||||
NSXTAGHEADER tagHeader;
|
||||
} data;
|
||||
#endif
|
||||
} HB_PAGEINFO;
|
||||
typedef HB_PAGEINFO * LPPAGEINFO;
|
||||
|
||||
typedef union
|
||||
{
|
||||
HB_UCHAR * buffer;
|
||||
LPNSXROOTHEADER header;
|
||||
} HB_NSXPAGEHEAD;
|
||||
|
||||
typedef struct _HB_NSXSCOPE
|
||||
{
|
||||
PHB_ITEM scopeItem;
|
||||
|
||||
@@ -88,13 +88,11 @@ HB_EXTERN_BEGIN
|
||||
#define NTXBLOCKBITS 10 /* Size of NTX block in bits */
|
||||
#define NTXBLOCKSIZE (1<<NTXBLOCKBITS) /* Size of block in NTX file */
|
||||
#define NTX_MAX_TAGNAME 10 /* Max len of tag name */
|
||||
#define NTX_TAGITEMSIZE 16 /* Size of tag item in CTX header */
|
||||
#define NTX_HDR_UNUSED 473 /* the unused part of header */
|
||||
#define NTX_PAGES_PER_TAG 8
|
||||
#define NTX_STACKSIZE 32 /* Maximum page stack size */
|
||||
|
||||
#define NTX_ROOTHEAD_HEADSIZE 12
|
||||
#define NTX_TAGHEAD_HEADSIZE 8
|
||||
|
||||
/* index file structures - defined as HB_BYTEs to avoid alignment problems */
|
||||
|
||||
@@ -121,6 +119,13 @@ typedef struct _NTXHEADER /* Header of NTX file */
|
||||
} NTXHEADER;
|
||||
typedef NTXHEADER * LPNTXHEADER;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HB_BYTE type[2];
|
||||
HB_BYTE version[2];
|
||||
HB_BYTE root[4];
|
||||
} NTXHEADERUPDT;
|
||||
|
||||
typedef struct _CTXTAGITEM /* TAG item in compound NTX (CTX) header */
|
||||
{
|
||||
HB_BYTE tag_name[ NTX_MAX_TAGNAME + 2 ];
|
||||
@@ -135,7 +140,7 @@ typedef struct _CTXHEADER /* Header of xHarbour CTX file */
|
||||
HB_BYTE version[ 4 ]; /* update counter LE */
|
||||
HB_BYTE freepage[ 4 ]; /* first free page in index file */
|
||||
HB_BYTE filesize[ 4 ]; /* size of index file in pages */
|
||||
HB_BYTE tags[ CTX_MAX_TAGS * NTX_TAGITEMSIZE ];
|
||||
CTXTAGITEM tags[ CTX_MAX_TAGS ];
|
||||
} CTXHEADER;
|
||||
typedef CTXHEADER * LPCTXHEADER;
|
||||
|
||||
|
||||
@@ -79,9 +79,9 @@ static HB_USHORT s_uiRddId;
|
||||
#define hb_nsxKeyFree(K) hb_xfree(K)
|
||||
#define hb_nsxFileOffset(I,B) ( (B) << ( (I)->LargeFile ? NSX_PAGELEN_BITS : 0 ) )
|
||||
#define hb_nsxGetRecSize(r) ( (r) < 0x10000 ? 2 : ( (r) < 0x1000000 ? 3 : 4 ) )
|
||||
#define hb_nsxPageBuffer(p) ( (p)->buffer )
|
||||
#define hb_nsxIsLeaf(p) ( ( (p)->buffer[0] & NSX_LEAFPAGE ) != 0 )
|
||||
#define hb_nsxIsRoot(p) ( ( (p)->buffer[0] & NSX_ROOTPAGE ) != 0 )
|
||||
#define hb_nsxPageBuffer(p) ( (p)->data.buffer )
|
||||
#define hb_nsxIsLeaf(p) ( ( (p)->data.buffer[0] & NSX_LEAFPAGE ) != 0 )
|
||||
#define hb_nsxIsRoot(p) ( ( (p)->data.buffer[0] & NSX_ROOTPAGE ) != 0 )
|
||||
#define hb_nsxPageType(p) ( hb_nsxPageBuffer(p)[0] )
|
||||
#define hb_nsxSetPageType(p,t) do hb_nsxPageBuffer(p)[0]=(t); while(0)
|
||||
#define hb_nsxGetKeyRecSize(p) (hb_nsxPageBuffer(p)[1])
|
||||
@@ -1175,7 +1175,7 @@ static void hb_nsxPageCheckKeys( LPPAGEINFO pPage, LPTAGINFO pTag, int iPos, int
|
||||
/*
|
||||
* read a given block from index file
|
||||
*/
|
||||
static HB_BOOL hb_nsxBlockRead( LPNSXINDEX pIndex, HB_ULONG ulBlock, HB_BYTE *buffer, int iSize )
|
||||
static HB_BOOL hb_nsxBlockRead( LPNSXINDEX pIndex, HB_ULONG ulBlock, void * buffer, int iSize )
|
||||
{
|
||||
if( !pIndex->lockRead && !pIndex->lockWrite )
|
||||
hb_errInternal( 9103, "hb_nsxBlockRead on not locked index file.", NULL, NULL );
|
||||
@@ -1193,7 +1193,7 @@ static HB_BOOL hb_nsxBlockRead( LPNSXINDEX pIndex, HB_ULONG ulBlock, HB_BYTE *bu
|
||||
/*
|
||||
* write a given block into index file
|
||||
*/
|
||||
static HB_BOOL hb_nsxBlockWrite( LPNSXINDEX pIndex, HB_ULONG ulBlock, HB_BYTE *buffer, int iSize )
|
||||
static HB_BOOL hb_nsxBlockWrite( LPNSXINDEX pIndex, HB_ULONG ulBlock, const void * buffer, int iSize )
|
||||
{
|
||||
if( !pIndex->lockWrite )
|
||||
hb_errInternal( 9102, "hb_nsxBlockWrite on not locked index file.", NULL, NULL );
|
||||
@@ -1219,7 +1219,7 @@ static HB_BOOL hb_nsxPageSave( LPNSXINDEX pIndex, LPPAGEINFO pPage )
|
||||
hb_nsxLeafSetFreeOffset( pPage, pPage->uiOffset );
|
||||
}
|
||||
if( !hb_nsxBlockWrite( pIndex, pPage->Page,
|
||||
( HB_BYTE * ) hb_nsxPageBuffer( pPage ), NSX_PAGELEN ) )
|
||||
hb_nsxPageBuffer( pPage ), NSX_PAGELEN ) )
|
||||
return HB_FALSE;
|
||||
pPage->Changed = HB_FALSE;
|
||||
pIndex->fFlush = HB_TRUE;
|
||||
@@ -1270,14 +1270,14 @@ static HB_BOOL hb_nsxTagHeaderCheck( LPTAGINFO pTag )
|
||||
{
|
||||
if( pTag->HeadBlock )
|
||||
{
|
||||
HB_BYTE buffer[ NSX_TAGHEAD_HEADSIZE ];
|
||||
if( hb_nsxBlockRead( pTag->pIndex, pTag->HeadBlock, buffer, NSX_TAGHEAD_HEADSIZE ) )
|
||||
NSXTAGHEADERUPDT header;
|
||||
|
||||
if( hb_nsxBlockRead( pTag->pIndex, pTag->HeadBlock, &header, sizeof( header ) ) )
|
||||
{
|
||||
LPNSXTAGHEADER pHeader = ( LPNSXTAGHEADER ) ( void * ) buffer;
|
||||
if( pHeader->Signature[0] == NSX_SIGNATURE )
|
||||
if( header.Signature[0] == NSX_SIGNATURE )
|
||||
{
|
||||
pTag->TagFlags = pHeader->TagFlags[0];
|
||||
pTag->RootBlock = HB_GET_LE_UINT32( pHeader->RootPage );
|
||||
pTag->TagFlags = header.TagFlags[0];
|
||||
pTag->RootBlock = HB_GET_LE_UINT32( header.RootPage );
|
||||
hb_nsxTagUpdateFlags( pTag );
|
||||
}
|
||||
}
|
||||
@@ -1397,8 +1397,8 @@ static LPPAGEINFO hb_nsxPageGetBuffer( LPTAGINFO pTag, HB_ULONG ulPage )
|
||||
pIndex->ulPages = 1;
|
||||
pIndex->ulPageLast = 0;
|
||||
pIndex->ulPagesDepth = NSX_PAGE_BUFFER;
|
||||
pIndex->pages = (LPPAGEINFO*) hb_xgrab( sizeof(LPPAGEINFO) * NSX_PAGE_BUFFER );
|
||||
memset( pIndex->pages, 0, sizeof(LPPAGEINFO) * NSX_PAGE_BUFFER );
|
||||
pIndex->pages = ( LPPAGEINFO * ) hb_xgrab( sizeof( LPPAGEINFO ) * NSX_PAGE_BUFFER );
|
||||
memset( pIndex->pages, 0, sizeof( LPPAGEINFO ) * NSX_PAGE_BUFFER );
|
||||
pPagePtr = &pIndex->pages[0];
|
||||
}
|
||||
else
|
||||
@@ -1418,8 +1418,8 @@ static LPPAGEINFO hb_nsxPageGetBuffer( LPTAGINFO pTag, HB_ULONG ulPage )
|
||||
{
|
||||
ul = pIndex->ulPagesDepth;
|
||||
pIndex->ulPagesDepth += NSX_PAGE_BUFFER >> 1;
|
||||
pIndex->pages = (LPPAGEINFO*) hb_xrealloc( pIndex->pages,
|
||||
sizeof(LPPAGEINFO) * pIndex->ulPagesDepth );
|
||||
pIndex->pages = ( LPPAGEINFO * ) hb_xrealloc( pIndex->pages,
|
||||
sizeof( LPPAGEINFO ) * pIndex->ulPagesDepth );
|
||||
memset( pIndex->pages + ul, 0,
|
||||
( NSX_PAGE_BUFFER >> 1 ) * sizeof( LPPAGEINFO ) );
|
||||
pIndex->ulPages++;
|
||||
@@ -1438,7 +1438,7 @@ static LPPAGEINFO hb_nsxPageGetBuffer( LPTAGINFO pTag, HB_ULONG ulPage )
|
||||
#ifdef HB_NSX_EXTERNAL_PAGEBUFFER
|
||||
if( !hb_nsxPageBuffer( *pPagePtr ) )
|
||||
{
|
||||
hb_nsxPageBuffer( *pPagePtr ) = ( char* ) hb_xgrab( NSX_PAGELEN );
|
||||
hb_nsxPageBuffer( *pPagePtr ) = ( HB_UCHAR * ) hb_xgrab( NSX_PAGELEN );
|
||||
memset( hb_nsxPageBuffer( *pPagePtr ), 0, NSX_PAGELEN );
|
||||
}
|
||||
#endif
|
||||
@@ -1525,7 +1525,7 @@ static LPPAGEINFO hb_nsxPageLoad( LPTAGINFO pTag, HB_ULONG ulPage )
|
||||
pPage = hb_nsxPageGetBuffer( pTag, ulPage );
|
||||
pPage->Changed = HB_FALSE;
|
||||
if( !hb_nsxBlockRead( pTag->pIndex, ulPage,
|
||||
( HB_BYTE * ) hb_nsxPageBuffer( pPage ), NSX_PAGELEN ) )
|
||||
hb_nsxPageBuffer( pPage ), NSX_PAGELEN ) )
|
||||
{
|
||||
hb_nsxPageRelease( pTag, pPage );
|
||||
return NULL;
|
||||
@@ -1556,7 +1556,7 @@ static LPPAGEINFO hb_nsxPageLoad( LPTAGINFO pTag, HB_ULONG ulPage )
|
||||
*/
|
||||
static void hb_nsxPageInit( LPPAGEINFO pPage )
|
||||
{
|
||||
memset( pPage->buffer, 0, NSX_PAGELEN );
|
||||
memset( pPage->data.buffer, 0, NSX_PAGELEN );
|
||||
pPage->uiKeys = pPage->uiOffset = 0;
|
||||
}
|
||||
|
||||
@@ -1566,10 +1566,11 @@ static void hb_nsxPageInit( LPPAGEINFO pPage )
|
||||
static void hb_nsxPageFree( LPTAGINFO pTag, LPPAGEINFO pPage )
|
||||
{
|
||||
hb_nsxSetPageType( pPage, 'f' );
|
||||
{
|
||||
LPNSXROOTHEADER pHeader = ( LPNSXROOTHEADER ) pPage->buffer;
|
||||
HB_PUT_LE_UINT32( pHeader->FreePage, pTag->pIndex->NextAvail );
|
||||
}
|
||||
#ifdef HB_NSX_EXTERNAL_PAGEBUFFER
|
||||
HB_PUT_LE_UINT32( pPage->data.rootHeader->FreePage, pTag->pIndex->NextAvail );
|
||||
#else
|
||||
HB_PUT_LE_UINT32( pPage->data.rootHeader.FreePage, pTag->pIndex->NextAvail );
|
||||
#endif
|
||||
pTag->pIndex->NextAvail = pPage->Page;
|
||||
pTag->pIndex->Changed = pPage->Changed = HB_TRUE;
|
||||
}
|
||||
@@ -1619,8 +1620,11 @@ static LPPAGEINFO hb_nsxPageNew( LPTAGINFO pTag, HB_BOOL fNull )
|
||||
return NULL;
|
||||
else
|
||||
{
|
||||
LPNSXROOTHEADER pHeader = ( LPNSXROOTHEADER ) pPage->buffer;
|
||||
pTag->pIndex->NextAvail = HB_GET_LE_UINT32( pHeader->FreePage );
|
||||
#ifdef HB_NSX_EXTERNAL_PAGEBUFFER
|
||||
pTag->pIndex->NextAvail = HB_GET_LE_UINT32( pPage->data.rootHeader->FreePage );
|
||||
#else
|
||||
pTag->pIndex->NextAvail = HB_GET_LE_UINT32( pPage->data.rootHeader.FreePage );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1943,7 +1947,7 @@ static HB_ERRCODE hb_nsxTagHeaderSave( LPTAGINFO pTag )
|
||||
iSize = sizeof( Header );
|
||||
}
|
||||
|
||||
if( !hb_nsxBlockWrite( pIndex, pTag->HeadBlock, ( HB_BYTE * ) &Header, iSize ) )
|
||||
if( !hb_nsxBlockWrite( pIndex, pTag->HeadBlock, &Header, iSize ) )
|
||||
return HB_FAILURE;
|
||||
|
||||
pTag->HdrChanged = HB_FALSE;
|
||||
@@ -2012,7 +2016,7 @@ static HB_ERRCODE hb_nsxIndexHeaderSave( LPNSXINDEX pIndex )
|
||||
HB_PUT_LE_UINT32( pIndex->HeaderBuff.FreePage, pIndex->NextAvail );
|
||||
HB_PUT_LE_UINT32( pIndex->HeaderBuff.FileSize, pIndex->FileSize );
|
||||
|
||||
if( !hb_nsxBlockWrite( pIndex, 0, ( HB_BYTE * ) &pIndex->HeaderBuff, iSize ) )
|
||||
if( !hb_nsxBlockWrite( pIndex, 0, &pIndex->HeaderBuff, iSize ) )
|
||||
return HB_FAILURE;
|
||||
|
||||
pIndex->Changed = pIndex->Update = HB_FALSE;
|
||||
@@ -2030,7 +2034,7 @@ static HB_ERRCODE hb_nsxIndexLoad( LPNSXINDEX pIndex )
|
||||
|
||||
if( !pIndex->fValidHeader )
|
||||
{
|
||||
if( !hb_nsxBlockRead( pIndex, 0, ( HB_BYTE * ) &pIndex->HeaderBuff, NSX_PAGELEN ) )
|
||||
if( !hb_nsxBlockRead( pIndex, 0, &pIndex->HeaderBuff, NSX_PAGELEN ) )
|
||||
return HB_FAILURE;
|
||||
pIndex->fValidHeader = HB_TRUE;
|
||||
}
|
||||
@@ -2063,7 +2067,7 @@ static HB_ERRCODE hb_nsxIndexLoad( LPNSXINDEX pIndex )
|
||||
if( ulBlock == 0 || pTagItem->TagName[ 0 ] <= 0x20 )
|
||||
return HB_FAILURE;
|
||||
if( !hb_nsxBlockRead( pIndex, ulBlock,
|
||||
( HB_BYTE * ) &tagbuffer, sizeof( NSXTAGHEADER ) ) )
|
||||
&tagbuffer, sizeof( NSXTAGHEADER ) ) )
|
||||
return HB_FAILURE;
|
||||
pTag = hb_nsxTagLoad( pIndex, ulBlock, ( const char * ) pTagItem->TagName, &tagbuffer );
|
||||
if( !pTag )
|
||||
@@ -2080,7 +2084,7 @@ static HB_ERRCODE hb_nsxIndexLoad( LPNSXINDEX pIndex )
|
||||
*/
|
||||
static HB_ERRCODE hb_nsxIndexHeaderRead( LPNSXINDEX pIndex )
|
||||
{
|
||||
if( !hb_nsxBlockRead( pIndex, 0, ( HB_BYTE * ) &pIndex->HeaderBuff, NSX_PAGELEN ) )
|
||||
if( !hb_nsxBlockRead( pIndex, 0, &pIndex->HeaderBuff, NSX_PAGELEN ) )
|
||||
return HB_FAILURE;
|
||||
|
||||
if( pIndex->HeaderBuff.Signature[0] !=
|
||||
|
||||
@@ -931,7 +931,7 @@ static void hb_ntxPageCheckKeys( LPPAGEINFO pPage, LPTAGINFO pTag, int iPos, int
|
||||
/*
|
||||
* read a given block from index file
|
||||
*/
|
||||
static HB_BOOL hb_ntxBlockRead( LPNTXINDEX pIndex, HB_ULONG ulBlock, HB_BYTE *buffer, int iSize )
|
||||
static HB_BOOL hb_ntxBlockRead( LPNTXINDEX pIndex, HB_ULONG ulBlock, void *buffer, int iSize )
|
||||
{
|
||||
if( !pIndex->lockRead && !pIndex->lockWrite )
|
||||
hb_errInternal( 9103, "hb_ntxBlockRead on not locked index file.", NULL, NULL );
|
||||
@@ -952,7 +952,7 @@ static HB_BOOL hb_ntxBlockRead( LPNTXINDEX pIndex, HB_ULONG ulBlock, HB_BYTE *bu
|
||||
/*
|
||||
* write a given block into index file
|
||||
*/
|
||||
static HB_BOOL hb_ntxBlockWrite( LPNTXINDEX pIndex, HB_ULONG ulBlock, HB_BYTE *buffer, int iSize )
|
||||
static HB_BOOL hb_ntxBlockWrite( LPNTXINDEX pIndex, HB_ULONG ulBlock, const void * buffer, int iSize )
|
||||
{
|
||||
if( !pIndex->lockWrite )
|
||||
hb_errInternal( 9102, "hb_ntxBlockWrite on not locked index file.", NULL, NULL );
|
||||
@@ -977,7 +977,7 @@ static HB_BOOL hb_ntxPageSave( LPNTXINDEX pIndex, LPPAGEINFO pPage )
|
||||
{
|
||||
hb_ntxSetKeyCount( pPage, pPage->uiKeys );
|
||||
if( !hb_ntxBlockWrite( pIndex, pPage->Page,
|
||||
( HB_BYTE * ) hb_ntxPageBuffer( pPage ), NTXBLOCKSIZE ) )
|
||||
hb_ntxPageBuffer( pPage ), NTXBLOCKSIZE ) )
|
||||
return HB_FALSE;
|
||||
pPage->Changed = HB_FALSE;
|
||||
pIndex->fFlush = HB_TRUE;
|
||||
@@ -1039,12 +1039,11 @@ static HB_BOOL hb_ntxTagHeaderCheck( LPTAGINFO pTag )
|
||||
{
|
||||
if( pTag->HeadBlock )
|
||||
{
|
||||
HB_BYTE buffer[ NTX_TAGHEAD_HEADSIZE ];
|
||||
if( hb_ntxBlockRead( pTag->Owner, pTag->HeadBlock, buffer, NTX_TAGHEAD_HEADSIZE ) )
|
||||
NTXHEADERUPDT header;
|
||||
if( hb_ntxBlockRead( pTag->Owner, pTag->HeadBlock, &header, sizeof( header ) ) )
|
||||
{
|
||||
LPNTXHEADER pHeader = ( LPNTXHEADER ) ( void * ) buffer;
|
||||
pTag->Signature = HB_GET_LE_UINT16( pHeader->type );
|
||||
pTag->RootBlock = HB_GET_LE_UINT32( pHeader->root );
|
||||
pTag->Signature = HB_GET_LE_UINT16( header.type );
|
||||
pTag->RootBlock = HB_GET_LE_UINT32( header.root );
|
||||
hb_ntxTagUpdateFlags( pTag );
|
||||
}
|
||||
}
|
||||
@@ -1286,7 +1285,7 @@ static LPPAGEINFO hb_ntxPageLoad( LPTAGINFO pTag, HB_ULONG ulPage )
|
||||
pPage = hb_ntxPageGetBuffer( pTag, ulPage );
|
||||
pPage->Changed = HB_FALSE;
|
||||
if( !hb_ntxBlockRead( pTag->Owner, ulPage,
|
||||
( HB_BYTE * ) hb_ntxPageBuffer( pPage ), NTXBLOCKSIZE ) )
|
||||
hb_ntxPageBuffer( pPage ), NTXBLOCKSIZE ) )
|
||||
{
|
||||
hb_ntxPageRelease( pTag, pPage );
|
||||
return NULL;
|
||||
@@ -1623,7 +1622,7 @@ static void hb_ntxIndexTagAdd( LPNTXINDEX pIndex, LPTAGINFO pTag )
|
||||
{
|
||||
LPCTXHEADER lpCTX = ( LPCTXHEADER ) pIndex->HeaderBuff;
|
||||
int iTags = HB_GET_LE_UINT16( lpCTX->ntags ), iLen, i;
|
||||
LPCTXTAGITEM pTagItem = ( LPCTXTAGITEM ) lpCTX->tags;
|
||||
LPCTXTAGITEM pTagItem = lpCTX->tags;
|
||||
|
||||
for( i = 0; i < iTags; pTagItem++, i++ )
|
||||
{
|
||||
@@ -1651,14 +1650,14 @@ static void hb_ntxIndexTagDel( LPNTXINDEX pIndex, char * szTagName )
|
||||
{
|
||||
LPCTXHEADER lpCTX = ( LPCTXHEADER ) pIndex->HeaderBuff;
|
||||
int iTags = HB_GET_LE_UINT16( lpCTX->ntags ), i;
|
||||
LPCTXTAGITEM pTagItem = ( LPCTXTAGITEM ) lpCTX->tags;
|
||||
LPCTXTAGITEM pTagItem = lpCTX->tags;
|
||||
|
||||
for( i = 0; i < iTags; pTagItem++, i++ )
|
||||
{
|
||||
if( !hb_strnicmp( ( char * ) pTagItem->tag_name, szTagName, NTX_MAX_TAGNAME ) )
|
||||
{
|
||||
memmove( pTagItem, pTagItem + 1, ( iTags - i ) * NTX_TAGITEMSIZE );
|
||||
memset( pTagItem + iTags - 1, 0, NTX_TAGITEMSIZE );
|
||||
memmove( pTagItem, pTagItem + 1, ( iTags - i ) * sizeof( CTXTAGITEM ) );
|
||||
memset( pTagItem + iTags - 1, 0, sizeof( CTXTAGITEM ) );
|
||||
--iTags;
|
||||
HB_PUT_LE_UINT16( lpCTX->ntags, iTags );
|
||||
pIndex->Update = HB_TRUE;
|
||||
@@ -1673,7 +1672,7 @@ static void hb_ntxIndexTagDel( LPNTXINDEX pIndex, char * szTagName )
|
||||
static HB_ULONG hb_ntxIndexTagFind( LPCTXHEADER lpCTX, char * szTagName )
|
||||
{
|
||||
int iTags = HB_GET_LE_UINT16( lpCTX->ntags ), i;
|
||||
LPCTXTAGITEM pTagItem = ( LPCTXTAGITEM ) lpCTX->tags;
|
||||
LPCTXTAGITEM pTagItem = lpCTX->tags;
|
||||
|
||||
for( i = 0; i < iTags; pTagItem++, i++ )
|
||||
{
|
||||
@@ -1768,7 +1767,7 @@ static HB_ERRCODE hb_ntxTagHeaderSave( LPTAGINFO pTag )
|
||||
iSize = sizeof( NTXHEADER );
|
||||
}
|
||||
|
||||
if( !hb_ntxBlockWrite( pIndex, pTag->HeadBlock, ( HB_BYTE * ) &Header, iSize ) )
|
||||
if( !hb_ntxBlockWrite( pIndex, pTag->HeadBlock, &Header, iSize ) )
|
||||
return HB_FAILURE;
|
||||
pTag->HdrChanged = HB_FALSE;
|
||||
pIndex->Changed = pIndex->Compound;
|
||||
@@ -1841,7 +1840,7 @@ static HB_ERRCODE hb_ntxIndexHeaderSave( LPNTXINDEX pIndex )
|
||||
HB_PUT_LE_UINT32( lpCTX->freepage, pIndex->NextAvail );
|
||||
HB_PUT_LE_UINT32( lpCTX->filesize, pIndex->TagBlock );
|
||||
|
||||
if( !hb_ntxBlockWrite( pIndex, 0, ( HB_BYTE * ) lpCTX, iSize ) )
|
||||
if( !hb_ntxBlockWrite( pIndex, 0, lpCTX, iSize ) )
|
||||
return HB_FAILURE;
|
||||
}
|
||||
pIndex->Changed = pIndex->Update = HB_FALSE;
|
||||
@@ -1872,7 +1871,7 @@ static HB_ERRCODE hb_ntxIndexLoad( LPNTXINDEX pIndex, char * szTagName )
|
||||
{
|
||||
HB_BYTE tagbuffer[ NTXBLOCKSIZE ];
|
||||
LPCTXHEADER lpCTX = ( LPCTXHEADER ) pIndex->HeaderBuff;
|
||||
LPCTXTAGITEM pTagItem = ( LPCTXTAGITEM ) lpCTX->tags;
|
||||
LPCTXTAGITEM pTagItem = lpCTX->tags;
|
||||
HB_ULONG ulBlock;
|
||||
int iTags;
|
||||
|
||||
|
||||
@@ -304,6 +304,12 @@ typedef struct _HSXHEADER
|
||||
} HSXHEADER;
|
||||
typedef HSXHEADER * LPHSXHEADER;
|
||||
|
||||
typedef union
|
||||
{
|
||||
HB_BYTE data[ HSXHEADER_LEN ];
|
||||
HSXHEADER header;
|
||||
} HSXHEADERBUF;
|
||||
|
||||
typedef struct _HSXINFO
|
||||
{
|
||||
int iHandle; /* HSX handle */
|
||||
@@ -656,25 +662,24 @@ static int hb_hsxHdrFlush( int iHandle )
|
||||
|
||||
if( pHSX->fHdrChanged )
|
||||
{
|
||||
HB_BYTE headrBuf[ HSXHEADER_LEN ];
|
||||
LPHSXHEADER pHeader = ( LPHSXHEADER ) ( void * ) headrBuf;
|
||||
HB_USHORT uiBits = 0, uiSize = pHSX->uiRecordSize;
|
||||
HSXHEADERBUF buffer;
|
||||
|
||||
while( uiSize >>= 1 )
|
||||
uiBits++;
|
||||
|
||||
HB_PUT_LE_UINT32( pHeader->recCount, pHSX->ulRecCount );
|
||||
HB_PUT_LE_UINT32( pHeader->recSize, ( HB_U32 ) pHSX->uiRecordSize );
|
||||
HB_PUT_LE_UINT32( pHeader->recSizeBits, ( HB_U32 ) uiBits );
|
||||
HB_PUT_LE_UINT16( pHeader->ignoreCase, pHSX->fIgnoreCase ? 1 : 0 );
|
||||
HB_PUT_LE_UINT16( pHeader->filterType, pHSX->iFilterType );
|
||||
HB_PUT_LE_UINT32( pHeader->hashLetters, pHSX->fUseHash ? 1 : 0 );
|
||||
HB_PUT_LE_UINT32( buffer.header.recCount, pHSX->ulRecCount );
|
||||
HB_PUT_LE_UINT32( buffer.header.recSize, ( HB_U32 ) pHSX->uiRecordSize );
|
||||
HB_PUT_LE_UINT32( buffer.header.recSizeBits, ( HB_U32 ) uiBits );
|
||||
HB_PUT_LE_UINT16( buffer.header.ignoreCase, pHSX->fIgnoreCase ? 1 : 0 );
|
||||
HB_PUT_LE_UINT16( buffer.header.filterType, pHSX->iFilterType );
|
||||
HB_PUT_LE_UINT32( buffer.header.hashLetters, pHSX->fUseHash ? 1 : 0 );
|
||||
|
||||
memset( pHeader->keyExpression, 0, HSXKEYEXP_LEN + 1 );
|
||||
memset( buffer.header.keyExpression, 0, HSXKEYEXP_LEN + 1 );
|
||||
if( pHSX->szKeyExpr )
|
||||
hb_strncpy( ( char * ) pHeader->keyExpression, pHSX->szKeyExpr, HSXKEYEXP_LEN );
|
||||
hb_strncpy( ( char * ) buffer.header.keyExpression, pHSX->szKeyExpr, HSXKEYEXP_LEN );
|
||||
|
||||
if( hb_fileWriteAt( pHSX->pFile, headrBuf, HSXHEADER_LEN, 0 ) != HSXHEADER_LEN )
|
||||
if( hb_fileWriteAt( pHSX->pFile, buffer.data, HSXHEADER_LEN, 0 ) != HSXHEADER_LEN )
|
||||
return HSX_BADHDRWRITE;
|
||||
|
||||
pHSX->fHdrChanged = HB_FALSE;
|
||||
@@ -723,26 +728,25 @@ static int hb_hsxFlushAll( int iHandle )
|
||||
static int hb_hsxHdrRead( int iHandle )
|
||||
{
|
||||
LPHSXINFO pHSX = hb_hsxGetPointer( iHandle );
|
||||
HB_BYTE headrBuf[ HSXHEADER_LEN ];
|
||||
LPHSXHEADER pHeader = ( LPHSXHEADER ) ( void * ) headrBuf;
|
||||
HSXHEADERBUF buffer;
|
||||
int iResult = HSX_SUCCESS;
|
||||
|
||||
if( ! pHSX )
|
||||
return HSX_BADHANDLE;
|
||||
|
||||
if( hb_fileReadAt( pHSX->pFile, headrBuf, HSXHEADER_LEN, 0 ) != HSXHEADER_LEN )
|
||||
if( hb_fileReadAt( pHSX->pFile, buffer.data, HSXHEADER_LEN, 0 ) != HSXHEADER_LEN )
|
||||
return HSX_BADREAD;
|
||||
|
||||
pHSX->ulRecCount = HB_GET_LE_UINT32( pHeader->recCount );
|
||||
pHSX->uiRecordSize = HB_GET_LE_UINT32( pHeader->recSize );
|
||||
pHSX->fIgnoreCase = HB_GET_LE_UINT16( pHeader->ignoreCase ) != 0;
|
||||
pHSX->iFilterType = HB_GET_LE_UINT16( pHeader->filterType );
|
||||
pHSX->fUseHash = HB_GET_LE_UINT32( pHeader->hashLetters ) != 0;
|
||||
pHSX->ulRecCount = HB_GET_LE_UINT32( buffer.header.recCount );
|
||||
pHSX->uiRecordSize = HB_GET_LE_UINT32( buffer.header.recSize );
|
||||
pHSX->fIgnoreCase = HB_GET_LE_UINT16( buffer.header.ignoreCase ) != 0;
|
||||
pHSX->iFilterType = HB_GET_LE_UINT16( buffer.header.filterType );
|
||||
pHSX->fUseHash = HB_GET_LE_UINT32( buffer.header.hashLetters ) != 0;
|
||||
|
||||
if( pHeader->keyExpression[0] >= ' ' )
|
||||
if( buffer.header.keyExpression[0] >= ' ' )
|
||||
{
|
||||
headrBuf[ HSXHEADER_LEN - 1 ] = '\0';
|
||||
pHSX->szKeyExpr = hb_strdup( ( char * ) pHeader->keyExpression );
|
||||
buffer.data[ HSXHEADER_LEN - 1 ] = '\0';
|
||||
pHSX->szKeyExpr = hb_strdup( ( char * ) buffer.header.keyExpression );
|
||||
iResult = hb_hsxCompile( pHSX->szKeyExpr, &pHSX->pKeyItem );
|
||||
}
|
||||
|
||||
|
||||
@@ -2593,9 +2593,15 @@ static HB_ERRCODE hb_usrRddInfo( LPRDDNODE pRDD, HB_USHORT uiInfoType, HB_ULONG
|
||||
return hb_usrReturn();
|
||||
}
|
||||
|
||||
|
||||
static const RDDFUNCS usrFuncTable =
|
||||
typedef union
|
||||
{
|
||||
RDDFUNCS funcTable;
|
||||
DBENTRYP_V funcentries[ 1 ];
|
||||
}
|
||||
HB_RDD_FUNCTABLE;
|
||||
|
||||
static const HB_RDD_FUNCTABLE usrFuncTable =
|
||||
{ {
|
||||
/* Movement and positioning methods */
|
||||
/* ( DBENTRYP_BP ) */ hb_usrBof, /* Bof */
|
||||
/* ( DBENTRYP_BP ) */ hb_usrEof, /* Eof */
|
||||
@@ -2719,10 +2725,10 @@ static const RDDFUNCS usrFuncTable =
|
||||
|
||||
/* Special and reserved methods */
|
||||
/* ( DBENTRYP_SVP ) */ NULL /* WhoCares */
|
||||
};
|
||||
} };
|
||||
|
||||
static const RDDFUNCS rddFuncTable =
|
||||
{
|
||||
static const HB_RDD_FUNCTABLE rddFuncTable =
|
||||
{ {
|
||||
/* Movement and positioning methods */
|
||||
/* ( DBENTRYP_BP ) */ NULL, /* Bof */
|
||||
/* ( DBENTRYP_BP ) */ NULL, /* Eof */
|
||||
@@ -2846,7 +2852,7 @@ static const RDDFUNCS rddFuncTable =
|
||||
|
||||
/* Special and reserved methods */
|
||||
/* ( DBENTRYP_SVP ) */ NULL /* WhoCares */
|
||||
};
|
||||
} };
|
||||
|
||||
HB_FUNC( USRRDD_GETFUNCTABLE )
|
||||
{
|
||||
@@ -2867,16 +2873,16 @@ HB_FUNC( USRRDD_GETFUNCTABLE )
|
||||
|
||||
if( puiCount && pSelfTable && pSuperTable && pMethods )
|
||||
{
|
||||
RDDFUNCS funcTable;
|
||||
HB_RDD_FUNCTABLE funcTable;
|
||||
DBENTRYP_V * pFunction;
|
||||
const DBENTRYP_V * pUsrFunction, * pRddFunction;
|
||||
|
||||
* puiCount = RDDFUNCSCOUNT;
|
||||
uiSize = ( HB_USHORT ) hb_arrayLen( pMethods );
|
||||
|
||||
pUsrFunction = ( const DBENTRYP_V * ) ( const void * ) &usrFuncTable;
|
||||
pRddFunction = ( const DBENTRYP_V * ) ( const void * ) &rddFuncTable;
|
||||
pFunction = ( DBENTRYP_V * ) ( void * ) &funcTable;
|
||||
pUsrFunction = usrFuncTable.funcentries;
|
||||
pRddFunction = rddFuncTable.funcentries;
|
||||
pFunction = funcTable.funcentries;
|
||||
|
||||
for( uiCount = 1; uiCount <= RDDFUNCSCOUNT; ++uiCount )
|
||||
{
|
||||
@@ -2890,7 +2896,7 @@ HB_FUNC( USRRDD_GETFUNCTABLE )
|
||||
++pRddFunction;
|
||||
++pFunction;
|
||||
}
|
||||
uiResult = hb_rddInherit( pSelfTable, &funcTable, pSuperTable, szSuperRDD );
|
||||
uiResult = hb_rddInherit( pSelfTable, &funcTable.funcTable, pSuperTable, szSuperRDD );
|
||||
if( uiResult == HB_SUCCESS )
|
||||
{
|
||||
pSelfTable->whoCares = ( DBENTRYP_SVP ) hb_itemNew( pMethods );
|
||||
|
||||
@@ -216,7 +216,9 @@
|
||||
# include <sys/un.h>
|
||||
# endif
|
||||
# include <netinet/tcp.h>
|
||||
# include <net/if.h>
|
||||
# if !( defined( HB_OS_LINUX ) && defined( __WATCOMC__ ) )
|
||||
# include <net/if.h>
|
||||
# endif
|
||||
# include <unistd.h>
|
||||
# include <fcntl.h>
|
||||
# if defined( HB_OS_DOS )
|
||||
@@ -745,6 +747,16 @@ PHB_ITEM hb_socketGetIFaces( int af, HB_BOOL fNoAliases )
|
||||
# define HB_SOCK_IS_EINPROGRES() ( errno == EINPROGRESS )
|
||||
#endif
|
||||
|
||||
typedef union
|
||||
{
|
||||
#if defined( HB_HAS_SOCKADDR_STORAGE )
|
||||
struct sockaddr_storage st;
|
||||
#else
|
||||
char st[ HB_SOCKADDR_MAX_LEN ];
|
||||
#endif
|
||||
struct sockaddr sa;
|
||||
} HB_SOCKADDR_STORAGE;
|
||||
|
||||
/* MT macros */
|
||||
#define HB_SOCKET_LOCK hb_threadEnterCriticalSection( &s_sockMtx );
|
||||
#define HB_SOCKET_UNLOCK hb_threadLeaveCriticalSection( &s_sockMtx );
|
||||
@@ -1927,21 +1939,15 @@ PHB_ITEM hb_socketAddrToItem( const void * pSockAddr, unsigned len )
|
||||
|
||||
int hb_socketGetSockName( HB_SOCKET sd, void ** pSockAddr, unsigned * puiLen )
|
||||
{
|
||||
int ret;
|
||||
#if defined( HB_HAS_SOCKADDR_STORAGE )
|
||||
struct sockaddr_storage st;
|
||||
struct sockaddr * sa = ( struct sockaddr * ) ( void * ) &st;
|
||||
#else
|
||||
char st[ HB_SOCKADDR_MAX_LEN ];
|
||||
struct sockaddr * sa = ( struct sockaddr * ) ( void * ) st;
|
||||
#endif
|
||||
HB_SOCKADDR_STORAGE st;
|
||||
socklen_t len = sizeof( st );
|
||||
int ret;
|
||||
|
||||
ret = getsockname( sd, sa, &len );
|
||||
ret = getsockname( sd, &st.sa, &len );
|
||||
hb_socketSetOsError( ret == 0 ? 0 : HB_SOCK_GETERROR() );
|
||||
if( ret == 0 )
|
||||
{
|
||||
*pSockAddr = memcpy( hb_xgrab( len + 1 ), sa, len );
|
||||
*pSockAddr = memcpy( hb_xgrab( len + 1 ), &st.sa, len );
|
||||
*puiLen = ( unsigned ) len;
|
||||
}
|
||||
else
|
||||
@@ -1961,20 +1967,14 @@ int hb_socketGetPeerName( HB_SOCKET sd, void ** pSockAddr, unsigned * puiLen )
|
||||
ret = -1;
|
||||
hb_socketSetRawError( HB_SOCKET_ERR_NOSUPPORT );
|
||||
#else
|
||||
#if defined( HB_HAS_SOCKADDR_STORAGE )
|
||||
struct sockaddr_storage st;
|
||||
struct sockaddr * sa = ( struct sockaddr * ) ( void * ) &st;
|
||||
#else
|
||||
char st[ HB_SOCKADDR_MAX_LEN ];
|
||||
struct sockaddr * sa = ( struct sockaddr * ) ( void * ) st;
|
||||
#endif
|
||||
HB_SOCKADDR_STORAGE st;
|
||||
socklen_t len = sizeof( st );
|
||||
|
||||
ret = getpeername( sd, sa, &len );
|
||||
ret = getpeername( sd, &st.sa, &len );
|
||||
hb_socketSetOsError( ret == 0 ? 0 : HB_SOCK_GETERROR() );
|
||||
if( ret == 0 )
|
||||
{
|
||||
*pSockAddr = memcpy( hb_xgrab( len + 1 ), sa, len );
|
||||
*pSockAddr = memcpy( hb_xgrab( len + 1 ), &st.sa, len );
|
||||
*puiLen = ( unsigned ) len;
|
||||
}
|
||||
else
|
||||
@@ -2121,15 +2121,9 @@ int hb_socketListen( HB_SOCKET sd, int iBacklog )
|
||||
HB_SOCKET hb_socketAccept( HB_SOCKET sd, void ** pSockAddr, unsigned * puiLen, HB_MAXINT timeout )
|
||||
{
|
||||
HB_SOCKET newsd = HB_NO_SOCKET;
|
||||
int ret;
|
||||
#if defined( HB_HAS_SOCKADDR_STORAGE )
|
||||
struct sockaddr_storage st;
|
||||
struct sockaddr * sa = ( struct sockaddr * ) ( void * ) &st;
|
||||
#else
|
||||
char st[ HB_SOCKADDR_MAX_LEN ];
|
||||
struct sockaddr * sa = ( struct sockaddr * ) ( void * ) st;
|
||||
#endif
|
||||
HB_SOCKADDR_STORAGE st;
|
||||
socklen_t len = sizeof( st );
|
||||
int ret;
|
||||
|
||||
hb_vmUnlock();
|
||||
ret = hb_socketSelectRD( sd, timeout );
|
||||
@@ -2141,7 +2135,7 @@ HB_SOCKET hb_socketAccept( HB_SOCKET sd, void ** pSockAddr, unsigned * puiLen, H
|
||||
* accepts incoming connection (concurrent calls).
|
||||
*/
|
||||
ret = timeout < 0 ? 0 : hb_socketSetBlockingIO( sd, HB_FALSE );
|
||||
newsd = accept( sd, sa, &len );
|
||||
newsd = accept( sd, &st.sa, &len );
|
||||
hb_socketSetOsError( newsd != HB_NO_SOCKET ? 0 : HB_SOCK_GETERROR() );
|
||||
if( ret > 0 )
|
||||
hb_socketSetBlockingIO( sd, HB_TRUE );
|
||||
@@ -2154,7 +2148,7 @@ HB_SOCKET hb_socketAccept( HB_SOCKET sd, void ** pSockAddr, unsigned * puiLen, H
|
||||
}
|
||||
else
|
||||
{
|
||||
*pSockAddr = memcpy( hb_xgrab( len + 1 ), sa, len );
|
||||
*pSockAddr = memcpy( hb_xgrab( len + 1 ), &st.sa, len );
|
||||
*puiLen = ( unsigned ) len;
|
||||
}
|
||||
}
|
||||
@@ -2322,18 +2316,12 @@ long hb_socketRecvFrom( HB_SOCKET sd, void * data, long len, int flags, void **
|
||||
}
|
||||
if( lReceived >= 0 )
|
||||
{
|
||||
#if defined( HB_HAS_SOCKADDR_STORAGE )
|
||||
struct sockaddr_storage st;
|
||||
struct sockaddr * sa = ( struct sockaddr * ) ( void * ) &st;
|
||||
#else
|
||||
char st[ HB_SOCKADDR_MAX_LEN ];
|
||||
struct sockaddr * sa = ( struct sockaddr * ) ( void * ) st;
|
||||
#endif
|
||||
HB_SOCKADDR_STORAGE st;
|
||||
socklen_t salen = sizeof( st );
|
||||
|
||||
do
|
||||
{
|
||||
lReceived = recvfrom( sd, ( char * ) data, len, flags, sa, &salen );
|
||||
lReceived = recvfrom( sd, ( char * ) data, len, flags, &st.sa, &salen );
|
||||
hb_socketSetOsError( HB_SOCK_GETERROR() );
|
||||
}
|
||||
while( lReceived == -1 && HB_SOCK_IS_EINTR() && hb_vmRequestQuery() == 0 );
|
||||
@@ -2347,7 +2335,7 @@ long hb_socketRecvFrom( HB_SOCKET sd, void * data, long len, int flags, void **
|
||||
}
|
||||
else
|
||||
{
|
||||
*pSockAddr = memcpy( hb_xgrab( salen + 1 ), sa, salen );
|
||||
*pSockAddr = memcpy( hb_xgrab( salen + 1 ), &st.sa, salen );
|
||||
*puiSockLen = ( unsigned ) salen;
|
||||
}
|
||||
}
|
||||
@@ -2968,7 +2956,8 @@ PHB_ITEM hb_socketGetAliases( const char * szAddr, int af )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if defined( SIOCGIFCONF ) || defined( HB_OS_WIN )
|
||||
#if defined( HB_OS_WIN ) || ( defined( SIOCGIFCONF ) && \
|
||||
!( defined( HB_OS_LINUX ) && defined( __WATCOMC__ ) ) )
|
||||
static void hb_socketArraySetInetAddr( PHB_ITEM pItem, HB_SIZE nPos,
|
||||
const void * pSockAddr, unsigned len )
|
||||
{
|
||||
@@ -2993,7 +2982,8 @@ PHB_ITEM hb_socketGetIFaces( int af, HB_BOOL fNoAliases )
|
||||
* new systems using 'struct lifreq' with SIOCGLIF* ioctls instead
|
||||
* of 'struct ifreq' and SIOCGIF*
|
||||
*/
|
||||
#if defined( SIOCGIFCONF )
|
||||
#if defined( SIOCGIFCONF ) && \
|
||||
!( defined( HB_OS_LINUX ) && defined( __WATCOMC__ ) )
|
||||
struct ifconf ifc;
|
||||
struct ifreq * pifr;
|
||||
char * buf, * ptr;
|
||||
|
||||
Reference in New Issue
Block a user