diff --git a/ChangeLog.txt b/ChangeLog.txt index 39cd6e5a31..b913cb36f5 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -7,6 +7,75 @@ Entries may not always be in chronological/commit order. See license at the end of file. */ +2024-02-09 20:56 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * contrib/hbcurl/core.c + * contrib/hbcurl/hbcurl.ch + + added HB_CURLOPT_XFERINFODATA and HB_CURLOPT_XFERINFOFUNCTION + ! use CURLOPT_XFERINFO* instead of depreciated CURLOPT_PROGRESS* + to implement HB_CURLOPT_PROGRESSBLOCK + ! do not use depreciated CURLOPT_RANDOM_FILE and CURLOPT_EGDSOCKET, + they serve no purpose anymore + + added macros for new protocols + + added HB_CURLOPT_PROTOCOLS_STR and HB_CURLOPT_REDIR_PROTOCOLS_STR + ! use CURLOPT_PROTOCOLS_STR and CURLOPT_REDIR_PROTOCOLS_STR instead + of depreciated CURLOPT_PROTOCOLS and CURLOPT_REDIR_PROTOCOLS + * emulate CURLOPT_PROTOCOLS and CURLOPT_REDIR_PROTOCOLS using + CURLOPT_PROTOCOLS_STR and CURLOPT_REDIR_PROTOCOLS_STR in new curl + versions + + added support for HB_CURLOPT_MIMEPOST + ! use CURLOPT_MIMEPOST to emulate depreciated in new curl versions + CURLOPT_HTTPPOST + + added support for HB_CURLOPT_PROXY_SERVICE_NAME + ! use CURLOPT_PROXY_SERVICE_NAME to emulate depreciated in new curl + versions CURLOPT_SOCKS5_GSSAPI_SERVICE + + added HB_CURLINFO_ACTIVESOCKET + ! use CURLINFO_ACTIVESOCKET instead of depreciated CURLINFO_LASTSOCKET + + added HB_CURLINFO_SIZE_UPLOAD_T, HB_CURLINFO_SIZE_DOWNLOAD_T, + HB_CURLINFO_SPEED_DOWNLOAD_T, HB_CURLINFO_SPEED_UPLOAD_T, + HB_CURLINFO_CONTENT_LENGTH_DOWNLOAD_T and + HB_CURLINFO_CONTENT_LENGTH_UPLOAD_T + ! use CURLINFO_*_T actions instead of depreciated ones which operate + double as file offset and emulate old actions using new ones in + new curl versions + + * contrib/hbssl/evp.c + ! Do no use EVP_cleanup() in OpenSSL 1.1.0 and newer. + It no longer has any effect. + + * contrib/hbssl/hbssl.h + * set OPENSSL_API_COMPAT to 1.2.0 to pacify OpenSSL 3.0 API. + It hides OpenSSL 3.0 warnings but we should update the code to use + new suggested API. + + * contrib/hbwin/olecore.c + ! invoke assign methods with DISPATCH_PROPERTYPUTREF instead of + DISPATCH_PROPERTYPUT if assigned value is OLE object. If such + functionality is not implemented by the object (some OLE + implementations do not support it and returns DISP_E_MEMBERNOTFOUND) + then call it again but in previous form with DISPATCH_PROPERTYPUT + + * include/hbapirdd.h + * src/rdd/dbcmd.c + ! fixed error codes set by DbSetRelations() to be Cl*pper compatible + + * src/rdd/dbcmd.c + + accept symbol items in Select() and DbSelectArea() just like in + ( ) -> + + * include/hbcompdf.h + * include/hbexprb.c + * src/common/funcid.c + + added compile time optimization for Select() function without parameters + + added compile time optimization DbSelectArea( | ) + + added support for hb_PIsByRef( @localVarName ) -> + When the parameter is passed by reference Harbour verifies if it's + existing local variable and change it to its index in parameter list + so effectively it works like hb_IsByRef( @localVarName ) in xHarbour + + * contrib/xhb/hbcompat.ch + + added translations for + hb_PIsByRef( @ ) <=> hb_IsByRef( @ ) + 2024-01-29 17:13 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/harbour.def + added hb_socketNToHS() to exported functions diff --git a/contrib/hbcurl/core.c b/contrib/hbcurl/core.c index b3e66370db..7478610f42 100644 --- a/contrib/hbcurl/core.c +++ b/contrib/hbcurl/core.c @@ -89,8 +89,12 @@ typedef struct _HB_CURL { CURL * curl; +#if LIBCURL_VERSION_NUM >= 0x073800 + curl_mime * mime; +#else struct curl_httppost * pHTTPPOST_First; struct curl_httppost * pHTTPPOST_Last; +#endif struct curl_slist * pHTTPHEADER; struct curl_slist * pHTTP200ALIASES; struct curl_slist * pQUOTE; @@ -117,7 +121,9 @@ typedef struct _HB_CURL PHB_ITEM pProgressCallback; PHB_ITEM pDebugCallback; +#ifdef HB_CURL_HASH_STRINGS PHB_HASH_TABLE pHash; +#endif } HB_CURL, * PHB_CURL; @@ -192,6 +198,71 @@ static const char * hb_curl_StrHashNew( PHB_CURL hb_curl, const char * szValue ) #endif /* HB_CURL_HASH_STRINGS */ +#if LIBCURL_VERSION_NUM >= 0x075500 +#define hb_bitShift( b, s ) ( ( b ) << ( s ) ) +static char * hb_curl_protnames( unsigned long bitmask ) +{ + /* now we need 166 bytes for 30 protocol names and trailing 0 so 200 is enough */ + HB_SIZE nLen = 200, nDst = 0; + char * buffer = ( char * ) hb_xgrab( nLen ); + unsigned long prot; + + for( prot = 1; prot != 0 && prot <= bitmask; prot <<= 1 ) + { + if( prot & bitmask ) + { + const char * szProt = NULL; + switch( prot & bitmask ) + { + case HB_CURLPROTO_HTTP: szProt = "HTTP" ; break; + case HB_CURLPROTO_HTTPS: szProt = "HTTPS" ; break; + case HB_CURLPROTO_FTP: szProt = "FTP" ; break; + case HB_CURLPROTO_FTPS: szProt = "FTPS" ; break; + case HB_CURLPROTO_SCP: szProt = "SCP" ; break; + case HB_CURLPROTO_SFTP: szProt = "SFTP" ; break; + case HB_CURLPROTO_TELNET: szProt = "TELNET" ; break; + case HB_CURLPROTO_LDAP: szProt = "LDAP" ; break; + case HB_CURLPROTO_LDAPS: szProt = "LDAPS" ; break; + case HB_CURLPROTO_DICT: szProt = "DICT" ; break; + case HB_CURLPROTO_FILE: szProt = "FILE" ; break; + case HB_CURLPROTO_TFTP: szProt = "TFTP" ; break; + case HB_CURLPROTO_IMAP: szProt = "IMAP" ; break; + case HB_CURLPROTO_IMAPS: szProt = "IMAPS" ; break; + case HB_CURLPROTO_POP3: szProt = "POP3" ; break; + case HB_CURLPROTO_POP3S: szProt = "POP3S" ; break; + case HB_CURLPROTO_SMTP: szProt = "SMTP" ; break; + case HB_CURLPROTO_SMTPS: szProt = "SMTPS" ; break; + case HB_CURLPROTO_RTSP: szProt = "RTSP" ; break; + case HB_CURLPROTO_RTMP: szProt = "RTMP" ; break; + case HB_CURLPROTO_RTMPT: szProt = "RTMPT" ; break; + case HB_CURLPROTO_RTMPE: szProt = "RTMPE" ; break; + case HB_CURLPROTO_RTMPTE: szProt = "RTMPTE" ; break; + case HB_CURLPROTO_RTMPS: szProt = "RTMPS" ; break; + case HB_CURLPROTO_RTMPTS: szProt = "RTMPTS" ; break; + case HB_CURLPROTO_GOPHER: szProt = "GOPHER" ; break; + case HB_CURLPROTO_SMB: szProt = "SMB" ; break; + case HB_CURLPROTO_SMBS: szProt = "SMBS" ; break; + case HB_CURLPROTO_MQTT: szProt = "MQTT" ; break; + case HB_CURLPROTO_GOPHERS: szProt = "GOPHERS"; break; + } + if( szProt ) + { + HB_SIZE l = strlen( szProt ); + if( nDst + l + ( nDst ? 1 : 0 ) < nLen ) + { + if( nDst ) + buffer[ nDst++ ] = ','; + memcpy( &buffer[ nDst ], szProt, l ); + nDst += l; + } + } + } + } + buffer[ nDst ] = '\0'; + return buffer; +} +#endif + /* Global initialization/deinitialization */ /* -------------------------------------- */ @@ -226,17 +297,22 @@ static void * hb_curl_calloc( size_t nelem, size_t elsize ) return ptr; } +static void hb_curl_retcode( CURLcode code ) +{ + hb_retni( ( int ) code ); +} + HB_FUNC( CURL_GLOBAL_INIT ) { #if LIBCURL_VERSION_NUM >= 0x070A08 /* Not documented. GUESS. */ - hb_retnl( ( long ) curl_global_init_mem( hb_parnldef( 1, CURL_GLOBAL_ALL ), - hb_curl_xgrab, - hb_curl_xfree, - hb_curl_xrealloc, - hb_curl_strdup, - hb_curl_calloc ) ); + hb_curl_retcode( curl_global_init_mem( hb_parnldef( 1, CURL_GLOBAL_ALL ), + hb_curl_xgrab, + hb_curl_xfree, + hb_curl_xrealloc, + hb_curl_strdup, + hb_curl_calloc ) ); #else - hb_retnl( ( long ) curl_global_init_mem( hb_parnldef( 1, CURL_GLOBAL_ALL ) ) ); + hb_curl_retcode( curl_global_init_mem( hb_parnldef( 1, CURL_GLOBAL_ALL ) ) ); #endif } @@ -386,7 +462,11 @@ static size_t hb_curl_write_buff_callback( void * buffer, size_t size, size_t nm return ( size_t ) -1; } +#if LIBCURL_VERSION_NUM >= 0x072000 +static int hb_curl_xferinfo_callback( void * Cargo, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow ) +#else static int hb_curl_progress_callback( void * Cargo, double dltotal, double dlnow, double ultotal, double ulnow ) +#endif { if( Cargo ) { @@ -394,8 +474,13 @@ static int hb_curl_progress_callback( void * Cargo, double dltotal, double dlnow { hb_vmPushEvalSym(); hb_vmPush( ( PHB_ITEM ) Cargo ); +#if LIBCURL_VERSION_NUM >= 0x072000 + hb_vmPushNumInt( ( HB_MAXINT ) ( ulnow > 0 ? ulnow : dlnow ) ); + hb_vmPushNumInt( ( HB_MAXINT ) ( ultotal > 0 ? ultotal : dltotal ) ); +#else hb_vmPushDouble( ulnow > 0 ? ulnow : dlnow, HB_DEFAULT_DECIMALS ); hb_vmPushDouble( ultotal > 0 ? ultotal : dltotal, HB_DEFAULT_DECIMALS ); +#endif hb_vmSend( 2 ); if( hb_parl( -1 ) ) @@ -433,6 +518,7 @@ static int hb_curl_debug_callback( CURL * handle, curl_infotype type, char * dat /* Helpers */ /* ------- */ +#if LIBCURL_VERSION_NUM < 0x073800 static void hb_curl_form_free( struct curl_httppost ** ptr ) { if( ptr && *ptr ) @@ -441,6 +527,7 @@ static void hb_curl_form_free( struct curl_httppost ** ptr ) *ptr = NULL; } } +#endif static void hb_curl_slist_free( struct curl_slist ** ptr ) { @@ -512,11 +599,18 @@ static void PHB_CURL_free( PHB_CURL hb_curl, HB_BOOL bFree ) curl_easy_setopt( hb_curl->curl, CURLOPT_READDATA, NULL ); curl_easy_setopt( hb_curl->curl, CURLOPT_WRITEFUNCTION, NULL ); curl_easy_setopt( hb_curl->curl, CURLOPT_WRITEDATA, NULL ); +#if LIBCURL_VERSION_NUM >= 0x072000 + curl_easy_setopt( hb_curl->curl, CURLOPT_XFERINFOFUNCTION, NULL ); + curl_easy_setopt( hb_curl->curl, CURLOPT_XFERINFODATA, NULL ); +#else curl_easy_setopt( hb_curl->curl, CURLOPT_PROGRESSFUNCTION, NULL ); curl_easy_setopt( hb_curl->curl, CURLOPT_PROGRESSDATA, NULL ); +#endif /* Some extra safety. Set these to NULL, before freeing their pointers. */ +#if LIBCURL_VERSION_NUM < 0x073800 curl_easy_setopt( hb_curl->curl, CURLOPT_HTTPPOST, NULL ); +#endif curl_easy_setopt( hb_curl->curl, CURLOPT_HTTPHEADER, NULL ); curl_easy_setopt( hb_curl->curl, CURLOPT_HTTP200ALIASES, NULL ); curl_easy_setopt( hb_curl->curl, CURLOPT_QUOTE, NULL ); @@ -527,8 +621,16 @@ static void PHB_CURL_free( PHB_CURL hb_curl, HB_BOOL bFree ) curl_easy_setopt( hb_curl->curl, CURLOPT_MAIL_RCPT, NULL ); #endif +#if LIBCURL_VERSION_NUM >= 0x073800 + if( hb_curl->mime ) + { + curl_mime_free( hb_curl->mime ); + hb_curl->mime = NULL; + } +#else hb_curl_form_free( &hb_curl->pHTTPPOST_First ); hb_curl->pHTTPPOST_Last = NULL; +#endif hb_curl_slist_free( &hb_curl->pHTTPHEADER ); hb_curl_slist_free( &hb_curl->pHTTP200ALIASES ); hb_curl_slist_free( &hb_curl->pQUOTE ); @@ -556,11 +658,13 @@ static void PHB_CURL_free( PHB_CURL hb_curl, HB_BOOL bFree ) hb_curl->pDebugCallback = NULL; } +#ifdef HB_CURL_HASH_STRINGS if( hb_curl->pHash ) { hb_hashTableKill( hb_curl->pHash ); hb_curl->pHash = NULL; } +#endif if( bFree ) { @@ -703,9 +807,9 @@ HB_FUNC( CURL_EASY_PAUSE ) #if LIBCURL_VERSION_NUM >= 0x071200 PHB_CURL hb_curl = PHB_CURL_par( 1 ); - hb_retnl( hb_curl ? ( long ) curl_easy_pause( hb_curl->curl, hb_parni( 2 ) ) : HB_CURLE_ERROR ); + hb_curl_retcode( hb_curl ? curl_easy_pause( hb_curl->curl, hb_parni( 2 ) ) : ( CURLcode ) HB_CURLE_ERROR ); #else - hb_retnl( HB_CURLE_ERROR ); + hb_curl_retcode( ( CURLcode ) HB_CURLE_ERROR ); #endif } else @@ -718,7 +822,7 @@ HB_FUNC( CURL_EASY_PERFORM ) { PHB_CURL hb_curl = PHB_CURL_par( 1 ); - hb_retnl( hb_curl ? ( long ) curl_easy_perform( hb_curl->curl ) : HB_CURLE_ERROR ); + hb_curl_retcode( hb_curl ? curl_easy_perform( hb_curl->curl ) : ( CURLcode ) HB_CURLE_ERROR ); } else hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); @@ -742,7 +846,7 @@ HB_FUNC( CURL_EASY_SEND ) hb_storns( size, 3 ); } #endif - hb_retnl( ( long ) res ); + hb_curl_retcode( res ); } else hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); @@ -773,7 +877,7 @@ HB_FUNC( CURL_EASY_RECV ) hb_xfree( buffer ); } #endif - hb_retnl( ( long ) res ); + hb_curl_retcode( res ); } else hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); @@ -831,6 +935,8 @@ HB_FUNC( CURL_EASY_SETOPT ) /* HB_CURLOPT_OPENSOCKETDATA */ /* HB_CURLOPT_PROGRESSFUNCTION */ /* HB_CURLOPT_PROGRESSDATA */ + /* HB_CURLOPT_XFERINFOFUNCTION */ + /* HB_CURLOPT_XFERINFODATA */ /* HB_CURLOPT_HEADERFUNCTION */ /* HB_CURLOPT_HEADERDATA / CURLOPT_WRITEHEADER */ /* HB_CURLOPT_DEBUGFUNCTION */ @@ -891,9 +997,11 @@ HB_FUNC( CURL_EASY_SETOPT ) case HB_CURLOPT_DNS_CACHE_TIMEOUT: res = curl_easy_setopt( hb_curl->curl, CURLOPT_DNS_CACHE_TIMEOUT, hb_parnl( 3 ) ); break; +#if LIBCURL_VERSION_NUM >= 0x070B01 && LIBCURL_VERSION_NUM < 0x073E00 case HB_CURLOPT_DNS_USE_GLOBAL_CACHE: /* OBSOLETE */ res = curl_easy_setopt( hb_curl->curl, CURLOPT_DNS_USE_GLOBAL_CACHE, HB_CURL_OPT_BOOL( 3 ) ); break; +#endif #if LIBCURL_VERSION_NUM >= 0x070A00 case HB_CURLOPT_BUFFERSIZE: res = curl_easy_setopt( hb_curl->curl, CURLOPT_BUFFERSIZE, hb_parnl( 3 ) ); @@ -914,17 +1022,56 @@ HB_FUNC( CURL_EASY_SETOPT ) #endif #if LIBCURL_VERSION_NUM >= 0x071304 case HB_CURLOPT_PROTOCOLS: +#if LIBCURL_VERSION_NUM >= 0x075500 + { + char * szProtocols = hb_curl_protnames( hb_parnl( 3 ) ); + res = curl_easy_setopt( hb_curl->curl, CURLOPT_PROTOCOLS_STR, szProtocols ); + hb_xfree( szProtocols ); + } +#else res = curl_easy_setopt( hb_curl->curl, CURLOPT_PROTOCOLS, hb_parnl( 3 ) ); +#endif + break; +#if LIBCURL_VERSION_NUM >= 0x075500 + case HB_CURLOPT_PROTOCOLS_STR: + if( HB_ISCHAR( 3 ) ) + res = curl_easy_setopt( hb_curl->curl, CURLOPT_PROTOCOLS_STR, hb_parc( 3 ) ); break; +#endif case HB_CURLOPT_REDIR_PROTOCOLS: +#if LIBCURL_VERSION_NUM >= 0x075500 + { + char * szProtocols = hb_curl_protnames( hb_parnl( 3 ) ); + res = curl_easy_setopt( hb_curl->curl, CURLOPT_REDIR_PROTOCOLS_STR, szProtocols ); + hb_xfree( szProtocols ); + } +#else res = curl_easy_setopt( hb_curl->curl, CURLOPT_REDIR_PROTOCOLS, hb_parnl( 3 ) ); +#endif break; +#if LIBCURL_VERSION_NUM >= 0x075500 + case HB_CURLOPT_REDIR_PROTOCOLS_STR: + if( HB_ISCHAR( 3 ) ) + res = curl_easy_setopt( hb_curl->curl, CURLOPT_REDIR_PROTOCOLS_STR, hb_parc( 3 ) ); + break; +#endif case HB_CURLOPT_NOPROXY: res = curl_easy_setopt( hb_curl->curl, CURLOPT_NOPROXY, hb_curl_StrHash( hb_curl, hb_parc( 3 ) ) ); break; +#if LIBCURL_VERSION_NUM >= 0x072B00 + case HB_CURLOPT_PROXY_SERVICE_NAME: + res = curl_easy_setopt( hb_curl->curl, CURLOPT_PROXY_SERVICE_NAME, hb_curl_StrHash( hb_curl, hb_parc( 3 ) ) ); + break; +#endif +#if LIBCURL_VERSION_NUM >= 0x071304 case HB_CURLOPT_SOCKS5_GSSAPI_SERVICE: +#if LIBCURL_VERSION_NUM >= 0x073100 + res = curl_easy_setopt( hb_curl->curl, CURLOPT_PROXY_SERVICE_NAME, hb_curl_StrHash( hb_curl, hb_parc( 3 ) ) ); +#else res = curl_easy_setopt( hb_curl->curl, CURLOPT_SOCKS5_GSSAPI_SERVICE, hb_curl_StrHash( hb_curl, hb_parc( 3 ) ) ); +#endif break; +#endif case HB_CURLOPT_SOCKS5_GSSAPI_NEC: res = curl_easy_setopt( hb_curl->curl, CURLOPT_SOCKS5_GSSAPI_NEC, HB_CURL_OPT_BOOL( 3 ) ); break; @@ -1020,7 +1167,11 @@ HB_FUNC( CURL_EASY_SETOPT ) break; #endif case HB_CURLOPT_PUT: +#if LIBCURL_VERSION_NUM >= 0x070C01 + res = curl_easy_setopt( hb_curl->curl, CURLOPT_UPLOAD, HB_CURL_OPT_BOOL( 3 ) ); +#else res = curl_easy_setopt( hb_curl->curl, CURLOPT_PUT, HB_CURL_OPT_BOOL( 3 ) ); +#endif break; case HB_CURLOPT_POST: res = curl_easy_setopt( hb_curl->curl, CURLOPT_POST, HB_CURL_OPT_BOOL( 3 ) ); @@ -1040,6 +1191,7 @@ HB_FUNC( CURL_EASY_SETOPT ) break; #endif case HB_CURLOPT_HTTPPOST: + case HB_CURLOPT_MIMEPOST: { PHB_ITEM pArray = hb_param( 3, HB_IT_ARRAY ); @@ -1048,9 +1200,26 @@ HB_FUNC( CURL_EASY_SETOPT ) HB_SIZE nPos; HB_SIZE nLen = hb_arrayLen( pArray ); - for( nPos = 0; nPos < nLen; ++nPos ) +#if LIBCURL_VERSION_NUM >= 0x073800 + if( hb_curl->mime || nLen > 0 ) { - PHB_ITEM pSubArray = hb_arrayGetItemPtr( pArray, nPos + 1 ); + if( ! hb_curl->mime ) + hb_curl->mime = curl_easy_init(); + + for( nPos = 1; nPos <= nLen; ++nPos ) + { + PHB_ITEM pSubArray = hb_arrayGetItemPtr( pArray, nPos ); + curl_mimepart * part = curl_mime_addpart( hb_curl->mime ); + + curl_mime_name( part, hb_arrayGetCPtr( pSubArray, 1 ) ); + curl_mime_filedata( part, hb_arrayGetCPtr( pSubArray, 2 ) ); + } + res = curl_easy_setopt( hb_curl->curl, CURLOPT_MIMEPOST, hb_curl->mime ); + } +#else + for( nPos = 1; nPos <= nLen; ++nPos ) + { + PHB_ITEM pSubArray = hb_arrayGetItemPtr( pArray, nPos ); curl_formadd( &hb_curl->pHTTPPOST_First, &hb_curl->pHTTPPOST_Last, @@ -1059,8 +1228,8 @@ HB_FUNC( CURL_EASY_SETOPT ) CURLFORM_FILE, hb_curl_StrHash( hb_curl, hb_arrayGetCPtr( pSubArray, 2 ) ), CURLFORM_END ); } - res = curl_easy_setopt( hb_curl->curl, CURLOPT_HTTPPOST, hb_curl->pHTTPPOST_First ); +#endif } } break; @@ -1538,12 +1707,14 @@ HB_FUNC( CURL_EASY_SETOPT ) case HB_CURLOPT_CAPATH: res = curl_easy_setopt( hb_curl->curl, CURLOPT_CAPATH, hb_curl_StrHash( hb_curl, hb_parc( 3 ) ) ); break; +#if LIBCURL_VERSION_NUM < 0x075400 case HB_CURLOPT_RANDOM_FILE: res = curl_easy_setopt( hb_curl->curl, CURLOPT_RANDOM_FILE, hb_curl_StrHash( hb_curl, hb_parc( 3 ) ) ); break; case HB_CURLOPT_EGDSOCKET: res = curl_easy_setopt( hb_curl->curl, CURLOPT_EGDSOCKET, hb_curl_StrHash( hb_curl, hb_parc( 3 ) ) ); break; +#endif case HB_CURLOPT_SSL_VERIFYHOST: res = curl_easy_setopt( hb_curl->curl, CURLOPT_SSL_VERIFYHOST, hb_parnl( 3 ) ); break; @@ -1663,9 +1834,13 @@ HB_FUNC( CURL_EASY_SETOPT ) if( hb_curl->pProgressCallback ) { +#if LIBCURL_VERSION_NUM >= 0x072000 + curl_easy_setopt( hb_curl->curl, CURLOPT_XFERINFOFUNCTION, NULL ); + curl_easy_setopt( hb_curl->curl, CURLOPT_XFERINFODATA, NULL ); +#else curl_easy_setopt( hb_curl->curl, CURLOPT_PROGRESSFUNCTION, NULL ); curl_easy_setopt( hb_curl->curl, CURLOPT_PROGRESSDATA, NULL ); - +#endif hb_itemRelease( hb_curl->pProgressCallback ); hb_curl->pProgressCallback = NULL; } @@ -1676,8 +1851,13 @@ HB_FUNC( CURL_EASY_SETOPT ) /* unlock the item so GC will not mark them as used */ hb_gcUnlock( hb_curl->pProgressCallback ); +#if LIBCURL_VERSION_NUM >= 0x072000 + curl_easy_setopt( hb_curl->curl, CURLOPT_XFERINFOFUNCTION, hb_curl_xferinfo_callback ); + res = curl_easy_setopt( hb_curl->curl, CURLOPT_XFERINFODATA, hb_curl->pProgressCallback ); +#else curl_easy_setopt( hb_curl->curl, CURLOPT_PROGRESSFUNCTION, hb_curl_progress_callback ); res = curl_easy_setopt( hb_curl->curl, CURLOPT_PROGRESSDATA, hb_curl->pProgressCallback ); +#endif } } break; @@ -1818,7 +1998,7 @@ HB_FUNC( CURL_EASY_SETOPT ) } } - hb_retnl( ( long ) res ); + hb_curl_retcode( res ); } else hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); @@ -1845,7 +2025,9 @@ HB_FUNC( CURL_EASY_DL_BUFF_GET ) #define HB_CURL_INFO_TYPE_PTR 2 #define HB_CURL_INFO_TYPE_LONG 3 #define HB_CURL_INFO_TYPE_DOUBLE 4 -#define HB_CURL_INFO_TYPE_SLIST 5 +#define HB_CURL_INFO_TYPE_OFFSET 5 +#define HB_CURL_INFO_TYPE_SOCKET 6 +#define HB_CURL_INFO_TYPE_SLIST 7 #define HB_CURL_EASY_GETINFO( hb_curl, n, p ) ( hb_curl ? curl_easy_getinfo( hb_curl->curl, n, p ) : ( CURLcode ) HB_CURLE_ERROR ) @@ -1864,6 +2046,8 @@ HB_FUNC( CURL_EASY_GETINFO ) long ret_long = 0; struct curl_slist * ret_slist = NULL; double ret_double = 0.0; + curl_socket_t ret_socket = 0; + curl_off_t ret_offset = 0; switch( hb_parni( 2 ) ) { @@ -1928,20 +2112,44 @@ HB_FUNC( CURL_EASY_GETINFO ) type = HB_CURL_INFO_TYPE_STR; break; case HB_CURLINFO_SIZE_UPLOAD: + case HB_CURLINFO_SIZE_UPLOAD_T: +#if LIBCURL_VERSION_NUM >= 0x073700 + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_SIZE_UPLOAD_T, &ret_offset ); + type = HB_CURL_INFO_TYPE_OFFSET; +#else res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_SIZE_UPLOAD, &ret_double ); type = HB_CURL_INFO_TYPE_DOUBLE; +#endif break; case HB_CURLINFO_SIZE_DOWNLOAD: + case HB_CURLINFO_SIZE_DOWNLOAD_T: +#if LIBCURL_VERSION_NUM >= 0x073700 + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_SIZE_DOWNLOAD_T, &ret_offset ); + type = HB_CURL_INFO_TYPE_OFFSET; +#else res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_SIZE_DOWNLOAD, &ret_double ); type = HB_CURL_INFO_TYPE_DOUBLE; +#endif break; case HB_CURLINFO_SPEED_DOWNLOAD: + case HB_CURLINFO_SPEED_DOWNLOAD_T: +#if LIBCURL_VERSION_NUM >= 0x073700 + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_SPEED_DOWNLOAD_T, &ret_offset ); + type = HB_CURL_INFO_TYPE_OFFSET; +#else res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_SPEED_DOWNLOAD, &ret_double ); type = HB_CURL_INFO_TYPE_DOUBLE; +#endif break; case HB_CURLINFO_SPEED_UPLOAD: + case HB_CURLINFO_SPEED_UPLOAD_T: +#if LIBCURL_VERSION_NUM >= 0x073700 + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_SPEED_UPLOAD_T, &ret_offset ); + type = HB_CURL_INFO_TYPE_OFFSET; +#else res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_SPEED_UPLOAD, &ret_double ); type = HB_CURL_INFO_TYPE_DOUBLE; +#endif break; case HB_CURLINFO_HEADER_SIZE: res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_HEADER_SIZE, &ret_long ); @@ -1962,12 +2170,24 @@ HB_FUNC( CURL_EASY_GETINFO ) type = HB_CURL_INFO_TYPE_SLIST; break; case HB_CURLINFO_CONTENT_LENGTH_DOWNLOAD: + case HB_CURLINFO_CONTENT_LENGTH_DOWNLOAD_T: +#if LIBCURL_VERSION_NUM >= 0x073700 + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &ret_offset ); + type = HB_CURL_INFO_TYPE_OFFSET; +#else res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &ret_double ); type = HB_CURL_INFO_TYPE_DOUBLE; +#endif break; case HB_CURLINFO_CONTENT_LENGTH_UPLOAD: + case HB_CURLINFO_CONTENT_LENGTH_UPLOAD_T: +#if LIBCURL_VERSION_NUM >= 0x073700 + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_CONTENT_LENGTH_UPLOAD_T, &ret_offset ); + type = HB_CURL_INFO_TYPE_OFFSET; +#else res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_CONTENT_LENGTH_UPLOAD, &ret_double ); type = HB_CURL_INFO_TYPE_DOUBLE; +#endif break; case HB_CURLINFO_CONTENT_TYPE: res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_CONTENT_TYPE, &ret_string ); @@ -2010,10 +2230,16 @@ HB_FUNC( CURL_EASY_GETINFO ) type = HB_CURL_INFO_TYPE_SLIST; break; case HB_CURLINFO_LASTSOCKET: + case HB_CURLINFO_ACTIVESOCKET: +#if LIBCURL_VERSION_NUM >= 0x072D00 + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_ACTIVESOCKET, &ret_socket ); + type = HB_CURL_INFO_TYPE_SOCKET; +#else #if LIBCURL_VERSION_NUM >= 0x070F02 res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_LASTSOCKET, &ret_long ); #endif type = HB_CURL_INFO_TYPE_LONG; +#endif break; case HB_CURLINFO_FTP_ENTRY_PATH: #if LIBCURL_VERSION_NUM >= 0x070F04 @@ -2100,6 +2326,12 @@ HB_FUNC( CURL_EASY_GETINFO ) case HB_CURL_INFO_TYPE_LONG: hb_retnl( ret_long ); break; + case HB_CURL_INFO_TYPE_OFFSET: + hb_retnint( ( HB_MAXINT ) ret_offset ); + break; + case HB_CURL_INFO_TYPE_SOCKET: + hb_retnint( ( HB_MAXINT ) ret_socket ); + break; case HB_CURL_INFO_TYPE_DOUBLE: hb_retnd( ret_double ); break; diff --git a/contrib/hbcurl/hbcurl.ch b/contrib/hbcurl/hbcurl.ch index ec666d5e51..193165af34 100644 --- a/contrib/hbcurl/hbcurl.ch +++ b/contrib/hbcurl/hbcurl.ch @@ -108,7 +108,8 @@ #define HB_CURLOPT_TRANSFERTEXT 53 /* transfer data in text/ASCII format */ #define HB_CURLOPT_PUT 54 /* HTTP PUT */ #define HB_CURLOPT_PROGRESSFUNCTION 56 -#define HB_CURLOPT_PROGRESSDATA 57 +#define HB_CURLOPT_PROGRESSDATA HB_CURLOPT_XFERINFODATA +#define HB_CURLOPT_XFERINFODATA 57 #define HB_CURLOPT_AUTOREFERER 58 #define HB_CURLOPT_PROXYPORT 59 #define HB_CURLOPT_POSTFIELDSIZE 60 @@ -125,8 +126,8 @@ #define HB_CURLOPT_CLOSEPOLICY 72 #define HB_CURLOPT_FRESH_CONNECT 74 #define HB_CURLOPT_FORBID_REUSE 75 -#define HB_CURLOPT_RANDOM_FILE 76 -#define HB_CURLOPT_EGDSOCKET 77 +#define HB_CURLOPT_RANDOM_FILE 76 /* Deprecated in 7.84.0. It serves no purpose anymore. */ +#define HB_CURLOPT_EGDSOCKET 77 /* Deprecated in 7.84.0. It serves no purpose anymore. */ #define HB_CURLOPT_CONNECTTIMEOUT 78 #define HB_CURLOPT_HEADERFUNCTION 79 #define HB_CURLOPT_HTTPGET 80 @@ -254,6 +255,11 @@ #define HB_CURLOPT_TCP_KEEPINTVL 206 #define HB_CURLOPT_MAIL_AUTH 207 #define HB_CURLOPT_MAXLIFETIME_CONN 208 +#define HB_CURLOPT_XFERINFOFUNCTION 219 +#define HB_CURLOPT_PROXY_SERVICE_NAME 235 +#define HB_CURLOPT_MIMEPOST 269 +#define HB_CURLOPT_PROTOCOLS_STR 318 +#define HB_CURLOPT_REDIR_PROTOCOLS_STR 319 #define HB_CURLOPT_DOWNLOAD 1001 /* Harbour special ones */ #define HB_CURLOPT_PROGRESSBLOCK 1002 #define HB_CURLOPT_UL_FILE_SETUP 1003 @@ -401,6 +407,11 @@ #define HB_CURLPROTO_RTMPTE hb_bitShift( 1, 22 ) #define HB_CURLPROTO_RTMPS hb_bitShift( 1, 23 ) #define HB_CURLPROTO_RTMPTS hb_bitShift( 1, 24 ) +#define HB_CURLPROTO_GOPHER hb_bitShift( 1, 25 ) +#define HB_CURLPROTO_SMB hb_bitShift( 1, 26 ) +#define HB_CURLPROTO_SMBS hb_bitShift( 1, 27 ) +#define HB_CURLPROTO_MQTT hb_bitShift( 1, 28 ) +#define HB_CURLPROTO_GOPHERS hb_bitShift( 1, 29 ) #define HB_CURLPROTO_ALL hb_bitNot( 0 ) /* curl_easy_pause() parameters. They can be combined with hb_bitOr(). */ @@ -463,6 +474,15 @@ #define HB_CURLINFO_PRIMARY_PORT 40 #define HB_CURLINFO_LOCAL_IP 41 #define HB_CURLINFO_LOCAL_PORT 42 +#define HB_CURLINFO_SOCKET 0x500000 +#define HB_CURLINFO_ACTIVESOCKET ( HB_CURLINFO_SOCKET + 44 ) +#define HB_CURLINFO_OFF_T 0x600000 +#define HB_CURLINFO_SIZE_UPLOAD_T ( HB_CURLINFO_OFF_T + 7 ) +#define HB_CURLINFO_SIZE_DOWNLOAD_T ( HB_CURLINFO_OFF_T + 8 ) +#define HB_CURLINFO_SPEED_DOWNLOAD_T ( HB_CURLINFO_OFF_T + 9 ) +#define HB_CURLINFO_SPEED_UPLOAD_T ( HB_CURLINFO_OFF_T + 10 ) +#define HB_CURLINFO_CONTENT_LENGTH_DOWNLOAD_T ( HB_CURLINFO_OFF_T + 15 ) +#define HB_CURLINFO_CONTENT_LENGTH_UPLOAD_T ( HB_CURLINFO_OFF_T + 16 ) /* curl result codes. */ diff --git a/contrib/hbssl/evp.c b/contrib/hbssl/evp.c index 6b898c2edb..0a647cf386 100644 --- a/contrib/hbssl/evp.c +++ b/contrib/hbssl/evp.c @@ -66,7 +66,9 @@ HB_FUNC( OPENSSL_ADD_ALL_ALGORITHMS ) HB_FUNC( EVP_CLEANUP ) { +#if OPENSSL_VERSION_NUMBER < 0x10100000L EVP_cleanup(); +#endif } HB_FUNC( ERR_LOAD_EVP_STRINGS ) diff --git a/contrib/hbssl/hbssl.h b/contrib/hbssl/hbssl.h index 154eb95deb..273d9a09d4 100644 --- a/contrib/hbssl/hbssl.h +++ b/contrib/hbssl/hbssl.h @@ -51,6 +51,11 @@ #include "hbapierr.h" #include "hbsocket.h" +/* pacify OpenSSL 3.0 depreciated warnings until we update the code */ +#ifndef OPENSSL_API_COMPAT + #define OPENSSL_API_COMPAT 10200 +#endif + #if defined( HB_OS_WIN ) #if ! defined( HB_OPENSSL_STATIC ) #define OPENSSL_OPT_WINDLL diff --git a/contrib/hbwin/olecore.c b/contrib/hbwin/olecore.c index d6ae77a082..197e9584a6 100644 --- a/contrib/hbwin/olecore.c +++ b/contrib/hbwin/olecore.c @@ -2246,16 +2246,23 @@ HB_FUNC( WIN_OLEAUTO___ONERROR ) if( lOleError == S_OK ) { DISPID lPropPut = DISPID_PROPERTYPUT; + WORD wFlags; memset( &excep, 0, sizeof( excep ) ); GetParams( &dispparam, 0, HB_FALSE, 0, NULL, NULL ); dispparam.rgdispidNamedArgs = &lPropPut; dispparam.cNamedArgs = 1; + wFlags = V_VT( &dispparam.rgvarg[ 0 ] ) == VT_DISPATCH ? DISPATCH_PROPERTYPUTREF : + DISPATCH_PROPERTYPUT; lOleError = HB_VTBL( pDisp )->Invoke( HB_THIS_( pDisp ) dispid, HB_ID_REF( IID_NULL ), - LOCALE_USER_DEFAULT, - DISPATCH_PROPERTYPUT, &dispparam, - NULL, &excep, &uiArgErr ); + LOCALE_USER_DEFAULT, wFlags, + &dispparam, NULL, &excep, &uiArgErr ); + if( lOleError == DISP_E_MEMBERNOTFOUND && wFlags == DISPATCH_PROPERTYPUTREF ) + lOleError = HB_VTBL( pDisp )->Invoke( HB_THIS_( pDisp ) dispid, HB_ID_REF( IID_NULL ), + LOCALE_USER_DEFAULT, DISPATCH_PROPERTYPUT, + &dispparam, NULL, &excep, &uiArgErr ); + FreeParams( &dispparam ); /* assign method should return assigned value */ diff --git a/contrib/xhb/hbcompat.ch b/contrib/xhb/hbcompat.ch index 32beaec952..918171083c 100644 --- a/contrib/xhb/hbcompat.ch +++ b/contrib/xhb/hbcompat.ch @@ -125,6 +125,8 @@ #xtranslate hb_argv( [] ) => hb_CmdArgArgV( ) + #xtranslate hb_PIsByRef( @ ) => hb_IsByRef( @ ) + #xtranslate hb_iniSetComment( [] ) => hb_SetIniComment( ) #xtranslate hb_iniRead( [] ) => hb_ReadIni( ) #xtranslate hb_iniWrite( [] ) => hb_WriteIni( ) @@ -384,6 +386,8 @@ #xtranslate hb_CmdArgArgV( [] ) => hb_argv( ) + #xtranslate hb_IsByRef( @ ) => hb_PIsByRef( @ ) + #xtranslate RAScan( [] ) => hb_RAScan( ) #xtranslate ASizeAlloc( [, ] ) => AFill( ) diff --git a/include/hbapirdd.h b/include/hbapirdd.h index acc34f85c8..a02f59a0fc 100644 --- a/include/hbapirdd.h +++ b/include/hbapirdd.h @@ -64,12 +64,14 @@ HB_EXTERN_BEGIN #define EDBCMD_SEEK_BADPARAMETER 1001 #define EDBCMD_NOALIAS 1002 #define EDBCMD_NOVAR 1003 +#define EDBCMD_REL_BADPARAMETER 1004 #define EDBCMD_USE_BADPARAMETER 1005 -#define EDBCMD_REL_BADPARAMETER 1006 +#define EDBCMD_ORD_BADPARAMETER 1006 #define EDBCMD_ORDLSTADD_BADPARAMETER 1008 #define EDBCMD_FIELDNAME_BADPARAMETER 1009 #define EDBCMD_BADALIAS 1010 #define EDBCMD_DUPALIAS 1011 +#define EDBCMD_REL_SAMEALIAS 1013 #define EDBCMD_DBCMDBADPARAMETER 1014 #define EDBCMD_BADPARAMETER 1015 #define EDBCMD_INFOBADPARAMETER 1032 diff --git a/include/hbcompdf.h b/include/hbcompdf.h index da793a3a73..a5329357a5 100644 --- a/include/hbcompdf.h +++ b/include/hbcompdf.h @@ -261,6 +261,7 @@ typedef enum HB_F_CTOD, HB_F_DATE, HB_F_DAY, + HB_F_DBSELECTAREA, HB_F_DELETED, HB_F_DEVPOS, HB_F_DOW, @@ -329,6 +330,7 @@ typedef enum HB_F_BITTEST, HB_F_BITNOT, HB_F_ARRAYTOPARAMS, + HB_F_PISBYREF, HB_F_I18N_GETTEXT, HB_F_I18N_GETTEXT_STRICT, HB_F_I18N_GETTEXT_NOOP, diff --git a/include/hbexprb.c b/include/hbexprb.c index 413ad63f3b..5c9cd459ca 100644 --- a/include/hbexprb.c +++ b/include/hbexprb.c @@ -2140,6 +2140,31 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall ) HB_GEN_FUNC3( PCode3, HB_P_ARRAYDIM, HB_LOBYTE( usCount ), HB_HIBYTE( usCount ) ); break; } + else if( pSelf->value.asFunCall.pFunName->value.asSymbol.funcid == HB_F_SELECT && usCount == 0 ) + { + HB_GEN_FUNC1( PCode1, HB_P_PUSHALIAS ); + break; + } +#ifndef HB_MACRO_SUPPORT + else if( pSelf->value.asFunCall.pFunName->value.asSymbol.funcid == HB_F_PISBYREF && usCount == 1 && + pSelf->value.asFunCall.pParms->value.asList.pExprList->ExprType == HB_ET_VARREF ) + { + PHB_HFUNC pFunc = HB_COMP_PARAM->functions.pLast; + int iVar, iScope; + + hb_compVariableFind( HB_COMP_PARAM, pSelf->value.asFunCall.pParms->value.asList.pExprList->value.asSymbol.name, + &iVar, &iScope ); + + if( pFunc->wParamCount && ( pFunc->funFlags & HB_FUNF_USES_LOCAL_PARAMS ) != 0 && + iScope == HB_VS_LOCAL_VAR && ( HB_USHORT ) iVar <= pFunc->wParamCount ) + { + HB_COMP_EXPR_FREE( pSelf->value.asFunCall.pParms ); + pSelf->value.asFunCall.pParms = hb_compExprNewLong( iVar, HB_COMP_PARAM ); + } + else + hb_compErrorRefer( HB_COMP_PARAM, NULL, pSelf->value.asFunCall.pParms->value.asList.pExprList->value.asSymbol.name ); + } +#endif } HB_GEN_FUNC2( PushFunCall, pSelf->value.asFunCall.pFunName->value.asSymbol.name, pSelf->value.asFunCall.pFunName->value.asSymbol.flags ); @@ -2174,8 +2199,22 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall ) HB_BOOL fArgsList = HB_FALSE; HB_USHORT usCount = 0; + if( pSelf->value.asFunCall.pParms ) + { + usCount = ( HB_USHORT ) hb_compExprParamListCheck( HB_COMP_PARAM, pSelf->value.asFunCall.pParms ); + fArgsList = pSelf->value.asFunCall.pParms->ExprType == HB_ET_MACROARGLIST; + } + if( pSelf->value.asFunCall.pFunName->ExprType == HB_ET_FUNNAME ) { + if( pSelf->value.asFunCall.pFunName->value.asSymbol.funcid == HB_F_DBSELECTAREA && usCount == 1 && + ( pSelf->value.asFunCall.pParms->value.asList.pExprList->ExprType == HB_ET_FUNREF || + hb_compExprIsInteger( pSelf->value.asFunCall.pParms->value.asList.pExprList ) ) ) + { + HB_EXPR_USE( pSelf->value.asFunCall.pParms, HB_EA_PUSH_PCODE ); + HB_GEN_FUNC1( PCode1, HB_P_POPALIAS ); + break; + } HB_GEN_FUNC2( PushFunCall, pSelf->value.asFunCall.pFunName->value.asSymbol.name, pSelf->value.asFunCall.pFunName->value.asSymbol.flags ); } @@ -2185,13 +2224,8 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall ) HB_GEN_FUNC1( PCode1, HB_P_PUSHNIL ); } - if( pSelf->value.asFunCall.pParms ) - { - usCount = ( HB_USHORT ) hb_compExprParamListCheck( HB_COMP_PARAM, pSelf->value.asFunCall.pParms ); - fArgsList = pSelf->value.asFunCall.pParms->ExprType == HB_ET_MACROARGLIST; - if( usCount ) - HB_EXPR_USE( pSelf->value.asFunCall.pParms, HB_EA_PUSH_PCODE ); - } + if( usCount ) + HB_EXPR_USE( pSelf->value.asFunCall.pParms, HB_EA_PUSH_PCODE ); if( fArgsList ) { diff --git a/src/common/funcid.c b/src/common/funcid.c index b6109411e3..46ef53da12 100644 --- a/src/common/funcid.c +++ b/src/common/funcid.c @@ -72,6 +72,7 @@ static _HB_FUNCID s_funcId[] = { "CTOD", 0, HB_FN_RESERVED, HB_F_CTOD }, { "DATE", 0, HB_FN_RESERVED, HB_F_DATE }, { "DAY", 0, HB_FN_RESERVED, HB_F_DAY }, + { "DBSELECTAREA", 0, HB_FN_RESERVED, HB_F_DBSELECTAREA }, { "DELETED", 4, HB_FN_RESERVED, HB_F_DELETED }, { "DEVPOS", 4, HB_FN_RESERVED, HB_F_DEVPOS }, { "DOW", 0, HB_FN_RESERVED, HB_F_DOW }, @@ -103,6 +104,7 @@ static _HB_FUNCID s_funcId[] = { "HB_I18N_NGETTEXT", 0, HB_FN_UDF, HB_F_I18N_NGETTEXT }, { "HB_I18N_NGETTEXT_NOOP", 0, HB_FN_UDF, HB_F_I18N_NGETTEXT_NOOP }, { "HB_I18N_NGETTEXT_STRICT", 0, HB_FN_UDF, HB_F_I18N_NGETTEXT_STRICT }, + { "HB_PISBYREF", 0, HB_FN_UDF, HB_F_PISBYREF }, { "HB_STOD", 0, HB_FN_UDF, HB_F_STOD }, { "HB_STOT", 0, HB_FN_UDF, HB_F_STOT }, { "INKEY", 4, HB_FN_RESERVED, HB_F_INKEY }, diff --git a/src/rdd/dbcmd.c b/src/rdd/dbcmd.c index f80ca91b98..208499653b 100644 --- a/src/rdd/dbcmd.c +++ b/src/rdd/dbcmd.c @@ -737,6 +737,16 @@ HB_FUNC( DBSELECTAREA ) { int iNewArea = hb_parni( 1 ); + if( iNewArea == 0 ) + { + PHB_ITEM pItem = hb_param( 1, HB_IT_SYMBOL ); + if( pItem ) + { + PHB_SYMB pSymAlias = hb_itemGetSymbol( pItem ); + if( pSymAlias->pDynSym ) + iNewArea = ( int ) hb_dynsymAreaHandle( pSymAlias->pDynSym ); + } + } /* * NOTE: iNewArea >= HB_RDD_MAX_AREA_NUM used intentionally * In Clipper area 65535 is reserved for "M" alias [druzus] @@ -1183,7 +1193,7 @@ HB_FUNC( ORDBAGNAME ) } else { - hb_errRT_DBCMD( EG_ARG, EDBCMD_REL_BADPARAMETER, NULL, HB_ERR_FUNCNAME ); + hb_errRT_DBCMD( EG_ARG, EDBCMD_ORD_BADPARAMETER, NULL, HB_ERR_FUNCNAME ); return; } } @@ -1289,7 +1299,7 @@ HB_FUNC( ORDCREATE ) ( dbOrderInfo.atomBagName == NULL || dbOrderInfo.atomBagName[ 0 ] == 0 ) ) || ! dbOrderInfo.abExpr ) { - hb_errRT_DBCMD( EG_ARG, EDBCMD_REL_BADPARAMETER, NULL, HB_ERR_FUNCNAME ); + hb_errRT_DBCMD( EG_ARG, EDBCMD_ORD_BADPARAMETER, NULL, HB_ERR_FUNCNAME ); return; } dbOrderInfo.itmCobExpr = hb_param( 4, HB_IT_BLOCK ); @@ -1363,7 +1373,7 @@ HB_FUNC( ORDFOR ) } else { - hb_errRT_DBCMD( EG_ARG, EDBCMD_REL_BADPARAMETER, NULL, HB_ERR_FUNCNAME ); + hb_errRT_DBCMD( EG_ARG, EDBCMD_ORD_BADPARAMETER, NULL, HB_ERR_FUNCNAME ); return; } } @@ -1399,7 +1409,7 @@ HB_FUNC( ORDKEY ) } else { - hb_errRT_DBCMD( EG_ARG, EDBCMD_REL_BADPARAMETER, NULL, HB_ERR_FUNCNAME ); + hb_errRT_DBCMD( EG_ARG, EDBCMD_ORD_BADPARAMETER, NULL, HB_ERR_FUNCNAME ); return; } } @@ -1490,7 +1500,7 @@ HB_FUNC( ORDNAME ) } else { - hb_errRT_DBCMD( EG_ARG, EDBCMD_REL_BADPARAMETER, NULL, HB_ERR_FUNCNAME ); + hb_errRT_DBCMD( EG_ARG, EDBCMD_ORD_BADPARAMETER, NULL, HB_ERR_FUNCNAME ); return; } } @@ -1517,7 +1527,7 @@ HB_FUNC( ORDNUMBER ) if( ! ( pOrderInfo.itmOrder || HB_ISNIL( 1 ) ) || ! ( pOrderInfo.atomBagName || HB_ISNIL( 2 ) ) ) { - hb_errRT_DBCMD( EG_ARG, EDBCMD_REL_BADPARAMETER, NULL, HB_ERR_FUNCNAME ); + hb_errRT_DBCMD( EG_ARG, EDBCMD_ORD_BADPARAMETER, NULL, HB_ERR_FUNCNAME ); return; } pOrderInfo.itmResult = hb_itemPutNI( NULL, 0 ); @@ -1660,6 +1670,16 @@ HB_FUNC( SELECT ) #endif hb_rddGetAliasNumber( szAlias, &iArea ); } + else + { + PHB_ITEM pItem = hb_param( 1, HB_IT_SYMBOL ); + if( pItem ) + { + PHB_SYMB pSymAlias = hb_itemGetSymbol( pItem ); + if( pSymAlias->pDynSym ) + iArea = ( int ) hb_dynsymAreaHandle( pSymAlias->pDynSym ); + } + } hb_retni( iArea ); } } @@ -1775,50 +1795,45 @@ HB_FUNC( DBSETRELATION ) if( pArea ) { - DBRELINFO dbRelations; - AREAP pChildArea; - HB_AREANO uiChildArea; - - if( hb_pcount() < 2 || - hb_param( 1, HB_IT_NUMERIC | HB_IT_STRING ) == NULL || - ! ( HB_ISNIL( 4 ) || HB_ISLOG( 4 ) ) ) - { - hb_errRT_DBCMD( EG_ARG, EDBCMD_REL_BADPARAMETER, NULL, HB_ERR_FUNCNAME ); - return; - } + int iArea = hb_rddGetCurrentWorkAreaNumber(); + const char * szAlias = hb_parc( 1 ); + PHB_ITEM pBlock = hb_param( 2, HB_IT_BLOCK ), + pText = hb_param( 3, HB_IT_STRING ); + AREAP pChildArea = NULL; - if( HB_ISNUM( 1 ) ) - { - uiChildArea = ( HB_AREANO ) hb_parni( 1 ); - } - else + if( szAlias ) { - int iArea = hb_rddGetCurrentWorkAreaNumber(); - - hb_rddSelectWorkAreaAlias( hb_parcx( 1 ) ); + if( hb_rddSelectWorkAreaAlias( szAlias ) == HB_SUCCESS ) + pChildArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer(); if( hb_vmRequestQuery() ) return; - uiChildArea = ( HB_AREANO ) hb_rddGetCurrentWorkAreaNumber(); hb_rddSelectWorkAreaNumber( iArea ); } + else + pChildArea = ( AREAP ) hb_rddGetWorkAreaPointer( hb_parni( 1 ) ); - pChildArea = uiChildArea ? ( AREAP ) hb_rddGetWorkAreaPointer( uiChildArea ) : NULL; - - if( ! pChildArea ) + if( pArea == pChildArea ) + hb_errRT_DBCMD( EG_ARG, EDBCMD_REL_SAMEALIAS, NULL, HB_ERR_FUNCNAME ); +#ifdef HB_CLP_STRICT + else if( ! pChildArea || ! pBlock ) +#else + else if( ! pChildArea || ! ( pBlock || hb_itemGetCLen( pText ) > 0 ) ) +#endif + hb_errRT_DBCMD( EG_ARG, EDBCMD_REL_BADPARAMETER, NULL, HB_ERR_FUNCNAME ); + else { - hb_errRT_BASE( EG_NOALIAS, EDBCMD_NOALIAS, NULL, NULL, 0 ); - return; - } + DBRELINFO dbRelations; - dbRelations.itmCobExpr = hb_itemNew( hb_param( 2, HB_IT_BLOCK ) ); - dbRelations.abKey = hb_itemNew( hb_param( 3, HB_IT_STRING ) ); - dbRelations.isScoped = hb_parl( 4 ); - dbRelations.isOptimized = HB_FALSE; - dbRelations.lpaChild = pChildArea; - dbRelations.lpaParent = pArea; - dbRelations.lpdbriNext = NULL; + dbRelations.itmCobExpr = hb_itemNew( pBlock ); + dbRelations.abKey = hb_itemNew( pText ); + dbRelations.isScoped = hb_parl( 4 ); + dbRelations.isOptimized = HB_FALSE; + dbRelations.lpaChild = pChildArea; + dbRelations.lpaParent = pArea; + dbRelations.lpdbriNext = NULL; - SELF_SETREL( pArea, &dbRelations ); + SELF_SETREL( pArea, &dbRelations ); + } } else hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, HB_ERR_FUNCNAME );