From 1834b0d653fe062c1ba057beb4541c2ec542c7e1 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Sun, 22 Mar 2009 17:10:43 +0000 Subject: [PATCH] 2009-03-22 18:16 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbstack.h * added alternative asm inline function to __MINGW32__ builds which operates on 64bit pointers. It's used when __MINGW64__ macro is defined. I do not know if such macro existing in 64bit MinGW version. * harbour/include/hbdefs.h + added HB_PTRUINT * harbour/source/common/hbprintf.c * used HB_PTRUINT for %p casting --- harbour/ChangeLog | 12 ++++++++++++ harbour/include/hbdefs.h | 2 ++ harbour/include/hbstack.h | 9 +++++++++ harbour/source/common/hbprintf.c | 2 +- 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 859034bdf3..fea050461e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,18 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-03-22 18:16 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbstack.h + * added alternative asm inline function to __MINGW32__ builds which + operates on 64bit pointers. It's used when __MINGW64__ macro is + defined. I do not know if such macro existing in 64bit MinGW version. + + * harbour/include/hbdefs.h + + added HB_PTRUINT + + * harbour/source/common/hbprintf.c + * used HB_PTRUINT for %p casting + 2009-03-21 09:01 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * harbour/contrib/hbqt/Makefile + Added new files. diff --git a/harbour/include/hbdefs.h b/harbour/include/hbdefs.h index c191b214bb..05597d9cf8 100644 --- a/harbour/include/hbdefs.h +++ b/harbour/include/hbdefs.h @@ -585,8 +585,10 @@ typedef unsigned long HB_COUNTER; /* type for memory pointer diff */ #if defined( HB_OS_WIN_64 ) typedef LONGLONG HB_PTRDIFF; + typedef ULONGLONG HB_PTRUINT; #else typedef long HB_PTRDIFF; + typedef unsigned long HB_PTRUINT; #endif #ifdef HB_LONG_LONG_OFF diff --git a/harbour/include/hbstack.h b/harbour/include/hbstack.h index 878014aa07..86baa2309a 100644 --- a/harbour/include/hbstack.h +++ b/harbour/include/hbstack.h @@ -213,12 +213,21 @@ typedef struct static __inline__ __attribute__ ((pure, malloc)) void * hb_stack_ptr_from_tls( void ) { void * p; +# if defined( __MINGW64__ ) + __asm__ ( + "movq %%fs:(0x18), %0\n\t" + "movq 0x0e10(%0,%1,4), %0\n\t" + :"=a" (p) + :"c" (hb_stack_key) + ); +# else __asm__ ( "movl %%fs:(0x18), %0\n\t" "movl 0x0e10(%0,%1,4), %0\n\t" :"=a" (p) :"c" (hb_stack_key) ); +# endif return p; } # define hb_stack_ptr ( ( PHB_STACK ) hb_stack_ptr_from_tls() ) diff --git a/harbour/source/common/hbprintf.c b/harbour/source/common/hbprintf.c index 668881f985..e832ffb951 100644 --- a/harbour/source/common/hbprintf.c +++ b/harbour/source/common/hbprintf.c @@ -1145,7 +1145,7 @@ int hb_snprintf( char * buffer, size_t bufsize, const char * format, ... ) case 'p': /* void * pointer */ argval.value.as_x_ptr = va_arg_n( args, _x_ptr, param ); if( argval.value.as_x_ptr ) - size = put_hex( buffer, bufsize, size, ( unsigned long ) argval.value.as_x_ptr, + size = put_hex( buffer, bufsize, size, ( HB_PTRUINT ) argval.value.as_x_ptr, flags | _F_ALTERNATE, width, precision, 0 ); else size = put_str( buffer, bufsize, size, "(nil)",