diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d610f1c1d9..53b7fdbcea 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,62 @@ The license applies to all entries newer than 2009-04-28. */ +2011-04-19 15:11 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/src/vm/procaddr.c + ! removed dummy entry at the end of function table + + * harbour/src/common/hbstr.c + * harbour/src/rdd/dbfcdx/dbfcdx1.c + * harbour/src/rdd/hsx/hsx.c + * harbour/contrib/xhb/fparse.c + * pacified warnings + + * harbour/include/hbsetup.h + * disabled flatten function attribute in ANDROID builds, + it causes that Android_NDK-GCC GPFs compiling src/vm/procaddr.c + + * harbour/include/hbdate.h + * enabled localtime_r() in Android builds + + * harbour/src/common/hbgete.c + * enabled setenv() in Android builds + + * harbour/src/common/hbtrace.c + ! fixed ANDROID_LOG_* flags + ; QUESTION: why Android log is used instead of syslog? + It causes that harbour has to be linked with + log library (-llog). + + * harbour/src/common/hbprintf.c + * disabled modfl() in Android builds + + * harbour/src/rtl/filesys.c + * added hack for missing functions in android libc library + + * harbour/src/rtl/diskspac.c + * harbour/src/rtl/disksphb.c + * use statfs instead of statvfs in Android builds + + * harbour/contrib/hbct/dattime3.c + * disabled stime() in Android builds + + * harbour/contrib/hbmzip/3rd/minizip/ioapi.h + * do not use 64bit FILE functions in Android builds + + * harbour/contrib/xhb/hbsyslog.c + * disabled using Android log in Android builds - use standard syslog + instead. This code needs deeper modification to switch to Android log. + + ; I have just recompiled whole Harbour code for android-3, android-5 + and android-9 at ARM using standard Harbour Linux build files. + Android does not have pthread and rt libraries (they are merged + with android c library) so to avoid link errors I simply created + soft links from libpthread.a and librt.a to libc.a. + With this hack could use unmodified hbmk2 and linux .mk files. + BTW exporting HB_CPU="arm" was not enough to switch to cross build + in my x86@64 Linux machine so I had to export HB_HOST_BIN and set + HB_BUILD_3RDEXT="no" + 2011-04-19 13:54 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * ChangeLog * Corrected some old text. diff --git a/harbour/contrib/hbct/dattime3.c b/harbour/contrib/hbct/dattime3.c index 3787768f95..b46e06c501 100644 --- a/harbour/contrib/hbct/dattime3.c +++ b/harbour/contrib/hbct/dattime3.c @@ -135,7 +135,7 @@ HB_FUNC( SETTIME ) st.wSecond = ( WORD ) iTime[2]; st.wMilliseconds = ( WORD ) iTime[3] * 10; fResult = SetLocalTime( &st ); -#elif defined( HB_OS_LINUX ) && !defined( __WATCOMC__ ) +#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; @@ -170,7 +170,7 @@ HB_FUNC( SETDATE ) st.wDay = ( WORD ) iDay; st.wDayOfWeek = ( WORD ) hb_dateJulianDOW( lDate ); fResult = SetLocalTime( &st ); -#elif defined( HB_OS_LINUX ) && !defined( __WATCOMC__ ) +#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; diff --git a/harbour/contrib/hbmzip/3rd/minizip/ioapi.h b/harbour/contrib/hbmzip/3rd/minizip/ioapi.h index c733f79f39..b8a1aef3ed 100644 --- a/harbour/contrib/hbmzip/3rd/minizip/ioapi.h +++ b/harbour/contrib/hbmzip/3rd/minizip/ioapi.h @@ -68,7 +68,8 @@ defined( HB_OS_DOS ) || \ defined( HB_OS_OS2 ) || \ defined( HB_OS_CYGWIN ) || \ - defined( HB_OS_MINIX ) + defined( HB_OS_MINIX ) || \ + defined( HB_OS_ANDROID ) # define USE_FILE32API #endif diff --git a/harbour/contrib/xhb/fparse.c b/harbour/contrib/xhb/fparse.c index 4d2d6b2343..a7c95fa0fd 100644 --- a/harbour/contrib/xhb/fparse.c +++ b/harbour/contrib/xhb/fparse.c @@ -672,7 +672,7 @@ HB_FUNC( FPARSELINE ) if( szText ) { const char * szDelim = hb_parc( 2 ); - int iWords; + int iWords = 0; hb_ParseLine( pArray, szText, szDelim ? ( unsigned char ) *szDelim : ',', &iWords ); nWords = iWords; } diff --git a/harbour/contrib/xhb/hbsyslog.c b/harbour/contrib/xhb/hbsyslog.c index d0a8d0a226..1a3ae41210 100644 --- a/harbour/contrib/xhb/hbsyslog.c +++ b/harbour/contrib/xhb/hbsyslog.c @@ -17,7 +17,7 @@ static HANDLE s_RegHandle; -#elif defined( HB_OS_ANDROID ) +#elif defined( HB_OS_ANDROID ) && 0 #include @@ -114,13 +114,13 @@ HB_FUNC( HB_SYSLOGMESSAGE ) #endif hb_retl( HB_FALSE ); - #elif defined( HB_OS_ANDROID ) + #elif defined( HB_OS_ANDROID ) && 0 int logval; switch( hb_parni( 2 ) ) { - case HB_LOG_CRITICAL: logval = ANDROID_LOG_VERBOSE; break; + case HB_LOG_CRITICAL: logval = ANDROID_LOG_FATAL; break; case HB_LOG_ERROR: logval = ANDROID_LOG_ERROR; break; case HB_LOG_WARN: logval = ANDROID_LOG_WARN; break; case HB_LOG_INFO: logval = ANDROID_LOG_INFO; break; diff --git a/harbour/include/hbdate.h b/harbour/include/hbdate.h index a2ed448598..9ccc677180 100644 --- a/harbour/include/hbdate.h +++ b/harbour/include/hbdate.h @@ -153,7 +153,8 @@ HB_EXTERN_END #if ( defined( _POSIX_C_SOURCE ) || defined( _XOPEN_SOURCE ) || \ defined( _BSD_SOURCE ) || defined( _SVID_SOURCE ) || \ - defined( HB_OS_SUNOS ) || defined( HB_OS_BEOS ) ) && \ + defined( HB_OS_SUNOS ) || defined( HB_OS_BEOS ) || \ + defined( HB_OS_ANDROID ) ) && \ ! defined( HB_OS_DARWIN_5 ) && !defined( HB_HAS_LOCALTIME_R ) # define HB_HAS_LOCALTIME_R #endif diff --git a/harbour/include/hbsetup.h b/harbour/include/hbsetup.h index c9bc442459..60b40acdeb 100644 --- a/harbour/include/hbsetup.h +++ b/harbour/include/hbsetup.h @@ -540,6 +540,7 @@ # if ( ( __GNUC__ > 4 ) || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 1 ) ) && \ !defined( __ICC ) && !defined( __clang__ ) && \ !defined( __PCC__ ) && \ + !defined( HB_OS_ANDROID ) && \ !defined( HB_NO_FLATTEN ) #define HB_FLATTEN_ATTR \ __attribute__ (( flatten )) diff --git a/harbour/src/common/hbgete.c b/harbour/src/common/hbgete.c index 56ffca8ffe..205e835729 100644 --- a/harbour/src/common/hbgete.c +++ b/harbour/src/common/hbgete.c @@ -217,7 +217,8 @@ HB_BOOL hb_setenv( const char * szName, const char * szValue ) defined( HB_OS_SUNOS ) || defined( HB_OS_BSD ) || \ defined( HB_OS_DARWIN ) || defined( HB_OS_BEOS ) || \ defined( HB_OS_QNX ) || defined( HB_OS_VXWORKS ) || \ - defined( HB_OS_CYGWIN ) || defined( HB_OS_MINIX ) + defined( HB_OS_CYGWIN ) || defined( HB_OS_MINIX ) || \ + defined( HB_OS_ANDROID ) if( szValue ) return setenv( szName, szValue, 1 ) == 0; diff --git a/harbour/src/common/hbprintf.c b/harbour/src/common/hbprintf.c index 9e23a1c429..157992a806 100644 --- a/harbour/src/common/hbprintf.c +++ b/harbour/src/common/hbprintf.c @@ -166,6 +166,7 @@ optimized. # if defined( __WATCOMC__ ) || defined( __MINGW32CE__ ) || defined( HB_OS_CYGWIN ) || \ defined( HB_OS_BEOS ) || defined( HB_OS_IPHONE ) || defined( HB_OS_SYMBIAN ) || \ defined( __OpenBSD__ ) || defined( __NetBSD__ ) || defined( __DragonFly__ ) || \ + defined( HB_OS_ANDROID ) || \ ( defined( HB_OS_WIN_CE ) && defined( __POCC__ ) ) || defined( HB_OS_MINIX ) # define _HB_WRAP_MODFL_ # define _MODFD( x, p ) _hb_modfl( x, p ) diff --git a/harbour/src/common/hbstr.c b/harbour/src/common/hbstr.c index 5cf5778b71..7f73c7ccd8 100644 --- a/harbour/src/common/hbstr.c +++ b/harbour/src/common/hbstr.c @@ -576,6 +576,7 @@ static HB_BOOL hb_str2number( HB_BOOL fPCode, const char * szNum, HB_SIZE nLen, iPos++; } + *dVal = 0; *lVal = 0; /* Hex Number */ diff --git a/harbour/src/common/hbtrace.c b/harbour/src/common/hbtrace.c index 449d0b424c..7ef45ec9b6 100644 --- a/harbour/src/common/hbtrace.c +++ b/harbour/src/common/hbtrace.c @@ -306,9 +306,9 @@ static void hb_tracelog_( int level, const char * file, int line, const char * p switch( level ) { - case HB_TR_ALWAYS: slevel = ANDROID_LOG_ASSERT; break; - case HB_TR_FATAL: slevel = ANDROID_LOG_VERBOSE; break; - case HB_TR_ERROR: slevel = ANDROID_LOG_ERROR break; + case HB_TR_ALWAYS: slevel = ANDROID_LOG_VERBOSE; break; + case HB_TR_FATAL: slevel = ANDROID_LOG_FATAL; break; + case HB_TR_ERROR: slevel = ANDROID_LOG_ERROR; break; case HB_TR_WARNING: slevel = ANDROID_LOG_WARN; break; case HB_TR_INFO: slevel = ANDROID_LOG_INFO; break; case HB_TR_DEBUG: slevel = ANDROID_LOG_DEBUG; break; diff --git a/harbour/src/rdd/dbfcdx/dbfcdx1.c b/harbour/src/rdd/dbfcdx/dbfcdx1.c index 8993a2822d..895482231c 100644 --- a/harbour/src/rdd/dbfcdx/dbfcdx1.c +++ b/harbour/src/rdd/dbfcdx/dbfcdx1.c @@ -9123,6 +9123,8 @@ static HB_BOOL hb_cdxSortKeyGet( LPCDXSORTINFO pSort, HB_BYTE ** pKeyVal, HB_ULO pSort->pSwapPage[ ulPage ].ulKeyBuf--; return HB_TRUE; } + *pulRec = 0; + *pKeyVal = NULL; return HB_FALSE; } @@ -9168,6 +9170,8 @@ static HB_BOOL hb_cdxSortKeyGet( LPCDXSORTINFO pSort, HB_BYTE ** pKeyVal, HB_ULO *pKeyVal = pKey; return HB_TRUE; } + *pulRec = 0; + *pKeyVal = NULL; return HB_FALSE; } diff --git a/harbour/src/rdd/hsx/hsx.c b/harbour/src/rdd/hsx/hsx.c index 4cab175549..cf8921e3da 100644 --- a/harbour/src/rdd/hsx/hsx.c +++ b/harbour/src/rdd/hsx/hsx.c @@ -1107,6 +1107,9 @@ static int hb_hsxAdd( int iHandle, HB_ULONG *pulRecNo, PHB_ITEM pExpr, HB_BOOL f LPHSXINFO pHSX = hb_hsxGetPointer( iHandle ); int iRetVal, iRet; + if( pulRecNo ) + *pulRecNo = 0; + if( ! pHSX ) return HSX_BADHANDLE; diff --git a/harbour/src/rtl/diskspac.c b/harbour/src/rtl/diskspac.c index 49fe1b6c6d..0c8c65ba01 100644 --- a/harbour/src/rtl/diskspac.c +++ b/harbour/src/rtl/diskspac.c @@ -64,24 +64,25 @@ # if defined( __WATCOMC__ ) || defined( __CEGCC__ ) || \ defined( HB_OS_VXWORKS ) || defined( HB_OS_SYMBIAN ) # include +# elif defined( HB_OS_ANDROID ) +# include # elif defined( HB_OS_DARWIN ) # include # include # else # include # endif -#endif -#if defined( HB_OS_WIN ) - #include - #if defined( HB_OS_WIN_CE ) - #include "hbwince.h" - #endif +#elif defined( HB_OS_WIN ) +# include +# if defined( HB_OS_WIN_CE ) +# include "hbwince.h" +# endif #elif defined( HB_OS_OS2 ) - #define INCL_BASE - #define INCL_DOSERRORS - #include +# define INCL_BASE +# define INCL_DOSERRORS +# include #elif defined( HB_OS_DOS ) - #include +# include #endif HB_FUNC( DISKSPACE ) @@ -237,7 +238,8 @@ HB_FUNC( DISKSPACE ) bError = HB_FALSE; #else -#if defined( HB_OS_DARWIN ) || defined( HB_OS_VXWORKS ) +#if defined( HB_OS_DARWIN ) || defined( HB_OS_ANDROID ) || \ + defined( HB_OS_VXWORKS ) struct statfs st; bError = statfs( szName, &st ) != 0; #else diff --git a/harbour/src/rtl/disksphb.c b/harbour/src/rtl/disksphb.c index 3f946be984..4bb174c506 100644 --- a/harbour/src/rtl/disksphb.c +++ b/harbour/src/rtl/disksphb.c @@ -57,14 +57,15 @@ #if defined( HB_OS_DARWIN ) #include #include +#elif defined( HB_OS_ANDROID ) + #include #elif defined( HB_OS_UNIX ) && !( defined( __WATCOMC__ ) || defined( __CEGCC__ ) ) #if defined( HB_OS_VXWORKS ) || defined( HB_OS_SYMBIAN ) #include #else #include #endif -#endif -#if defined( HB_OS_WIN ) +#elif defined( HB_OS_WIN ) #include #if defined( HB_OS_WIN_CE ) #include "hbwince.h" @@ -359,7 +360,8 @@ HB_FUNC( HB_DISKSPACE ) } #elif defined( HB_OS_UNIX ) && !( defined( __WATCOMC__ ) || defined( __CEGCC__ ) || defined( HB_OS_SYMBIAN ) ) { -#if defined( HB_OS_DARWIN ) || defined( HB_OS_VXWORKS ) +#if defined( HB_OS_DARWIN ) || defined( HB_OS_ANDROID ) || \ + defined( HB_OS_VXWORKS ) struct statfs sf; #else struct statvfs sf; @@ -368,7 +370,8 @@ HB_FUNC( HB_DISKSPACE ) szPath = hb_fsNameConv( szPath, &pszFree ); -#if defined( HB_OS_DARWIN ) || defined( HB_OS_VXWORKS ) +#if defined( HB_OS_DARWIN ) || defined( HB_OS_ANDROID ) || \ + defined( HB_OS_VXWORKS ) if( statfs( szPath, &sf ) == 0 ) #else if( statvfs( szPath, &sf ) == 0 ) diff --git a/harbour/src/rtl/filesys.c b/harbour/src/rtl/filesys.c index 4a75c3bdd3..df47fe23da 100644 --- a/harbour/src/rtl/filesys.c +++ b/harbour/src/rtl/filesys.c @@ -308,6 +308,14 @@ #define HB_FS_SOPEN #endif +#if defined( HB_OS_ANDROID ) + /* hack for missing functions in android libc library */ + #define fdatasync fsync + #define ftruncate64 ftruncate + #define pread64 pread + #define pwrite64(f,b,s,o) pwrite(f,(void*)b,s,o) +#endif + #if UINT_MAX == USHRT_MAX #define HB_FS_IO_16BIT #endif diff --git a/harbour/src/vm/procaddr.c b/harbour/src/vm/procaddr.c index 80660d4051..17325c58d8 100644 --- a/harbour/src/vm/procaddr.c +++ b/harbour/src/vm/procaddr.c @@ -117,7 +117,7 @@ PHB_FUNC hb_vmProcAddress( const char * szFuncName ) { "hb_xalloc", ( PHB_FUNC ) hb_xalloc }, { "hb_xfree", ( PHB_FUNC ) hb_xfree }, { "hb_xgrab", ( PHB_FUNC ) hb_xgrab }, - { "hb_xrealloc", ( PHB_FUNC ) hb_xrealloc }, + { "hb_xrealloc", ( PHB_FUNC ) hb_xrealloc } }; unsigned int uiFirst = 0, uiLast = HB_SIZEOFARRAY( s_funcTable ), uiMiddle;