[physfs] Re: more warnings

Dennis Schridde devurandom at gmx.net
Sat Mar 8 14:45:46 EST 2008


Am Samstag, 8. März 2008 20:08:53 schrieb Dennis Schridde:
> After working around the visibility warning, I get more warnings in the
> windows platform code:
>
> /home/devpkg/src/physfs-svn/platform/windows.c: In function
> ‘findApiSymbols’: /home/devpkg/src/physfs-svn/platform/windows.c:287:
> warning: dereferencing type-punned pointer will break strict-aliasing rules
> /home/devpkg/src/physfs-svn/platform/windows.c:292: warning: dereferencing
> type-punned pointer will break strict-aliasing rules
> /home/devpkg/src/physfs-svn/platform/windows.c:298: warning: dereferencing
> type-punned pointer will break strict-aliasing rules
> /home/devpkg/src/physfs-svn/platform/windows.c:299: warning: dereferencing
> type-punned pointer will break strict-aliasing rules
> /home/devpkg/src/physfs-svn/platform/windows.c:300: warning: dereferencing
> type-punned pointer will break strict-aliasing rules
> /home/devpkg/src/physfs-svn/platform/windows.c:301: warning: dereferencing
> type-punned pointer will break strict-aliasing rules
> /home/devpkg/src/physfs-svn/platform/windows.c:302: warning: dereferencing
> type-punned pointer will break strict-aliasing rules
> /home/devpkg/src/physfs-svn/platform/windows.c:303: warning: dereferencing
> type-punned pointer will break strict-aliasing rules
> /home/devpkg/src/physfs-svn/platform/windows.c:304: warning: dereferencing
> type-punned pointer will break strict-aliasing rules
> /home/devpkg/src/physfs-svn/platform/windows.c:305: warning: dereferencing
> type-punned pointer will break strict-aliasing rules
> /home/devpkg/src/physfs-svn/platform/windows.c:306: warning: dereferencing
> type-punned pointer will break strict-aliasing rules
> /home/devpkg/src/physfs-svn/platform/windows.c:307: warning: dereferencing
> type-punned pointer will break strict-aliasing rules
> /home/devpkg/src/physfs-svn/platform/windows.c:308: warning: dereferencing
> type-punned pointer will break strict-aliasing rules
> /home/devpkg/src/physfs-svn/platform/windows.c:309: warning: dereferencing
> type-punned pointer will break strict-aliasing rules
> /home/devpkg/src/physfs-svn/platform/windows.c: In
> function ‘__PHYSFS_platformSeek’:
> /home/devpkg/src/physfs-svn/platform/windows.c:1115: warning: pointer
> targets in passing argument 3 of ‘SetFilePointer’ differ in signedness
> /home/devpkg/src/physfs-svn/platform/windows.c: In
> function ‘__PHYSFS_platformTell’:
> /home/devpkg/src/physfs-svn/platform/windows.c:1135: warning: pointer
> targets in passing argument 3 of ‘SetFilePointer’ differ in signedness
Conforming to http://msdn2.microsoft.com/en-us/library/aa365541.aspx I fixed 
the last two warnings like this:

Index: platform/windows.c
===================================================================
--- platform/windows.c  (revision 930)
+++ platform/windows.c  (working copy)
@@ -1089,8 +1089,8 @@
 int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos)
 {
     HANDLE Handle = ((WinApiFile *) opaque)->handle;
-    DWORD HighOrderPos;
-    DWORD *pHighOrderPos;
+    LONG HighOrderPos;
+    PLONG pHighOrderPos;
     DWORD rc;

     /* Get the high order 32-bits of the position */
@@ -1127,7 +1127,7 @@
 PHYSFS_sint64 __PHYSFS_platformTell(void *opaque)
 {
     HANDLE Handle = ((WinApiFile *) opaque)->handle;
-    DWORD HighPos = 0;
+    LONG HighPos = 0;
     DWORD LowPos;
     PHYSFS_sint64 retval;


The type-punning warnings are more difficult to fix, since they all are 
created by the LOOKUP and LOOKUP_NOFALLBACK macros. Will take me a bit more 
time...

--Dennis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://icculus.org/pipermail/physfs/attachments/20080308/d8ce6b04/attachment.pgp>


More information about the physfs mailing list