mingw64: casting to pointer from narrower integer fixes in sal

Change-Id: I63321e33f92223be47c7ee25dbf03fe3032991d6
This commit is contained in:
Fridrich Štrba 2013-06-10 12:44:57 +02:00
parent 44feea1957
commit 094560c29f
4 changed files with 10 additions and 10 deletions

View File

@ -98,7 +98,7 @@ __do_global_dtors (void)
void void
__do_global_ctors (void) __do_global_ctors (void)
{ {
unsigned long nptrs = (unsigned long) __CTOR_LIST__[0]; sal_uIntPtr nptrs = (sal_uIntPtr) __CTOR_LIST__[0];
unsigned i; unsigned i;
/* /*
@ -106,7 +106,7 @@ __do_global_ctors (void)
* is terminated with a null entry. Otherwise the first entry was * is terminated with a null entry. Otherwise the first entry was
* the number of pointers in the list. * the number of pointers in the list.
*/ */
if (nptrs == (unsigned long)-1) if (nptrs == (sal_uIntPtr)-1)
{ {
for (nptrs = 0; __CTOR_LIST__[nptrs + 1] != 0; nptrs++) for (nptrs = 0; __CTOR_LIST__[nptrs + 1] != 0; nptrs++)
; ;
@ -264,7 +264,7 @@ static DWORD GetParentProcessId()
static DWORD WINAPI ParentMonitorThreadProc( LPVOID lpParam ) static DWORD WINAPI ParentMonitorThreadProc( LPVOID lpParam )
{ {
DWORD dwParentProcessId = (DWORD)lpParam; DWORD_PTR dwParentProcessId = (DWORD_PTR)lpParam;
HANDLE hParentProcess = OpenProcess( SYNCHRONIZE, FALSE, dwParentProcessId ); HANDLE hParentProcess = OpenProcess( SYNCHRONIZE, FALSE, dwParentProcessId );
if ( IsValidHandle( hParentProcess ) ) if ( IsValidHandle( hParentProcess ) )
@ -300,7 +300,7 @@ BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
{ {
DWORD dwThreadId = 0; DWORD dwThreadId = 0;
DWORD dwParentProcessId = (DWORD)atol( szBuffer ); DWORD_PTR dwParentProcessId = (DWORD_PTR)atol( szBuffer );
if ( dwParentProcessId && GetParentProcessId() == dwParentProcessId ) if ( dwParentProcessId && GetParentProcessId() == dwParentProcessId )
{ {

View File

@ -565,14 +565,14 @@ DWORD g_dwTLSTextEncodingIndex = (DWORD)-1;
rtl_TextEncoding SAL_CALL osl_getThreadTextEncoding(void) rtl_TextEncoding SAL_CALL osl_getThreadTextEncoding(void)
{ {
DWORD dwEncoding; DWORD_PTR dwEncoding;
rtl_TextEncoding _encoding; rtl_TextEncoding _encoding;
BOOL gotACP; BOOL gotACP;
if ( (DWORD)-1 == g_dwTLSTextEncodingIndex ) if ( (DWORD)-1 == g_dwTLSTextEncodingIndex )
g_dwTLSTextEncodingIndex = TlsAlloc(); g_dwTLSTextEncodingIndex = TlsAlloc();
dwEncoding = (DWORD)TlsGetValue( g_dwTLSTextEncodingIndex ); dwEncoding = (DWORD_PTR)TlsGetValue( g_dwTLSTextEncodingIndex );
_encoding = LOWORD(dwEncoding); _encoding = LOWORD(dwEncoding);
gotACP = HIWORD(dwEncoding); gotACP = HIWORD(dwEncoding);
@ -586,7 +586,7 @@ rtl_TextEncoding SAL_CALL osl_getThreadTextEncoding(void)
else else
_encoding = rtl_getTextEncodingFromWindowsCodePage( GetACP() ); _encoding = rtl_getTextEncodingFromWindowsCodePage( GetACP() );
TlsSetValue( g_dwTLSTextEncodingIndex, (LPVOID)MAKELONG( _encoding, TRUE ) ); TlsSetValue( g_dwTLSTextEncodingIndex, (LPVOID)(DWORD_PTR)MAKELONG( _encoding, TRUE ) );
} }
return _encoding; return _encoding;
@ -599,7 +599,7 @@ rtl_TextEncoding SAL_CALL osl_setThreadTextEncoding( rtl_TextEncoding Encoding )
{ {
rtl_TextEncoding oldEncoding = osl_getThreadTextEncoding(); rtl_TextEncoding oldEncoding = osl_getThreadTextEncoding();
TlsSetValue( g_dwTLSTextEncodingIndex, (LPVOID)MAKELONG( Encoding, TRUE) ); TlsSetValue( g_dwTLSTextEncodingIndex, (LPVOID)(DWORD_PTR)MAKELONG( Encoding, TRUE) );
return oldEncoding; return oldEncoding;
} }

View File

@ -721,7 +721,7 @@ rtl_arena_activate (
for (i = 1; i <= n; i++) for (i = 1; i <= n; i++)
{ {
size = i * arena->m_quantum; size = i * arena->m_quantum;
(void) snprintf (namebuf, sizeof(namebuf), "%s_%lu", arena->m_name, size); (void) snprintf (namebuf, sizeof(namebuf), "%s_%" SAL_PRIuUINTPTR, arena->m_name, size);
arena->m_qcache_ptr[i - 1] = rtl_cache_create(namebuf, size, 0, NULL, NULL, NULL, NULL, arena, RTL_CACHE_FLAG_QUANTUMCACHE); arena->m_qcache_ptr[i - 1] = rtl_cache_create(namebuf, size, 0, NULL, NULL, NULL, NULL, arena, RTL_CACHE_FLAG_QUANTUMCACHE);
} }
} }

View File

@ -210,7 +210,7 @@ void rtl_memory_init()
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {
char name[RTL_CACHE_NAME_LENGTH + 1]; char name[RTL_CACHE_NAME_LENGTH + 1];
(void) snprintf (name, sizeof(name), "rtl_alloc_%lu", g_alloc_sizes[i]); (void) snprintf (name, sizeof(name), "rtl_alloc_%" SAL_PRIuUINTPTR, g_alloc_sizes[i]);
g_alloc_caches[i] = rtl_cache_create (name, g_alloc_sizes[i], 0, NULL, NULL, NULL, NULL, NULL, 0); g_alloc_caches[i] = rtl_cache_create (name, g_alloc_sizes[i], 0, NULL, NULL, NULL, NULL, NULL, 0);
} }