-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix arc4 compilation debian #343
base: main
Are you sure you want to change the base?
Changes from all commits
5bb312a
d9744bd
fbe5fea
75b5f75
5577ba1
7783cd4
8aebc73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,41 +149,42 @@ HB_FUNC( FBCREATEDB ) | |
hb_retnl( 0 ); | ||
} | ||
|
||
HB_FUNC( FBCONNECT ) | ||
HB_FUNC(FBCONNECT) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It'd make it easier to review and merge without formatting/comment changes to existing code. |
||
{ | ||
ISC_STATUS_ARRAY status; | ||
isc_db_handle db = ( isc_db_handle ) 0; | ||
const char * db_connect = hb_parcx( 1 ); | ||
const char * user = hb_parcx( 2 ); | ||
const char * passwd = hb_parcx( 3 ); | ||
char dpb[ 128 ]; | ||
short i = 0; | ||
int len; | ||
|
||
/* FIXME: Possible buffer overflow. Use hb_snprintf(). */ | ||
dpb[ i++ ] = isc_dpb_version1; | ||
dpb[ i++ ] = isc_dpb_user_name; | ||
len = ( int ) strlen( user ); | ||
if( len > ( int ) ( sizeof( dpb ) - i - 4 ) ) | ||
len = ( int ) ( sizeof( dpb ) - i - 4 ); | ||
dpb[ i++ ] = ( char ) len; | ||
hb_strncpy( &( dpb[ i ] ), user, len ); | ||
i += ( short ) len; | ||
dpb[ i++ ] = isc_dpb_password; | ||
len = ( int ) strlen( passwd ); | ||
if( len > ( int ) ( sizeof( dpb ) - i - 2 ) ) | ||
len = ( int ) ( sizeof( dpb ) - i - 2 ); | ||
dpb[ i++ ] = ( char ) len; | ||
hb_strncpy( &( dpb[ i ] ), passwd, len ); | ||
i += ( short ) len; | ||
|
||
if( isc_attach_database( status, 0, db_connect, &db, i, dpb ) ) | ||
hb_retnl( isc_sqlcode( status ) ); | ||
else | ||
hb_FB_db_handle_ret( db ); | ||
ISC_STATUS_ARRAY status; | ||
isc_db_handle db = (isc_db_handle)0; | ||
const char *db_connect = hb_parcx(1); | ||
const char *user = hb_parcx(2); | ||
const char *passwd = hb_parcx(3); | ||
char dpb[128]; | ||
short i = 0; | ||
int len; | ||
|
||
i += hb_snprintf(dpb + i, sizeof(dpb) - i, "%c", isc_dpb_version1); | ||
i += hb_snprintf(dpb + i, sizeof(dpb) - i, "%c", isc_dpb_user_name); | ||
len = (int)strlen(user); | ||
if (len > (int)(sizeof(dpb) - i - 4)) | ||
len = (int)(sizeof(dpb) - i - 4); | ||
i += hb_snprintf(dpb + i, sizeof(dpb) - i, "%c", (char)len); | ||
hb_strncpy(&(dpb[i]), user, len); | ||
i += (short)len; | ||
i += hb_snprintf(dpb + i, sizeof(dpb) - i, "%c", isc_dpb_password); | ||
len = (int)strlen(passwd); | ||
if (len > (int)(sizeof(dpb) - i - 2)) | ||
len = (int)(sizeof(dpb) - i - 2); | ||
i += hb_snprintf(dpb + i, sizeof(dpb) - i, "%c", (char)len); | ||
hb_strncpy(&(dpb[i]), passwd, len); | ||
i += (short)len; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can the above There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pushed a fix for this that uses a single call. Untested. |
||
|
||
if (isc_attach_database(status, 0, db_connect, &db, i, dpb)) | ||
hb_retnl(isc_sqlcode(status)); | ||
else | ||
hb_FB_db_handle_ret(db); | ||
} | ||
|
||
|
||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Missing standard indentation and extra lines. |
||
HB_FUNC( FBCLOSE ) | ||
{ | ||
isc_db_handle db = hb_FB_db_handle_par( 1 ); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/* Rewritten in 2012 by Viktor Szakats and kept in the | ||
/* | ||
* Rewritten in 2012 by Viktor Szakats and kept in the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unrelated change. |
||
public domain. | ||
This is an original work by Glenn Scott and is placed in the public domain. | ||
|
||
|
@@ -57,14 +58,14 @@ HB_FUNC( FT_SETDATE ) | |
} | ||
#elif defined( HB_OS_LINUX ) && ! defined( HB_OS_ANDROID ) && ! defined( __WATCOMC__ ) | ||
{ | ||
/* stime() exists only in SVr4, SVID, X/OPEN and Linux */ | ||
long lNewDate; | ||
time_t tm; | ||
/* clock_settime() per a sistemes Linux moderns */ | ||
struct timespec ts; | ||
struct tm tm_info = { .tm_year = iYear - 1900, .tm_mon = iMonth - 1, .tm_mday = iDay }; | ||
|
||
lNewDate = lDate - hb_dateEncode( 1970, 1, 1 ); | ||
tm = time( NULL ); | ||
tm = lNewDate * 86400 + ( tm % 86400 ); | ||
fResult = stime( &tm ) == 0; | ||
ts.tv_sec = mktime(&tm_info); | ||
ts.tv_nsec = 0; | ||
|
||
fResult = clock_settime(CLOCK_REALTIME, &ts) == 0; | ||
} | ||
#elif defined( HB_OS_DOS ) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/* Rewritten in 2012 by Viktor Szakats and kept in the | ||
/* | ||
* Rewritten in 2012 by Viktor Szakats and kept in the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unrelated change. |
||
public domain. | ||
This is an original work by Glenn Scott and is placed in the public domain. | ||
|
||
|
@@ -67,14 +68,19 @@ HB_FUNC( FT_SETTIME ) | |
} | ||
#elif defined( HB_OS_LINUX ) && ! defined( HB_OS_ANDROID ) && ! defined( __WATCOMC__ ) | ||
{ | ||
/* stime() exists only in SVr4, SVID, X/OPEN and Linux */ | ||
HB_ULONG lNewTime; | ||
time_t tm; | ||
/* clock_settime() per a sistemes Linux moderns */ | ||
struct timespec ts; | ||
time_t now = time(NULL); | ||
struct tm *tm_info = localtime(&now); | ||
|
||
lNewTime = iHour * 3600 + iMinute * 60 + iSeconds; | ||
tm = time( NULL ); | ||
tm += lNewTime - ( tm % 86400 ); | ||
fResult = stime( &tm ) == 0; | ||
tm_info->tm_hour = iHour; | ||
tm_info->tm_min = iMinute; | ||
tm_info->tm_sec = iSeconds; | ||
|
||
ts.tv_sec = mktime(tm_info); | ||
ts.tv_nsec = 0; | ||
|
||
fResult = clock_settime(CLOCK_REALTIME, &ts) == 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I pushed a fixed for this. |
||
} | ||
#elif defined( HB_OS_DOS ) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,8 +137,10 @@ PROCEDURE hbtest_Call( cBlock, bBlock, xResultExpected ) | |
cBlock := "[Preprocessor error]" | ||
lPPError := .T. | ||
ENDIF | ||
|
||
cLangOld := hb_langSelect( "en" ) /* to always have RTEs in one language */ | ||
|
||
|
||
cLangOld := __hb_langSelect( "en" ) /* to always have RTEs in one language */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why doing this change? |
||
|
||
|
||
IF ! s_lBanner | ||
s_lBanner := .T. | ||
|
@@ -153,7 +155,7 @@ PROCEDURE hbtest_Call( cBlock, bBlock, xResultExpected ) | |
lRTE := .T. | ||
END SEQUENCE | ||
|
||
hb_langSelect( cLangOld ) | ||
__hb_langSelect( cLangOld ) | ||
|
||
IF lRTE | ||
lFailed := ! XToStr( xResult ) == XToStr( xResultExpected ) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a patch for this, but it doesn't apply, not sure why.