You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by mt...@apache.org on 2008/04/17 10:30:17 UTC
svn commit: r649000 - in /apr/apr/trunk: include/arch/win32/apr_arch_misc.h
misc/win32/misc.c
Author: mturk
Date: Thu Apr 17 01:30:14 2008
New Revision: 649000
URL: http://svn.apache.org/viewvc?rev=649000&view=rev
Log:
Fix compile time warnings by properly casting to 64 or 32 bits
Modified:
apr/apr/trunk/include/arch/win32/apr_arch_misc.h
apr/apr/trunk/misc/win32/misc.c
Modified: apr/apr/trunk/include/arch/win32/apr_arch_misc.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/arch/win32/apr_arch_misc.h?rev=649000&r1=648999&r2=649000&view=diff
==============================================================================
--- apr/apr/trunk/include/arch/win32/apr_arch_misc.h (original)
+++ apr/apr/trunk/include/arch/win32/apr_arch_misc.h Thu Apr 17 01:30:14 2008
@@ -180,7 +180,7 @@
DLL_defined = 6 // must define as last idx_ + 1
} apr_dlltoken_e;
-FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, char *fnName, int ordinal);
+FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, const char *fnName, int ordinal);
/* The apr_load_dll_func call WILL return 0 set error to
* ERROR_INVALID_FUNCTION if the function cannot be loaded
Modified: apr/apr/trunk/misc/win32/misc.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/misc/win32/misc.c?rev=649000&r1=648999&r2=649000&view=diff
==============================================================================
--- apr/apr/trunk/misc/win32/misc.c (original)
+++ apr/apr/trunk/misc/win32/misc.c Thu Apr 17 01:30:14 2008
@@ -165,7 +165,7 @@
static HMODULE lateDllHandle[DLL_defined] = {
NULL, NULL, NULL, NULL, NULL, NULL };
-FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, char* fnName, int ordinal)
+FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, const char* fnName, int ordinal)
{
if (!lateDllHandle[fnLib]) {
lateDllHandle[fnLib] = LoadLibraryA(lateDllName[fnLib]);
@@ -174,12 +174,14 @@
}
#if defined(_WIN32_WCE)
if (ordinal)
- return GetProcAddressA(lateDllHandle[fnLib], (char *) ordinal);
+ return GetProcAddressA(lateDllHandle[fnLib], (const char *)
+ (apr_ssize_t)ordinal);
else
return GetProcAddressA(lateDllHandle[fnLib], fnName);
#else
if (ordinal)
- return GetProcAddress(lateDllHandle[fnLib], (char *) ordinal);
+ return GetProcAddress(lateDllHandle[fnLib], (const char *)
+ (apr_ssize_t)ordinal);
else
return GetProcAddress(lateDllHandle[fnLib], fnName);
#endif
@@ -220,8 +222,8 @@
}
if (!nh) {
- (sprintf)(sbuf, "%08x %08x %08x %s() %s:%d\n",
- (DWORD)ha, seq, GetCurrentThreadId(), fn, fl, ln);
+ (sprintf)(sbuf, "%p %08x %08x %s() %s:%d\n",
+ ha, seq, GetCurrentThreadId(), fn, fl, ln);
(EnterCriticalSection)(&cs);
(WriteFile)(fh, sbuf, (DWORD)strlen(sbuf), &wrote, NULL);
(LeaveCriticalSection)(&cs);
@@ -234,21 +236,21 @@
HANDLE *hv = va_arg(a, HANDLE*);
char *dsc = va_arg(a, char*);
if (strcmp(dsc, "Signaled") == 0) {
- if ((DWORD)ha >= STATUS_WAIT_0
- && (DWORD)ha < STATUS_ABANDONED_WAIT_0) {
- hv += (DWORD)ha;
+ if ((apr_ssize_t)ha >= STATUS_WAIT_0
+ && (apr_ssize_t)ha < STATUS_ABANDONED_WAIT_0) {
+ hv += (apr_ssize_t)ha;
}
- else if ((DWORD)ha >= STATUS_ABANDONED_WAIT_0
- && (DWORD)ha < STATUS_USER_APC) {
- hv += (DWORD)ha - STATUS_ABANDONED_WAIT_0;
+ else if ((apr_ssize_t)ha >= STATUS_ABANDONED_WAIT_0
+ && (apr_ssize_t)ha < STATUS_USER_APC) {
+ hv += (apr_ssize_t)ha - STATUS_ABANDONED_WAIT_0;
dsc = "Abandoned";
}
- else if ((DWORD)ha == WAIT_TIMEOUT) {
+ else if ((apr_ssize_t)ha == WAIT_TIMEOUT) {
dsc = "Timed Out";
}
}
- (sprintf)(sbuf, "%08x %08x %08x %s(%s) %s:%d\n",
- (DWORD*)*hv, seq, GetCurrentThreadId(),
+ (sprintf)(sbuf, "%p %08x %08x %s(%s) %s:%d\n",
+ *hv, seq, GetCurrentThreadId(),
fn, dsc, fl, ln);
(WriteFile)(fh, sbuf, (DWORD)strlen(sbuf), &wrote, NULL);
} while (--nh);
Re: svn commit: r649000 - in /apr/apr/trunk: include/arch/win32/apr_arch_misc.h
misc/win32/misc.c
Posted by Mladen Turk <mt...@apache.org>.
William A. Rowe, Jr. wrote:
> Mladen Turk wrote:
>> William A. Rowe, Jr. wrote:
>>> mturk@apache.org wrote:
>>>> +++ apr/apr/trunk/include/arch/win32/apr_arch_misc.h Thu Apr 17
>>>> 01:30:14 2008
>>>> @@ -180,7 +180,7 @@
>>>> DLL_defined = 6 // must define as last idx_ + 1
>>>> } apr_dlltoken_e;
>>>>
>>>> -FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, char *fnName, int
>>>> ordinal);
>>>> +FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, const char *fnName,
>>>> int ordinal);
>>>
>>> This bit is an API breakage (but not a binary ABI breakage). Hmmm.
>>>
>>> I can accept it but thought it should be discussed on list.
>>>
>>
>> I thought that was apr private, isn't it?
>> It isn't exported as far as I can tell.
>
> ACK - should be no problem. By the way, what compiler was giving you
> errors? I've built as far as VC 2008's compiler and hadn't seen any
> noise here.
>
It's 64 bit compilation that makes warnings, usually conversion
from pointer to DWORD (64 to 32 bit). Fixed now by using
apr_ssize_t when casting.
Regards
--
(TM)
Re: svn commit: r649000 - in /apr/apr/trunk: include/arch/win32/apr_arch_misc.h
misc/win32/misc.c
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Mladen Turk wrote:
> William A. Rowe, Jr. wrote:
>> mturk@apache.org wrote:
>>> +++ apr/apr/trunk/include/arch/win32/apr_arch_misc.h Thu Apr 17
>>> 01:30:14 2008
>>> @@ -180,7 +180,7 @@
>>> DLL_defined = 6 // must define as last idx_ + 1
>>> } apr_dlltoken_e;
>>>
>>> -FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, char *fnName, int
>>> ordinal);
>>> +FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, const char *fnName,
>>> int ordinal);
>>
>> This bit is an API breakage (but not a binary ABI breakage). Hmmm.
>>
>> I can accept it but thought it should be discussed on list.
>>
>
> I thought that was apr private, isn't it?
> It isn't exported as far as I can tell.
ACK - should be no problem. By the way, what compiler was giving you
errors? I've built as far as VC 2008's compiler and hadn't seen any
noise here.
Bill
Re: svn commit: r649000 - in /apr/apr/trunk: include/arch/win32/apr_arch_misc.h
misc/win32/misc.c
Posted by Mladen Turk <mt...@apache.org>.
William A. Rowe, Jr. wrote:
> mturk@apache.org wrote:
>> +++ apr/apr/trunk/include/arch/win32/apr_arch_misc.h Thu Apr 17
>> 01:30:14 2008
>> @@ -180,7 +180,7 @@
>> DLL_defined = 6 // must define as last idx_ + 1
>> } apr_dlltoken_e;
>>
>> -FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, char *fnName, int
>> ordinal);
>> +FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, const char *fnName,
>> int ordinal);
>
> This bit is an API breakage (but not a binary ABI breakage). Hmmm.
>
> I can accept it but thought it should be discussed on list.
>
I thought that was apr private, isn't it?
It isn't exported as far as I can tell.
Regards
--
(TM)
Re: svn commit: r649000 - in /apr/apr/trunk: include/arch/win32/apr_arch_misc.h
misc/win32/misc.c
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
mturk@apache.org wrote:
> +++ apr/apr/trunk/include/arch/win32/apr_arch_misc.h Thu Apr 17 01:30:14 2008
> @@ -180,7 +180,7 @@
> DLL_defined = 6 // must define as last idx_ + 1
> } apr_dlltoken_e;
>
> -FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, char *fnName, int ordinal);
> +FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, const char *fnName, int ordinal);
This bit is an API breakage (but not a binary ABI breakage). Hmmm.
I can accept it but thought it should be discussed on list.
Bill